Skip to content

Instantly share code, notes, and snippets.

@Josscii
Last active December 20, 2021 15:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save Josscii/9dbcce53d80d89a5477718681c27784c to your computer and use it in GitHub Desktop.
Save Josscii/9dbcce53d80d89a5477718681c27784c to your computer and use it in GitHub Desktop.
oc 运行时学习记录

OC 运行时学习记录

debugger - lldb

Dancing in the Debugger — A Waltz with LLDB

Hopper + lldb for iOS Developers: A Gentle Introduction


complier - clang & llvm

深入剖析 iOS 编译 Clang LLVM

The Compiler


assembly

推荐阅读的书籍:

Reverse Engineering for Beginners

Computer Systems: A Programmer's Perspective


dyld

iOS程序启动->dyld加载->runtime初始化(初识)

dyld源码分析-动态加载main的流程和load函数执行的流程

dyld 加载 Mach-O


source code

阅读源码的一些指南。

源代码可以在苹果开源官网上下载:

objc4

阅读技巧:

下载源码后,用 Xcode 打开 objc.xcodeproj 可以看到源码的分类,能够更方便的查看。其中最需要关注的是 Project Headers 里面的 objc-private.h 和 objc-runtime-new.h 以及 Source 里面的文件。

源码中的消息发送部分用到了 MASM,在微软的官方文档中可以了解:

Microsoft Macro Assembler Reference

你可能需要了解的基础 c 语言知识:

unnamed struct

bit field

void *

uintptr_t

Mask

推荐阅读的博客有:

Kylin Roc

杨萧玉

一缕殇流化隐半边冰霜

推荐看的书:

The C Programming Language.


其他

runtime 如何加载类的 SO 回答

oc中的类是先加载到内存

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment