emacs-lsp / dap-mode

Emacs :heart: Debug Adapter Protocol
https://emacs-lsp.github.io/dap-mode
GNU General Public License v3.0
1.3k stars 181 forks source link

dap-mode M-x dap-debug goes wrong using "launch.json" copied from vscode (tested good)--- Win10 #465

Open eric-k-ice opened 3 years ago

eric-k-ice commented 3 years ago

the pic proves ".json" works well in VScode: image I moved the "launch.json" file to the root of project, M-x dap-debug, choose the right one, it goes wrong with this: image saying: 在 Newtonsoft.Json.Serialization.JsonSerializerInternalReader.Deserialize(JsonReader reader, Type objectType, Boolean checkAdditionalContent)

在 Newtonsoft.Json.JsonSerializer.DeserializeInternal(JsonReader reader, Type objectType)

在 Newtonsoft.Json.JsonConvert.DeserializeObject(String value, Type type, JsonSerializerSettings settings)

在 Newtonsoft.Json.JsonConvert.DeserializeObject[T](String value, JsonSerializerSettings settings)

在 OpenDebugAD7.MILaunchOptions.CreateLaunchOptions(String program, String workingDirectory, String args, Boolean isPipeLaunch, Boolean& stopAtEntry, Boolean& isCoreDump, Boolean& debugServerUsed, Boolean& isOpenOCD, Boolean& visualizerFileUsed)

在 OpenDebugAD7.AD7DebugSession.HandleLaunchRequestAsync(IRequestResponder`1 responder)'

eric-k-ice commented 3 years ago

i've found the same issue on https://github.com/emacs-lsp/dap-mode/issues/407 , and try to fix my problem.

eric-k-ice commented 3 years ago

problem fixed, but i got a new probelm, the command created by launch.js has a middle path named "Program files" which has a space. so i got the problem "~/Program " is not a path to found the .exe to excute, how can i fix this problem, by reinstalling my debug tools to a path with no space? Is there other way to fix this?

yyoncho commented 3 years ago

This sounds like a bug on our side, we should track it and fix it.

yyoncho commented 3 years ago

@eric-k-ice can you provide the log available in Messages buffer after setting dap-print-io to t? At this point it is unclear to me which is the failing operation. Seems like we are not quoting properly the command that the server asks us to start.

eric-k-ice commented 3 years ago

Thanksssss for reply my question, after setting dap-print-io to t, i run dap-debug, choose the launch.json template, got the message on Message buffer: ;;--------------------------------------------------------------------------------------------------------------- Sending: { "command": "initialize", "arguments": { "clientID": "vscode", "clientName": "Visual Studio Code", "adapterID": "cppdbg", "pathFormat": "path", "linesStartAt1": true, "columnsStartAt1": true, "supportsVariableType": true, "supportsVariablePaging": true, "supportsRunInTerminalRequest": true, "locale": "en-us" }, "type": "request", "seq": 1 } Received: { "seq": 1, "body": { "supportsClipboardContext": null, "supportsLogPoints": true, "supportedChecksumAlgorithms": null, "additionalModuleColumns": null, "completionTriggerCharacters": null, "supportsSetVariable": true, "exceptionBreakpointFilters": null, "supportsEvaluateForHovers": true, "supportsConditionalBreakpoints": true, "supportsFunctionBreakpoints": true, "supportsConfigurationDoneRequest": true }, "command": "initialize", "success": true, "request_seq": 1, "type": "response" } Sending: { "command": "launch", "arguments": { "name": "vs code launch.json", "type": "cppdbg", "request": "launch", "program": "a:/INSTALLED_FILES/Program Files (x86)/Emacs/Code/test.exe", "args": [], "stopAtEntry": false, "cwd": "a:/INSTALLED_FILES/Program Files (x86)/Emacs", "environment": [], "externalConsole": false, "MIMode": "gdb", "miDebuggerPath": "C:\Program Files\mingw-w64\x86_64-8.1.0-posix-seh-rt_v6-rev0\mingw64\bin\gdb.exe", "setupCommands": [ { "description": "为 gdb 启用整齐打印", "text": "-enable-pretty-printing", "ignoreFailures": true } ] }, "type": "request", "seq": 2 } Received: { "seq": 2, "arguments": { "env": { }, "args": [ "a:\INSTALLED_FILES\Program Files (x86)\Emacs\.emacs.d\.extension\vscode\cpptools\extension\debugAdapters\bin\WindowsDebugLauncher.exe", "--stdin=Microsoft-MIEngine-In-ix4e4mkk.uht", "--stdout=Microsoft-MIEngine-Out-f5xi2ygf.rhv", "--stderr=Microsoft-MIEngine-Error-e4i4jrwh.ihy", "--pid=Microsoft-MIEngine-Pid-u4vaj4sv.kc5", "--dbgExe=C:\Program Files\mingw-w64\x86_64-8.1.0-posix-seh-rt_v6-rev0\mingw64\bin\gdb.exe", "--interpreter=mi" ], "cwd": "", "title": "cppdbg: test.exe", "kind": "integrated" }, "command": "runInTerminal", "type": "request" } Sending: { "type": "response", "request_seq": 2, "success": true, "command": "runInTerminal", "seq": 3 } a:\INSTALLED_FILES\Program Files (x86)\Emacs.emacs.d.extension\vscode\cpptools\extension\debugAdapters\bin\WindowsDebugLauncher.exe --stdin=Microsoft-MIEngine-In-ix4e4mkk.uht --stdout=Microsoft-MIEngine-Out-f5xi2ygf.rhv --stderr=Microsoft-MIEngine-Error-e4i4jrwh.ihy --pid=Microsoft-MIEngine-Pid-u4vaj4sv.kc5 --dbgExe=C:\Program Files\mingw-w64\x86_64-8.1.0-posix-seh-rt_v6-rev0\mingw64\bin\gdb.exe --interpreter=mi: exited abnormally with code 1. ;;----------------------------------------------------------------------------------------------------------

the command printed on cmd seems to miss quote, here is my Vscode command : ;;-------------------------------------------------------------------------------------------------- PS A:\INSTALLED_FILES\Program Files (x86)\Emacs\Code> & ‘c:\Users\35498.vscode\extensions\ms-vscode.cpptools-1.3.0\debugAdapters\bin\WindowsDebugLauncher.exe’ ‘–stdin=Microsoft-MIEngine-In-jxtvkpy2.yjg’ ‘–stdout=Microsoft-MIEngine-Out-o30mwjol.nh1’ ‘–stderr=Microsoft-MIEngine-Error-5wtt1agp.qx4’ ‘–pid=Microsoft-MIEngine-Pid-02kd3oom.201’ ‘–dbgExe=C:\Program Files\mingw-w64\x86_64-8.1.0-posix-seh-rt_v6-rev0\mingw64\bin\gdb.exe’ ‘–interpreter=mi’ ;;----------------------------------------------------------------------------------------------------

@eric-k-ice can you provide the log available in Messages buffer after setting dap-print-io to t? At this point it is unclear to me which is the failing operation. Seems like we are not quoting properly the command that the server asks us to start.

yyoncho commented 3 years ago

Got it. I will try to provide a fix soon.

eric-k-ice commented 3 years ago

thanksssssssss!