Stack Dump on NPTL - Linux

This is a discussion on Stack Dump on NPTL - Linux ; Hi, I am trying to get the stack trace for all the threads in a process with NPTL library. Using pstack does not help as it gives stack trace for main thread only. This seems to work fine when NPTL ...

+ Reply to Thread
Results 1 to 8 of 8

Thread: Stack Dump on NPTL

  1. Stack Dump on NPTL

    Hi,

    I am trying to get the stack trace for all the threads in a process
    with NPTL library. Using pstack does not help as it gives stack trace
    for main thread only. This seems to work fine when NPTL is not used.
    Does anyone know how to do this with NPTL?

    Thanks & regards,
    Chetan.

  2. Re: Stack Dump on NPTL

    On Apr 1, 6:19 am, Chetan wrote:

    > I am trying to get the stack trace for all the threads in a process
    > with NPTL library. Using pstack does not help as it gives stack trace
    > for main thread only. This seems to work fine when NPTL is not used.
    > Does anyone know how to do this with NPTL?


    You either have an old version of 'gdb' or an old version of 'pstack'.
    Attach 'gdb' to the running process and see if 'thread apply all bt'
    works. If so, 'pstack' is broken. If not, 'gdb' is. Upgrade the broken
    tool.

    DS


  3. Re: Stack Dump on NPTL

    On Apr 2, 9:01*am, David Schwartz wrote:
    > On Apr 1, 6:19 am, Chetan wrote:
    >
    > > I am trying to get the stack trace for all the threads in a process
    > > with NPTL library. Using pstack does not help as it gives stack trace
    > > for main thread only. This seems to work fine when NPTL is not used.
    > > Does anyone know how to do this with NPTL?

    >
    > You either have an old version of 'gdb' or an old version of 'pstack'.
    > Attach 'gdb' to the running process and see if 'thread apply all bt'
    > works. If so, 'pstack' is broken. If not, 'gdb' is. Upgrade the broken
    > tool.
    >
    > DS


    The 'pstack' doesnt seem to be broken. I tried it on different
    machines but it still gives stack for main thread only. On Solaris,
    however, it gives stack for all the threads. So wondering if NPTL
    causes this behavior change. Here is the man page for 'pstack'.

    NAME
    pstack - print a stack trace of a running process

    SYNOPSIS
    pstack pid

    DESCRIPTION
    pstack attaches to the active process named by the pid on the
    command line, and prints out an execution stack trace. If ELF sym-
    bols exist in the binary (usually the case unless you have run
    strip(1)), then symbolic addresses are printed as well.

    If the process is part of a thread group, then pstack will
    print out a stack trace for each of the threads in the group.

    SEE ALSO
    nm(1), ptrace(2), gdb(1)

  4. Re: Stack Dump on NPTL

    On Apr 1, 11:48 pm, Chetan wrote:

    > > You either have an old version of 'gdb' or an old version of 'pstack'.
    > > Attach 'gdb' to the running process and see if 'thread apply all bt'
    > > works. If so, 'pstack' is broken. If not, 'gdb' is. Upgrade the broken
    > > tool.


    > The 'pstack' doesnt seem to be broken. I tried it on different
    > machines but it still gives stack for main thread only.


    Umm, that is evidence that it *is* broken.

    > On Solaris,
    > however, it gives stack for all the threads. So wondering if NPTL
    > causes this behavior change. Here is the man page for 'pstack'.


    Why not try what I suggested, since it will actually solve your
    problem?

    DS

  5. Re: Stack Dump on NPTL

    On Apr 3, 1:02*am, David Schwartz wrote:
    > On Apr 1, 11:48 pm, Chetan wrote:
    >
    > > > You either have an old version of 'gdb' or an old version of 'pstack'.
    > > > Attach 'gdb' to the running process and see if 'thread apply all bt'
    > > > works. If so, 'pstack' is broken. If not, 'gdb' is. Upgrade the broken
    > > > tool.

    > > The 'pstack' doesnt seem to be broken. I tried it on different
    > > machines but it still gives stack for main thread only.

    >
    > Umm, that is evidence that it *is* broken.
    >
    > > On Solaris,
    > > however, it gives stack for all the threads. So wondering if NPTL
    > > causes this behavior change. Here is the man page for 'pstack'.

    >
    > Why not try what I suggested, since it will actually solve your
    > problem?
    >
    > DS


    Which versions of these ae recomended for NPTL?

    Thanks & regards,
    Chetan.

  6. Re: Stack Dump on NPTL

    On Apr 3, 1:14 am, Chetan wrote:

    > Which versions of these ae recomended for NPTL?


    Your 'gdb' should ideally be 6.3 or later. But your problem is
    probably 'pstack', which should be 1.2 or later and should know how to
    use gdb with 'thread apply'.

    You should test 'gdb' as I explained.

    DS

  7. Re: Stack Dump on NPTL

    On Apr 3, 1:37*pm, David Schwartz wrote:
    > On Apr 3, 1:14 am, Chetan wrote:
    >
    > > Which versions of these ae recomended for NPTL?

    >
    > Your 'gdb' should ideally be 6.3 or later. But your problem is
    > probably 'pstack', which should be 1.2 or later and should know how to
    > use gdb with 'thread apply'.
    >
    > You should test 'gdb' as I explained.
    >
    > DS


    Hi,

    I update both gdb and pstack to latest versions and it worked. Thanks
    alot for your inputs.

    Thanks & regards,
    Chetan.

  8. Re: Stack Dump on NPTL

    On Apr 3, 1:37*pm, David Schwartz wrote:
    > On Apr 3, 1:14 am, Chetan wrote:
    >
    > > Which versions of these ae recomended for NPTL?

    >
    > Your 'gdb' should ideally be 6.3 or later. But your problem is
    > probably 'pstack', which should be 1.2 or later and should know how to
    > use gdb with 'thread apply'.
    >
    > You should test 'gdb' as I explained.
    >
    > DS


    Hi,

    I updated both gdb and pstack to latest versions and it worked.
    Thanks
    alot for your inputs.


    Thanks & regards,
    Chetan.

+ Reply to Thread