gdb笔记

阅读更多
如果出现
Could not find debuginfo pkg for dependency package glib
Missing separate debuginfos, use: debuginfo-install glibc-2.12-1.7.el6_0.5.x86_64

需要
下操作在CentOS 6.1:
1 su 切换到root下
2 进入到/etc/yum.repos.d/目录下
3 vim CentOS-Debuginfo.repo打开此文件,将[debug]下的enabled=0修改为enabled=1然后退出insert状态,执 行:wq命令保存
4 然后再运行debuginfo-install glibc-2.12-1.7……






i reg 看寄存器         info
bt full                backtrace
p $eax                 print
print有各种格式,p/x 16进制,p/o 8进制,p/s 字符
x/格式 地址
x $pc       pc为程序指针也叫eip
x/i $pc  汇编指令 ★★★★★★★★★★
disas $pc              disassemble 反汇编命令
(gdb) i reg
eax            0xfffffdfe       -514
ecx            0x8      8
edx            0xb74c0ff4       -1219751948
ebx            0xbfe34850       -1075623856
esp            0xbfe347e0       0xbfe347e0
ebp            0x85f1968        0x85f1968
esi            0x1      1
edi            0x85f08a8        140445864
eip            0xb7721424       0xb7721424 <__kernel_vsyscall+16>
eflags         0x200246 [ PF ZF IF ID ]
cs             0x73     115
ss             0x7b     123
ds             0x7b     123
es             0x7b     123
fs             0x0      0
gs             0x33     51
(gdb) p $eax
$1 = -514
(gdb) p/x $eax
$2 = 0xfffffdfe
(gdb) p/d $eax
$3 = -514
(gdb) p/u $eax
$4 = 4294966782
(gdb) p/o $eax
$5 = 037777776776
(gdb) p/t $eax
$6 = 11111111111111111111110111111110
(gdb) p/c $eax
$7 = -2 '\376'
(gdb) p/f $eax
$8 = -nan(0x7ffdfe)
(gdb) p/s $eax
$9 = -514
(gdb) p/i $eax
Format letter "i" is meaningless in "print" command.
(gdb) 

你可能感兴趣的:(c,gdb,汇编)