gpt4 book ai didi

c++ - 打印所有线程的堆栈跟踪而不附加 GDB

转载 作者:行者123 更新时间:2023-12-02 00:39:21 32 4
gpt4 key购买 nike

是否可以在不附加 GDB 的情况下以编程方式打印出所有正在运行的线程的堆栈跟踪?该应用程序在 Linux 嵌入式系统上运行。

我找到了 very similar thread但该解决方案使用了特殊的 GDB 命令。

最佳答案

这个问题已在 this thread 的帮助下解决了和 this thread

引用:

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.

关于c++ - 打印所有线程的堆栈跟踪而不附加 GDB,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23473717/

32 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com