我正在尝试弄清楚堆栈保护机制中的canary值的设置和检查。
#include int main(void) { return printf("Hi!\n"); }
当反汇编main函数时,我得到:
(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
我在0x0804840e处设置断点:
b *0x0804840e
当程序在此断点处停止后,我希望gdb
能够跳到下一个指令而不是下一行C代码。我认为我不能使用next
来实现这个目的。那么除了在每个指令上设置断点之外,我还有哪些选项可用?
help
将为您提供主题列表,其中包括运行;help running
列出了“stepi-精确执行一条指令”,而help stepi
则提供了更详细的描述。 - Cascabel