Bug 129331 - backtrace corrupted
backtrace corrupted
Status: CLOSED RAWHIDE
Product: Fedora
Classification: Fedora
Component: gdb (Show other bugs)
rawhide
powerpc Linux
medium Severity medium
: ---
: ---
Assigned To: Andrew Cagney
:
Depends On: 108886
Blocks: fedora-ppc 140532 140534 169570
  Show dependency treegraph
 
Reported: 2004-08-06 11:38 EDT by David Woodhouse
Modified: 2007-11-30 17:10 EST (History)
5 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2007-01-13 04:40:58 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)
Output from FC2 gdb (20.45 KB, text/plain)
2004-11-10 20:00 EST, David Woodhouse
no flags Details
Output from current gdb (21.32 KB, text/plain)
2004-11-10 20:01 EST, David Woodhouse
no flags Details

  None (edit)
Description David Woodhouse 2004-08-06 11:38:17 EDT
See backtrace in bug #129329. Trivial test case:

shinybook /home/dwmw2 $ cat helloworld.c
int main(void)
{
        printf("hello\n");
        return 0;
}
shinybook /home/dwmw2 $ gcc -o helloworld helloworld.c
shinybook /home/dwmw2 $ gdb helloworld
GNU gdb Red Hat Linux (6.1post-1.20040607.19rh)
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 "ppc-redhat-linux-gnu"...(no debugging
symbols found)...Using host libthread_db library
"/lib/tls/libthread_db.so.1".
 
(gdb) break printf
Breakpoint 1 at 0x10010954
(gdb) run
Starting program: /home/dwmw2/helloworld
(no debugging symbols found)...Breakpoint 1 at 0xfe5aabc
(no debugging symbols found)...
Breakpoint 1, 0x0fe5aabc in printf () from /lib/tls/libc.so.6
(gdb) bt
#0  0x0fe5aabc in printf () from /lib/tls/libc.so.6
#1  0x10000438 in main ()
(gdb) quit
The program is running.  Exit anyway? (y or n) y
shinybook /home/dwmw2 $ strip helloworld
shinybook /home/dwmw2 $ gdb helloworld
GNU gdb Red Hat Linux (6.1post-1.20040607.19rh)
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 "ppc-redhat-linux-gnu"...(no debugging
symbols found)...Using host libthread_db library
"/lib/tls/libthread_db.so.1".
 
(gdb) break printf
Breakpoint 1 at 0x10010954
(gdb) run
Starting program: /home/dwmw2/helloworld
(no debugging symbols found)...Breakpoint 1 at 0xfe5aabc
(no debugging symbols found)...
Breakpoint 1, 0x0fe5aabc in printf () from /lib/tls/libc.so.6
(gdb) bt
#0  0x0fe5aabc in printf () from /lib/tls/libc.so.6
#1  0x10000438 in ?? ()
#2  0x10000438 in ?? ()
Previous frame identical to this frame (corrupt stack?)
(gdb) quit
The program is running.  Exit anyway? (y or n) y
shinybook /home/dwmw2 $ rpm -q gcc binutils gdb
gcc-3.4.1-7
binutils-2.15.91.0.2-1
gdb-6.1post-1.20040607.19
Comment 1 David Woodhouse 2004-09-01 16:07:29 EDT
Still broken in 6.1post-1.20040607.28rh:

Starting program: /usr/bin/telnet irc.ipv6.freenode.net

Program received signal SIGSEGV, Segmentation fault.
0x07edf438 in gaih_inet () from /lib/tls/libc.so.6
(gdb) bt
#0  0x07edf438 in gaih_inet () from /lib/tls/libc.so.6
#1  0x07edfe80 in getaddrinfo () from /lib/tls/libc.so.6
#2  0x07edfe80 in getaddrinfo () from /lib/tls/libc.so.6
#3  0x07edfe80 in getaddrinfo () from /lib/tls/libc.so.6
#4  0x07edfe80 in getaddrinfo () from /lib/tls/libc.so.6
#5  0x07edfe80 in getaddrinfo () from /lib/tls/libc.so.6
#6  0x07edfe80 in getaddrinfo () from /lib/tls/libc.so.6
Previous frame inner to this frame (corrupt stack?)
Comment 2 Colin Charles 2004-09-16 04:55:12 EDT
Still around in:
gcc-3.4.1-10.ppc
binutils-2.15.91.0.2-8.ppc
gdb-6.1post-1.20040607.28.ppc
Comment 3 David Woodhouse 2004-10-27 08:46:25 EDT
It isn't just stripped binaries -- it happens when I have debuginfo
installed too. Here's one from evolution with the current (-43) gdb:


$ gdb evolution
GNU gdb Red Hat Linux (6.1post-1.20040607.43rh)
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 "ppc-redhat-linux-gnu"...Using host
libthread_db library "/lib/tls/libthread_db.so.1".
 
(gdb) run
Starting program: /usr/bin/evolution
[Thread debugging using libthread_db enabled]
[New Thread 805512576 (LWP 17468)]
Detaching after fork from child process 17471.
[New Thread 823280864 (LWP 17472)]
Detaching after fork from child process 17473.
[New Thread 833766624 (LWP 17474)]
[New Thread 844252384 (LWP 17475)]
Detaching after fork from child process 17476.
 
Program received signal SIGINT, Interrupt.
[Switching to Thread 805512576 (LWP 17468)]
0x0ff456e0 in poll () from /lib/tls/libc.so.6
(gdb) thread apply all bt
 
Thread 4 (Thread 844252384 (LWP 17475)):
#0  0x0fc4901c in pthread_cond_wait@@GLIBC_2.3.2 ()
   from /lib/tls/libpthread.so.0
#1  0x0f95d510 in e_msgport_wait (mp=0x101ceba0) at e-msgport.c:511
#2  0x0f95d510 in e_msgport_wait (mp=0x101ceba0) at e-msgport.c:511
#3  0x0f95d510 in e_msgport_wait (mp=0x101ceba0) at e-msgport.c:511
#4  0x0f95d510 in e_msgport_wait (mp=0x101ceba0) at e-msgport.c:511
Previous frame inner to this frame (corrupt stack?)
#0  0x0ff456e0 in poll () from /lib/tls/libc.so.6
(gdb) 
Comment 4 Andrew Cagney 2004-10-27 11:16:35 EDT
Two problems:
- GDB can't use CFI (the stuff out of GCC is corrupt - I enabled it
and the results were worse :-().
- GDB's prologue analyser probably needs an upgrade.
Comment 5 Andrew Cagney 2004-10-27 11:21:47 EDT
Added dependency on PPC CFI.
Comment 7 Andrew Cagney 2004-11-04 18:44:10 EST
david,
Please try fish:64/gdb/gdb.

Bugs:

- DW_CFI_offset_extended_sf being decoded incorrectly (fix backported).

- return-address column (65) needs to refer to _this_ LR and not
_next_ LR.  Added REG_INDIRECT.

- "pc" needs to refer to return-address column
Added hack.  Proper fix involves adding a per-frame frame_pc_unwind
and have that return return-address directly.
-> need to submit

- PPC wasn't initializing dwarf2 cfi state
-> need to submit

- dwarf2-frame always reported an uninitialized register (even when
the register was initialized by the PPC's initialize dwarf2 cfi state
function)
-> need to submit
Comment 8 Andrew Cagney 2004-11-10 18:10:37 EST
-bash-3.00$ cat > hello.c
int main(void)
{
        printf("hello\n");
        return 0;
}
-bash-3.00$ gcc -o helloworld helloworld.c
gcc: helloworld.c: No such file or directory
gcc: no input files
-bash-3.00$ gcc -o hello hello.c
-bash-3.00$ ~/64/gdb/gdb hello
GNU gdb Red Hat Linux (6.1post-1.20040607.50rh)
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 "powerpc64-unknown-linux-gnu"...(no
debugging symbols found)...Using host libthread_db library
"/lib64/tls/libthread_db.so.1".

(gdb) b printf
Breakpoint 1 at 0x10010954
(gdb) run
Starting program: /home/cagney/tmp/hello
(no debugging symbols found)...Breakpoint 1 at 0xfeaad8c
(no debugging symbols found)...
Breakpoint 1, 0x0feaad8c in printf () from /lib/tls/libc.so.6
(gdb) bt
#0  0x0feaad8c in printf () from /lib/tls/libc.so.6
#1  0x10000438 in main ()
(gdb)
Comment 9 David Woodhouse 2004-11-10 19:59:57 EST
Still doesn't look entirely sane. Test case -- attaching to Evolution
and running 'thread apply all bt'. See attached output from
gdb-6.1post-1.20040607.50 and from the FC2 version
gdb-6.0post-0.20040223.19...
Comment 10 David Woodhouse 2004-11-10 20:00:39 EST
Created attachment 106461 [details]
Output from FC2 gdb
Comment 11 David Woodhouse 2004-11-10 20:01:26 EST
Created attachment 106462 [details]
Output from current gdb
Comment 13 Elena Zannoni 2004-11-12 09:17:37 EST
What's the status? I am putting back into assigned state, since it
doesn't seem to be fully fixed.
Comment 14 Andrew Cagney 2004-11-12 19:09:40 EST
These are separate, more specific problems.  File new bug reports?

In the below, GDB could more robustly detect the bottom of a thread's
stack (by detecting that the CFI has terminated).

#4  0x0fe804d0 in clone () from /lib/tls/libc.so.6
#5  0x0fe804d0 in clone () from /lib/tls/libc.so.6
Previous frame identical to this frame (corrupt stack?)

In the below, GDB has been lead astray by poor libc debug info:

#0  0x0fe757c8 in poll () from /lib/tls/libc.so.6
#1  0x0f91f0f0 in g_main_context_acquire () from /usr/lib/libglib-2.0.so.0
#2  0x0fe757b0 in poll () from /lib/tls/libc.so.6
#3  0x1028bbe8 in ?? ()
#4  0x0fe757b0 in poll () from /lib/tls/libc.so.6
#5  0x1028bbe8 in ?? ()
#6  0x0fe757b0 in poll () from /lib/tls/libc.so.6
#7  0x0f93cd00 in g_static_private_free () from /usr/lib/libglib-2.0.so.0
Previous frame inner to this frame (corrupt stack?)
Comment 15 David Woodhouse 2004-11-19 09:47:45 EST
Do I really need to file separate bug reports? Can't this be a generic
'GDB is basically screwed' bug, and someone with some clue about GDB
can close it when GDB is close to actually being useful?

After all I'm not doing anything clever with gdb here -- I lack the
wit for that. All I'm trying to do is attach to a program and see a
backtrace.

If I was trying something cunning and it was failing, I'd agree that
it makes sense to open separate bugs.
Comment 16 Elena Zannoni 2004-11-23 09:22:10 EST
Ping? any updates here?
Comment 18 Andrew Cagney 2004-11-23 10:03:05 EST
Created bugs #140532 and #140534.
Comment 19 Jan Kratochvil 2007-01-13 04:40:58 EST
I hope this issues got resolved for PPC RawHide by Bug 140532.

Note You need to log in before you can comment on or make changes to this bug.