Can't debug on Windows simple c++ binary with any debug-adapter doom emacs 30.1
Every time I start debug session I see: [jsonrpc] Server exited with status 9
content of dape-connection events
[jsonrpc] e[10:55:59.850] --> initialize[1] {"type":"request","seq":1,"command":"initialize","arguments":{"clientID":"dape","adapterID":"lldb-dap","pathFormat":"path","linesStartAt1":true,"columnsStartAt1":true,"supportsRunInTerminalRequest":true,"supportsArgsCanBeInterpretedByShell":true,"supportsProgressReporting":true,"supportsStartDebuggingRequest":true}}
[stderr]
[stderr]
[stderr] nil
[stderr] nil
[stderr] Process dape adapter stderr finished
[jsonrpc] e[10:55:59.946] <-- initialize[1] {"body":{"__lldb":{"version":"lldb version 20.1.0"},"completionTriggerCharacters":["."," ","\t"],"exceptionBreakpointFilters":[{"default":false,"filter":"cpp_catch","label":"C++ Catch"},{"default":false,"filter":"cpp_throw","label":"C++ Throw"},{"default":false,"filter":"objc_catch","label":"Objective-C Catch"},{"default":false,"filter":"objc_throw","label":"Objective-C Throw"}],"supportTerminateDebuggee":true,"supportsCompletionsRequest":true,"supportsConditionalBreakpoints":true,"supportsConfigurationDoneRequest":true,"supportsDataBreakpoints":true,"supportsDelayedStackTraceLoading":true,"supportsDisassembleRequest":true,"supportsEvaluateForHovers":true,"supportsExceptionInfoRequest":true,"supportsExceptionOptions":true,"supportsFunctionBreakpoints":true,"supportsGotoTargetsRequest":false,"supportsHitConditionalBreakpoints":true,"supportsInstructionBreakpoints":true,"supportsLoadedSourcesRequest":false,"supportsLogPoints":true,"supportsModulesRequest":true,"supportsProgressReporting":true,"supportsReadMemoryRequest":true,"supportsRestartFrame":false,"supportsRestartRequest":true,"supportsRunInTerminalRequest":true,"supportsSetVariable":true,"supportsStepBack":false,"supportsStepInTargetsRequest":true,"supportsSteppingGranularity":true,"supportsValueFormattingOptions":true},"command":"initialize","request_seq":1,"seq":0,"success":true,"type":"response"}
[jsonrpc] e[10:55:59.946] --> launch[2] {"type":"request","seq":2,"command":"launch","arguments":{"type":"lldb-dap","cwd":"e:/fun/om","program":"e:/fun/om/build/vcpkg/00-basic-prog/29-localization/29-localization.exe"}}
[jsonrpc] e[10:56:00.501] <-- launch[2] {"command":"launch","request_seq":2,"seq":0,"success":true,"type":"response"}
[jsonrpc] e[10:56:00.501] <-- process {"body":{"isLocalProcess":true,"name":"e:\\fun\\om\\build\\vcpkg\\00-basic-prog\\29-localization\\29-localization.exe","startMethod":"launch","systemProcessId":25172},"event":"process","seq":0,"type":"event"}
[jsonrpc] e[10:56:00.501] <-- initialized {"event":"initialized","seq":0,"type":"event"}
[jsonrpc] e[10:56:00.501] --> setExceptionBreakpoints[3] {"type":"request","seq":3,"command":"setExceptionBreakpoints","arguments":{"filters":[]}}
[jsonrpc] e[10:56:00.520] <-- setExceptionBreakpoints[3] {"command":"setExceptionBreakpoints","request_seq":3,"seq":0,"success":true,"type":"response"}
[jsonrpc] e[10:56:00.521] --> setBreakpoints[4] {"type":"request","seq":4,"command":"setBreakpoints","arguments":{"source":{"path":"e:/fun/om/00-basic-prog/29-localization/main.cxx"},"breakpoints":[{"line":325}],"lines":[325]}}
[jsonrpc] e[10:56:00.823] <-- setBreakpoints[4] {"body":{"breakpoints":[{"id":1,"instructionReference":"0x7FF70FDBB4F6","line":325,"source":{"name":"main.cxx","path":"e:/fun/om/00-basic-prog/29-localization/main.cxx"},"verified":true}]},"command":"setBreakpoints","request_seq":4,"seq":0,"success":true,"type":"response"}
[jsonrpc] e[10:56:00.823] --> setDataBreakpoints[5] {"type":"request","seq":5,"command":"setDataBreakpoints","arguments":{"breakpoints":[]}}
[jsonrpc] e[10:56:00.842] <-- setDataBreakpoints[5] {"body":{"breakpoints":[]},"command":"setDataBreakpoints","request_seq":5,"seq":0,"success":true,"type":"response"}
[jsonrpc] e[10:56:00.842] --> configurationDone[6] {"type":"request","seq":6,"command":"configurationDone"}
[jsonrpc] e[10:56:00.862] <-- configurationDone[6] {"command":"configurationDone","request_seq":6,"seq":0,"success":true,"type":"response"}
[jsonrpc] e[10:56:00.907] <-- stopped {"body":{"allThreadsStopped":true,"description":"breakpoint 1.1","hitBreakpointIds":[1],"preserveFocusHint":false,"reason":"breakpoint","threadCausedFocus":true,"threadId":44256},"event":"stopped","seq":0,"type":"event"}
[jsonrpc] e[10:56:00.907] --> threads[7] {"type":"request","seq":7,"command":"threads"}
[jsonrpc] e[10:56:01.150] <-- threads[7] {"body":{"threads":[{"id":32596,"name":""},{"id":44256,"name":""},{"id":46428,"name":""},{"id":54252,"name":""}]},"command":"threads","request_seq":7,"seq":0,"success":true,"type":"response"}
[jsonrpc] e[10:56:01.150] --> stackTrace[8] {"type":"request","seq":8,"command":"stackTrace","arguments":{"threadId":44256,"startFrame":0,"levels":1}}
[jsonrpc] e[10:56:01.183] <-- stackTrace[8] {"body":{"stackFrames":[{"column":0,"id":524288,"instructionPointerReference":"0x7FF70FDBB4F6","line":325,"name":"main","source":{"name":"main.cxx","path":"E:\\fun\\om\\00-basic-prog\\29-localization\\main.cxx"}}],"totalFrames":21},"command":"stackTrace","request_seq":8,"seq":0,"success":true,"type":"response"}
[jsonrpc] e[10:56:01.185] --> scopes[9] {"type":"request","seq":9,"command":"scopes","arguments":{"frameId":524288}}
[jsonrpc] D[10:56:01.294] Connection state change: `exited abnormally with code 9
'
----------b---y---e---b---y---e----------
content of dape-repl
* Welcome to the Dape REPL *
Available Dape commands: debug, next, continue, pause, step, out, up, down, threads, stack, modules, sources, breakpoints, scope, watch, restart, kill, disconnect, quit
Empty input will rerun last command.
* Adapter started with "lldb-dap" *
* Process launched e:\fun\om\build\vcpkg\00-basic-prog\29-localization\29-localization.exe *
* Adapter started with "lldb-dap" *
* Process launched e:\fun\om\build\vcpkg\00-basic-prog\29-localization\29-localization.exe *
* Adapter started with "lldb-dap" *
* Process launched e:\fun\om\build\vcpkg\00-basic-prog\29-localization\29-localization.exe *
>
I try to start debug-adapter like:
Run adapter: lldb-dap :program "e:/fun/om/build/vcpkg/00-basic-prog/29-localization/29-localization.exe" :cwd "e:/fun/om" command-cwd "e:/fun/om"
My project is open, so you always can try your self, be advised on Windows you need cmake + vcpkg and use vcpkg preset. link: https://github.com/leanid/om
Hey and thank you for your bug report!
I have not tried dape on windows neither do I have access to a windows machine, have you tried any other adapters/languages, does that work?
It looks to be crashing on scopes request, do you get any further if stop dape from doing any scopes request by creating the following stub:
(defun dape--scopes (&rest _))
Is it possible to generate any additional debug information with lldb-dap? I can't seam to find anything.
If you are able to generate more debug information please send it my way, as I don't think i will be able to reproduce without windows.
After your sugestion to disable dape--scopes - debugger start working! And stop on first breakpoint like it should. Also be advices dape works for python on windows without problem.
I also suffer from this issue. The problem is indeed goes away with mock definition but it is not tied to it as lldb-dap exits again with code 9 further in the execution of my C++ program. I suspect the problem is about process encodings or debugger expecting windows path styles \\. For example, netcoredbg expects breakpoint paths to be using \\ but dape uses /. I opened and discussed the problem in their repository which I will open an issue in the feature for a request in dape.
My solution, at least for lldb-dap (or generally) is to be using Emacs it inside MSYS2 MingW64 environment. Even if Emacs is compiled in that environment or installed in that environment, you should start Emacs in that environment. For example, starting Emacs from Windows startup won't be same, naturally, which one may not expect. You should also install lldb-dap through pacman and make sure (executable-find "lldb-dap") results with the path inside MingW64 (You may have installed or download for Windows). Instead of launching Emacs by MingW64 terminal, you can call
<msys-install-path>\\msys2_shell.cmd -mingw64 -shell bash -c runemacs
or create a Windows shortcut with this target and put it in startup programs to ease launch of Emacs.
Since most of the processes Emacs interacts with through packages expects to be in Unix style, it is usually best to use Emacs in MingW64 environment. Though, I really believe package maintainers should handle Windows.