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/1437: gdb fails to print backtrace: Cannot access memory at address 0xbf800000 in Linux/gcc/C


>Number:         1437
>Category:       backtrace
>Synopsis:       gdb fails to print backtrace: Cannot access memory at address 0xbf800000 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 19:18:00 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:
Here is a program and shell output showing the gcc and gdb commands I
used in which gdb prints ?? in a backtrace.  Of course, this program
is so simple that you don't need a call stack to see what went wrong,
but I also get missing 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.

This bug happens when I have gdb read a core file.  But if I then ask
gdb to run the program again, then when it crashes, gdb shows the
backtrace.  It is strange that gdb can show the backtrace in one case
but not the other.  The output below demonstrates this.
>How-To-Repeat:
#include <stdlib.h>
#include <assert.h>

void f() {
  malloc(1);
  f();
}

int main() {
  f();
  return 0;
}

~ sumatra 46 jb % gcc t.c -g
~ sumatra 47 jb % a.out 
Segmentation fault (core dumped)
~ sumatra 48 jb % /disk/tmp/bjacob/gdb+dejagnu-20031028_install/bin/gdb a.out core.18725 
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 11, Segmentation fault.
Cannot access memory at address 0x400136c0
#0  0x4207a2f9 in ?? ()
(gdb) backtrace 9
#0  0x4207a2f9 in ?? ()
Cannot access memory at address 0xbf800000
(gdb) run
Starting program: /home/bjacob/a.out 

Program received signal SIGSEGV, Segmentation fault.
0x4207a2f9 in chunk_alloc () from /lib/i686/libc.so.6
(gdb) backtrace 9
#0  0x4207a2f9 in chunk_alloc () from /lib/i686/libc.so.6
#1  0x4207a148 in malloc () from /lib/i686/libc.so.6
#2  0x08048382 in f () at t.c:5
#3  0x08048387 in f () at t.c:6
#4  0x08048387 in f () at t.c:6
#5  0x08048387 in f () at t.c:6
#6  0x08048387 in f () at t.c:6
#7  0x08048387 in f () at t.c:6
#8  0x08048387 in f () at t.c:6
(More stack frames follow...)
(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]