I attached to my multithread application with gdb and after that type cont to continue execution.
- Is there any way to stop execution at any time on
contgdb state and check what every thread do? - How to check state of every thread and get execution line number of each? (commands)
Here’s what I do, (taken from here )
Create a little gdb script
stackdumper.gdbthat dumps the stack trace of all threads:Then repeatedly attach gdb and run the dumper:
where
./a.outis the binary you are interested and 123456 is the PID.Adjust the sleep to match your sampling needs.