c++ - 用于调试的 Visual Studio Code 设置和配置
问题描述
我正在尝试启动调试会话。不幸的是,gnome-terminal 无法启动,一些 dbus 错误。但是,xterm 工作正常。我无法让 Visual Studio 代码使用 Xterm。我附上了我的配置和其他附加信息。任何帮助表示赞赏。
用户设置:
{
"workbench.colorTheme":"Quiet Light",
"editor.fontSize":14,
"julia.executablePath":"/usr/local/bin/julia",
"files.associations": {
"*.jl":"julia"
},
"editor.fontFamily":"'DejaVu Sans Mono'",
"editor.fontWeight":"bold",
"editor.suggestFontSize":11,
"clang.executable":"/clang/bin",
"clang.cxxflags":[
"--std=c++11"
],
"terminal.external.linuxExec":"/bin/xterm"
}
调试设置
{
"name":"test",
"type":"cppdbg",
"request":"launch",
"program":"${workspaceFolder}/a.out",
"args":[],
"stopAtEntry":false,
"cwd":"${workspaceFolder}/build",
"environment":[
{
"Name":"LD_LIBRARY_PATH",
"Value":"/opt/gcc-7.3.0/lib64"
}
],
"externalConsole":false,
"MIMode":"gdb",
"miDebuggerPath":"/usr/bin/gdb",
"logging":{
"engineLogging":true
},
"setupCommands":[
{
"description":"Enable pretty-printing for gdb",
"text":"-enable-pretty-printing",
"ignoreFailures":true
}
]
}
从启动调试:
: (207) LaunchOptions<LocalLaunchOptions xmlns='http://schemas.microsoft.com/vstudio/MDDDebuggerOptions/2014'
1: (221) LaunchOptions ExePath='a.out'
1: (221) LaunchOptions WorkingDirectory='build'
1: (221) LaunchOptions ExeArguments='2018 0 2 0 5 2018 0 2 10'
1: (221) LaunchOptions MIMode='gdb'
1: (221) LaunchOptions MIDebuggerPath='/usr/bin/gdb'
1: (221) LaunchOptions WaitDynamicLibLoad='false'
1: (221) LaunchOptions>
1: (221) LaunchOptions
1: (221) LaunchOptions -enable-pretty-printing
1: (221) LaunchOptions
1: (221) LaunchOptions
....................................
.............................................
1: (221) LaunchOptions
1: (301) TempFile=/tmp/Microsoft-MIEngine-fifo-o7umkzct.ydv
1: (301) TempFile=/tmp/Microsoft-MIEngine-fifo-rchtx3yv.2pf
1: (301) TempFile=/tmp/Microsoft-MIEngine-fifo-t6pq9ig2.q4j
1: (357) term-stderr:Option "--title" is deprecated and might be removed in a later version of gnome-terminal.
1: (364) term-stderr:Error constructing proxy for org.gnome.Terminal:/org/gnome/Terminal/Factory0: Error spawning command line 'dbus-launch --autolaunch=36e4fff9ca604cbc9c6743ae4bf5904b --binary-syntax --close-stderr': Child process exited with code 1
解决方案
显然 VS Code cpp-tools 不会选择 xterm,除非 gnome 终端不存在/缺失。
https://github.com/Microsoft/vscode-cpptools/issues/1940
正如 WardenGnaw 在 cpp-tools 问题页面上发布的:
“cpptools 扩展使用 MIEngine。如果 gnome 终端不存在,MIEngine 只会选择 XTERM。”
推荐阅读
- python - Flask Flash 消息未在按钮单击时显示
- sql - 使用按帐号分区的先前值填充列
- ssl - 拒绝 IIS 中的所有客户端证书
- swift - 当导航栏被隐藏时,在 SwiftUI 中进行向后滑动手势仅适用于特定视图?
- node.js - 如何使用 db.command() 和 NodeJS 运行原始 MongoDB 操作
- python - 从 scipy.integrate 导入 _arpack 时 DLL 加载失败
- css - Tailwind:使用空白行前实用程序时尊重动态高度?
- python - pydictor 中的命令行选项,用于生成仅具有唯一字母的 worldist
- python - 读取文本文件行中的第一个单词时出现 IndexError
- swift - Swift将完成处理程序与返回值结合起来