I am trying to debug a segmentation fault. I am thinking I do not have VSCode set up properly.
Here is my 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
}
]
}
]
}
Here is my call stack:
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)
Let me know if I need to provide any additional info.
I am using VSCode 1.63.2
Make sure you are compiling everything in Debug mode. If in VS Code, make sure to build in Debug. If using catkin build, make sure the correct Debug flags are set. If using CMakeLists.txt for included libraries, make sure they do not set a release mode because that seems to overwrite the global option.