0

I'm trying to debug a Fortran program using Visual Studio Code (VSC) under Mac OS X Catalina (10.15.3). I can set a breakpoint and VSC breaks at that line appropriately, but I can't Watch any variables. VSC displays "error: no value" in the Watch window and when I type print <variable_name> in the terminal. I'm using the lldb debugger.

Here are the extensions I've installed

C/C++ Fortran Breakpoint Support FORTRAN IntelliSense Modern Fortran Python Jupyter Native Debug

This is my launch.json

{
    "version": "0.2.0",
    "configurations": [

        {
            "name": "(lldb) Launch",
            "type": "cppdbg",
            "request": "launch",
            "program": "${workspaceFolder}/test",
            "args": ["${workspaceFolder}/data.txt"],
            "stopAtEntry": false,
            "cwd": "${workspaceFolder}",
            "environment": [],
            "externalConsole": false,
            "osx": {
                "MIMode": "lldb",
            }
        }
    ]
}

and my tasks.json

{
    "version": "2.0.0",
    "tasks": [
        {
            "label": "build",
            "type": "shell",
            "command": "make",
            "args": [],
            "group": "build",
            "presentation": {
                "reveal": "silent"
            },
            "problemMatcher": "$msCompile"
        }
    ]
} 

Has anyone successfully used a debugger for a Fortran program in VS Code? I can debug a C++ program with no issues.

1

1 Answer 1

1

At present, lldb has no support for Fortran.

With some other languages (like Rust) in lieu of real support lldb is told to pretend they are C++, and that sort of works. You could try that with lldb (you'd have to build your own copy to make the change). But Fortran is pretty different from C++ so this would only get you so far.

gdb has Fortran support, maybe you can get VSCode to work with gdb instead?

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.