VSCode 调用堆栈变灰并充满(来源不明)

Ben*_*lan 7 visual-studio-code vscode-debugger

我正在尝试调试分段错误。我想我没有正确设置 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 Source:0)
MainWindow::newFile() (Unknown Source:0)
MainWindow::loadInitFile() (Unknown Source:0)
MainWindow::qt_static_metacall(QObject*, QMetaObject::Call, int, void**) (Unknown Source:0)
libQt5Core.so.5!QMetaObject::activate(QObject*, int, int, void**) (Unknown Source:0)
libQt5Core.so.5![Unknown/Just-In-Time compiled code] (Unknown Source:0)
libQt5Core.so.5!QObject::event(QEvent*) (Unknown Source:0)
libQt5Widgets.so.5!QApplicationPrivate::notify_helper(QObject*, QEvent*) (Unknown Source:0)
libQt5Widgets.so.5!QApplication::notify(QObject*, QEvent*) (Unknown Source:0)
libQt5Core.so.5!QCoreApplication::notifyInternal2(QObject*, QEvent*) (Unknown Source:0)
libQt5Core.so.5!QTimerInfoList::activateTimers() (Unknown Source:0)
libQt5Core.so.5![Unknown/Just-In-Time compiled code] (Unknown Source:0)
libglib-2.0.so.0!g_main_context_dispatch (Unknown Source:0)
libglib-2.0.so.0![Unknown/Just-In-Time compiled code] (Unknown Source:0)
libglib-2.0.so.0!g_main_context_iteration (Unknown Source:0)
libQt5Core.so.5!QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) (Unknown Source:0)
libQt5Core.so.5!QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) (Unknown Source:0)
libQt5Core.so.5!QCoreApplication::exec() (Unknown Source:0)
Run Code Online (Sandbox Code Playgroud)

如果我需要提供任何其他信息,请告诉我。

我使用的是 VSCode 1.63.2

小智 4

确保您在调试模式下编译所有内容。如果在 VS Code 中,请确保在调试中构建。如果使用catkin构建,请确保设置了正确的调试标志。如果对包含的库使用 CMakeLists.txt,请确保它们没有设置发布模式,因为这似乎会覆盖全局选项。