p-x9/swift-dwarf

GitHub: p-x9/swift-dwarf

一个用于解析 Mach-O 二进制文件 DWARF 调试信息的 Swift 库,填补了 Swift 生态在底层调试数据读取上的能力空白。

Stars: 21 | Forks: 0

# swift-dwarf 一个用于解析二进制文件以获取 DWARF 信息的 Swift 库。 [![Github issues](https://img.shields.io/github/issues/p-x9/swift-dwarf)](https://github.com/p-x9/swift/issues) [![Github forks](https://img.shields.io/github/forks/p-x9/swift-dwarf)](https://github.com/p-x9/swift-dwarf/network/members) [![Github stars](https://img.shields.io/github/stars/p-x9/swift-dwarf)](https://github.com/p-x9/swift-dwarf/stargazers) [![Github top language](https://img.shields.io/github/languages/top/p-x9/swift-dwarf)](https://github.com/p-x9/swift-dwarf/) ## 用法 ### 基础 可以通过 `dwarf` 属性从二进制文件(MachOFile)中获取 DWARF 信息。 ``` import MachOKit import DWARF // string table in `.debug_str` section let strings = machO.dwarf.strings // abbreviations tables in `.debug_abbrev` section let abbreviationSets = machO.dwarf.abbreviationsSets // compilation units in `.debug_info` section let compilationUnits = machO.dwarf.compilationUnits /* ... */ ``` [DWARFMachOPrintTests.swift](/Tests/DWARFTests/DWARFMachOPrintTests.swift) 提供了生成类似 dwarfdump 输出的测试用例,可作为参考。 ## 状态 ### 支持的二进制格式 - [x] mach-o - [ ] ELF ### 支持的 DWARF 节区 - [x] `.debug_abbrev` - [x] `.debug_info` - [x] `.debug_line` - [x] `.debug_str` - [x] `.debug_line_str` - [x] `.debug_str_offs` - [x] `.debug_addr` - [x] `.debug_aranges` - [x] `.debug_rnglists` - [x] `.debug_loclists` - [x] `.debug_names` - [ ] `.debug-macro` - [ ] `.debug-pubnames` - [ ] `.debug-pubtypes` - [ ] `.debug-ranges` ## 许可证 swift-dwarf 在 MIT License 下发布。请参见 [LICENSE](./LICENSE)。
标签:.debug_abbrev, .debug_aranges, .debug_info, .debug_line, .debug_line_str, .debug_loclists, .debug_names, .debug_rnglists, .debug_str, .debug_str_offs, DWARF, Mach-O, MachOKit, Swift, 二进制解析, 云安全监控, 云资产清单, 开源库, 搜索引擎爬虫, 符号表, 调试信息, 逆向工程, 静态分析