This is the mail archive of the
gdb-prs@sources.redhat.com
mailing list for the GDB project.
Re: fortran/3: gdb segfaults associated with FORTRAN (g77) arrayarguments
- From: Fred Krogh <fkrogh at mathalacarte dot com>
- To: nobody at sources dot redhat dot com
- Cc: gdb-prs at sources dot redhat dot com,
- Date: 13 Apr 2005 14:48:03 -0000
- Subject: Re: fortran/3: gdb segfaults associated with FORTRAN (g77) arrayarguments
- Reply-to: Fred Krogh <fkrogh at mathalacarte dot com>
The following reply was made to PR fortran/3; it has been noted by GNATS.
From: Fred Krogh <fkrogh@mathalacarte.com>
To: gdb-gnats@sources.redhat.com, nobody@sources.redhat.com,
smith@arete-dc.com
Cc:
Subject: Re: fortran/3: gdb segfaults associated with FORTRAN (g77) array
arguments
Date: Wed, 13 Apr 2005 07:33:43 -0700
It looks like gdb still has this problem at version 6.3. (Or perhaps it
is g77 version 3.4.3??) Here is a way to reproduce.
The program (test.f):
integer IA(10), I
do I = 1, 10
IA(I) = I
end do
call IP(IA)
print *, 'IA(1)=', IA(1)
stop
end
subroutine IP(IA)
integer IA(10)
IA(1) = IA(1) + IA(2)
IA(2) = IA(2) + IA(3)
return
end
Compile it:
g77 -g -o test test.f
Debug it:
bash-2.05b$ gdb test
GNU gdb 6.3
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 "x86_64-pc-linux-gnu"...Using host
libthread_db library "/lib/libthread_db.so.1".
(gdb) break test.f:12
Breakpoint 1 at 0x4009cd: file test.f, line 12.
(gdb) run
Starting program: /tmp/test/test
Breakpoint 1, ip_ (ia=0x7fffffffef30) at test.f:12
12 IA(2) = IA(2) + IA(3)
Current language: auto; currently fortran
(gdb) p ia(2)
Program received signal SIGSEGV, Segmentation fault.
0x00007fffffffef30 in ?? ()
The program being debugged was signaled while in a function called from
GDB.
GDB remains in the frame where the signal was received.
To change this behavior use "set unwindonsignal on"
Evaluation of the expression containing the function (at 0x7fffffffef30)
will be abandoned.
I find it of some interest that if I start with "set unwindonsignal on"
then the recommendation for changing the identical behavior is to "set
unwindonsignal off"!
If there is some "approved" way to, for example, print entries 3 to 6 of
IA while in the subroutine IP, I'd love to know what it is.
Many thanks,
Fred