Issues with debugger in vsCode

Hello!

I have a project in vsCode, that is compiled by using fpm and the the Intel ifx compiler. I can compile and run the program just fine, however the gdb debugger does not stop on any set breakpoint. This is weird for me, because I can use the debugger just fine, when I use the gfortran compiler.

I read up on the compiler and a potential issue might be the code optimization done by ifx. To fix this, I’m using the --profile debug when compiling. I also found a gdb debugger in the Intel oneApi directories and tried to use it, but no luck here either.

Does anyone has an idea, what the problem exactly is and how I can fix it? Programming without a proper debugger is possible, but also painfully inefficient…

launch.json

{
    "version": "0.2.0",
    "configurations": [
        {
            "name": "fpmTest Debug Main",
            "type": "cppdbg",
            "request": "launch",
            "program": "${workspaceFolder}\\build\\ifx_BDDC0259BFB63FA8\\app\\fpmTest.exe",
            "args": [""],
            "stopAtEntry": false,
            "cwd": "${workspaceFolder}",
            "miDebuggerPath": "C:\\Program Files (x86)\\Intel\\oneAPI\\debugger\\2024.0\\opt\\debugger\\bin\\gdb-oneapi.exe",
            "MIMode": "gdb",
            "preLaunchTask": "fpm_build_debug_main"
        },
        {
            "name": "fpmTest Debug Unittest",
            "type": "cppdbg",
            "request": "launch",
            "program": "${workspaceFolder}\\build\\ifx_BDDC0259BFB63FA8\\test\\Unittest.exe",
            "args": [""],
            "stopAtEntry": false,
            "cwd": "${workspaceFolder}",
            "miDebuggerPath": "gdb.exe",
            "MIMode": "gdb",
            "preLaunchTask": "fpm_build_debug_test"
        },
    ]
}

task.json

{
    "version": "2.0.0",
    "tasks": [{
            "label": "fpm_build_release",
            "type": "shell",
            "command": "fpm build --compiler ifx --profile release"
        },{
            "label": "fpm_build_debug_main",
            "type": "shell",
            "command": "fpm build --verbose --compiler ifx --profile debug"
        },{
            "label": "fpm_build_debug_test",
            "type": "shell",
            "command": "fpm build --tests --compiler ifx --profile debug"
        }
    ]
}

As far as I remember, Intel’s gdb only works on Linux, not Windows.
Did you have a look at Intel integration with Microsoft Visual Studio IDE?

I did not know that. What a bummer.

I tried to set up the visual studio IDE, but couldn’t get it to work. Since I haven’t worked with the IDE to begin with, I don’t have any experience with it. I basically have to deal with 2 problems at the same time. :confused:

I had several issues with visual studio 2022. In the end, I had to downgrade to VS2019 and compiler+debugger work just fine. The problem is that Microsoft does not distribute the community version of VS2019 anymore.

I actually have the VS2019 community version installed

And which version of the Intel Compiler? Did you install the Base+HPC toolkit?
By the way, Intel GDB should run on Windows.

I have both the Base and HPS toolkit (so the whole Intel oneApi toolkit) for version 2024.0 and 2023.2 installed.

I will have to read the linked documentation later. Thanks for sharing :slight_smile:

1 Like

It might certainly be the case. My memories are from some time ago, where I recall having read that Intel GDB was actually only working on Linux platforms.
I recall having tried myselft to run it, but failed.
It could be that actually CLI gdb was only supported on Linux, and that on Windows you need to go through VS (it also looks like that all the Windows documentation reports GDB usage from VS).
It might be worth a try if that’s fixed.

I raised this issue 3-4 years ago, initially at the vscode cpptools team, and then at Intel, but not much has come out of it. I don’t have the links to the discussions handy but at the core of the issue is that there is no debug adaptor to interpret Intel Fortran on Windows code. If that ever stops being the case either the vscode cpptools team will ship it with cpptools, like they do with everything else, or we will include it in Modern Fortran directly.
Unfortunately there is not much else we can do on our side.

1 Like