-
-
Notifications
You must be signed in to change notification settings - Fork 30
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fortran variables are sometimes not accessible #310
Comments
You can see the Fortran compiler flags under consoleapplication1\x64\debug\kbclib.fcf. Note that it works fine for "simpler" Fortran methods, but it does not seem to like the bigger beasties. C/C++ extension v1.8.0-insiders |
By the way, THANK YOU, for this extension. I know it must have taken a lot of work, but its essential, thank you! |
I will have a look but FYI I am on Linux, so I might have to spin up a VM if I can't replicate the problem on my machine. Also, I feel that I need to mention that VSCode and VS in terms of project setups are vastly different so a 1:1 comparison might not be particularly helpful. |
I am not able to replicate the bug on Linux, the debugger (gdb-oneapi) works fine for both cases, I will spin up a VM and see what happens then. ifort -c -g -o Fortran1.o Fortran1.f90
icpx -g -o test ConsoleApplication1.cpp Fortran1.o Then use the newly created {
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "(gdb) Launch",
"type": "cppdbg",
"request": "launch",
"program": "${workspaceFolder}/test",
"args": [],
"stopAtEntry": false,
"cwd": "${fileDirname}",
"environment": [],
"externalConsole": false,
"MIMode": "gdb",
// This is only available for Linux and Mac
"miDebuggerPath": "/home/gn/intel/oneapi/debugger/10.1.1/gdb/intel64/bin/gdb-oneapi",
"setupCommands": [
{
"description": "Enable pretty-printing for gdb",
"text": "-enable-pretty-printing",
"ignoreFailures": true
},
{
"description": "Set Disassembly Flavor to Intel",
"text": "-gdb-set disassembly-flavor intel",
"ignoreFailures": true
}
]
}
]
} Debugger output Linux |
I am sorry for all the effort, where in your extensions is the code the evaluates the watch window? Maybe the issue is really in the C++ debug API to which it must call up, it does it do a lot more? |
No need to apologise. Modern Fortran does not have a debug adapter of its own, we plug in to Microsoft's C/C++ extension Debug component. We rely on the fact that C++ debuggers understand Fortran, however when it comes to Windows and Intel compilers I am not sure if that is the case and/or you have to use a specific version of the MSVC debugger. Maybe you can ask the C/C++ devs if they have any insights as to why it is not working on Windows. PS It just ocured to me that I don't have a Windows VM with Intel compilers in it so testing on Windows for me might not be possible. PPS I was not familiar with the way you bind Fortran with C++, I suppose that is not considered standard, right? You might want to consider using |
Thank you, yes, we have tons of old Fortran code. I have also logged this issue here: microsoft/vscode-cpptools#8479 |
I had a look at the C++ issue you linked, it would appear that there is not much we could do from our end either.
Both of them are extremely inconvenient IMO but I don't see another solution. I will be closing this issue now. Feel free to reopen if you think there is something else that can be done through Modern Fortran. |
Attached a solution which can be unzipped. It contains one C++ file compiled via Visual Studio 2019, and one Fortran file compiled via Intel Fortran, all native Windows code using OBJ / PDB file format. The C++ code calls into the Fortran code.
The Visual Studio Code version and installed extensions is shown in ConsoleApplicaiton4.png
Open the top folder in Visual Studio Code. If you put a breakpoint in the Fortran file in test, it hits it and you can local variables and NOPROP. See ConsoleApplication1.png.
However, now put a breakpoint in the larger method, see ConsoleApplicaiton3.png. Now you cant see any variables.
If you debug this using Visual Studio 2019 with Intel Fortran, you can see all the variables.
Can you please investigate? I can log this with the C++ extension if that is where the problem lies?
![ConsoleApplication1](https://user-images.githubusercontent.com/12629164/144279168-8f431dd5-0e35-499b-a0ca-16b1fbd5583c.png)
![ConsoleApplication2](https://user-images.githubusercontent.com/12629164/144279180-a88fbce9-c150-40c0-8da3-6d74cf568723.png)
![ConsoleApplication3](https://user-images.githubusercontent.com/12629164/144279196-fe4a308a-0fed-4749-8ac2-4e0738c8655c.png)
![image](https://user-images.githubusercontent.com/12629164/144298047-8088ee9f-bab7-4b92-a21c-a7656ce401dc.png)
ConsoleApplication1.zip
The text was updated successfully, but these errors were encountered: