Getting stacktrace of all threads without attaching GDB

后端 未结 6 852
甜味超标
甜味超标 2021-02-13 16:24

Is there a way to print stacktrace of all threads without attaching GDB?

Or is there a command which I can use as gdb batch mode to print stacktrace of all threads?

6条回答
  •  伪装坚强ぢ
    2021-02-13 16:43

    As in linux All threads are essentially Light weight processes , they get individual LWP PIDs. you can dump the status of these by using a ps or top based script or echoing the w in /proc/sysrq-trigger. This will give you the I/O state of the threads in the /var/log/messages.

    This won't give you the complete stack trace though . but its a good way to debug the thread states on periodical intervals.

    you can also explore whats current scheduler state by looking into /proc/sched_debug to see which tasks are getting scheduled and so on .

提交回复
热议问题