Open iamalsonothere opened 5 months ago
I had the same issue on VSCodium 1.90.2, and I got it to work. CMake successfully builds the executable, but gdb ignores all breakpoints. Fixed with this launch.json configuration:
{
"version": "0.2.0",
"configurations": [
{
"name": "GDB Debug",
"type": "gdb",
"request": "launch",
"cwd": "${workspaceFolder}",
"target": "${workspaceFolder}/build/[executable name]",
"stopAtEntry": false,
"arguments": "",
"valuesFormatting": "prettyPrinters"
}
]
}
Additionally, these are the build tasks I wrote in tasks.json:
"version": "2.0.0",
"tasks": [
{
"label": "CMake configure",
"type": "process",
"command": "cmake",
"args": [
"-S",
"${workspaceFolder}",
"-B",
"${workspaceFolder}/build",
"-DCMAKE_BUILD_TYPE=Debug"
],
"group": {
"kind": "build",
"isDefault": false
},
"problemMatcher": [
{
"owner": "cpp",
"fileLocation": ["relative", "${workspaceFolder}"],
"pattern": {
"regexp": "^(.*?):(\\d+):(\\d+):\\s+(warning|error):\\s+(.*)$",
"file": 1,
"line": 2,
"column": 3,
"severity": 4,
"message": 5
}
}
],
"detail": "Configure the project using CMake"
},
{
"label": "CMake build",
"type": "process",
"command": "cmake",
"args": [
"--build",
"${workspaceFolder}/build"
],
"group": {
"kind": "build",
"isDefault": true
},
"problemMatcher": [
{
"owner": "cpp",
"fileLocation": ["relative", "${workspaceFolder}"],
"pattern": {
"regexp": "^(.*?):(\\d+):(\\d+):\\s+(warning|error):\\s+(.*)$",
"file": 1,
"line": 2,
"column": 3,
"severity": 4,
"message": 5
}
}
],
"detail": "Build the project using CMake"
}
]
}
And here is the CMakeLists.txt used to build it:
cmake_minimum_required(VERSION 3.23)
project(BugHTTPServer)
set(CMAKE_C_STANDARD 23)
set(CMAKE_C_STANDARD_REQUIRED ON)
add_executable(BugHTTPServer http_server.c)
set(CMAKE_BUILD_TYPE Debug)
... So what was the part in launch config that actually fixed it?
I was originally trying to launch it in the VSCodium terminal using
"terminal": "integrated"
Removing this line fixed the issue for me, and it loads in VSCodium by default anyways.
When i configure the GDB debug in launch.json and add a pre task to compile it, all it does is launch the binary. Doesnt even attempt at debugging it, does not acknowledge that any breakpoints exist.
I am using VSCodium 1.87.2