Visual Studio C++, breakpoints not stopping debugging DLL (GODOT GDExtention)

45 Views Asked by At

In short, all compiles and runs but breakpoints not getting hit. I am using VC++ 2022. I am following this tutorial.

Invoking: scons -j4 target=template_debug dev_build=yes debug_symbols=yes

All DLLs and lib complied with dev.debug:

![image|485x500](upload://7LOe2cfD8VYpFHboBkMB31Ay1iK.png)

The launch.vs.json

{
  "version": "0.2.1",
  "defaults": {},
  "configurations": [
    {
      "type": "default",
      "project": "C:\\dev\\my\\godot\\Godot_v4.2.1-stable_win64.exe\\Godot_v4.2.1-stable_win64_console.exe",
      "name": "Godot Game",
      "args": [
        "--path",
        "C:\\dev\\my\\godot\\godotcpp\\test1\\godot-cpp-template\\demo"
      ]
    },
    {
      "type": "default",
      "project": "C:\\dev\\my\\godot\\Godot_v4.2.1-stable_win64.exe\\Godot_v4.2.1-stable_win64_console.exe",
      "name": "Godot Editor",
      "args": [
        "-e C:\\dev\\my\\godot\\godotcpp\\test1\\godot-cpp-template\\demo\\project.godot"
      ]
    }
  ]
}

And do start the scene from the editor. The breakpoint doesn't get hit and looks like this:

enter image description here

Update

Here is the pdb file:

enter image description here

Looks like total mess, what am I doing wrong?

2

There are 2 best solutions below

1
Markus Schumann On

It looks like you are missing the program database (PDB files). You have to invoke the linker with the /DEBUG option. Since you are using SCons - you have the edit your configuration file and add the /DEBUG linker options.

2
bdbaddog On

SCons does support generating the PDB files, however you must enable it by setting env['PDB']

env['PDB'] = "${TARGET.base}.pdb"

Should likely do the job (I've not tried this)

From the SCons manpage:

The Microsoft Visual C++ PDB file that will store debugging information for object files, shared libraries, and programs. This variable is ignored by tools other than Microsoft Visual C++. When this variable is defined SCons will add options to the compiler and linker command line to cause them to generate external debugging information, and will also set up the dependencies for the PDB file. Example:

env['PDB'] = 'hello.pdb' The Microsoft Visual C++ compiler switch that SCons uses by default to generate PDB information is /Z7. This works correctly with parallel (-j) builds because it embeds the debug information in the intermediate object files, as opposed to sharing a single PDB file between multiple object files. This is also the only way to get debug information embedded into a static library. Using the /Zi instead may yield improved link-time performance, although parallel builds will no longer work. You can generate PDB files with the /Zi switch by overriding the default $CCPDBFLAGS variable; see the entry for that variable for specific examples.

See: