I'm trying to debug a C program using Visual Studio Code in Ubuntu.
I set
"program": "${workspaceRoot}/sample"
in the launch.json where "sample" is the name of my program. Then I simply put a breakpoint in code and click the debug arrow. However, the debugger does not hit the breakpoint, a terminal simply flashes and closes. When I hover over my breakpoint it says:
Module containing this breakpoint has not yet loaded or the breakpoint adress could not be obtained.
Is there an additional setting that I must configure ?
Debug view. To bring up the Debug view, select the Debug icon in the Activity Bar on the side of VS Code. You can also use the keyboard shortcut ⇧⌘D (Windows, Linux Ctrl+Shift+D). The Debug view displays all information related to debugging and has a top bar with debugging commands and configuration settings.
Windows debugging with GDB # You can debug Windows applications created using Cygwin or MinGW by using VS Code. To use Cygwin or MinGW debugging features, the debugger path must be set manually in the launch configuration (launch.json).
The C/C++ extension for VS Code also has the ability to debug memory dumps. To debug a memory dump, open your launch.json file and add the coreDumpPath (for GDB or LLDB) or dumpPath (for the Visual Studio Windows Debugger) property to the C++ Launch configuration, set its value to be a string containing the path to the memory dump.
The Debug: Run (Start Without Debugging) action is triggered with Ctrl+F5 and uses the currently selected launch configuration. Many of the launch configuration attributes are supported in 'Run' mode. VS Code maintains a debug session while the program is running, and pressing the Stop button terminates the program.
The problem had nothing to do with VS code. I was simply missing the -g tag when compiling the program.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With