public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug backtrace/11666] New: Backtrace error with Fortran program using C Signal Handler
@ 2010-06-04 13:22 Kevin dot Kronmiller at eglin dot af dot mil
  2010-06-10 13:41 ` [Bug backtrace/11666] " Kevin dot Kronmiller at eglin dot af dot mil
  0 siblings, 1 reply; 2+ messages in thread
From: Kevin dot Kronmiller at eglin dot af dot mil @ 2010-06-04 13:22 UTC (permalink / raw)
  To: gdb-prs

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 5706 bytes --]

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.


^ permalink raw reply	[flat|nested] 2+ messages in thread

* [Bug backtrace/11666] Backtrace error with Fortran program using C Signal Handler
  2010-06-04 13:22 [Bug backtrace/11666] New: Backtrace error with Fortran program using C Signal Handler Kevin dot Kronmiller at eglin dot af dot mil
@ 2010-06-10 13:41 ` Kevin dot Kronmiller at eglin dot af dot mil
  0 siblings, 0 replies; 2+ messages in thread
From: Kevin dot Kronmiller at eglin dot af dot mil @ 2010-06-10 13:41 UTC (permalink / raw)
  To: gdb-prs


------- Additional Comments From Kevin dot Kronmiller at eglin dot af dot mil  2010-06-10 13:41 -------
Here is the output of the same program built on a fro system with gdb 7.1 and 
gcc4.4.4.

 ZZZZZzzzzzzz           3557
 ZZZZZzzzzzzz           3557
 ZZZZZzzzzzzz           3557
 ZZZZZzzzzzzz           3557
 ZZZZZzzzzzzz           3557
 ZZZZZzzzzzzz           3557
 ZZZZZzzzzzzz           3557
 ZZZZZzzzzzzz           3557
 ZZZZZzzzzzzz           3557
GNU gdb (GDB) 7.1
Copyright (C) 2010 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".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>...
./sample.exe: No such file or directory.
Attaching to process 3557
Reading symbols from /home/kronmill/RTRECOVERY/SIMPLE/sample...done.
Reading symbols from /usr/lib/libgfortran.so.3...(no debugging symbols 
found)...done.
Loaded symbols for /usr/lib/libgfortran.so.3
Reading symbols from /lib/libm.so.6...(no debugging symbols found)...done.
Loaded symbols for /lib/libm.so.6
Reading symbols from /lib/libc.so.6...(no debugging symbols found)...done.
Loaded symbols for /lib/libc.so.6
Reading symbols from /lib/libpthread.so.0...(no debugging symbols 
found)...done.
[Thread debugging using libthread_db enabled]
Loaded symbols for /lib/libpthread.so.0
Reading symbols from /usr/lib/libgcc_s.so.1...(no debugging symbols 
found)...done.
Loaded symbols for /usr/lib/libgcc_s.so.1
Reading symbols from /lib/ld-linux.so.2...(no debugging symbols found)...done.
Loaded symbols for /lib/ld-linux.so.2
0xb76486ce in __waitpid_nocancel () from /lib/libc.so.6
#0  0xb76486ce in __waitpid_nocancel () from /lib/libc.so.6
#1  0xb75e3363 in do_system () from /lib/libc.so.6
#2  0x08048857 in handler (
stack.c:289: 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:289: 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           3557
 ZZZZZzzzzzzz           3557
 ZZZZZzzzzzzz           3557
 ZZZZZzzzzzzz           3557
 ZZZZZzzzzzzz           3557
 ZZZZZzzzzzzz           3557
 ZZZZZzzzzzzz           3557
 ZZZZZzzzzzzz           3557
 ZZZZZzzzzzzz           3557
 ZZZZZzzzzzzz           3557
 ZZZZZzzzzzzz           3557
 ZZZZZzzzzzzz           3557
 ZZZZZzzzzzzz           3557
 ZZZZZzzzzzzz           3557



-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
            Version|6.8                         |7.1


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.


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2010-06-10 13:41 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-06-04 13:22 [Bug backtrace/11666] New: Backtrace error with Fortran program using C Signal Handler Kevin dot Kronmiller at eglin dot af dot mil
2010-06-10 13:41 ` [Bug backtrace/11666] " Kevin dot Kronmiller at eglin dot af dot mil

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).