gdb/testsuite: add DAP tests for core-file state-tracking bugs#137
gdb/testsuite: add DAP tests for core-file state-tracking bugs#137czidev-amd wants to merge 1 commit into
Conversation
Add two tests in gdb.dap/ covering bugs reported against rocgdb 16.3,
where GDB DAP's state tracker fell out of sync with the inferior
after a core file was loaded.
corefile-cli-preload.exp
Spawn gdb with a core file already attached on the command line
(either '-ex "core-file <core>"' or '-c <core>'), then send one DAP
'initialize' request. In rocgdb 16.3 the response came back with
success=false and message="notStopped" because the pre-loaded core
was not registered as a stopped target. The test asserts
success=true; on failure, a follow-up assertion fires to flag
whether the specific "notStopped" message was returned.
corefile-after-launch.exp
Launch a binary with stopAtBeginningOfMainSubprogram, wait for the
stopped event at main, then load a core file by sending the CLI
command through a DAP 'evaluate' request in the repl context. The
evaluate succeeds and the new core inferior reaches stopped state,
but in rocgdb 16.3 every follow-up DAP request (threads, evaluate,
stackTrace, ...) returned success=false with message="notStopped"
because the state tracker missed the CLI-driven inferior switch.
The test issues 'threads', 'evaluate("info threads")', and
'stackTrace' and asserts each one succeeds.
Both tests reuse the existing gdb.dap/corefile.c source by setting
testfile/srcfile/binfile manually; standard_testfile would otherwise
derive the source name from the .exp basename.
The bugs do not reproduce against current trunk (gdb 18.0.50), so the
tests pass today and will catch regressions if either bug returns.
Signed-off-by: Claudiu Zissulescu <claudiu.zissulescu-ianculescu@amd.com>
4c29af0 to
4e7b707
Compare
|
Bug-fixing commit: |
|
I tested, reviewed and it looks good to me. |
lumachad
left a comment
There was a problem hiding this comment.
Only some nits. Furthermore, this should be pursue upstream rather than rocgdb. Once pushed upstream, we will pick this up from the regular master syncs.
| # You should have received a copy of the GNU General Public License | ||
| # along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
|
|
||
| ### Test if GDB DAP doesn't recognize CLI-driven inferior state changes |
There was a problem hiding this comment.
Style. We don't tend to use this format of comment. I'm fine with it, but you might want to stick to single hash.
| # load the core | ||
| # Then: | ||
| # - evaluate(core-file) succeeds and the core is loaded | ||
| # - All subsequent DAP requests (threads, evaluate, pause) return |
There was a problem hiding this comment.
Stale comment. We don't do pause in this test.
| "evaluate message is not notStopped" | ||
| } | ||
|
|
||
| # 3. A backtrace request on thread 1 of the new inferior must succeed. |
There was a problem hiding this comment.
Is Thread 1 a fixed thing? If we don't care about the number, then we should make it generic.
| # You should have received a copy of the GNU General Public License | ||
| # along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
|
|
||
| ## Test if initialize returns notStopped when core is pre-loaded via CLI |
There was a problem hiding this comment.
Styling. Stick with single hash.
| if {[dict exists $response message]} { | ||
| set msg [dict get $response message] | ||
| } | ||
| gdb_assert { $msg != "notStopped" } \ |
There was a problem hiding this comment.
From the title: Test if initialize returns notStopped
And then we check if it is NOT notStopped. We might want to clarify the title.
Suggestion:
"Verify initialize succeeds when a core file is pre-loaded via CLI."
Add two tests in gdb.dap/ covering bugs reported against rocgdb 16.3, where GDB DAP's state tracker fell out of sync with the inferior after a core file was loaded.
corefile-cli-preload.exp
Spawn gdb with a core file already attached on the command line
(either '-ex "core-file "' or '-c '), then send one DAP
'initialize' request. In rocgdb 16.3 the response came back with
success=false and message="notStopped" because the pre-loaded core
was not registered as a stopped target. The test asserts
success=true; on failure, a follow-up assertion fires to flag
whether the specific "notStopped" message was returned.
corefile-after-launch.exp
Launch a binary with stopAtBeginningOfMainSubprogram, wait for the
stopped event at main, then load a core file by sending the CLI
command through a DAP 'evaluate' request in the repl context. The
evaluate succeeds and the new core inferior reaches stopped state,
but in rocgdb 16.3 every follow-up DAP request (threads, evaluate,
stackTrace, ...) returned success=false with message="notStopped"
because the state tracker missed the CLI-driven inferior switch.
The test issues 'threads', 'evaluate("info threads")', and
'stackTrace' and asserts each one succeeds.
Both tests reuse the existing gdb.dap/corefile.c source by setting testfile/srcfile/binfile manually; standard_testfile would otherwise derive the source name from the .exp basename.
The bugs do not reproduce against current trunk (gdb 18.0.50), so the tests pass today and will catch regressions if either bug returns.