User forums > Help

Debugging fortran

<< < (2/6) > >>

JoachimB:
How do you mean, a mixed fortran / c++ project?
Earlier, I used to use f2c and converted to c files which I made a project of. Then I could debug the c-code of course. But from your screenshot, it looks like you are debugging the fortran code itself. -What does your project look like? After installing G77 according to your wiki page, I have the following build log

-------------- Build: Debug in Fello2 ---------------
g77.exe -Wall -g  -I- -I. -IC:\MingW\include  -c main.f -o obj\Debug\main.o
g77.exe -LC:\MinGW\lib  -o bin\Debug\Fello2.exe obj\Debug\main.o   -lg2c -lstdc++ 
Process terminated with status 0 (0 minutes, 0 seconds)
0 errors, 0 warnings


MortenMacFly:

--- Quote from: JoachimB on May 09, 2006, 11:07:54 pm ---How do you mean, a mixed fortran / c++ project?

--- End quote ---
Nope, you are completely right. I have used my Fortran template and just adjusted the main.f file in it. Thus I did not have a "native" Fortran application for the screenshot. Just forget about that post of mine. Sorry.
With regards, Morten.

Michael:

--- Quote from: JoachimB on May 09, 2006, 10:33:05 pm ---> set prompt (gdb)
GNU gdb 5.2.1

--- End quote ---

Hello,

You should use GDB 6.3 and not 5.2.1.

Best wishes,
Michael

JoachimB:
Thanks Mikael, I tried but it makes no difference

Command-line: C:\MinGW\bin\gdb.exe -nx -fullname  -args bin/Debug/Fello2.exe
Working dir : C:\Projects\Tiny\Fello2\
> set prompt (gdb)
GNU gdb 6.3  :shock:
Copyright 2004 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "i686-pc-mingw32"...
(gdb) (gdb)
> set confirm off
(gdb)
> set width 0
(gdb)
> set height 0
(gdb)
> set breakpoint pending on
(gdb)
> set print asm-demangle on
(gdb)
> set new-console on
(gdb)
> set disassembly-flavor intel
(gdb)
> directory C:/Projects/Tiny/Fello2/
(gdb)
> delete breakpoints
(gdb)
> break main.f:4
Breakpoint 1 at 0x40131b: file main.f, line 4.
(gdb)
> run
Breakpoint 1, MAIN__ () at main.f:4
C:/Projects/Tiny/Fello2/main.f:4:84:beg:0x40131b  --It knows right :shock:
Current language:  auto; currently fortran
(gdb)

MortenMacFly:

--- Quote from: JoachimB on May 10, 2006, 12:53:28 am ---Thanks Mikael, I tried but it makes no difference

--- End quote ---
It doesn't depend on the debugger's version. I guess it has to do with the parsing of the debugger's output. This is "optimised" for C/C++ code. If you have a hello world C++ application the output looks different:

--- Code: ---> break main.cpp:5
Breakpoint 1 at 0x401408: file main.cpp, line 5.
(gdb)
> run
Breakpoint 1, main () at main.cpp:5
C:/DOKUME~1/morten/Desktop/haha/main.cpp:5:38:beg:0x401408
(gdb)

--- End code ---
...again in comparision, here is the fortran's output:

--- Code: ---> break main.f:4
Breakpoint 2 at 0x40131b: file main.f, line 4.
(gdb)
> run
Breakpoint 2, MAIN__ () at main.f:4
C:/DOKUME~1/morten/Desktop/huhu/main.f:4:81:beg:0x40131b
Current language:  auto; currently fortran
(gdb)

--- End code ---
I've had a look at it already but fall asleep yesterday... ;-) Give me some time.
...or I'm sure mandrav knows - he wrote the debugger's parser.
With regards, Morten.

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version