Open tosiek88 opened 4 years ago
I tested with vscode and it works like that too.
Note that you could execute gdb command in dap-ui-repl.
There is another gdb debug adapter which ships as part of Microsoft cpp tools which we currently do not have adapter but it seems like it works much better:
Here it is initial integration with it - https://github.com/emacs-lsp/dap-mode/issues/11#issuecomment-429654509 but someone has to finish it.
Ok thanks? I am quite new in Emacs and ELisp language , what shall be done , I registered this new debug provider,
(dap-register-debug-provider
"cppdbg" (lambda (conf)
(plist-put conf
:dap-server-path
'("/home/tocha/.vscode/extensions/ms-vscode.cpptools-0.26.3/debugAdapters/OpenDebugAD7"))
conf))
(dap-register-debug-template "C++ Run Configuration"
(list :type "cppdbg"
:cwd "/home/tocha/develop/gcc_proces_tut/"
:request "launch"
:program "/home/tocha/develop/gcc_proces_tut/build/debug/gcc_test_project"
:name "Run Configuration"))
A get information that I don't have TERM
env variables setup. Minor thing in .zshrc
export TERM=alacritty line have been add.
M-x
dap-debug
then I can choose C++ Run Configuration, Buffer is created: Async Shell Command
So this what I understand we can exchange some information between debugger and Emacs?
A get information that I don't have TERM env variables setup. Minor thing in .zshrc export TERM=alacritty line have been add.
Can you elaborate?
FYI the autogenerated template on vscode is:
"name": "(gdb) Launch",
"type": "cppdbg",
"request": "launch",
"program": "/home/kyoncho/Sources/lsp-docker/demo-projects/CPP/hello-world/to-debug",
"args": [],
"stopAtEntry": false,
"cwd": "${workspaceFolder}", ;; replace that with the real value in dap-template.
"environment": [],
"externalConsole": false,
"MIMode": "gdb",
"setupCommands": [
{
"description": "Enable pretty-printing for gdb",
"text": "-enable-pretty-printing",
"ignoreFailures": true
}
]
Just my Linux TERM variable for some reason was empty, so I add correct terminal which I am using. Maybe Debugger complain about this because by default "externalConsole" is true ? I am not sure. Generally I will try now this config what You generate in VSCode.
So I am still getting empty Async Shell Command Buffer and nothing else, should I start somehow "/bin/usr/gdb" --interpreter=mi ? I am trying to send some data but I am not sure how should format for request. My knowledge about this is limited I will dig later :)
@tosiek88 no worries, we will take a look.
CC @danielmartin - you might be interested too - the MS adapter supports lldb and I suspect it might be better than the alternatives.
Thanks, appreciate your job.
I found that maybe it will be helpful
"valuesFormatting": {
"type": "string",
"description": "Set the way of showing variable values. 'disabled' - show value as is, 'parseText' - parse debuggers output text into structure, 'prettyPrinters' - enable debuggers custom pretty-printers if there are any",
"default": "parseText",
"enum": [
"disabled",
"parseText",
"prettyPrinters"
]
},
I was trying to put this to template:
(dap-register-debug-template
"GDB::Run"
(list :type "gdb"
:request "launch"
:valuesFormatting "prettyPrinters"
:name "GDB::Run"
:target nil
:cwd nil))
But it has giving me error if I click on ->Local : Wrong type argument: hash-table-p, 49
In VSCode is working
I will take a look tomorrow my time - probably VScode client side is changing the template before sending it to the debug adapter server.
Ok it seems to work, but when inspecting variables which is not evaluated (before breakpoints) whole emacs hangs up .
M-x toggle-debug-on-quit and then C-g when it freezes and report the callstack here.
Debugger entered--Lisp error: (quit)
accept-process-output(nil 0.001)
dap-request(#s(dap--debug-session :name "GDB::Run" :last-id 21 :proc #<process GDB::Run> :response-handlers #<hash-table eql 1/65 0x1b9c8d9> :parser #s(dap--parser :waiting-for-response nil :response-result nil :headers nil :body nil :reading-body nil :body-length nil :body-received nil :leftovers "") :output-buffer #<buffer *GDB::Run out*> :thread-id 1 :workspace nil :threads (#<hash-table equal 2/65 0x2616ab1>) :thread-states #<hash-table eql 2/65 0x1c79959> :active-frame-id nil :active-frame #<hash-table equal 5/65 0x181a1f5> :cursor-marker nil :state running :breakpoints #<hash-table equal 1/65 0x131fdc1> :thread-stack-frames #<hash-table eql 1/65 0x125a259> :launch-args (:type "gdb" :valuesFormatting "prettyPrinters" :request "launch" :name "GDB::Run" :target "/home/tocha/develop/gcc_proces_tut/build/debug/gcc_test_project" :cwd "/home/tocha/develop/gcc_proces_tut/" :dap-server-path ("node" "/home/tocha/.emacs.d/.local/etc/dap-extension/vscode/webfreak.debug/extension/out/src/gdb.js")) :initialize-result #<hash-table equal 6/65 0x1e121b1> :error-message nil :loaded-sources nil) "variables" :variablesReference 132073)
dap-ui-render-variables(#s(dap--debug-session :name "GDB::Run" :last-id 21 :proc #<process GDB::Run> :response-handlers #<hash-table eql 1/65 0x1b9c8d9> :parser #s(dap--parser :waiting-for-response nil :response-result nil :headers nil :body nil :reading-body nil :body-length nil :body-received nil :leftovers "") :output-buffer #<buffer *GDB::Run out*> :thread-id 1 :workspace nil :threads (#<hash-table equal 2/65 0x2616ab1>) :thread-states #<hash-table eql 2/65 0x1c79959> :active-frame-id nil :active-frame #<hash-table equal 5/65 0x181a1f5> :cursor-marker nil :state running :breakpoints #<hash-table equal 1/65 0x131fdc1> :thread-stack-frames #<hash-table eql 1/65 0x125a259> :launch-args (:type "gdb" :valuesFormatting "prettyPrinters" :request "launch" :name "GDB::Run" :target "/home/tocha/develop/gcc_proces_tut/build/debug/gcc_test_project" :cwd "/home/tocha/develop/gcc_proces_tut/" :dap-server-path ("node" "/home/tocha/.emacs.d/.local/etc/dap-extension/vscode/webfreak.debug/extension/out/src/gdb.js")) :initialize-result #<hash-table equal 6/65 0x1e121b1> :error-message nil :loaded-sources nil) 132073 (:label #("second: {...}" 0 6 (face font-lock-variable-name-face)) :icon variable :value "{...}" :session #s(dap--debug-session :name "GDB::Run" :last-id 21 :proc #<process GDB::Run> :response-handlers #<hash-table eql 1/65 0x1b9c8d9> :parser #s(dap--parser :waiting-for-response nil :response-result nil :headers nil :body nil :reading-body nil :body-length nil :body-received nil :leftovers "") :output-buffer #<buffer *GDB::Run out*> :thread-id 1 :workspace nil :threads (#<hash-table equal 2/65 0x2616ab1>) :thread-states #<hash-table eql 2/65 0x1c79959> :active-frame-id nil :active-frame #<hash-table equal 5/65 0x181a1f5> :cursor-marker nil :state running :breakpoints #<hash-table equal 1/65 0x131fdc1> :thread-stack-frames #<hash-table eql 1/65 0x125a259> :launch-args (:type "gdb" :valuesFormatting "prettyPrinters" :request "launch" :name "GDB::Run" :target "/home/tocha/develop/gcc_proces_tut/build/debug/gcc_test_project" :cwd "/home/tocha/develop/gcc_proces_tut/" :dap-server-path ("node" "/home/tocha/.emacs.d/.local/etc/dap-extension/vscode/webfreak.debug/extension/out/src/gdb.js")) :initialize-result #<hash-table equal 6/65 0x1e121b1> :error-message nil :loaded-sources nil) :variables-reference 132073 :name "second" :actions (["Set value" dap-ui-set-variable-value]) :key "second" :children #f(compiled-function (&rest args2) #<bytecode 0x1d272d5>)))
apply(dap-ui-render-variables (#s(dap--debug-session :name "GDB::Run" :last-id 21 :proc #<process GDB::Run> :response-handlers #<hash-table eql 1/65 0x1b9c8d9> :parser #s(dap--parser :waiting-for-response nil :response-result nil :headers nil :body nil :reading-body nil :body-length nil :body-received nil :leftovers "") :output-buffer #<buffer *GDB::Run out*> :thread-id 1 :workspace nil :threads (#<hash-table equal 2/65 0x2616ab1>) :thread-states #<hash-table eql 2/65 0x1c79959> :active-frame-id nil :active-frame #<hash-table equal 5/65 0x181a1f5> :cursor-marker nil :state running :breakpoints #<hash-table equal 1/65 0x131fdc1> :thread-stack-frames #<hash-table eql 1/65 0x125a259> :launch-args (:type "gdb" :valuesFormatting "prettyPrinters" :request "launch" :name "GDB::Run" :target "/home/tocha/develop/gcc_proces_tut/build/debug/gcc_test_project" :cwd "/home/tocha/develop/gcc_proces_tut/" :dap-server-path ("node" "/home/tocha/.emacs.d/.local/etc/dap-extension/vscode/webfreak.debug/extension/out/src/gdb.js")) :initialize-result #<hash-table equal 6/65 0x1e121b1> :error-message nil :loaded-sources nil) 132073 (:label #("second: {...}" 0 6 (face font-lock-variable-name-face)) :icon variable :value "{...}" :session #s(dap--debug-session :name "GDB::Run" :last-id 21 :proc #<process GDB::Run> :response-handlers #<hash-table eql 1/65 0x1b9c8d9> :parser #s(dap--parser :waiting-for-response nil :response-result nil :headers nil :body nil :reading-body nil :body-length nil :body-received nil :leftovers "") :output-buffer #<buffer *GDB::Run out*> :thread-id 1 :workspace nil :threads (#<hash-table equal 2/65 0x2616ab1>) :thread-states #<hash-table eql 2/65 0x1c79959> :active-frame-id nil :active-frame #<hash-table equal 5/65 0x181a1f5> :cursor-marker nil :state running :breakpoints #<hash-table equal 1/65 0x131fdc1> :thread-stack-frames #<hash-table eql 1/65 0x125a259> :launch-args (:type "gdb" :valuesFormatting "prettyPrinters" :request "launch" :name "GDB::Run" :target "/home/tocha/develop/gcc_proces_tut/build/debug/gcc_test_project" :cwd "/home/tocha/develop/gcc_proces_tut/" :dap-server-path ("node" "/home/tocha/.emacs.d/.local/etc/dap-extension/vscode/webfreak.debug/extension/out/src/gdb.js")) :initialize-result #<hash-table equal 6/65 0x1e121b1> :error-message nil :loaded-sources nil) :variables-reference 132073 :name "second" :actions (["Set value" dap-ui-set-variable-value]) :key "second" :children #f(compiled-function (&rest args2) #<bytecode 0x1d272d5>))))
#f(compiled-function (&rest args2) #<bytecode 0x1d272d5>)((:label #("second: {...}" 0 6 (face font-lock-variable-name-face)) :icon variable :value "{...}" :session #s(dap--debug-session :name "GDB::Run" :last-id 21 :proc #<process GDB::Run> :response-handlers #<hash-table eql 1/65 0x1b9c8d9> :parser #s(dap--parser :waiting-for-response nil :response-result nil :headers nil :body nil :reading-body nil :body-length nil :body-received nil :leftovers "") :output-buffer #<buffer *GDB::Run out*> :thread-id 1 :workspace nil :threads (#<hash-table equal 2/65 0x2616ab1>) :thread-states #<hash-table eql 2/65 0x1c79959> :active-frame-id nil :active-frame #<hash-table equal 5/65 0x181a1f5> :cursor-marker nil :state running :breakpoints #<hash-table equal 1/65 0x131fdc1> :thread-stack-frames #<hash-table eql 1/65 0x125a259> :launch-args (:type "gdb" :valuesFormatting "prettyPrinters" :request "launch" :name "GDB::Run" :target "/home/tocha/develop/gcc_proces_tut/build/debug/gcc_test_project" :cwd "/home/tocha/develop/gcc_proces_tut/" :dap-server-path ("node" "/home/tocha/.emacs.d/.local/etc/dap-extension/vscode/webfreak.debug/extension/out/src/gdb.js")) :initialize-result #<hash-table equal 6/65 0x1e121b1> :error-message nil :loaded-sources nil) :variables-reference 132073 :name "second" :actions (["Set value" dap-ui-set-variable-value]) :key "second" :children #f(compiled-function (&rest args2) #<bytecode 0x1d272d5>)))
treemacs--do-expand-node(#<marker (moves after insertion) at 79 in *dap-ui-locals*>)
treemacs-expand-node(nil)
treemacs-TAB-action(nil)
funcall-interactively(treemacs-TAB-action nil)
call-interactively(treemacs-TAB-action nil nil)
command-execute(treemacs-TAB-action)
Ok, will fix that tomorrow my time. What did you do to make it work?
(dap-register-debug-template
"GDB::Run"
(list :type "gdb"
:request "launch"
:valuesFormatting "prettyPrinters"
:name "GDB::Run"
:target nil
:cwd nil))
valuesFormatting "prettyPrintings", it wasn't work because i have some syntax error, done by mistake in my config.el
Hi. I have simple program to test:
when I am in dap-debug mode gdb template I am getting limited information about std:: variables like, map, vectors.
in gdb with dashboard extension I am getting :
Am I missing something?