Skip to content

feat: support DAP terminate requests - #645

Merged
wenyt (wenytang-ms) merged 2 commits into
mainfrom
wenytang-ms-symmetrical-potato
Oct 26, 2026
Merged

wenyt (wenytang-ms) merged 2 commits into
mainfrom
wenytang-ms-symmetrical-potato

Conversation

@wenytang-ms

Copy link
Copy Markdown
Contributor

Summary

  • add standard DAP terminate request support and advertise supportsTerminateRequest
  • terminate launched debug sessions without detaching or marking the VM terminated, so shutdown hooks remain debuggable
  • preserve attach and disconnect behavior while sharing no-debug process termination
  • add focused unit coverage and a Linux JDI shutdown-hook breakpoint test

Testing

  • ./mvnw -pl com.microsoft.java.debug.core -Dtest=TerminateRequestHandlerTest,TerminateRequestHandlerJdiTest test
  • ./mvnw -pl com.microsoft.java.debug.core verify (55 tests)

Resolves microsoft/vscode-java-debug#1720

@wenytang-ms wenyt (wenytang-ms) changed the title Support DAP terminate requests feat: support DAP terminate requests Oct 26, 2026
@wenytang-ms
wenyt (wenytang-ms) requested a balanced review from Copilot October 26, 2026 04:47

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 Changes recommended

Graceful termination can stall when all threads are suspended, and the JDI test needs failure-safe process cleanup.

2 open issues
What changed in this PR

Adds standard DAP terminate support so launched Java sessions can remain attached while shutdown hooks run, addressing microsoft/vscode-java-debug#1720.

Changes:

  • Registers the terminate request and advertises its capability.
  • Preserves attach/disconnect behavior and shares no-debug process termination.
  • Adds handler unit tests and a JDI shutdown-hook breakpoint test.
File Description
com.microsoft.java.debug.test/​project/​5.shutdownhook/​src/​main/​java/​ShutdownHookTest.java Adds the shutdown-hook test fixture.
com.microsoft.java.debug.core/​src/​test/​java/​com/​microsoft/​java/​debug/​core/​adapter/​handler/​TerminateRequestHandlerTest.java Tests termination behavior and capability reporting.
com.microsoft.java.debug.core/​src/​test/​java/​com/​microsoft/​java/​debug/​core/​adapter/​handler/​TerminateRequestHandlerJdiTest.java Tests debugger attachment during shutdown.
com.microsoft.java.debug.core/​src/​main/​java/​com/​microsoft/​java/​debug/​core/​protocol/​Types.java Adds the terminate capability field.
com.microsoft.java.debug.core/​src/​main/​java/​com/​microsoft/​java/​debug/​core/​protocol/​Requests.java Defines the terminate command and arguments.
com.microsoft.java.debug.core/​src/​main/​java/​com/​microsoft/​java/​debug/​core/​adapter/​handler/​TerminateRequestHandler.java Handles termination without detaching.
com.microsoft.java.debug.core/​src/​main/​java/​com/​microsoft/​java/​debug/​core/​adapter/​handler/​InitializeRequestHandler.java Advertises terminate support.
com.microsoft.java.debug.core/​src/​main/​java/​com/​microsoft/​java/​debug/​core/​adapter/​handler/​DisconnectRequestWithoutDebuggingHandler.java Delegates process termination to the shared helper.
com.microsoft.java.debug.core/​src/​main/​java/​com/​microsoft/​java/​debug/​core/​adapter/​handler/​DebuggeeProcessHelper.java Centralizes process and PID-based termination.
com.microsoft.java.debug.core/​src/​main/​java/​com/​microsoft/​java/​debug/​core/​adapter/​DebugAdapter.java Registers the terminate handler.

Review effort: Balanced

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟢 Approval recommended

No unresolved blocking issues remain, and the updated resume path and test cleanup address the prior lifecycle concerns.

No open issues 🎉

2 resolved since last review

Review effort: Balanced

@wenytang-ms
wenyt (wenytang-ms) merged commit 90fdfe8 into main Oct 26, 2026
5 checks passed
@wenytang-ms
wenyt (wenytang-ms) deleted the wenytang-ms-symmetrical-potato branch October 26, 2026 06:15
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.

Stop detaches the debugger before shutdown hooks run, so JVM shutdown cannot be debugged

3 participants