简体   繁体   English

无法在 VS Code 中调试 Fortran 程序

[英]Unable to debug Fortran program in VS Code

I'm trying to debug a Fortran program using Visual Studio Code (VSC) under Mac OS X Catalina (10.15.3).我正在尝试在 Mac OS X Catalina (10.15.3) 下使用 Visual Studio Code (VSC) 调试 Fortran 程序。 I can set a breakpoint and VSC breaks at that line appropriately, but I can't Watch any variables.我可以在该行适当地设置断点和 VSC 中断,但我无法观察任何变量。 VSC displays "error: no value" in the Watch window and when I type print <variable_name> in the terminal.当我在终端中键入 print <variable_name> 时,VSC 在 Watch window 中显示“错误:无值”。 I'm using the lldb debugger.我正在使用 lldb 调试器。

Here are the extensions I've installed这是我安装的扩展

C/C++ Fortran Breakpoint Support FORTRAN IntelliSense Modern Fortran Python Jupyter Native Debug C/C++ Fortran 断点支持 FORTRAN IntelliSense 现代 Fortran ZA7F5F35426B927811FCZ231B 原生调试

This is my launch.json这是我的发射。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和我的任务。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?有没有人在 VS Code 中成功地为 Fortran 程序使用调试器? I can debug a C++ program with no issues.我可以毫无问题地调试 C++ 程序。

At present, lldb has no support for Fortran.目前lldb不支持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.使用其他一些语言(如 Rust)代替真正的支持,lldb 被告知假装它们是 C++,这样就可以了。 You could try that with lldb (you'd have to build your own copy to make the change).您可以使用 lldb 进行尝试(您必须构建自己的副本才能进行更改)。 But Fortran is pretty different from C++ so this would only get you so far.但是 Fortran 与 C++ 完全不同,所以这只能让你到目前为止。

gdb has Fortran support, maybe you can get VSCode to work with gdb instead? gdb 支持 Fortran,也许您可以让 VSCode 与 gdb 一起工作?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM