Issue |
140154
|
Summary |
Infinite Loop in DAP when sending request before launch.
|
Labels |
lldb-dap
|
Assignees |
|
Reporter |
da-viper
|
I noticed this while implementing the [supportsDataBreakpointBytes](https://microsoft.github.io/debug-adapter-protocol//specification.html#Requests_DataBreakpointInfo)
This adds an option to the break-point panel in vscode, to set an address range. It is also persistent between debug sessions.
lldb-dap goes into an infinite loop because, The current implementation creates pending requests places request based on the below filter,
https://github.com/llvm/llvm-project/blob/efae492ad1ba80764ec4a85f5622a8713646f970/lldb/tools/lldb-dap/DAP.cpp#L927-L933
Since VSCode is waiting for a response for the `databreakpointInfo` request it will not send the `configurationdone` request.
Since lldb-dap is waiting for the `configurationDone` request it will not start the launch or attach request, and it is stuck in an infinite loop.
Normally adding the `databreakpointinfo` to the filter would suffice, but it will break existing binary when there is a new capability.
Example scenario.
- User debugs a program with `debugger A` and set's a `dataBreakpointInfo`
- User end `debugger A` session.
- User starts debugging with lldb-dap.
- lldb-dap enters an infinite loop because it cannot respond to the request.
Another way to mediate the issue is to handle it the way it is done in lldb
```
(lldb) b main
Breakpoint 1: no locations (pending).
Breakpoint set in dummy target, will get copied into future targets.
```
During the `launch request` and `attach request` we create the target and after the `configurationDone` request we then launch the debuggee. This is something similar to
```sh
# During launch request
(lldb) target create a.out
Current executable set to '/home/da-viper/Dev/projects/test_lldb/a.out' (x86_64).
(lldb) b main
Breakpoint 1: where = a.out`main + 18 at main.cc:21:7, address = 0x00000000004005f2
# After configuration done request
(lldb) run
Process 136009 launched: '/home/da-viper/Dev/projects/test_lldb/a.out' (x86_64)
```
This also deals with the issue of unverified breakpoints as breakpoints can be set with a valid target.
Relevant stuck lldb-dap with the logs on the side.

Pinging for feedback in case I am missing anything before implementing the fix.
@JDevlieghere @ashgti @ely @kazutakahirata
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs