当前位置: 技术问答>linux和unix
gdb调试中command命令是做什么用的
来源: 互联网 发布时间:2016-07-11
本文导语: 1.如题,gdb调试时command和end配对使用,为什么要这样用,作用是什么? 2.下面两句的具体意义是什么 handle SIG35 SIGUSR2 nostop noprint set height 0 | handle是用来设置如何处理一个的信号 (gdb) help ...
1.如题,gdb调试时command和end配对使用,为什么要这样用,作用是什么?
2.下面两句的具体意义是什么
handle SIG35 SIGUSR2 nostop noprint
set height 0
2.下面两句的具体意义是什么
handle SIG35 SIGUSR2 nostop noprint
set height 0
|
handle是用来设置如何处理一个的信号
(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.
set height是用来设置gdb一页显示多少行。
(gdb) help set height
Set number of lines gdb thinks are in a page.
(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.
set height是用来设置gdb一页显示多少行。
(gdb) help set height
Set number of lines gdb thinks are in a page.
|
在gdb中打一下help就知道了,command/end是自定义设置遇到断点时执行的操作。
(gdb) help command
Set commands to be executed when a breakpoint is hit.
Give breakpoint number as argument after "commands".
With no argument, the targeted breakpoint is the last one set.
The commands themselves follow starting on the next line.
Type a line containing "end" to indicate the end of them.
Give "silent" as the first line to make the breakpoint silent;
then no output is printed when it is hit, except what the commands print.
(gdb) help command
Set commands to be executed when a breakpoint is hit.
Give breakpoint number as argument after "commands".
With no argument, the targeted breakpoint is the last one set.
The commands themselves follow starting on the next line.
Type a line containing "end" to indicate the end of them.
Give "silent" as the first line to make the breakpoint silent;
then no output is printed when it is hit, except what the commands print.
|
SIG35 SIGUSR2 是系统里的两个消息。意思应该应该是调试时候碰到这两个消息,程序不停止执行,也不打印信息。
|
LS说的对,是系统的两个信号,程序在调试运行过程中如果遇到这两个信号默认会被中断的,加入这两句就不会被终止了,也不会有打印信息出现。
|
正解,在gdb进行多线程调试的时候,经常要有 handle SIG32 nostop noprint