stop:收到该信号时,GDB会停住程序 nostop:收到信号时,GDB不会停住程序,但是会打印消息告诉你收到该信号 print:收到信号时,打印一条消息 noprint:收到信号时,GDB不会高告诉你收到信号 pass/noignore:收到信号时,GDB不做处理,让程序的信号处理程序接手 nopass/ignore:收到信号时,GDB不会让程序看到整个信号 查...
non-stop mode,不停模式,调试器(如VS2008和老版本的GDB)往往只支持 all-stop 模式,但在某些场景中,我们可能需要调试个别的线程,并且不想在调试过程中影响其他线程的运行,这样可以把GDB的调式模式由 all-stop 改成 non-stop,7.0 版本的GDB引入了 non-stop 模式。在 non-stop 模式下 continue、next、step 命令...
启动 $ gdb program # program是你的可执行文件,一般在当前目录 $ gdb program core # gdb同时调试运行程序和core文件,core是程序非法执行产生的文件 $ gdb program pid # 如果你的程序是一个服务程序,那么你可以指定这个服务程序运行时的进程ID。gdb会自动attach上去,并调试他。program应该在PATH环境变量中搜索得到。
current program counter ▪ thread apply all bt backtrace for every thread ▪ dprintf dynamic printf ▪ python: define custom commands by inheriting from gdb.Command class ▪ python: hook events to invoke python functions using gdb.events.stop.connect ▪ gcc’s -g and -O are orthogonal...
set print null-stop <on/off> 如果打开了这个选项,那么当显示字符串时,遇到结束符则停止显示。这个选项默认为off set print union <on/off> 设置显示结构体时,是否显式其内的联合体数据。例如有以下数据结构 p string+n显示偏移n后的字符串内容
set print null-stop 不显示'\000'这种 函数跳转 命令 作用 set step-mode on 不跳过不含调试信息的函数,可以显示和调试汇编代码 finish 执行完当前函数并打印返回值,然后触发中断 return 0 不再执行后面的指令,直接返回,可以指定返回值 call printf("%s\n", str) 调用printf函数,打印字符串(可以使用call或者...
file program 载入目标可执行文件 set args arg1 arg2 设置命令行参数 run 执行目标程序 attach pid 链接到目标进程,链接成功后目标进程将停止执行 continue 恢复执行目标进程 stop 停止运行 3、信息显示 show version 显示GDB版本 gdb -q 不显示提示信息启动GDB ...
Signal Stop Print Pass to program Description SIGHUP Yes Yes Yes Hangup SIGINT Yes Yes No Interrupt SIGQUIT Yes Yes Yes Quit SIGILL Yes Yes Yes Illegal instruction SIGTRAP Yes Yes No Trace/breakpoint trap SIGABRT Yes Yes Yes Aborted
Starting program: /root/./test_main In main(): x is 10 and is stored at 0x7fffffffe424. ptr points to 0x7fffffffe424 which holds 10. In print(): xx is 10 and is stored at 0x7fffffffe40c. xxptr points to 0x7fffffffe424 which holds 10. ...