【发布时间】:2014-03-18 17:15:15
【问题描述】:
我目前正在编写简单的测试,以了解 gdb 如何使用 extern "C" 和选项 -O0 从 C++ 编译为 asm,而我的 asm 对象是使用 nasm -g -f elf64 编译的
这是我反汇编的相关堆栈帧:
0x0000000000400570 <+0>: push rbp
0x0000000000400571 <+1>: mov rbp,rsp
0x0000000000400574 <+4>: push r10
=> 0x0000000000400576 <+6>: mov r10,QWORD PTR [rbp-0x8]
0x000000000040057a <+10>: pop r10
0x000000000040057c <+12>: mov rsp,rbp
0x000000000040057f <+15>: pop rbp
0x0000000000400580 <+16>: ret
0x0000000000400581 <+17>: nop WORD PTR cs:[rax+rax*1+0x0] ; this instruction
0x000000000040058b <+27>: nop DWORD PTR [rax+rax*1+0x0] ; and this one
最后两条指令用nop填充,因为对齐,我可以得到这个。
现在我的问题是,为什么 nop 和 WORD PTR cs:[rax+rax*1+0x0] 和 DWORD PTR [rax+rax*1+0x0] 在一起?
【问题讨论】: