问题描述
我正在为应用程序编写插件,有时会抛出SIGSEGV.但是,该应用程序捕获到信号SIGSEGV.换句话说,该插件是一个动态库.该错误发生在我的插件和动态库中.但是应用程序处理了sSIGSEGV并正常退出.因此,对我来说调试和获取所有堆栈帧的回溯是非常困难的.任何的想法?
I am writing a plugin for a application, occasionally a SIGSEGV would be throw out. However, the application catches the signal SIGSEGV. In other word, The plugin is a dynamical library. The error occurs in my plugin and dynamical library. But the applcation handle the sSIGSEGV and exit normally. So, it is quite difficult for me to debug and get the backtrace of all stack frames. Any idea?
当前,我正在使用gdb作为调试工具.
Currently I am using gdb as debug tool.
推荐答案
GDB 将在应用程序执行之前捕获SIGSEGV
.
GDB will catch SIGSEGV
before the application does.
您在评论洛根答案时所描述的内容没有任何意义.
What you described in comment to Logan's answer makes no sense.
我怀疑真正发生的事情是该应用程序创建了一个新进程,并且仅在另一个进程中获得了SIGSEGV
,而不是您将GDB附加到的那个进程.
I suspect what's really happening is that the application creates a new process, and only gets SIGSEGV
in that other process, not the one you attached GDB to.
如果我的猜测正确,以下命令可能会有用:
The following commands may be useful if my guess is correct:
(gdb) catch fork
(gdb) catch vfork
(gdb) set follow-fork-mode child
您可能还想编辑和扩展您的问题:
You might also want to edit and expand your question:
- 您怎么知道 首先是
SIGSEGV
? - 发布与
GDB
的交互日志也可能很有用.
- how do you know there is a
SIGSEGV
to begin with? - Posting a log of your interaction with
GDB
may also prove useful.
这篇关于如何使用SIGSEGV的信号处理程序调试程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!