gdb操作技巧
开启汇编调试set disassemble-next-line on2.汇编单步调试命令
(gdb) si
(gdb) ni退出layout:ctrl+x 再a键
代码
基于64位,用pushl会编译报错,查看了C编的程序都用pushq 压栈8字节
.section .data
base:.int 100
plus_no:.int 8.section .text
.globl _start
_start:noppushq base #将函数所需参数压入堆栈顶部pushq plus_nocall cal_funcmovl $1, %eaxint $0x80cal_func:pushq %rbpmovq %rsp, %rbpmovl $0, %eaxaddl 16(%rbp), %eax # pushq 有值的时,rsp会+8,push两次所以偏移16addl 24(%rbp), %eaxmovl %eax, %ebxpopq %rbpret
参考
linux平台学x86汇编(十四):函数的使用_汇编.type %function-CSDN博客