This is the mail archive of the gdb-prs@sources.redhat.com mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

backtrace/1435: backtrace fails to mention main function in Linux/gcc/C


>Number:         1435
>Category:       backtrace
>Synopsis:       backtrace fails to mention main function in Linux/gcc/C
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Thu Oct 30 18:48:01 UTC 2003
>Closed-Date:
>Last-Modified:
>Originator:     Jacob Burckhardt
>Release:        20031028
>Organization:
>Environment:
This GDB was configured as "i686-pc-linux-gnu"...Using host libthread_db library "/lib/libthread_db.so.1".
gdb and the test program were both compiled with gcc 3.3.2 and Linux sumatra.ca.metsci.com 2.4.18-17.7.xsmp #1 SMP Tue Oct 8 12:37:04 EDT 2002 i686 unknown
>Description:
The following program cores and when gdb reads the core file it fails
to mention function main in the backtrace.  The main function calls
function f in two places, and I would like to know which of those two
calls was on the stack when the program cored.  Of course, it is easy
to deduce which call it was merely by reading the source code, but I
also get incomplete call stacks in my very large programs where it is
impossible to know which path the code went through.  Maybe fixing
this small test case will also help with my large programs.
>How-To-Repeat:
Below is
some shell output showing how I ran gcc and gdb and showing the
incomplete backtrace.

#include <assert.h>

void f() {
  assert(0);
}

int main() {
  int i = 0;
  if (i)
	f();
  else {
	++i;
	f();
  }
  return 0;
}

~ sumatra 514 jb % gcc -g t.c
~ sumatra 515 jb % a.out 
a.out: t.c:4: f: Assertion `0' failed.
Abort (core dumped)
~ sumatra 516 jb % /disk/tmp/bjacob/gdb+dejagnu-20031028_install/bin/gdb a.out core.9666 
GNU gdb 20031028
Copyright 2003 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-linux-gnu"...Using host libthread_db library "/lib/libthread_db.so.1".

Core was generated by `a.out'.
Program terminated with signal 6, Aborted.
Reading symbols from /lib/i686/libc.so.6...done.
Loaded symbols for /lib/i686/libc.so.6
Reading symbols from /lib/ld-linux.so.2...done.
Loaded symbols for /lib/ld-linux.so.2
#0  0x42029331 in kill () from /lib/i686/libc.so.6
(gdb) where
#0  0x42029331 in kill () from /lib/i686/libc.so.6
#1  0x4202911a in raise () from /lib/i686/libc.so.6
#2  0x4202a8c2 in abort () from /lib/i686/libc.so.6
#3  0x42022ecb in __assert_fail () from /lib/i686/libc.so.6
#4  0x0804839a in f () at t.c:4
(gdb) 
>Fix:

>Release-Note:
>Audit-Trail:
>Unformatted:


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]