Unix

NAVIGATION
CATEGORIES
REFERRENCE
LINKS
  • HPUX-DEVTOOLS: Debug multithreaded application

    6 answers - 625 bytes - related search similar search Add To My Delicious Add To My Stumble Upon Add To My Google Mark Add To My Facebook Add To My Digg Add To My Reddit

    Hi,
    I am debugging a big multithreaded application. My one of the threads while
    trying to send a signal to another thread gets the error value as ESRCH,
    which means that it could not find that thread id.
    From the stacks i could find that everytime it is the same thread id (as
    assigned internally by gdb).
    Is it possible to set some kind of breakpoint so that i can stop and check
    why my target thread died before sending the signal. Restating again i want
    to stop just before the first thread dies
    Is there any thread command for thisi am working on itanium 11.23.
    Thanks in advance
  • No.1 | | 1162 bytes | |

    You can set a breakpoint at pthread_exit() and trace all terminating
    threads. Gdb "thread" command will tell you the current thread id when
    the breakpoint is hit. Currently I don't think there is a way to set a
    breakpoint to detect termination of a particular thread.

    Dmitry.

    Manish Katiyar wrote:
    Hi,

    I am debugging a big multithreaded application. My one of the threads while
    trying to send a signal to another thread gets the error value as ESRCH,
    which means that it could not find that thread id.
    >>From the stacks i could find that everytime it is the same thread id (as

    assigned internally by gdb).
    Is it possible to set some kind of breakpoint so that i can stop and check
    why my target thread died before sending the signal. Restating again i want
    to stop just before the first thread dies

    Is there any thread command for thisi am working on itanium 11.23.

    Thanks in advance

    To leave this mailing list, send mail to majordomo (AT) cxx (DOT) cup.hp.com
    with the message UNSUBSCRIBE hpux-devtools
  • No.2 | | 2313 bytes | |

    >>You can set a breakpoint at pthread_exit()

    Would this work for a thread that does not explicitly call
    pthread_exit()?

    E.g. if a thread terminated it's start-routine by saying "return
    <someValue>", does pthread_exit() get implicitly called?

    I've seen thread-specific data used such that when a thread terminates,
    the user-specified destructor routine for the thread-specific data is
    called, which you could set a break-point on. This isn't an elegant
    solution - e.g. it requires source-code modification, but I thought I'd
    offer it as a suggestion. See pthread_key_create() &
    pthread_set_specific().

    JW

    Message
    From: owner-hpux-devtools (AT) cxx (DOT) cup.hp.com
    [mailto:owner-hpux-devtools (AT) cxx (DOT) cup.hp.com] Behalf Dmitry Mikulin
    Sent: 31 January 2007 20:54
    To: Manish Katiyar
    Cc: hpux-devtools (AT) cxx (DOT) cup.hp.com
    Subject: Re: HPUX-DEVTLS: Debug multithreaded application

    You can set a breakpoint at pthread_exit() and trace all terminating
    threads. Gdb "thread" command will tell you the current thread id when
    the breakpoint is hit. Currently I don't think there is a way to set a
    breakpoint to detect termination of a particular thread.

    Dmitry.

    Manish Katiyar wrote:
    Hi,

    I am debugging a big multithreaded application. My one of the threads
    while trying to send a signal to another thread gets the error value
    as ESRCH, which means that it could not find that thread id.
    >>From the stacks i could find that everytime it is the same thread id
    >>(as

    assigned internally by gdb).
    Is it possible to set some kind of breakpoint so that i can stop and
    check why my target thread died before sending the signal. Restating
    again i want to stop just before the first thread dies

    Is there any thread command for thisi am working on itanium
    11.23.

    Thanks in advance

    To leave this mailing list, send mail to majordomo (AT) cxx (DOT) cup.hp.com
    with the message UNSUBSCRIBE hpux-devtools

    To leave this mailing list, send mail to majordomo (AT) cxx (DOT) cup.hp.com
    with the message UNSUBSCRIBE hpux-devtools
  • No.3 | | 2788 bytes | |

    Wood, John (Partner Tech Svcs) wrote:
    You can set a breakpoint at pthread_exit()

    Would this work for a thread that does not explicitly call
    pthread_exit()?

    E.g. if a thread terminated it's start-routine by saying "return
    <someValue>", does pthread_exit() get implicitly called?

    According to the pthread_exit man page, it should work:

    An implicit call to pthread_exit() is made when a thread returns from
    its start routine.

    I've seen thread-specific data used such that when a thread terminates,
    the user-specified destructor routine for the thread-specific data is
    called, which you could set a break-point on. This isn't an elegant
    solution - e.g. it requires source-code modification, but I thought I'd
    offer it as a suggestion. See pthread_key_create() &
    pthread_set_specific().

    JW

    Message
    From: owner-hpux-devtools (AT) cxx (DOT) cup.hp.com
    [mailto:owner-hpux-devtools (AT) cxx (DOT) cup.hp.com] Behalf Dmitry Mikulin
    Sent: 31 January 2007 20:54
    To: Manish Katiyar
    Cc: hpux-devtools (AT) cxx (DOT) cup.hp.com
    Subject: Re: HPUX-DEVTLS: Debug multithreaded application

    You can set a breakpoint at pthread_exit() and trace all terminating
    threads. Gdb "thread" command will tell you the current thread id when
    the breakpoint is hit. Currently I don't think there is a way to set a
    breakpoint to detect termination of a particular thread.

    Dmitry.

    Manish Katiyar wrote:

    >>Hi,
    >>
    >>I am debugging a big multithreaded application. My one of the threads
    >>while trying to send a signal to another thread gets the error value
    >>as ESRCH, which means that it could not find that thread id.

    From the stacks i could find that everytime it is the same thread id
    >>

    (as
    >>
    >>assigned internally by gdb).
    >>Is it possible to set some kind of breakpoint so that i can stop and
    >>check why my target thread died before sending the signal. Restating
    >>again i want to stop just before the first thread dies
    >>
    >>Is there any thread command for thisi am working on itanium


    11.23.

    >>Thanks in advance
    >>


    To leave this mailing list, send mail to majordomo (AT) cxx (DOT) cup.hp.com
    with the message UNSUBSCRIBE hpux-devtools

    To leave this mailing list, send mail to majordomo (AT) cxx (DOT) cup.hp.com
    with the message UNSUBSCRIBE hpux-devtools
  • No.4 | | 220 bytes | |

    >An implicit call to pthread_exit() is made when a thread returns from
    its start routine.
    Thanks Dimitry.
    How about if the thread is cancelled e.g. by another thread calling
    pthread_cancel() on it?
  • No.5 | | 397 bytes | |

    Wood, John (Partner Tech Svcs) wrote:
    An implicit call to pthread_exit() is made when a thread returns from

    its start routine.

    Thanks Dimitry.

    How about if the thread is cancelled e.g. by another thread calling
    pthread_cancel() on it?

    You may be out of luck in this case :) You can always set a breakpoint
    in pthread_cancel() and monitor cancellation requests.
  • No.6 | | 3513 bytes | |

    Hi Manish,

    Does the problem you see, happen under load conditions, i.e. whatever
    you application is doing, I assume it to be some kind of a
    event-driven-system. So the condition under which you see the problem,
    does it happen under multiple events occuring in a short span of time ?

    If not, then I'd suggest you go back to the age-old (most primitive)
    form of debugging, i.e. with traces / logs. If it is indeed occuring
    under load conditions, unfortunately, the volume of traces/logs might be
    overwhelming (not only to the person debugging, but also to the
    FileSystem :) ).

    My 2 cents,
    Banibrata

    Message
    From: owner-hpux-devtools (AT) cxx (DOT) cup.hp.com
    [mailto:owner-hpux-devtools (AT) cxx (DOT) cup.hp.com] Behalf Wood, John
    (Partner Tech Svcs)
    Sent: Thursday, February 01, 2007 3:34 AM
    To: Dmitry Mikulin; Manish Katiyar
    Cc: hpux-devtools (AT) cxx (DOT) cup.hp.com
    Subject: RE: HPUX-DEVTLS: Debug multithreaded application

    >>You can set a breakpoint at pthread_exit()


    Would this work for a thread that does not explicitly call
    pthread_exit()?

    E.g. if a thread terminated it's start-routine by saying "return
    <someValue>", does pthread_exit() get implicitly called?

    I've seen thread-specific data used such that when a thread terminates,
    the user-specified destructor routine for the thread-specific data is
    called, which you could set a break-point on. This isn't an elegant
    solution - e.g. it requires source-code modification, but I thought I'd
    offer it as a suggestion. See pthread_key_create() &
    pthread_set_specific().

    JW

    Message
    From: owner-hpux-devtools (AT) cxx (DOT) cup.hp.com
    [mailto:owner-hpux-devtools (AT) cxx (DOT) cup.hp.com] Behalf Dmitry Mikulin
    Sent: 31 January 2007 20:54
    To: Manish Katiyar
    Cc: hpux-devtools (AT) cxx (DOT) cup.hp.com
    Subject: Re: HPUX-DEVTLS: Debug multithreaded application

    You can set a breakpoint at pthread_exit() and trace all terminating
    threads. Gdb "thread" command will tell you the current thread id when
    the breakpoint is hit. Currently I don't think there is a way to set a
    breakpoint to detect termination of a particular thread.

    Dmitry.

    Manish Katiyar wrote:
    Hi,

    I am debugging a big multithreaded application. My one of the threads
    while trying to send a signal to another thread gets the error value
    as ESRCH, which means that it could not find that thread id.
    >>From the stacks i could find that everytime it is the same thread id
    >>(as

    assigned internally by gdb).
    Is it possible to set some kind of breakpoint so that i can stop and
    check why my target thread died before sending the signal. Restating
    again i want to stop just before the first thread dies

    Is there any thread command for thisi am working on itanium
    11.23.

    Thanks in advance

    To leave this mailing list, send mail to majordomo (AT) cxx (DOT) cup.hp.com
    with the message UNSUBSCRIBE hpux-devtools

    To leave this mailing list, send mail to majordomo (AT) cxx (DOT) cup.hp.com
    with the message UNSUBSCRIBE hpux-devtools

    To leave this mailing list, send mail to majordomo (AT) cxx (DOT) cup.hp.com
    with the message UNSUBSCRIBE hpux-devtools

Re: HPUX-DEVTOOLS: Debug multithreaded application


max 4000 letters.
Your nickname that display:
In order to stop the spam: 2 + 2 =
QUESTION ON "Unix"

EMSDN.COM