Skip to content

Fix GDB core dump test hang caused by deferred error response#22

Merged
derekparker merged 3 commits into
masterfrom
fix/gdb-core-dump-test
Jun 18, 2026
Merged

Fix GDB core dump test hang caused by deferred error response#22
derekparker merged 3 commits into
masterfrom
fix/gdb-core-dump-test

Conversation

@derekparker

Copy link
Copy Markdown
Member

GDB's native DAP defers launch/attach processing until after
configurationDone. When GDB rejects an attach request (e.g. core
dump on GDB < 18 which lacks coreFile support), the error response
arrives in the post-configurationDone wait loop where it was silently
skipped, causing an infinite hang.

Track the launch/attach request sequence number and check for matching
error responses in the StoppedEvent and breakpoint wait loops. This
turns a 120s timeout into a fast error (~0.3s).

Add TestMain with a -dap-log flag that enables DAP protocol and
tool-level logging during test runs. When set to a directory path,
each test gets its own .protocol.log and .tool.log files.

Helper functions dapLogArgs() and dumpDAPLogs() wire the logging
into test debug sessions and dump logs on test failure.
GDB's native DAP defers launch/attach processing until after
configurationDone. When GDB rejects an attach request (e.g. core
dump on GDB < 18 which lacks coreFile support), the error response
arrives in the post-configurationDone wait loop where it was silently
skipped, causing an infinite hang.

Track the launch/attach request sequence number and check for matching
error responses in the StoppedEvent and breakpoint wait loops. This
turns a 120s timeout into a fast error (~0.3s).

Also:
- Revert incorrect core dump protocol (attach + coreFile is correct,
  not launch + core)
- Remove mandatory path requirement for GDB core mode (GDB 18+ can
  auto-detect executable from core file)
- Add os.Chmod guard in TestGDBCoreDump to prevent false success
- Skip GDB core dump tests on GDB < 18 with informative message
- Restore early validation for non-GDB core mode requiring path param
- Use -1 sentinel for launchSeq so unset value can't match a real response
- Add comments clarifying that successful deferred responses are intentional no-ops
- Restore "main" assertion in TestGDBCoreDumpWithoutPath
- Extract skipIfGDBLacksCoreFileSupport helper to reduce duplication
@derekparker derekparker merged commit 2c900cd into master Jun 18, 2026
1 check passed
@derekparker derekparker deleted the fix/gdb-core-dump-test branch June 18, 2026 17:24
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.

1 participant