Skip to content

Infinite Loop in DAP when sending request before launch. #140154

Open
@da-viper

Description

@da-viper

I noticed this while implementing the supportsDataBreakpointBytes

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,

disconnecting = true;
if (!configuration_done)
add_to_pending_queue =
command != "initialize" && command != "configurationDone" &&
command != "disconnect" && !command.ends_with("Breakpoints");
}

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

# 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.

Image

Pinging for feedback in case I am missing anything before implementing the fix.
@JDevlieghere @ashgti @ely @kazutakahirata

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions