修改项目结构

This commit is contained in:
2021-12-14 09:36:26 +08:00
parent 293e043e30
commit 2162005745
29 changed files with 129 additions and 65 deletions

View File

@@ -1,5 +1,10 @@
import UIKit import UIKit
var greeting = "Hello, playground"
import UIKit
// //
// //

View File

@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<playground version='5.0' target-platform='ios' buildActiveScheme='true' importAppTypes='true'>
<timeline fileName='timeline.xctimeline'/>
</playground>

View File

@@ -4,7 +4,7 @@
<dict> <dict>
<key>SchemeUserState</key> <key>SchemeUserState</key>
<dict> <dict>
<key>SwiftStudy (Playground).xcscheme</key> <key>01 注释 (Playground).xcscheme</key>
<dict> <dict>
<key>isShown</key> <key>isShown</key>
<false/> <false/>

View File

@@ -1,3 +1,7 @@
import UIKit
var greeting = "Hello, playground"
//: [Previous](@previous) //: [Previous](@previous)
//: ### //: ###

View File

@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<playground version='5.0' target-platform='ios' buildActiveScheme='true' importAppTypes='true'>
<timeline fileName='timeline.xctimeline'/>
</playground>

View File

@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<Workspace
version = "1.0">
<FileRef
location = "group:">
</FileRef>
</Workspace>

View File

@@ -1,3 +1,7 @@
import UIKit
var greeting = "Hello, playground"
//: [Previous](@previous) //: [Previous](@previous)
//: ## //: ##

View File

@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<playground version='5.0' target-platform='ios' buildActiveScheme='true' importAppTypes='true'>
<timeline fileName='timeline.xctimeline'/>
</playground>

View File

@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<Workspace
version = "1.0">
<FileRef
location = "group:">
</FileRef>
</Workspace>

View File

@@ -1,3 +1,7 @@
import UIKit
var greeting = "Hello, playground"
//: [Previous](@previous) //: [Previous](@previous)
import Darwin import Darwin

View File

@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<playground version='5.0' target-platform='ios' buildActiveScheme='true' importAppTypes='true'>
<timeline fileName='timeline.xctimeline'/>
</playground>

View File

@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<Workspace
version = "1.0">
<FileRef
location = "group:">
</FileRef>
</Workspace>

View File

@@ -1,3 +1,7 @@
import UIKit
var greeting = "Hello, playground"
//: [Previous](@previous) //: [Previous](@previous)
import Foundation import Foundation

View File

@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<playground version='5.0' target-platform='ios' buildActiveScheme='true' importAppTypes='true'>
<timeline fileName='timeline.xctimeline'/>
</playground>

View File

@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<Workspace
version = "1.0">
<FileRef
location = "group:">
</FileRef>
</Workspace>

View File

@@ -1,9 +1,11 @@
import UIKit
var greeting = "Hello, playground"
//: [Previous](@previous) //: [Previous](@previous)
import Foundation import Foundation
var greeting = "Hello, playground"
//: #### //: ####
/*: /*:
: nil : nil

View File

@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<playground version='5.0' target-platform='ios' buildActiveScheme='true' importAppTypes='true'>
<timeline fileName='timeline.xctimeline'/>
</playground>

View File

@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<Workspace
version = "1.0">
<FileRef
location = "group:">
</FileRef>
</Workspace>

View File

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

View File

@@ -1,7 +0,0 @@
//: [Previous](@previous)
import Foundation
var greeting = "Hello, playground"
//: [Next](@next)

View File

@@ -1,12 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<playground version='6.0' target-platform='ios' display-mode='raw' buildActiveScheme='true' importAppTypes='true'>
<pages>
<page name='01 注释'/>
<page name='02 数据类型'/>
<page name='03 流程控制'/>
<page name='04 函数'/>
<page name='05 枚举'/>
<page name='06 可选项'/>
<page name='07 汇编分析枚举'/>
</pages>
</playground>