7 breakpoint keep y 0x080483d6 test.asm:24
(gdb) delete 6 <======================删除断点6
(gdb) info b
num type disp enb address what
1 breakpoint keep y 0x080483c0 test.asm:17
2 breakpoint keep y 0x080483c5 test.asm:20
3 breakpoint keep y 0x080483ca test.asm:21
4 breakpoint keep y 0x080483cf test.asm:22
5 breakpoint keep y 0x080483d6 test.asm:25
7 breakpoint keep y 0x080483d6 test.asm:24
(gdb) r <=========================开始执行,调试开始
starting program: /home/lishuo/test
breakpoint 1, 0x080483c0 in main ()
(gdb) n <====================由于nasm的一些原因,单步执行n和s都不能使用
single stepping until exit from function main,
which has no line number information.
breakpoint 2, 0x080483c5 in main ()
(gdb) s
single stepping until exit from function main,
which has no line number information.
breakpoint 3, 0x080483ca in main ()
(gdb) print $eax <=======================打印寄存器的值
$1 = 1
(gdb) info r <==========================显示所有的寄存器值
eax 0x11
ecx 0x804a010134520848
edx 0x1117
ebx 0xb7fc2ff4-1208209420
esp 0xbffff2fc0xbffff2fc
ebp 0x00x0
esi 0x00
edi 0x00
eip 0x80483ca0x80483ca
eflags 0x200246[ pf zf if id ]
cs 0x73115
ss 0x7b123
ds 0x7b123
es 0x7b123
fs 0x00
gs 0x3351
(gdb) disassemble <========================反汇编
dump of assembler code for function main:
0x080483c0 < 0>:mov $0x11,�x
0x080483c5 < 5>:mov $0x804a010,�x
=> 0x080483ca < 10>:mov $0x1,�x
0x080483cf < 15>:mov $0x4,�x
0x080483d4 < 20>:int $0x80
0x080483d6 < 22>:mov $0x0,�x
0x080483db < 27>:mov $0x1,�x
0x080483e0 < 32>:int $0x80
0x080483e2 < 34>:nop
0x080483e3 < 35>:nop
0x080483e4 < 36>:nop
0x080483e5 < 37>:nop
0x080483e6 < 38>:nop
0x080483e7 < 39>:nop
0x080483e8 < 40>:nop
0x080483e9 < 41>:nop
0x080483ea < 42>:nop
0x080483eb < 43>:nop
0x080483ec < 44>:nop
0x080483ed < 45>:nop
0x080483ee < 46>:nop
0x080483ef < 47>:nop
---type
end of assembler dump.
(gdb) x/5cb 0x804a010 <================显示内存地址0x804a010开始的一段内存的值
0x804a010
(gdb) set disassembly-flavor intel <==========设置以intel汇编形式显示
(gdb) disassemble main
dump of assembler code for function main:
0x080483c0 < 0>:mov edx,0x11
0x080483c5 < 5>:mov ecx,0x804a010
=> 0x080483ca < 10>:mov ebx,0x1
0x080483cf < 15>:mov eax,0x4
0x080483d4 < 20>:int 0x80
0x080483d6 < 22>:mov ebx,0x0
0x080483db < 27>:mov eax,0x1
0x080483e0 < 32>:int 0x80
0x080483e2 < 34>:nop
0x080483e3 < 35>:nop
0x080483e4 < 36>:nop
0x080483e5 < 37>:nop
0x080483e6 < 38>:nop
0x080483e7 < 39>:nop
0x080483e8 < 40>:nop
0x080483e9 < 41>:nop
0x080483ea < 42>:nop
0x080483eb < 43>:nop
0x080483ec < 44>:nop
0x080483ed < 45>:nop
0x080483ee < 46>:nop
0x080483ef < 47>:nop
---type
end of assembler dump.
(gdb) x/90xb main <===============显示main开始的内存的内容
0x80483c0
0x80483c8
0x80483d0
0x80483d8
0x80483e0
0x80483e8
0x80483f0 <__libc_csu_init>:0x550x570x560x530xe80x690x000x00
0x80483f8 <__libc_csu_init 8>:0x000x810xc30xfb0x1b0x000x000x83
0x8048400 <__libc_csu_init 16>:0xec0x1c0x8b0x6c0x240x300x8d0xbb
0x8048408 <__libc_csu_init 24>:0x200xff0xff0xff0xe80x830xfe0xff
0x8048410 <__libc_csu_init 32>:0xff0x8d0x830x200xff0xff0xff0x29
0x8048418 <__libc_csu_init 40>:0xc70xc1
(gdb) info stack <=========================显示堆栈信息
#0 0x080483ca in main ()
(gdb) q <====================退出正在调试的程序
a debugging session is active.
inferior 1 [process 2587] will be killed.
quit anyway? (y or n) n
not confirmed.
(gdb) c <==============继续调试到下一个断点
continuing.
breakpoint 4, 0x080483cf in main ()
(gdb) c
continuing.
this is a test !
breakpoint 5, 0x080483d6 in main ()
(gdb) c
continuing.
[inferior 1 (process 2587) exited normally]
(gdb) q <==================退出gdb调试