gdb/testsuite: Add runtime-core-attached test - #216
Conversation
6262869 to
3d062bb
Compare
lancesix
left a comment
There was a problem hiding this comment.
Some preliminary comments. Will do a more in depth review later.
16e1248 to
6fa15be
Compare
51b440f to
5108ffd
Compare
lumachad
left a comment
There was a problem hiding this comment.
Could we please have a better description of what we're trying to test here? The "test core dump while gdb is attached" sounded to me like we were controlling rocgdb when generating the core file, but it sounds like what we want is for some unrelated process to be generating a core file while we test something else in the runtime.
Is that the case? If so, should this be a ROCR test instead?
be3797f to
3e11ade
Compare
531654b to
2b99b98
Compare
| gdb_test "handle SIGABRT nostop pass" ".*" | ||
| gdb_test "handle SIGSEGV nostop pass" ".*" | ||
| gdb_test_no_output "set cwd $coredir" | ||
| gdb_test "set args $fault" ".*" |
There was a problem hiding this comment.
Done. Changed to gdb_test_no_output "set args $fault" on line 53.
| # a while for large core dumps. | ||
| with_timeout_factor 3 { | ||
| gdb_test_multiple "" "wait for program exit" { | ||
| -re "Program terminated with signal" { |
There was a problem hiding this comment.
Multiple messages arrive before the prompt (both "Program terminated" and "The program no longer exists"), so
-wrap on each pattern causes race conditions; using exp_continue for messages and matching the final prompt
directly works correctly.
| with_timeout_factor 3 { | ||
| gdb_test_multiple "" "wait for program exit" { | ||
| -re "Program terminated with signal" { | ||
| pass "program crashed" |
There was a problem hiding this comment.
Let's please use $gdb_test_name. Also in the occurrences below.
| gdb_test "target core $merged_core" \ | ||
| [multi_line \ | ||
| ".*" \ | ||
| "Core was generated by .*" \ |
There was a problem hiding this comment.
I feel uneasy about .*'s in such cases, because they can also match newline. Can we use \[\r\n\]* instead. Also in the line below.
There was a problem hiding this comment.
The pattern (lines 120-124) follows the established pattern from runtime-core.exp for matching core file loading output. The leading .* on line 121 is necessary to skip the library loading messages that precede "Core was generated by". The trailing .* patterns allow matching variable content (command arguments, signal details, wave coordinates). The multi_line structure with these patterns has been proven to work correctly in the sibling test.
37620ba to
5703c12
Compare
| require allow_rocm_core_tests | ||
| require allow_hip_tests | ||
|
|
||
| standard_testfile runtime-core.cpp |
There was a problem hiding this comment.
We usually try to have a 1:1 mapping between .ccp and .exp. Either what is tested here fits in runtime-core.exp, or this test should have its own test program.
There was a problem hiding this comment.
Sure, added runtime-core-attached.cpp
| # Check that ulimit allows core dumps. The test environment must | ||
| # have ulimit -c set to unlimited before running this test. | ||
| set ulimit_value [exec sh -c "ulimit -c"] | ||
| if {$ulimit_value != "unlimited"} { |
There was a problem hiding this comment.
I am not sure checking ulimit that way is sufficient. For example, if building GDB with ASAN, the ASAN runtime implicitly turns ulimit to 0 (the ASAN has a heavy impact on core size otherwise):
$ ulimit -c
unlimited
$ ASAN_OPTIONS=detect_leaks=0 ./gdb/gdb -data-directory ./gdb/data-directory -ex "shell ulimit -c" -q -batch
0
There was a problem hiding this comment.
I've removed the check, since runtime-core.exp does not check for it either.
| } | ||
|
|
||
| set hostcore_list [glob -nocomplain -directory $coredir "core*"] | ||
| set gpucore_list {} |
There was a problem hiding this comment.
isn't the runtime pringing the gpu core name? Could we find this in the gdb_test_multiple?
5703c12 to
6fc6cb4
Compare
6fc6cb4 to
f5ecd1e
Compare
b35e2fd to
aad3169
Compare
Test core dump generation while program runs under GDB. What we're testing: 1. Run a HIP program under GDB 2. Configure GDB to pass signals through (not stop on them) 3. Program crashes with GPU fault 4. ROCm runtime generates core dumps even though GDB is attached 5. Verify GDB can load those cores and see GPU threads Uses batch mode: -ex 'handle SIGABRT/SIGSEGV nostop pass' -ex 'run' This allows GDB to catch faults but pass them to runtime/kernel.
aad3169 to
6dd0052
Compare
Test core dump generation while program runs under GDB. With the fix for core dump collection during debugging, verify that running under GDB in batch mode with signal passthrough generates both host and GPU cores, which can be merged and loaded.
What we're testing:
Uses batch mode: -ex 'handle SIGABRT/SIGSEGV nostop pass' -ex 'run' This allows GDB to catch faults but pass them to runtime/kernel.
Motivation
Tests the new capability from ROCm/rocm-systems#6811 that enables core dump generation even when a debugger is
attached
Technical Details
core.*) and GPU (core.*.gpu) cores are generatedsystemcommand to inherit test environment (LD_LIBRARY_PATH)