Jumping to the next "instruction" using gdb

I am attempting to figure the canary value setting and checking mechanism.

#include 
int main(void)
{
        return printf("Hi!n");
}

When disassemble the main, I get

(gdb) disas main
0x080483f4 :    lea    0x4(%esp),%ecx
0x080483f8 :    and    $0xfffffff0,%esp
0x080483fb :    pushl  -0x4(%ecx)
0x080483fe :   push   %ebp
0x080483ff :   mov    %esp,%ebp
0x08048401 :   push   %ecx
0x08048402 :   sub    $0x14,%esp
0x08048405 :   mov    %gs:0x14,%eax
0x0804840b :   mov    %eax,-0x8(%ebp)
0x0804840e :   xor    %eax,%eax
0x08048410 :   movl   $0x8048500,(%esp)
0x08048417 :   call   0x8048320 
0x0804841c :   mov    -0x8(%ebp),%edx
0x0804841f :   xor    %gs:0x14,%edx
0x08048426 :   je     0x804842d 
0x08048428 :   call   0x8048330 
0x0804842d :   add    $0x14,%esp
0x08048430 :   pop    %ecx
0x08048431 :   pop    %ebp
0x08048432 :   lea    -0x4(%ecx),%esp
0x08048435 :   ret

I set a breakpoint at 0x0804840e using

b *0x0804840e

After the program flow stops at this breakpoint I would like gdb to go to the next instruction instead of next line of c code . I don't think I can use next for this. So what other option do I have apart from setting a breakpoint at every instruction?


you want to use stepi . it steps by one machine instruction.

check ftp://ftp.gnu.org/pub/old-gnu/Manuals/gdb/html_node/gdb_37.html for more info

链接地址: http://www.djcxy.com/p/67092.html

上一篇: 将C代码转换成汇编

下一篇: 使用gdb跳到下一个“指令”