gdb超级基础教程

GDB超级基础教程

为什么叫超级基础呢,因为我被坑了一把....

编译选项带 -g 就可以在可执行程序中加入调试信息,然后就可以使用gdb去查看了。

使用help命令就可以看到:

(gdb) help
List of classes of commands:

aliases -- Aliases of other commands
breakpoints -- Making program stop at certain points
data -- Examining data
files -- Specifying and examining files
internals -- Maintenance commands
obscure -- Obscure features
running -- Running the program
stack -- Examining the stack
status -- Status inquiries
support -- Support facilities
tracepoints -- Tracing of program execution without stopping the program
user-defined -- User-defined commands

Type "help" followed by a class name for a list of commands in that class.
Type "help" followed by command name for full documentation.
Command name abbreviations are allowed if unambiguous.

这里注意一点了,这些不是命令行参数,是一种种类,有需要的话再进入查看,比如输入 help status!!!

常用的gdb命令:

breakpoint
clear
q
info breakpoint
next
run
continue
print VariableName
backtrace
finish #退出函数
list

需要注意的是,用 list 显示的是编译路径下的代码,并不是可执行文件中包含了源码。加 -g 之后可执行文件中会记录编译路径这些信息,list 时 gdb 去读编译路径下的源码,如果编译路径下的源码删除或者没有源码,那么 list 是显示不了代码的。

那gdb能不能调试python呢。。。

转载于:https://www.cnblogs.com/HelloGreen/p/8870256.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值