[Asterisk-Dev] How can I see what a thread is doing?

Derrick D. Daugherty derrick+asterisk at blinky-lights.org
Mon Jun 27 14:33:26 MST 2005

Cracks in my tinfoil beanie around Mon, Jun 27, 2005 at 03:34:52PM -0500
allowed Matthew Boehm <mboehm at cytelcom.com> to seep these bits into my brain:
> Brian West wrote:
> >attach to it with gdb and do "thread apply all bt"
> That's destructive though isn't it? Will it kill calls? Halt the server? 
> Do I attach to the main thread or the thread in question?

get it's pid(top, logs, ps etc) and use strace/truss/whatever your OS
has to see what that process is doing.  gdb will stop the process when
you attach to it, strace/truss/etc will not.  use -f to follow it's
chidlren.  you can use ast_grab_core in contrib/ to quickly attach gdb
and get the thread info.  it will most likely cause an audible hiccup on
that older box though, but it is relatively harmless for a system in
working condition.


More information about the asterisk-dev mailing list