2

I am using Vs Code in Linux. Is it possible to configure Gdb with Code so that I can use the gui for debugging for C/C++ programs.

2 Answers 2

1

There is an extension called debug you can install using ext install debug. Im the author of the extension and it supports debugging native applications using GDB. Just follow the README in there and it should be very easy to setup. If you want to build before debugging, just add a preLaunchTask to the config and create a build task that compiles your application.

Sign up to request clarification or add additional context in comments.

3 Comments

trying your WebFreak Debug but keep getting an error "Path must be a string. Received undefined"
still not able to get GDB working in VSCode. It start (says running executable) but then nothing. no output, not breaking on breakpoints, just hanging it seems. Any insight on how to debug?
If you start debugging something should appear in the debug console. Make sure the application path is properly set too and you might want to try out the C/C++ Extension by Microsoft which now also supports debugging with GDB because it might give you different errors or just work
0

EDIT: Sorry, strike that since it's just Homebrew's gdb not being signed in Yosemite: http://sourceware.org/gdb/wiki/BuildingOnDarwin

Installed your extension, defined the .json runner and got a terminal stating:

"&"warning: GDB: Failed to set controlling terminal: Operation not permitted\n"...

When typing GDB commands, I'm told that the process is running (despite having set the breakpoint in the editor, red dot).

Then when I close the floating terminal (outside the VSCode builtin one):

GNU gdb (GDB) 7.11
Copyright (C) 2016 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-apple-darwin14.5.0".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
=cmd-param-changed,param="confirm",value="off"
=cmd-param-changed,param="output-radix",value="16"
=cmd-param-changed,param="prompt",value="\001\e[;31m\002gdb-peda$ \001\e[0m\002"
=cmd-param-changed,param="history expansion",value="on"
=cmd-param-changed,param="history save",value="on"
=cmd-param-changed,param="disassembly-flavor",value="intel"
=cmd-param-changed,param="follow-fork-mode",value="child"
=cmd-param-changed,param="step-mode",value="on"
=cmd-param-changed,param="print pretty",value="on"
ERROR: Unable to start debugging. Unexpected GDB output from command "-exec-run". Unable to find Mach task port for process-id 65326: (os/kern) failure (0x5).
 (please check gdb is codesigned - see taskgated(8))
The program '/Users/romanvg/dev/bcftools/bcftools' has exited with code 42 (0x0000002a).

:(

1 Comment

Sorry, strike that since it's just Homebrew's gdb not being signed in Yosemite: sourceware.org/gdb/wiki/BuildingOnDarwin

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.