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]

Re: backtrace/1505: [regression] gdb prints a bad backtrace for a thread


The following reply was made to PR backtrace/1505; it has been noted by GNATS.

From: mec.gnu@mindspring.com (Michael Elizabeth Chastain)
To: kettenis@chello.nl
Cc: gdb-gnats@sources.redhat.com
Subject: Re: backtrace/1505: [regression] gdb prints a bad backtrace for a thread
Date: Sun, 11 Jan 2004 17:31:33 -0500 (EST)

 First, just for information, are the shared library versions
 on my system (i686-pc-linux-gnu red hat 8.0).
 
   [mec.gnu@berman tmp]$ ldd pthreads
 	  libpthread.so.0 => /lib/i686/libpthread.so.0 (0x4001e000)
 	  libm.so.6 => /lib/i686/libm.so.6 (0x4004f000)
 	  libc.so.6 => /lib/i686/libc.so.6 (0x42000000)
 	  /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x40000000)
 
   [mec.gnu@berman tmp]$ ls -l /lib/i686/libpthread.so.0
   /lib/i686/libm.so.6 /lib/i686/libc.so.6 /lib/ld-linux.so.2 lrwxrwxrwx    1 root     root           14 Jan 29  2003
   /lib/i686/libc.so.6 -> libc-2.2.93.so lrwxrwxrwx    1 root     root           14 Jan 29  2003
   /lib/i686/libm.so.6 -> libm-2.2.93.so lrwxrwxrwx    1 root     root           18 Jan 29  2003
   /lib/i686/libpthread.so.0 -> libpthread-0.10.so lrwxrwxrwx    1 root     root           12 Jan 29  2003
   /lib/ld-linux.so.2 -> ld-2.2.93.so
 
 And here is a backtrace with 'info frame' and the register values
 in each frame and a memory dump of the stack.
 
   Script started on Sun Jan 11 17:21:24 2004
 
   [mec.gnu@berman tmp]$ /berman/fsf/_today_/berman/install/target/native/gdb/HEAD/bin/REAL-gdb pthreads 
   GNU gdb 2004-01-09-cvs
   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 "i686-pc-linux-gnu"...Using host libthread_db library "/lib/libthread_db.so.1".
 
   (gdb) break common_routine
   Breakpoint 1 at 0x804859a: file /berman/fsf/_today_/source/gdb/HEAD/src/gdb/testsuite/gdb.threads/pthreads.c, line 53.
 
   (gdb) run
   Starting program: /berman/home/mec.gnu/tmp/pthreads 
   [Thread debugging using libthread_db enabled]
   [New Thread 8192 (LWP 7313)]
   [New Thread 16385 (LWP 7315)]
   [New Thread 8194 (LWP 7316)]
   [Switching to Thread 8194 (LWP 7316)]
 
   Breakpoint 1, common_routine (arg=1)
       at /berman/fsf/_today_/source/gdb/HEAD/src/gdb/testsuite/gdb.threads/pthreads.c:53
   53	  if (verbose) printf("common_routine (%d)\n", arg);
 
   (gdb) thread apply all backtrace
 
   Thread 3 (Thread 8194 (LWP 7316)):
   #0  common_routine (arg=1)
       at /berman/fsf/_today_/source/gdb/HEAD/src/gdb/testsuite/gdb.threads/pthreads.c:53
   #1  0x08048691 in thread1 (arg=0xfeedface)
       at /berman/fsf/_today_/source/gdb/HEAD/src/gdb/testsuite/gdb.threads/pthreads.c:82
   #2  0x40024941 in pthread_start_thread () from /lib/i686/libpthread.so.0
   #3  0x00000000 in ?? ()
   #4  0x40270cf8 in ?? ()
   #5  0x40026108 in __pthread_wait_for_restart_signal ()
      from /lib/i686/libpthread.so.0
   Cannot access memory at address 0xfeedfad2
 
   (gdb) thread 3
   [Switching to thread 3 (Thread 8194 (LWP 7316))]#0  common_routine (arg=1)
       at /berman/fsf/_today_/source/gdb/HEAD/src/gdb/testsuite/gdb.threads/pthreads.c:53
   53	  if (verbose) printf("common_routine (%d)\n", arg);
 
   (gdb) frame 0
   #0  common_routine (arg=1)
       at /berman/fsf/_today_/source/gdb/HEAD/src/gdb/testsuite/gdb.threads/pthreads.c:53
   53	  if (verbose) printf("common_routine (%d)\n", arg);
 
   (gdb) info frames
   Undefined info command: "frames".  Try "help info".
 
   (gdb) info frame
   Stack level 0, frame at 0x40270a7c:
    eip = 0x804859a in common_routine
       (/berman/fsf/_today_/source/gdb/HEAD/src/gdb/testsuite/gdb.threads/pthreads.c:53); saved eip 0x8048691
    called by frame at 0x40270a9c
    source language c.
    Arglist at 0x40270a74, args: arg=1
    Locals at 0x40270a74, Previous frame's sp is 0x40270a7c
    Saved registers:
     ebp at 0x40270a74, eip at 0x40270a78
 
   (gdb) print $eip
   $1 = (void *) 0x804859a
 
   (gdb) print $esp
   $2 = (void *) 0x40270a5c
 
   (gdb) print $ebp
   $3 = (void *) 0x40270a74
 
   (gdb) frame 1
   #1  0x08048691 in thread1 (arg=0xfeedface)
       at /berman/fsf/_today_/source/gdb/HEAD/src/gdb/testsuite/gdb.threads/pthreads.c:82
   82	      common_routine (1);
 
   (gdb) info frame
   Stack level 1, frame at 0x40270a9c:
    eip = 0x8048691 in thread1
       (/berman/fsf/_today_/source/gdb/HEAD/src/gdb/testsuite/gdb.threads/pthreads.c:82); saved eip 0x40024941
    called by frame at 0x40270aa4, caller of frame at 0x40270a7c
    source language c.
    Arglist at 0x40270a94, args: arg=0xfeedface
    Locals at 0x40270a94, Previous frame's sp is 0x40270a9c
    Saved registers:
     ebp at 0x40270a94, eip at 0x40270a98
 
   (gdb) print $eip
   $4 = (void *) 0x8048691
 
   (gdb) print $esp
   $5 = (void *) 0x40270a7c
 
   (gdb) print $ebp
   $6 = (void *) 0x40270a94
 
   (gdb) frame 2
   #2  0x40024941 in pthread_start_thread () from /lib/i686/libpthread.so.0
 
   (gdb) info frame
   Stack level 2, frame at 0x40270aa4:
    eip = 0x40024941 in pthread_start_thread; saved eip 0x0
    called by frame at 0x40270aa8, caller of frame at 0x40270a9c
    Arglist at 0x40270a9c, args: 
    Locals at 0x40270a9c, Previous frame's sp is 0x40270aa4
    Saved registers:
     ebp at 0x40270a9c, eip at 0x40270aa0
 
   (gdb) print $eip
   $7 = (void *) 0x40024941
 
   (gdb) print $esp
   $8 = (void *) 0x40270a9c
 
   (gdb) print $ebp
   $9 = (void *) 0x40270b94
 
   (gdb) frame 3
   #3  0x00000000 in ?? ()
 
   (gdb) info frame
   Stack level 3, frame at 0x40270aa8:
    eip = 0x0; saved eip 0x40270cf8
    called by frame at 0x40270aac, caller of frame at 0x40270aa4
    Arglist at 0x40270aa0, args: 
    Locals at 0x40270aa0, Previous frame's sp is 0x40270aa8
    Saved registers:
     ebp at 0x40270a9c, eip at 0x40270aa4
 
   (gdb) print $eip
   $10 = (void *) 0x0
 
   (gdb) print $esp
   $11 = (void *) 0x40270aa4
 
   (gdb) print $ebp
   $12 = (void *) 0xfeedface
 
   (gdb) frame 4
   #4  0x40270cf8 in ?? ()
 
   (gdb) info frame
   Stack level 4, frame at 0x40270aac:
    eip = 0x40270cf8; saved eip 0x40026108
    called by frame at 0xfeedfad6, caller of frame at 0x40270aa8
    Arglist at 0x40270aa4, args: 
    Locals at 0x40270aa4, Previous frame's sp is 0x40270aac
    Saved registers:
     ebp at 0x40270a9c, eip at 0x40270aa8
 
   (gdb) print $eip
   $13 = (void *) 0x40270cf8
 
   (gdb) print $esp
   $14 = (void *) 0x40270aa8
 
   (gdb) print $ebp
   $15 = (void *) 0xfeedface
 
   (gdb) frame 0
   #0  common_routine (arg=1)
       at /berman/fsf/_today_/source/gdb/HEAD/src/gdb/testsuite/gdb.threads/pthreads.c:53
   53	  if (verbose) printf("common_routine (%d)\n", arg);
 
   (gdb) print $esp
   $16 = (void *) 0x40270a5c
 
   (gdb) x/200w $esp
   0x40270a5c:	0x4001e000	0x4002dc64	0x000000fc	0x40020a00
   0x40270a6c:	0x42008318	0x4212a2d0	0x40270a94	0x08048691
   0x40270a7c:	0x00000001	0x42118dc0	0x42126a40	0x4002db44
   0x40270a8c:	0x00000001	0x00000001	0x40270b94	0x40024941
   0x40270a9c:	0xfeedface	0x00000000	0x40270cf8	0x40026108
   0x40270aac:	0x40270abc	0x00000020	0x40270abc	0x00000000
   0x40270abc:	0x00000002	0x40270be0	0x00000420	0x00000041
   0x40270acc:	0x00000002	0x40270be0	0x00000420	0x00000041
   0x40270adc:	0x00000000	0x00000000	0x00000000	0x00000000
   0x40270aec:	0x00000000	0x00000000	0x00000000	0x00000000
   0x40270afc:	0x00000000	0x00000000	0x00000000	0x00000000
   0x40270b0c:	0x00000000	0x00000000	0x00000000	0x00000000
   0x40270b1c:	0x00000000	0x00000000	0x00000000	0x00000000
   0x40270b2c:	0x00000000	0x00000000	0x00000000	0x00000000
   0x40270b3c:	0x00000000	0x00000000	0x400260b1	0x4002db44
   0x40270b4c:	0x4002de40	0x40270be0	0x40270b94	0x40027f48
   0x40270b5c:	0x40270be0	0x00000000	0x00000000	0x00000001
   0x40270b6c:	0x00000001	0x00000000	0x00000000	0x00000000
   0x40270b7c:	0x00000000	0x00000000	0x400247a5	0x4002db44
   0x40270b8c:	0x40270be0	0x40270be0	0x40270bd4	0x40024a45
   0x40270b9c:	0x40270be0	0x40270bbc	0x00000010	0x00000000
   0x40270bac:	0x00000002	0x40270be0	0x00000420	0x00000041
   0x40270bbc:	0x00000002	0x40270be0	0x00000420	0x00000041
   0x40270bcc:	0x40024990	0x40270be0	0x00000000	0x420da1ca
   0x40270bdc:	0x40270be0	0x40270be0	0x00000000	0x40270be0
   0x40270bec:	0x00000000	0x00000000	0x00000000	0x00000000
   0x40270bfc:	0x00000000	0x00000000	0x00000000	0x00000000
   0x40270c0c:	0x00000000	0x00000000	0x00000000	0x00000000
   0x40270c1c:	0x00000000	0x4002b080	0x4002b080	0x00000000
   0x40270c2c:	0x00000000	0x00002002	0x00001c94	0x00000000
   0x40270c3c:	0x4002de40	0x00000020	0x00000000	0x00000000
   0x40270c4c:	0x00000000	0x00000000	0x00000000	0x00000000
   0x40270c5c:	0x00000000	0x00000000	0x00000000	0x00000000
   0x40270c6c:	0x0804861b	0xfeedface	0x80000000	0x00000000
   0x40270c7c:	0x00000003	0x4004e548	0x00000000	0x00000001
   0x40270c8c:	0x00000000	0x40006d9f	0x400124b8	0x0000014f
   0x40270c9c:	0x40012be0	0x40006d9f	0x400124b8	0x00000005
   0x40270cac:	0x400126e0	0xbffff7d0	0x4000a01f	0x4001287c
   0x40270cbc:	0x4004e538	0x00000001	0x00000000	0xbffff7c0
   0x40270ccc:	0x40028427	0x4001e000	0x4002dd00	0x0000014f
   0x40270cdc:	0x400205e8	0x00000000	0x08049b94	0x00000005
   0x40270cec:	0x08048277	0x4001f67c	0x00000000	0x00000000
   0x40270cfc:	0x00000000	0x00000000	0x00000000	0x00000000
   0x40270d0c:	0x00000000	0x00000000	0x00000000	0x00000000
   0x40270d1c:	0x00000000	0x00000000	0x00000000	0x00000000
   0x40270d2c:	0x00000000	0x00000000	0x00000000	0x00000000
   0x40270d3c:	0x00000000	0x00000000	0x00000000	0x00000000
   0x40270d4c:	0x00000000	0x00000000	0x00000000	0x00000000
   0x40270d5c:	0x00000000	0x00000000	0x00000000	0x00000000
   0x40270d6c:	0x00000000	0x00000000	0x00000000	0x00000000
   (gdb) quit
   The program is running.  Exit anyway? (y or n) y
 
   [mec.gnu@berman tmp]$ exit
   exit
 
   Script done on Sun Jan 11 17:24:00 2004


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