disassembly - 如何理解 Mach-O 符号表

标签 disassembly mach-o

我目前正在学习如何反汇编 Mach-O 二进制文件,并且我正在尝试弄清楚如何理解“符号表”(在加载命令 LC_SYMTAB 中)。

如何阅读/解释符号表及其条目? 我不是 100%,但看起来每个条目都是 8 个字节? (如果我错了请纠正我)

我知道字符串表是由空字节分隔的一组字符串,但什么是符号表及其用途?

谢谢。

最佳答案

直接来自 <mach-o/nlist.h> :

struct nlist {
    union {
        uint32_t n_strx;    /* index into the string table */
    } n_un;
    uint8_t n_type;         /* type flag, see below */
    uint8_t n_sect;         /* section number or NO_SECT */
    int16_t n_desc;         /* see <mach-o/stab.h> */
    uint32_t n_value;       /* value of this symbol (or stab offset) */
};

struct nlist_64 {
    union {
        uint32_t  n_strx;   /* index into the string table */
    } n_un;
    uint8_t n_type;         /* type flag, see below */
    uint8_t n_sect;         /* section number or NO_SECT */
    uint16_t n_desc;        /* see <mach-o/stab.h> */
    uint64_t n_value;       /* value of this symbol (or stab offset) */
};

所以不,不应该是 8 个字节,对于 32 位二进制文​​件应该是 12 个字节,对于 64 位二进制文​​件应该是 16 个字节。

关于disassembly - 如何理解 Mach-O 符号表,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44770226/

相关文章:

c++ - 未捕获的异常——调试技巧(C++)

ios - IOS 二进制文件中的 LC_DATA_IN_CODE

.NET 反汇编、编辑和补丁

c - 如何在反汇编中查看局部变量符号名称? (来自 C 源)

c - 为什么我要向堆栈指针添加一个地址?

MacOS:未捆绑/unix 可执行文件的版本信息

c++ - Xcode 4 mach-o 错误

reverse-engineering - 如何在 IDA Pro 中设置数组元素的大小?

java - IntelliJ 可以在没有相应源代码的情况下反汇编第三方(或 JDK)的 java 字节码吗?

macos - Darwin 10.15 上的自修改代码导致 "malformed mach-o image"?