Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > Fortran > gdb, gfortran a...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 1 of 14 Topic 8464 of 8908
Post > Topic >>

gdb, gfortran and an elementary program

by Ron Ford <ron@[EMAIL PROTECTED] > Jul 7, 2008 at 08:55 PM

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
 




 14 Posts in Topic:
gdb, gfortran and an elementary program
Ron Ford <ron@[EMAIL P  2008-07-07 20:55:08 
Re: gdb, gfortran and an elementary program
Arjen Markus <arjen.ma  2008-07-08 21:38:36 
Re: gdb, gfortran and an elementary program
Ron Ford <ron@[EMAIL P  2008-07-09 19:00:04 
Re: gdb, gfortran and an elementary program
Arjen Markus <arjen.ma  2008-07-09 00:16:54 
Re: gdb, gfortran and an elementary program
Ron Ford <ron@[EMAIL P  2008-07-09 19:15:47 
Re: gdb, gfortran and an elementary program
Arjen Markus <arjen.ma  2008-07-09 23:39:35 
Re: gdb, gfortran and an elementary program
Ron Ford <ron@[EMAIL P  2008-07-11 12:07:07 
Re: gdb, gfortran and an elementary program
Arjen Markus <arjen.ma  2008-07-12 02:17:14 
Re: gdb, gfortran and an elementary program
Arjen Markus <arjen.ma  2008-07-12 02:37:07 
Re: gdb, gfortran and an elementary program
Ron Ford <ron@[EMAIL P  2008-07-14 20:36:01 
Re: gdb, gfortran and an elementary program
Arjen Markus <arjen.ma  2008-07-15 02:32:48 
Re: gdb, gfortran and an elementary program
Ron Ford <ron@[EMAIL P  2008-07-14 22:13:15 
Re: gdb, gfortran and an elementary program
Arjen Markus <arjen.ma  2008-07-15 12:34:33 
Re: gdb, gfortran and an elementary program
Ron Ford <ron@[EMAIL P  2008-07-19 21:55:10 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Wed Nov 19 7:39:28 CST 2008.