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
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?)
Still around in: gcc-3.4.1-10.ppc binutils-2.15.91.0.2-8.ppc gdb-6.1post-1.20040607.28.ppc
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)
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.
Added dependency on PPC CFI.
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
-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)
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...
Created attachment 106461 [details] Output from FC2 gdb
Created attachment 106462 [details] Output from current gdb
What's the status? I am putting back into assigned state, since it doesn't seem to be fully fixed.
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?)
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.
Ping? any updates here?
Created bugs #140532 and #140534.
I hope this issues got resolved for PPC RawHide by Bug 140532.