【发布时间】:2017-09-17 00:48:24
【问题描述】:
我正在尝试按照这篇文章的方向进行操作
Visual Studio Code redirect input on debug
但是当我将控制台配置添加到 launch.json 文件时
"console": "integratedTerminal"
它会抛出“不允许使用属性控制台”。当我调试程序时,它仍然等待输入并且永远不会像我在 shell 中启动时那样达到断点
"./a.out 1 test1.txt"
"./a.out 1 <test1.txt"
完整配置
{
"version": "0.2.0",
"configurations": [
{
"name": "(lldb) Launch",
"type": "cppdbg",
"request": "launch",
//"program": "${workspaceRoot}/a.out.dSYM/Contents/Resources/DWARF/a.out",
"program": "${workspaceRoot}/a.out",
"args": ["1", "<","test1.txt"],
"stopAtEntry": false,
"cwd": "${workspaceRoot}/",
"environment": [],
"externalConsole": true,
"MIMode": "lldb",
//"miDebuggerPath": "C:\\mingw\\bin\\gdb.exe",
"setupCommands": [
{
"description": "Enable pretty-printing for gdb",
"text": "-enable-pretty-printing",
"ignoreFailures": true
}
],
"console": "integratedTerminal"
//"preLaunchTask": //"build test1"
}
]
}
【问题讨论】:
-
"./a.out 1
-
另外,如果有人可以告诉我如何在 shell 中启动 cpp 程序,然后在 vscode 中附加我的 lldb 调试。这也行,谢谢
-
经过一个月的研究,目前似乎没有办法在 Cpp for LLDB 调试器中这样做。但是有一个 Node 的解决方法,如问题中所列。stackoverflow.com/questions/32863807/…