Is it possible to programatically print out stack trace of all running threads without attaching GDB? The application is running on an embedded system with Linux.

I've found a very similar thread but the solution uses a special GDB command.

有帮助吗?

解决方案

This has been solved with the help of this thread and this thread.

Quoting:

Signal Handling with the help of backtrace can solve your purpose.

I mean if you have a PID of the Thread, you can raise a signal for that thread. and in the handler you can use the backtrace. since the handler would be executing in that partucular thread, the backtrace there would be the output what you are needed.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top