Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

My breakpoints are completely ignored #420

Open
iamalsonothere opened this issue Apr 4, 2024 · 4 comments
Open

My breakpoints are completely ignored #420

iamalsonothere opened this issue Apr 4, 2024 · 4 comments

Comments

@iamalsonothere
Copy link

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

$ gdb --version
GNU gdb (GDB) 14.2
Copyright (C) 2023 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
@plowsters
Copy link

plowsters commented Jul 7, 2024

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"
    }
  ]
}

@plowsters
Copy link

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)

@GitMensch
Copy link
Collaborator

GitMensch commented Jul 8, 2024 via email

@plowsters
Copy link

plowsters commented Jul 8, 2024

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants