Since the fortran I find interesting is now beyond f95, I'm trying
gfortran's debugger to figure out what object I get when I ask for an
integer in different ways. I hope that my serial failures are about to
give way to getting information from gdb.
The program in question is simple and runs without complaint:
program debug2
USE ISO_C_BINDING, only: C_INT
INTEGER(C_INT) :: I
INTEGER :: J
I = 41
J = 42
PRINT *, I, J
PRINT *, kind(0), c_int
do k = 1,20
print *, k, selected_int_kind(k)
enddo
end program
! gfortran -o debug -g debug2.f03
! gdb debug >text42.txt 2>text43.txt
A huge problem had been that I didn't know how to get gdb's comments from
a
dos window into text. I thought the app was hanging when I asked it to
channel stdout, but it was just storing what it should have. If you can
remember your commands (and type without mistakes), you can make it work.
Since I type:
break main
run
step
step
print j
quit
y
, I've gotten pretty good at it, as far as failing reliably. Furthermore,
I think I see the picture developing in what is in text42, from stdout,
and
from text43, from stderr.
Text42, from stdout, is:
GNU gdb 6.6
Copyright (C) 2006 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) break main
Breakpoint 1 at 0x401543: file ../../../trunk/libgfortran/fmain.c, line
11.
(gdb) run
Starting program: C:\Do***ents and
Settings\dan\Desktop\gfortran\source/debug.exe
Loaded symbols for C:\WINDOWS\system32\ntdll.dll
Loaded symbols for C:\WINDOWS\system32\kernel32.dll
Loaded symbols for C:\WINDOWS\system32\msvcrt.dll
Breakpoint 1, main (argc=1, argv=0x3d24f8)
at ../../../trunk/libgfortran/fmain.c:11
in ../../../trunk/libgfortran/fmain.c
(gdb) step
13 in ../../../trunk/libgfortran/fmain.c
(gdb) step
*__gfortran_store_exe_path (
argv0=0x3d2479 "C:\\Do***ents and
Settings\\dan\\Desktop\\gfortran\\source/debug.exe") at
.../../../trunk/libgfortran/runtime/main.c:115
in ../../../trunk/libgfortran/runtime/main.c
(gdb) print j
(gdb) quit
The program is running. Exit anyway? (y or n)
Text43, from stderr, is:
11 ../../../trunk/libgfortran/fmain.c: No such file or directory.
115 ../../../trunk/libgfortran/runtime/main.c: No such file or directory.
No symbol "j" in current context.
I've searched my gfortran install, and there's no trunk and no fmain.c,
which prompts 2 questions:
1) How do I get fmain.c and other files I need to use gdb profitably?
2) How do I put them in the right place?
--
Archbishop - A Christian ecclesiastic of a rank superior to that attained
by Christ.
H. L. Mencken


|