Help required to debug darktable under Windows

Hi all,

I’m asking for help, since I’m struggeling to debug darktable under Windows 10 (64bit).

I followed the instructions at https://github.com/darktable-org/darktable/blob/master/packaging/windows/BUILD.md (thanks to @paul_pw) and succeeded quite “out-of-the-box” to compile darktable based on the latest commits and run the executable on my system. I’m using Ninja, which works also fine with my configuration.

:+1: :grinning:

Since I want to get a little familiar with the darktable sources, I would like to set breakpoints and debug the application. Unfortunately this is where the problem starts - for sure also due to my missing experience using debugging tools in C and the non-knowing of the darktable sources.

OK, so to keep it simple, I started with Visual Studio Code (and not with Visual Studio Community Editition). I tried to point build.json to the freshly build darktable.exe, but I get the error message

ERROR: Unable to start debugging. Unexpected GDB output from command “-exec-run”. Error creating process /usr/bin/C:\msys64\opt\darktable\bin\darktable.exe, (error 2).
The program ‘C:\msys64\opt\darktable\bin\darktable.exe’ has exited with code 42 (0x0000002a).

My launch.json is as follows (the second attempt with the currently commented line results in an error message, that the executable cannot be found):

"configurations": [
        {
            "name": "Run (gdb)",
            "type": "cppdbg",
            "request": "launch",
            "program": "C:\\msys64\\opt\\darktable\\bin\\darktable.exe",
            //"program": "..\\..\\opt\\darktable\\bin\\darktable.exe",
            "args": [],
            "stopAtEntry": true,
            "cwd": ".",
            "environment": [],
            "externalConsole": true,
            "MIMode": "gdb",
            "miDebuggerPath": "C:\\msys64\\usr\\bin\\gdb.exe",
            "setupCommands": [
                {
                    "description": "Enable pretty-print for \"gdb\"",
                    "text": "-enable-pretty-printing",
                    "ignoreFailures": false
                }
            ]
        }
    ]

I would really appreciate, if someone could help me with some hints or point me to additional ressources that I perhaps haven’t found. Thanks so much in advance.

1 Like

I think you want to use the MINGW64 purpose built debugger, not the MSYS2 (POSIX) one… So make sure mingw-w64-x86_64-gdb is installed and use C:\\msys64\\mingw64\\bin\\gdb.exe in VSCode. I think you also want C:\msys64\mingw64\bin in your system PATH

1 Like

Yesss - this works like a charm. I already had installed it but took the default gdb.exe given in a Visual Studio Code tutorial :crazy_face:. Thanks a lot for your quick support :+1: and summery greetings from :pretzel: Bavaria…