In the list of Debugging features, it's written:
Executing GDB or MI commands directly when using 'C++ (GDB/LLDB)' debugging environment
How to send those commands to GDB? The only thing it seems that I'm able to do is writing variables names in the Debug Console in order to have their value printed.
I'd like for example to pretty print an array, set a data breakpoint, or basically be able to have the GDB command line available. Am I missing something. I'm using the following version of VSCode on Ubuntu 16.10, amd64, with the official GDB apt package:
Version 1.8.1
Commit ee428b0eead68bf0fb99ab5fdc4439be227b6281
Date 2016-12-19T14:41:20.664Z
Shell 1.4.6
Renderer 53.0.2785.143
Node 6.5.0
You can execute gdb commands by typing "-exec" before the gdb command in the debug console. Setting data breakpoints using gdb may results in strange behavior since you would be bypassing the vscode debuggers own breakpoint management. But pretty printing and other commands which retrieve process state should be fine.
If pretty printing is your primary need you can turn on python pretty printing for all evaluations. In the debug console window enter "-exec -enable-pretty-printing".
Great.
Is this -exec
flag documented somewhere?
You were right about data breakpoints. As they aren't managed by the
extension, I was not expecting them to be handled gracefully on the VSCode
side. Actually the process is not stopped when the data breakpoint is hit,
but the debug console shows the value of the watched memory region (the
normal gdb output for that, in fact). That's already useful! I also didn't
note any strange behaviour, the extension just ignored it.
Having this feature implemented in a future release would be great.
thanks a lot
@paulmaybee I have worked with gdb prompt (gdb)
for debugging all these days and I am more familiar with the gdb commands and would prefer to have similar feel with the vscode debugger console.
So if I want to have native gdb environment feel, what can I do?
typing in -exec <_gdb command_> is not an attractive option as involves more keystrokes for every command. I would prefer to just enter 'n' for 'step over' and 's' for 'step into' and 'c' for continue.
Is there anyway, we can achieve this?
Most helpful comment
You can execute gdb commands by typing "-exec" before the gdb command in the debug console. Setting data breakpoints using gdb may results in strange behavior since you would be bypassing the vscode debuggers own breakpoint management. But pretty printing and other commands which retrieve process state should be fine.
If pretty printing is your primary need you can turn on python pretty printing for all evaluations. In the debug console window enter "-exec -enable-pretty-printing".