Skip to content

Commit cd98ea7

Browse files
committed
testsuite: avoid leftover process from gdb.rocm/gcore-after-attach
The gcore-after-attach process does start a process outside of the debugger, attach to it, generate a core dump of the process and then restarts GDB to load the core dump back. The restart part is done using clean_restart, which kills GDB and restarts a new session. Because we attached to the process, GDB is not using the PTRACE_O_EXITKILL option, so when we kill the debugger, the process is free to continue execution. Since the process has an infinite loop (to make it easier to ensure GPU activity at the moment we attach), it continues execution until runtest eventually completes and kills it. A consequence is that the gcore-after-attach processes are going to be present when running any test after the gcore-after-attach.exp, which is not the intent. This patch makes sure that no process is left over after running the gcore-after-attach.exp testcase by explicitly killing and reaping the process. Bug: SWDEV-469646 Change-Id: I70c923004f70ef200ee4be825d2d4a6b48dbc123 (cherry picked from commit 851c124)
1 parent 7ba4b4f commit cd98ea7

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

gdb/testsuite/gdb.rocm/gcore-after-attach.exp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,15 @@ proc do_test {debug_enabled} {
8080
return
8181
}
8282

83+
# Since we attached to the process, GDB is not using PTRACE_O_EXITKILL,
84+
# so when we later call clean_restart, we kill GDB and the spawned process
85+
# is free to go again. However, because this process uses an infinite loop,
86+
# it will remain around using GPU resources until the runtest execution has
87+
# completed, which could affect other tests executed later in the session.
88+
# To avoid this, be sure to kill the process, and have TCL reap the wait
89+
# status.
90+
kill_wait_spawned_process $spawn_id
91+
8392
# Reload the corefile.
8493
clean_restart $::binfile
8594
gdb_test "core-file $corefile_path" "Core was generated by.*" \

0 commit comments

Comments
 (0)