Skip to content

lldb-dap takes 3000ms instead of 120-400ms #150220

@LevoDeLellis

Description

@LevoDeLellis

There's a crashed that will happen but has been fixed (see https://discourse.llvm.org/t/is-lldb-dap-usable/87320/10)
I noticed lldb-dap takes a long time, so I tested against gdb (120ms) and codelldb which uses lldb (<400ms) but lldb-dap takes 3s, this is on linux. I haven't tried on other OSes

Put this in /tmp/a.c and compile with clang a.cpp -g

#include <stdio.h> int main() {	puts("Hello"); } 

Save the dap file below as dap, make sure the line ending is saved as CRLF, then run time cat dap | lldb-dap, as mentioned it'll crash but thats been fixed.

My real code measure time more accurately, doesn't suffer from the crash, uses better input (below omits threadid but the dap still appears to work) and waits for messages. Anyway, you can also test with gdb by writing time cat dap | gdb --interpreter=dap to confirm my numbers are accurate. For codelldb I wrote cat dap | nc -l 127.0.0.1 -p 5547 which I press ctrl+c when I see seq 18 and I run codelldb by writing time codelldb --connect 5547. It's <1s, my proper code measures it in <400ms

The two main areas that are slow is replying to launch and the first stop event. Additional stop events didn't seem to suffer from delays

Content-Length: 370 {"seq":1,"type":"request","command":"initialize","arguments":{"clientID":"tester","clientName":"tester","adapterID":"lldb-dap","linesStartAt1":true,"columnsStartAt1":true,"supportsRunInTerminalRequest":false,"supportsProgressReporting":true,"supportsInvalidatedEvent":true,"supportsMemoryReferences":true,"supportsMemoryEvent":true,"supportsStartDebuggingRequest":true}}Content-Length: 141 {"seq":2,"type":"request","command":"launch","arguments":{"type":"lldb","request":"launch","program":"/tmp/a.out","relativePathBase":"/tmp"}}Content-Length: 107 {"seq":3,"type":"request","command":"setFunctionBreakpoints","arguments":{"breakpoints":[{"name":"main"}]}}Content-Length: 71 {"seq":4,"type":"request","command":"configurationDone","arguments":{}}Content-Length: 61 {"seq":5,"type":"request","command":"threads","arguments":{}}Content-Length: 64 {"seq":6,"type":"request","command":"stackTrace","arguments":{}}Content-Length: 62 {"seq":7,"type":"request","command":"continue","arguments":{}} 

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions