A Swift library for parsing binary files to obtain DWARF information.
Note
Currently, only mach-o binaries are supported. (MachOKit)
Support for ELF binaries will also be added in the future. (ELFKit)
DWARF information from binary file (MachOFile) can be retrieved via the dwarf property.
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
// compiration units in `.debug_info` section
let compirationUnits = machO.dwarf.compilationUnits
/* ... */DWARFMachOPrintTests.swift provides test cases that generate output similar to dwarfdump. Please use these as a reference.
- mach-o
- ELF
-
.debug_abbrev -
.debug_info -
.debug_line -
.debug_str -
.debug_line_str -
.debug_str_offs -
.debug_addr -
.debug_aranges -
.debug_rnglists -
.debug_loclists -
.debug_names -
.debug-macro -
.debug-pubnames -
.debug-pubtypes -
.debug-ranges
swift-dwarf is released under the MIT License. See LICENSE