Clear board_info entry in kill_wait_spawned_process

Message ID 20240314175633.1090335-1-tromey@adacore.com
State New
Headers
Series Clear board_info entry in kill_wait_spawned_process |

Checks

Context Check Description
linaro-tcwg-bot/tcwg_gdb_build--master-aarch64 success Testing passed
linaro-tcwg-bot/tcwg_gdb_build--master-arm success Testing passed
linaro-tcwg-bot/tcwg_gdb_check--master-arm success Testing passed
linaro-tcwg-bot/tcwg_gdb_check--master-aarch64 success Testing passed

Commit Message

Tom Tromey March 14, 2024, 5:56 p.m. UTC
  When certain DAP tests are run in a certain order, dejagnu will throw
an exception during shutdown.  After adding many logging statements, I
tracked this down to kill_wait_spawned_process not clearing the
'fileid' board_info entry, causing dejagnu to try to wait for the
process a second time -- and fail.

Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=31435
---
 gdb/testsuite/lib/gdb.exp | 5 +++++
 1 file changed, 5 insertions(+)
  

Patch

diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp
index fe4ac7d2719..48c241ad178 100644
--- a/gdb/testsuite/lib/gdb.exp
+++ b/gdb/testsuite/lib/gdb.exp
@@ -6194,6 +6194,11 @@  proc kill_wait_spawned_process { proc_spawn_id } {
     # wait for the PID in the background.  That's fine because we
     # don't care about the exit status.  */
     wait -nowait -i $proc_spawn_id
+
+    # Don't let dejagnu try to clean this up, either.
+    global board_info
+    set name [board_info target name]
+    unset -nocomplain board_info($name,fileid)
 }
 
 # Returns the process id corresponding to the given spawn id.