Go to file
2021-12-13 22:50:09 +08:00
444
2021-12-13 22:50:09 +08:00
444
2021-12-13 22:50:09 +08:00

//## 汇编语言 //iOS使用的是AT&T的汇编语言 //### 常见的寄存器 //16个常用的寄存器 //* rax、rbx、rcx 、rdx、rsi、rdi、rbp、rsp //* r8、r9、r10、r11、r12、r13、r14、r15 // //寄存器的具体用途 //* rax、rdx常作为函数的返回值使用 //* rdi、rsi、rdx、rcx、r8、r9等寄存器常用于函数的参数 //* rbp、rsp用于栈操作 //* rip作为指令指针 // * 存储着CPU下一条要执行的指令的地址 // * 一旦CPU读取一条指令rip会自动指向下一条指令 // //java //r开头: 64bit, 8字节 //e开头: 32bit, 4字节 //ax bx cx: 16bit, 2字节 //ah al: 8bit1字节 //bh bl // // //### 常见的汇编指令 // //| 项目名称 | AT&T | Intel | 说明 | //|:-----------:|:---------------------------------------------------:|:----------------------------------------------:|:-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------:| //| 寄存器名称 | %rax | rax| | //| 操作数顺序 | mvq %rax, %rdx | mv rdx, rax | 将rax的值赋给rdx| //| 常数\立即数 | movq $3, %rax
movq $0x10, %rax | mov rax, 3
mov rax, 0x10 | 将3赋值给rax
将0x10赋值给rax| //| 内存赋值 | movq $0xa, 0x1ff7(%rip) | mov qword ptr [rip+0x1ff7], 0xa | 将0xa赋值给地址为rip + 0x1ff7的内存空间 | //| 取内存地址 | leaq -0x18(%rbp), %rax | leaq -0x18(%rbp), %rax | 将rbp 0x18这个地址值赋值给rax | //| jmp指令 | jmp %rdx
jmp 0x4001002
jmp (%rax) | jmp rdx
jmp 0x4001002
jmp [rax] | call和jmp写法类似 | //| 操作数长度 | movl %eax, %edx
movb $0x10, %al
eaw 0x10(%dx),%ax | mov edx, eax
mov al, 0x10
lea ax, [dx + 0x10] | b = byte (8-bit)
s = short (16-bit integer or 32-bit floating point)
w = word (16-bit)
l = long (32-bit integer or 64-bit floating point)
q = quad (64 bit)
t = ten bytes (80-bit floating point) | // // //### lldb常见的命令 //
thread step-over、next、n: 单步运⾏行行,把子函数当做整体⼀一步执⾏行行(源码级别) //
thread step-in、step、s: 单步运⾏行行,遇到子函数会进⼊入子函数(源码级别) //* thread step-inst-over、nexti、ni: 单步运⾏行行,把子函数当做整体⼀一步执⾏行行(汇编级别) //* thread step-inst、stepi、si: 单步运⾏行行,遇到子函数会进⼊入子函数(汇编级别) //* thread step-out、finish: 直接执⾏行行完当前函数的所有代码,返回到上一个函数(遇到断点会卡住) //

Description
No description provided
Readme 292 KiB
Languages
Swift 100%