Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How does the debugger notify dap client that a breakpoint is disabled? #463

Open
demin-han opened this issue Feb 18, 2024 · 8 comments
Open
Labels
info-needed Issue requires more information from poster

Comments

@demin-han
Copy link

for example, using gdb in vscode:

  1. add breakpoint in editor
  2. use debug console to disable this breakpoint
  3. the breakpoint's status in UI is not changed

I haven't found the enable or disable field in Breakpoint type.

@connor4312
Copy link
Member

There's no "disabled" state in DAP. In VS Code, a disabled breakpoint is simply not sent to the debugger.

@connor4312 connor4312 added the info-needed Issue requires more information from poster label Feb 18, 2024
@demin-han
Copy link
Author

demin-han commented Feb 18, 2024

There's no "disabled" state in DAP. In VS Code, a disabled breakpoint is simply not sent to the debugger.

it is OK from editor to debugger. what about from debugger to editor?
if I disabled breakpoints through debug console, the breakpoint's status would be inconsistent.
In debugger side, the breakpoint is disabled, but in VS Code side, the breakpoint is still enabled.
The breakpoint changed event seems not work for this, because of no "disabled" state in breakpoint response.

@connor4312
Copy link
Member

That's correct, the debug adapter does not control the breakpoint enablement state. If it fails to set a breakpoint, it can signal that by marking it as unverified with a message. But the adapter is driven by the client, not the other way around.

Is there a use case you have in mind where having the DA disable a breakpoint would be useful?

@demin-han
Copy link
Author

As I know the unverified status is for pending.
I think it's a common case(or debug workflow) for users who like use debug console.

Could this be improved in future dap version?
1 Add "disabled" field or
2 Reuse "reason" field ?

@connor4312
Copy link
Member

That sounds like something that clients should implement in their "debug console"s rather than in DAP.

@demin-han
Copy link
Author

when I input CMD in debug console, it's a "evaluate" REQ, I think the client don't understand these CMD.
Current breakpoint definition of DAP can't tell or distinguish the disable of breakpoint , the client receives the change event, but don't know the reason which is breakpoint disable.

@connor4312
Copy link
Member

That is up to the client. There's no requirement in the protocol that a debug console exists or how it should behave.

There is no notion of disabled breakpoints in DAP. And I would not implement it the way you describe e.g. in VS Code, because it would not play nice if there were multiple concurrent debug sessions happening at the same time: a UI breakpoint is not owned by a debug adapter.

It sounds like the way to do what you want would just be to set verified: false with some message like "Disabled by the user" or something along those lines.

@demin-han
Copy link
Author

It sounds like the way to do what you want would just be to set verified: false with some message like "Disabled by the user" or something along those lines.

Yes, something like this. Currently, just set "verified: false" the checkbox is still checked in VS code UI.
The "verified" field is set just according to breakpoint pending status for several gdb adapter .
If the "message" or "reason" field are not defined formally, how different dap clients to parse the meaning of message ?

/**

  • A message about the state of the breakpoint.
  • This is shown to the user and can be used to explain why a breakpoint could
  • not be verified.
    */
    message?: string;

/**

  • A machine-readable explanation of why a breakpoint may not be verified. If
  • a breakpoint is verified or a specific reason is not known, the adapter
  • should omit this property. Possible values include:
    • pending: Indicates a breakpoint might be verified in the future, but
  • the adapter cannot verify it in the current state.
    • failed: Indicates a breakpoint was not able to be verified, and the
  • adapter does not believe it can be verified without intervention.
  • Values: 'pending', 'failed'
    */
    reason?: 'pending' | 'failed';

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
info-needed Issue requires more information from poster
Projects
None yet
Development

No branches or pull requests

2 participants