Skip to content

gdb/testsuite: add DAP tests for core-file state-tracking bugs#137

Open
czidev-amd wants to merge 1 commit into
amd-stagingfrom
users/czissule/dap-tests
Open

gdb/testsuite: add DAP tests for core-file state-tracking bugs#137
czidev-amd wants to merge 1 commit into
amd-stagingfrom
users/czissule/dap-tests

Conversation

@czidev-amd

Copy link
Copy Markdown

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.

@czidev-amd czidev-amd requested a review from a team as a code owner May 21, 2026 16:18
@czidev-amd czidev-amd force-pushed the users/czissule/dap-tests branch from 4c29af0 to 4e7b707 Compare May 21, 2026 16:34
@czidev-amd

Copy link
Copy Markdown
Author

Bug-fixing commit:
0a481bb — "gdb/dap: add support for opening core files" by Andrew Burgess,
2026-03-23.

@motokultivator

Copy link
Copy Markdown
Contributor

I tested, reviewed and it looks good to me.

@lumachad lumachad left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread gdb/testsuite/gdb.dap/corefile-after-launch.exp Outdated
Comment thread gdb/testsuite/gdb.dap/corefile-after-launch.exp Outdated
Comment thread gdb/testsuite/gdb.dap/corefile-after-launch.exp Outdated
Comment thread gdb/testsuite/gdb.dap/corefile-cli-preload.exp Outdated
Comment thread gdb/testsuite/gdb.dap/corefile-cli-preload.exp
Comment thread gdb/testsuite/gdb.dap/corefile-after-launch.exp Outdated
Comment thread gdb/testsuite/gdb.dap/corefile-after-launch.exp Outdated
Comment thread gdb/testsuite/gdb.dap/corefile-cli-preload.exp Outdated
Comment thread gdb/testsuite/gdb.dap/corefile-cli-preload.exp Outdated
Comment thread gdb/testsuite/gdb.dap/corefile-cli-preload.exp Outdated
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>
@czidev-amd czidev-amd force-pushed the users/czissule/dap-tests branch from 4e7b707 to 50ce487 Compare June 2, 2026 08:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants