I am trying to debug a very large legacy code base with mostly fortran77 code (with some f90 and C/C++).
It’s being run under linux wsl2. Compiler is Intel 2024, so it’s ifx for fortran.
Whenever I want to “step into” a subroutine, it won’t let me, it just steps over.
If i put a breakpoint in the subroutine, then it will stop there.
Intellisense works just fine. I can get the subroutine definition with a right-click.
Any idea what is wrong?
Hmm, I have just realized that I can’t step into the subroutines with “gdb” itself either.
So, it has nothing to do with the “Modern Fortran” extension. My bad.
But, if I use the Intel debugger “gdb-oneapi”, then I can step into the subroutines.
Any advice on what i can do to make it work? Can you use “gdb-oneapi” with “Modern Fortran” extension?
I have never used those tools, but I do know that you must usually compile with specific options in order to step into a subroutine with a debugger. For ifx, I think that option is -g
, but there may be other compiler options required too. I found this discussion online: debugging output generated by ifx - Intel Community
1 Like
Even before ifx, Intel shipped a modified version of gdb (named gdb-ia) that would work with Intel-compiled Fortran. Sometimes GNU gdb would work anyway though. So it’s no surprise that you are having to use an Intel gdb. I have never used a debugger through an IDE, but I would imagine there is a section of debugger settings where you can provide a path to a specific executable to use. gdb-oneapi in your case. It probably has nothing to do with the Modern Fortran extension.
1 Like
As I understand it the vscode debugging is actually provided by the C/C++ extension. From this page it’s not immediately obvious whether you could make some suitable change in your launch.json file. Hopefully the path can be pointed to the intel gdb-oneapi …
If you install the “oneapi” extension from Intel, you can have a launch config that uses “gdb-oneapi”. I tried that and it runs. The problem is you cannot actually debug within the “ModernFortran” extension. I can set breakpoints but, when i launch the debugger, “Modern Fortran” seems to not handle it well as it seems to stop but there is no debugging cursor (in other words, you can’t debug at all). So, I don’t think “Modern Fortran” extension is compatibe with “gdb-oneapi”. That’s what I have experienced.
I opened a support ticket at intel regarding the debugger integration in VSCode on January 2024. I have received sparse feedback every 3-4 months telling me that the engineers have pushed the subject, last time I got feedback was on January this year… I’m guessing, just as it happens in many software companies, if there is just one random person opening a ticket it doesn’t get much attention, if several people more or less at the same time-frame request a similar issue it can go up in priority.
I would advise for others to go to intel’s support page and request for the VSCode integration for Fortran to be pushed further.
1 Like