FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Add suspend mode for source breakpoints by tsmaeder · Pull Request #610 · microsoft/java-debug · GitHub

Add suspend mode for source breakpoints - #610

Open
Thomas Mäder (tsmaeder) wants to merge 6 commits into
microsoft:mainfrom
tsmaeder:608_suspend_modes
Open

Add suspend mode for source breakpoints#610
Thomas Mäder (tsmaeder) wants to merge 6 commits into
microsoft:mainfrom
tsmaeder:608_suspend_modes

Conversation

Thomas Mäder (tsmaeder) commented Oct 21, 2025
edited
Loading

Copy link
Copy Markdown

Fixes #608

Note that this PR contains code for handling source breakpoints and exception breakpoints. But in fact, VS Code Java only properly handles source and instruction breakpoints. I've left the code in there, since it's not completely trivial and it should not affect the behavior if no suspend mode is sent when setting the exception breakpoints.

How to Test

  1. Set a breakpoint in a Java Program
  2. Start Debugging
  3. You now should be able to chose the suspend mode (thread or VM) in the breakpoints view and when editing the breakpoint condition.
  4. Make sure the breakpoint can suspend either all threads or only one thread depending on the mode
  5. Put your breakpoint in a for loop and when the breakpoint is hit, switch to the other suspend mode
  6. Resume the program (may need "resume all" from the context menu) and ensure the new suspend mode is honored the next time you hit the breakpoint.
  7. Make sure exception breakpoints behave as usual. There should be no UI to set the mode and exceptions should only suspend the thread the occur on.

Copy link
Copy Markdown
Contributor

Thomas Mäder (@tsmaeder) I wrote a simple program to test it, but got error:

public class HelloWorld {
    public static void main(String[] args) {
        System.out.println("Starting application...");
       
        String message = "Hello, World!";
        System.out.println(message); // Set a breakpoint here
       
        for (int i = 0; i < 3; i++) {
            System.out.println("Count: " + i);
        }
       
        System.out.println("Application finished.");
    }
}

Error:
No delegateCommandHandler for vscode.java.resolveMainMethod

Also please fix CI errors.

Copy link
Copy Markdown
Author

Changyong Gong (@chagong) how are you testing? I have a very similar program which works fine for me. Also, this PR does not contain changes that could cause a problem with the delegate command handler, IMO. Here's what I do:

  1. build a new jar with mvnw clean install
  2. copy the resulting jar to ..\vscode-java-debug\server
  3. Run the vscode-java-debug plugin from source
  4. Works fine for me 🤷

Signed-off-by: Thomas Mäder <t.s.maeder@gmail.com>
Signed-off-by: Thomas Mäder <t.s.maeder@gmail.com>

Copy link
Copy Markdown
Contributor

Thomas Mäder (@tsmaeder) probably the problem of my setup, it works after I relaunch vscode and F5. The PR is good to go after your fix the format errors.

Signed-off-by: Thomas Mäder <t.s.maeder@gmail.com>
Signed-off-by: Thomas Mäder <t.s.maeder@gmail.com>

Thomas Mäder (tsmaeder) commented Nov 6, 2025
edited
Loading

Copy link
Copy Markdown
Author

Changyong Gong (@chagong) running checkstyle:check locally spews out messages about <cr><lf> not being allowed for every file. However, that line ending is just an artifact of checking out the repo on Windows.

Signed-off-by: Thomas Mäder <t.s.maeder@gmail.com>

Copy link
Copy Markdown
Author

Changyong Gong (@chagong) is there anything (beyond a rebase) that I could do to move this forward?

Copy link
Copy Markdown
Contributor

Hi Thomas Mäder (@tsmaeder), can you check if the fix to microsoft/vscode-java-debug#722 has already supported the suspend policy setting?

Copy link
Copy Markdown
Author

Changyong Gong (@chagong) no, this PR allows to set the suspend mode per breakpoint, the other PR just introduces a global flag.

Copy link
Copy Markdown
Contributor

Thomas Mäder (@tsmaeder) we make it a global flag because vscode doesn't have UI option to set breakpoint property. Are you doing this for cursor?

Copy link
Copy Markdown
Author

Thomas Mäder (@tsmaeder) we make it a global flag because vscode doesn't have UI option to set breakpoint property. Are you doing this for cursor?

Chagon VS Code does have UI for this, but you have to enable the modes in the debug adapter (what this PR does) in order to see it. See description.

This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
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.

Support "Suspend VM" and "Suspend Thread" Breakpoint Modes

3 participants


Back | FazBrowse Home | New Git URL