使用Gdb配置VS代码

时间:2016-01-26 07:06:59

标签: gdb visual-studio-code

我在Linux中使用Vs代码。是否可以使用Code配置Gdb,以便我可以使用gui来调试C / C ++程序。

2 个答案:

答案 0 :(得分:1)

您可以使用debug安装名为ext install debug的扩展程序。我是扩展的作者,它支持使用GDB调试本机应用程序。只需按照那里的README,它应该很容易设置。如果要在调试之前构建,只需在配置中添加preLaunchTask并创建一个编译应用程序的构建任务。

答案 1 :(得分:0)

编辑:很抱歉,请注意,因为它只是Homebrew的gdb没有在优胜美地签名:http://sourceware.org/gdb/wiki/BuildingOnDarwin

安装了你的扩展程序,定义了.json跑步者并得到一个终端说明:

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

当输入GDB命令时,我告诉过程正在运行(尽管在编辑器中设置了断点,红点)。

然后当我关闭浮动终端(内置VSCode外部)时:

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).

:(

相关问题