Fortran 90 debugger for MacOS Sonoma?

Hello,

With VS Code, I can program, compile and execute my code in Fortran 90.

  • Compile with a Makefile specific to the program + terminal then Execute via the terminal.
  • or Compile and execute the programme with a button that launches a generic script.

On the other hand, I can’t get a Fortran 90 debugger to work on MacOS (Sonoma): neither GDB nor LLDB. Either in the terminal or via VS Code.
With GDB, it crashes. With LLDB, the breakpoints work but the variables are not displayed (in the VS Code VARIABLES explorer or via the terminal): “This version of LLDB has no plugin for the language “fortran95”. Inspection of frame variables will be limited”.

My configuration:

  • MacOS Sonoma (14.5)
  • VS Code 1.91.1 + Modern Fortran 3.2.0 + Fortran Breakpoint Support 0.0.4 + CodeLLDB 1.10.0
  • gfortan (GCC) 14.1.0
  • GDB 15.1
  • LLDB 18.1.8
  • Xcode 15.4 (I don’t know if it matters)

Does anyone debug their Fortran 90 code on MacOS Sonoma?
If yes, with which debugger (version) ? More generally, what is your configuration? Is there a specific procedure or trick?

Thank you in advance for your feedback. Maybe what I’m looking for just doesn’t exist.

1 Like

Hello,
I’m in a similar position. When working from home I use an Apple M1 running Sonoma 14.5. I write Fortran in VS Code with Modern Fortran and compile with GFortran (GCC 14.1.0). As far as I can tell GDB isn’t available for M1 Macs and I have the same problem as you with LLDB (18.1.8). Fortuntately my work PC runs Linux (CentOS), which means I can log on remotley and use GDB for debugging. At least I can use a debugger but I’d also like to know if there’s a Mac based solution that works (perhaps LFortran in time, which I haven’t yet).

This is likely has something to do with code signing on Mac OS Sonoma, just search for gdb code signing Mac OS Sonoma and you should be able to figure it out.

Yes, code signing works if you have an Intel Mac but as far as I can tell GDB isn’t available for Apple silicon (I’ve looked at Homebrew and Macports).

Yep… you are correct

file /usr/local/bin/gdb

returns

/usr/local/bin/gdb: Mach-O 64-bit executable x86_64

Bummer… my primary machine is a 27" iMac but I do my fortran develoment remotely on a Linux server at this point (more CPU cores / nVidia support).

I worked on MacOS X at Apple for 10+ years and I still enjoy using MacOS… If and when Apple decides to actually make a 27" iMac that I can afford I will update… but for the foreseeable future it’s going to be this setup.

Maybe you could build gdb and gfortran as native on MacOS? That is where I would start.

I’m not certain, but I think the commercial Simply Fortran works on Apple ARM cpus and with the latest versions of MacOS. That package includes the gdb debugger, so they must have somehow figured out the code signing security problems.

[edit: after looking around the site some more, I see a few “intel only” tags scattered around, so maybe it doesn’t work after all on Apple ARM.]

Yes, on the SF MacOS download page it says; Simply Fortran for Apple Silicon does not support debugging at this time.

1 Like

I wonder if the Apple Silicon has some sort of protection that doesn’t allow GDB to work… LLDB in the past has been for LLVM compiled code so I suspect it wouldn’t work well.

I think that is a possibility once we have LLVM-based fortran compilers. At least, that was one of the rationals for supporting LLVM based compilers in the first place. Until then, it looks like one step forward, two steps back…

I’ve come across this Q/A page, which says “lima” + “RemoteSSH” allows the use of GDB from Mac M1 (+ VScode). Possibly worth checking…?

Totalview works AFAIK, but isn’t exactly free (neither as in beer nor as in speech).

Hello,

Thank you for all of your answers.

Indeed, I forgot to mention that my MacBook uses an Intel processor.

The code signing procedure works on my computer. Nevertheless, GDB doesn’t work.

Is someone has MacOS Sonoma + Intel and succeed to use a Fortran debugger?