Reputation: 2500
I attached to my multithread application with gdb and after that type cont
to continue execution.
cont
gdb state and check what every thread do?Upvotes: 2
Views: 1043
Reputation: 55
Is it "pstack" because i don't think "pstask" is any command in linux, If it is please provide some more info
Upvotes: 0
Reputation: 3307
thread apply all bt
Or
info threads
t <threadid from above trace >
Followed by
where
or bt
Upvotes: 2
Reputation: 14467
To get the backtrace for all of the stopped threads type the
thread apply all bt
command (the output is exactly the same that one might see in the MacOSX crash report box).
Usually the threads are stopped simultaneously in gdb.
Reference: http://www.delorie.com/gnu/docs/gdb/gdb_40.html
And here's about "all-stop" mode, which is default: http://sourceware.org/gdb/onlinedocs/gdb/All_002dStop-Mode.html
Upvotes: 1
Reputation: 73440
Here's what I do, (taken from here )
Create a little gdb script stackdumper.gdb
that dumps the stack trace of all threads:
thread apply all backtrace
Then repeatedly attach gdb and run the dumper:
for i in $(seq 1 10) ; do
gdb -batch -x stackdumper.gdb ./a.out 123456 > stack.$i
sleep 10
done
where ./a.out
is the binary you are interested and 123456 is the PID.
Adjust the sleep to match your sampling needs.
Upvotes: 2
Reputation:
Is this any way to stop execution at any time on cont gdb state and check what every thread do
If you ask about ways to check what threads do without gdb
the you can just run
pstask <pid-of-your application>
Upvotes: 0