Package: pstack
Version: 1.2-1
Severity: normal

On Tue, Mar 07, 2006 at 11:32:51AM +0000, Baruch Even wrote:
> Justin Pryzby wrote:
> > BTW, does pstack still work correctly?
> 
> When I needed it (rarely) it worked fine.
> 
> > $ pstack 8987
> > 
> > 8987: gaim -d
> > (No symbols found)
> > 0xb77b5d16: ???? (8341a08, 8, 63, 8341a08, 8, 15530) + 40
> > 0xb786ddbc: ???? (8146a48, 1, 81f8a00, 0, bf9b8d88, 8146a48) + 10
> > 0xb786e2c7: ???? (82991e8, 82991e8, 1, 1, 0, 82991e8) + 30
> > 0xb7cc1231: ???? (829ab50, 0, 80f95e0, 80fdabb, 810eab4, 0) + 2170
> > 0x080fa017: ???? (2, bf9baf94, bf9bafa0, 1, b7821ff4, 0) + 30
> > 0xb7703ed0: ???? (80f95f0, 2, bf9baf94, 80fb870, 80fb8e0, b7fb25d0) + 
> > 40645077
> > 
> > But gdb shows useful function names:
> > #0  0xb77b5d16 in poll () from /lib/tls/libc.so.6
> > #1  0xb786ddbc in g_main_context_check () from /usr/lib/libglib-2.0.so.0
> > #2  0xb786e2c7 in g_main_loop_run () from /usr/lib/libglib-2.0.so.0
> > #3  0xb7cc1231 in gtk_main () from /usr/lib/libgtk-x11-2.0.so.0
> > #4  0x080fa017 in main (argc=2, argv=0xbf9baf94) at main.c:961
> > 
> > I'd love to be able to not load gdb every time I need a bt, but right
> > now this isn't useful..  It says that it needs unstripped binaries;
> > why? 
> 
> It's actually strange to me that gdb gives symbols without them present
> in the files? Or maybe it knows to go to debug libraries to get the data?
Oops, gaim was a bad example; I had installed the debugging libraries
just that night :)

But still, it doesn't work forme.  I don't know about ELF internals,
but GDB and catchsegv can both give a stacktrace even when compiling
without -g, and even when the source file is unavailable.

Yet pstack doesn't even DWIW when I compile with -g, and gives a bogus
error about opening the object file (why does it want the object
file!?  This happens even if the .o is available (make sleep.o && make
sleep).

$ cat sleep.c
#include <unistd.h>

int main()
{
        sleep(999);
        return 0;
}

$ make CFLAGS='-W -Wall -g' sleep
cc -W -Wall -g    sleep.c   -o sleep

$ ./sleep &
[1] 19029

$ pstack 19029

19029: ./sleep
'': opening object file: No such file or directory
Could not open object file.

It tries this:
open("", O_RDONLY)                      = -1 ENOENT (No such file or directory)

which is apparently the result of reading the /proc/$pid/exe file and
then ptrace peeking at the processes address space.

I consider this a bug .. I'm very interested in figuring it out
though.  So I'm finally sending this off instead of letting it bitrot
and clutter my mailbox; I hope to look at it sometime soon..

Justin


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to