分享

gdb如何设置信号的处理

 jijo 2008-12-30

gdb如何设置信号的处理

2008-08-12 02:02:09

  gdb调试的程序所注册的信号处理函数似乎不起作用,因此需要在gdb中设置对信号的处理,使用handle命令。可以设置stop,print,pass三种状态。
(gdb) help handle
Specify how to handle a signal.
Args are signals and actions to apply to those signals.
Symbolic signals (e.g. SIGSEGV) are recommended but numeric signals
from 1-15 are allowed for compatibility with old versions of GDB.
Numeric ranges may be specified with the form LOW-HIGH (e.g. 1-5).
The special arg "all" is recognized to mean all signals except those
used by the debugger, typically SIGTRAP and SIGINT.
Recognized actions include "stop", "nostop", "print", "noprint",
"pass", "nopass", "ignore", or "noignore".
Stop means reenter debugger if this signal happens (implies print).
Print means print a message if this signal happens.
Pass means let program see this signal; otherwise program doesn't know.
Ignore is a synonym for nopass and noignore is a synonym for pass.
Pass and Stop may be combined.
(gdb) handle SIGPIPE
Signal        Stop	Print	Pass to program	Description
SIGPIPE       Yes	Yes	Yes		Broken pipe
(gdb) handle SIGPIPE nostop
Signal        Stop	Print	Pass to program	Description
SIGPIPE       No	Yes	Yes		Broken pipe
ps1:Linux内核对一个socket的fd write的时候如果另一端挂掉了,那么会出现抛出SIGPIPE信号,FreeBSD就比较酷,在05年的时候修正了这个无厘头的行为
ps2:python默认会忽略SIGPIPE信号
ref1:http://www./forum/showthread.php?t=2953
ref2:http://lists./pipermail/freebsd-bugs/2005-March/011883.html
ref3:http://mail./pipermail/python-dev/2004-August/048174.html

    本站是提供个人知识管理的网络存储空间,所有内容均由用户发布,不代表本站观点。请注意甄别内容中的联系方式、诱导购买等信息,谨防诈骗。如发现有害或侵权内容,请点击一键举报。
    转藏 分享 献花(0

    0条评论

    发表

    请遵守用户 评论公约

    类似文章 更多