我正在尝试调试分段错误。我想我没有正确设置 VSCode。
这是我的 launch.json:
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "(gdb) Launch",
"type": "cppdbg",
"request": "launch",
"program": "${workspaceFolder}/MidiEditor",
"args": [],
"stopAtEntry": false,
"cwd": "${fileDirname}",
"environment": [],
"externalConsole": false,
"MIMode": "gdb",
"setupCommands": [
{
"description": "Enable pretty-printing for gdb",
"text": "-enable-pretty-printing",
"ignoreFailures": true
}
]
}
]
}
Run Code Online (Sandbox Code Playgroud)
这是我的调用堆栈:
libQt5Core.so.5!QString::operator=(QString const&) (Unknown Source:0)
MidiFile::populateInstruments() (Unknown Source:0)
MidiFile::MidiFile() (Unknown …
Run Code Online (Sandbox Code Playgroud) 我在 CLI 中输入这个
git commit -m "Hello World!"
Run Code Online (Sandbox Code Playgroud)
这是我收到的错误消息
husky > commit-msg (node v14.15.3)
? input: Hello World!
? subject may not be empty [subject-empty]
? type may not be empty [type-empty]
? found 2 problems, 0 warnings
? Get help: https://github.com/conventional-changelog/commitlint/#what-is-commitlint
husky > commit-msg hook failed (add --no-verify to bypass)
Run Code Online (Sandbox Code Playgroud)
这是什么意思?
操作系统是Linux。
打开终端会产生此错误:
The terminal process failed to launch: Path to shell executable "bash" is not a file of a symlink.
Run Code Online (Sandbox Code Playgroud)
settings.json 和变量中的 bash 路径是正确的$PATH
。
这是 Visual Studio Code 版本 1.57.1。回滚到早期版本可以解决该问题,因此我做了一个错误报告。
第 7 行有一个等于 0 的变量 x。当我运行程序时,如果 x 不大于 0,它不应该前进到下一个缩进。但由于某种原因它确实如此。
到底是怎么回事?
class MyProblem():
def __init__(self):
self.x = 5
def recursive(self):
self.x -= 1
if self.x > 0:
self.recursive()
p = MyProblem()
p.recursive()
Run Code Online (Sandbox Code Playgroud)