This is the mail archive of the
gdb-prs@sourceware.org
mailing list for the GDB project.
[Bug backtrace/11666] New: Backtrace error with Fortran program using C Signal Handler
- From: "Kevin dot Kronmiller at eglin dot af dot mil" <sourceware-bugzilla at sourceware dot org>
- To: gdb-prs at sourceware dot org
- Date: 4 Jun 2010 13:22:48 -0000
- Subject: [Bug backtrace/11666] New: Backtrace error with Fortran program using C Signal Handler
- Reply-to: sourceware-bugzilla at sourceware dot org
I have a Fortran routine with a C signal handler. When a signal is caught,
the signal handler calls gdb with a script argument to the system() call to
output a backtrace.
When I build the fortran file with the -g option, run the program, and send it
a signal,I receive the error message ?stack.c:295: internal-error ??. Without
the -g option the error message does not appear but as expected I get limited
output in my backtrace.
Below is a description of the environment in which the bug is experienced,
output from gdb showing the bugs occurrence, as well as source code and a
Makefile to reproduce the bug.
The problem occurs in gdb 6.8 but I have seen the same results with gdb 7.1
----------------------------------------------
The following lines describe the environment:
gdb -v
GNU gdb 6.8
Copyright (C) 2008 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "i486-slackware-linux"...
gfortran -v
Using built-in specs.
Target i686-pc-linux-gno
Configures with: ./configure --prefix=/usr
Thread model: posix
gcc version 4.4.1 (GCC)
gcc -v
Using built-in specs.
Target i686-pc-linux-gno
Configures with: ./configure --prefix=/usr
Thread model: posix
gcc version 4.4.1 (GCC)
The following is the output from the sample program and gdb when the program
receives signal 10. The signal is sent to the running program with the "kill -
10 pid" command.
ZZZZZzzzzzzz 16727
ZZZZZzzzzzzz 16727
ZZZZZzzzzzzz 16727
ZZZZZzzzzzzz 16727
ZZZZZzzzzzzz 16727
ZZZZZzzzzzzz 16727
ZZZZZzzzzzzz 16727
ZZZZZzzzzzzz 16727
GNU gdb 6.8
Copyright (C) 2008 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "i486-slackware-linux"...
./sample.exe: No such file or directory.
Attaching to process 16727
Reading symbols from /home/kronmill/RTRECOVERY/SIMPLE/sample...done.
Reading symbols from /usr/local/lib/libgfortran.so.3...done.
Loaded symbols for /usr/local/lib/libgfortran.so.3
Reading symbols from /lib/libm.so.6...done.
Loaded symbols for /lib/libm.so.6
Reading symbols from /lib/libc.so.6...done.
Loaded symbols for /lib/libc.so.6
Reading symbols from /lib/libpthread.so.0...done.
[Thread debugging using libthread_db enabled]
[New Thread 0xb7c436c0 (LWP 16727)]
Loaded symbols for /lib/libpthread.so.0
Reading symbols from /usr/local/lib/libgcc_s.so.1...done.
Loaded symbols for /usr/local/lib/libgcc_s.so.1
Reading symbols from /lib/ld-linux.so.2...done.
Loaded symbols for /lib/ld-linux.so.2
0xb7d19d6e in __waitpid_nocancel () from /lib/libc.so.6
#0 0xb7d19d6e in __waitpid_nocancel () from /lib/libc.so.6
#1 0xb7cb42db in do_system () from /lib/libc.so.6
#2 0x08048891 in handler (
stack.c:295: internal-error: print_frame_args: Assertion `nsym != NULL' failed.
A problem internal to GDB has been detected,
further debugging may prove unreliable.
Quit this debugging session? (y or n) [answered Y; input not from terminal]
stack.c:295: internal-error: print_frame_args: Assertion `nsym != NULL' failed.
A problem internal to GDB has been detected,
further debugging may prove unreliable.
Create a core file of GDB? (y or n) [answered Y; input not from terminal]
ZZZZZzzzzzzz 16727
ZZZZZzzzzzzz 16727
ZZZZZzzzzzzz 16727
ZZZZZzzzzzzz 16727
ZZZZZzzzzzzz 16727
----------------------------------------------
The source files follow:
C
C Sample.f
C
program sample
implicit none
integer ipid
external handler
call signal(10,handler) !Which signal to catch
10 ipid = getpid()
print *,"ZZZZZzzzzzzz ",ipid
call sleep(1)
go to 10
end
----------------------------------------------
//
// handler.c
//
#include <stdio.h>
void handler (int daSignal)
{
char s[100]=" ";
sprintf(s,"gdb ./sample.exe -x commands.gdb %d", getpid());
system(s);
}
And now the Makefile
CC = gcc
FC = gfortran
LD = gfortran
INCLUDES = -I.
CFLAGS = -g -O2 $(INCLUDES)
#
# gdb error using the -g option in FFLAGS
#
FFLAGS = -fno-underscoring -g
#
# gdb works when not using the -g option in FFLAGS
#
# BUT does not provide full trace information
#
#FFLAGS = -fno-underscoring
LDFLAGS = -g
LIBS = -L/usr/lib/nptl -lm -lc -lgfortran -lpthread
F_SOURCES = \
sample.f
C_SOURCES = \
handler.c
F_OBJECTS = $(F_SOURCES:.f=.o)
C_OBJECTS = $(C_SOURCES:.c=.o)
OBJECTS = $(F_OBJECTS) $(C_OBJECTS)
all: sample
sample: $(OBJECTS)
$(LD) $(LDFLAGS) -o $@ $(OBJECTS) $(LIBS)
.PHONY: clean
clean:
-rm -f *.o
-rm -f *.exe
-rm -f sample
--
Summary: Backtrace error with Fortran program using C Signal
Handler
Product: gdb
Version: 6.8
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: backtrace
AssignedTo: unassigned at sourceware dot org
ReportedBy: Kevin dot Kronmiller at eglin dot af dot mil
CC: gdb-prs at sourceware dot org
http://sourceware.org/bugzilla/show_bug.cgi?id=11666
------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.