Is there any trick to debugging mixed language c++ calling fortran in vs 2008? When I place a break in the c++ fortran call and try to step into the fortran, it steps over. When I try to put a break directly into the fortran the break is disabled saying that no symbols have been loaded for this file. What am I missing?
Are you using debugged version or release version? Please make sure your configuration is debug version?
It is debug version, both the in c++ main that ouputs the executable and the pvf that is set to output a static library.
You will need to set PVF project as a start up project. Then on a property page of PVF start up project -> Configuration properties -> Debugging, there should be a Command tab, you then enter a command(Path to C++ main program) and other environments variables.
I made the PFV project the startup project and I set the command as the c++ exe and now it won’t stop at breaks in either the fortran nor the c++ source. What am I missing?
To clarify, so you are able to set breakpoints but it won’t stop at your breakpoints? Can you remove all the breakpoints and start all over again? Sometime if the source code is change, the breakpoints need to be reset.
If you try all avenues and still does not work, can you please send us a small test case? Send to email@example.com.
I have received your project and could not reproduce the problem you reported.
What are the steps you do to debug your program?
Here are what I do:
- Unzip the project into C:\tmp directory.
- Open PGI Visual Studio 2008.
- From Menu: click on File->Open->Project/Solution and browse for the project(PVFLib.sln) in C:\tmp\PVFLib and click OK
- From Menu: click on Debug -> Start Debugging.
It then starts the program and stops in main where the breakpoint is(a call to libsub_).
If you do differently, perhaps try follow those steps and see if it breaks for you.
What message did it say when it didn’t stop at breakpoints, or no message at all? Note that when it stops, the red circle of your breakpoint will have arrow in it. What did you see differently?
The OS I ran is Microsoft Windows Server 2003 R2. What is your OS?
I followed your steps but with the same result. It does not stop at any breaks. The output is
‘Main.exe’: Loaded ‘C:\Windows\system32\ntdll.dll’, Symbols loaded.
‘Main.exe’: Loaded ‘C:\Windows\system32\kernel32.dll’, Symbols loaded.
The program ‘ Main.exe: 0’ has exited with code 0 (0x0).
that is it exits normal but does not stop at breaks. My OS is vista.
Once we get vs2008 on vista, I will let you know what the problem is.
Thanks for you patience.
I have filed TPR# 15011 for this. This seems to be a bug in our debugger on Vista. Unfortunately there is no workaround for now unless you try it on Windows Server 2003.
Has there been any progress on fixing this bug in Vista?
Just to be clear, the problem here only applies to using PVF to debug C++ code linked using Visual Studio. Debugging Fortran code linked with PVF works fine.
The issue is that Visual C++ 2008 enables the /DYNAMICBASE linker flag by default. On Windows Vista, this flag causes the executable to run with Address Space Layout Randomization (ASLR). The PGI debugger does not yet support ASLR executables.
To work around the problem, you need to disable the “Configuration Properties -> Linker -> Advanced -> Randomized Base Address” property and relink. For existing binaries, you can run the command " editbin /DYNAMICBASE:no ".
Hope this helps,