I would like to do some minor changes to a demosaic algorithm and need to rebuild and debug the code under Windows 11. So far I managed to compile using msys2 and the executable is fine.
Managed to get the code under some IDEs - Visual Studio, Visual Stusio Code etc. The compilation is fine and the executable is generated OK, but for a week I struggle to attach a debugger so I can debug easily the changes I apply. Anybody who has any experience with running successfully a debugger under windows? Thanks!
Welcome!
I suppose you already went through Get Started with C++ and MinGW-w64 in Visual Studio Code and Debug C++ in Visual Studio Code?
Come to think of it, IIRC my msys2 gcc toolchain was (semi-?)automatically picked up by VS Code and I didn’t do much to get it going.
Note that you need to install the gdb package matching your target environment, not the base MSYS one…
Here’s my launch.json
I use for debugging darktable:
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "(gdb) Launch",
"type": "cppdbg",
"request": "launch",
"program": "C:\\msys64\\opt\\darktable\\bin\\darktable.exe",
"args": [
"-d",
"all",
"--disable-opencl",
"--configdir",
"C:/Temp/dtconf"
],
"stopAtEntry": true,
"cwd": "C:\\msys64\\opt\\darktable\\bin",
"environment": [
{
"name": "PATH",
"value": "C:\\msys64\\ucrt64\\bin;${env:PATH}"
}
],
"externalConsole": false,
"MIMode": "gdb",
"miDebuggerPath": "C:\\msys64\\ucrt64\\bin\\gdb.exe",
"setupCommands": [
{
"description": "Enable pretty-printing for gdb",
"text": "-enable-pretty-printing",
"ignoreFailures": true
},
{
"description": "Set Disassembly Flavor to Intel",
"text": "-gdb-set disassembly-flavor intel",
"ignoreFailures": true
}
]
}
]
}
Also note that I (and darktable, and VS Code links above) use the UCRT64 environment, while I noticed RT still recommends the legacy MINGW64 one.
Hi, thanks for the quick reply!
Yes, I went trough Get started… etc. just have not installed any additional gdb package yet - will do and give it a try.
(btw I use UCRT64 too - not sure why they recommend the legacy environment either. )
I think having C:\msys64\ucrt64\bin
in your PATH
(and gdb.exe
there of course) was a critical step as well.
Yes, I found that. Also, I found having env variable CMAKE_PREFIX_PATH = C:\msys64\ucrt64\ helps a lot too.
Still no luck with Visual Studio (and Code) but managed to create Code::Blocks project and after adjusting few settings it compiles and debugs OK. No the fanciest IDE, but does the job, all sorted for now, thanks for you help !