Bug 129331 - backtrace corrupted
Summary: backtrace corrupted
Status: CLOSED RAWHIDE
Alias: None
Product: Fedora
Classification: Fedora
Component: gdb
Version: rawhide
Hardware: powerpc
OS: Linux
medium
medium
Target Milestone: ---
Assignee: Andrew Cagney
QA Contact:
URL:
Whiteboard:
Keywords:
Depends On: 108886
Blocks: fedora-ppc 140532 140534 169570
TreeView+ depends on / blocked
 
Reported: 2004-08-06 15:38 UTC by David Woodhouse
Modified: 2007-11-30 22:10 UTC (History)
5 users (show)

(edit)
Clone Of:
(edit)
Last Closed: 2007-01-13 09:40:58 UTC


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

Description David Woodhouse 2004-08-06 15:38:17 UTC
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 20:07:29 UTC
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 08:55:12 UTC
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 12:46:25 UTC
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 15:16:35 UTC
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 15:21:47 UTC
Added dependency on PPC CFI.

Comment 7 Andrew Cagney 2004-11-04 23:44:10 UTC
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 23:10:37 UTC
-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-11 00:59:57 UTC
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-11 01:00:39 UTC
Created attachment 106461 [details]
Output from FC2 gdb

Comment 11 David Woodhouse 2004-11-11 01:01:26 UTC
Created attachment 106462 [details]
Output from current gdb

Comment 13 Elena Zannoni 2004-11-12 14:17:37 UTC
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-13 00:09:40 UTC
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 14:47:45 UTC
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 14:22:10 UTC
Ping? any updates here?

Comment 18 Andrew Cagney 2004-11-23 15:03:05 UTC
Created bugs #140532 and #140534.

Comment 19 Jan Kratochvil 2007-01-13 09:40:58 UTC
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.