Dunfey · Hotel WWDC as data, est. 1983
Front desk everything
Years
Topics

2021 Developer Tools

WWDC21 · 37 min · Developer Tools

Symbolication: Beyond the basics

Discover how you can achieve maximum performance and insightful debugging with your app. Symbolication is at the center of tools such as Instruments and LLDB to help bridge the layers between your application’s runtime and your source code. Learn how this process works and the steps you can take to gain the most insight into your app.

Watch at developer.apple.com ↗

Transcript all transcripts

Code shown on screen · 17 snippets

MagicNumbers swift · at 1:11 ↗
func selectMagicNumber(choices: [Int]) -> Int {
    return choices[MAGIC_CHOICE]
}

func randomValue() -> Int {
    return Int.random(in: 1...100)
}

func numberChoices() -> [Int] {
    var choices = [Int]()
    for _ in 1...10 {
        choices.append(randomValue())
    }
    return choices
}

func generateMagicNumber() -> Int {
    let numbers = numberChoices()
    let magic = selectMagicNumber(choices: numbers)
    return magic
}

print("The magic number is: \(generateMagicNumber())")
atos symbolication bash · at 2:51 ↗
atos -o MagicNumbers.dSYM/Contents/Resources/DWARF/MagicNumbers -arch arm64 -l 0x10045c000 -i 0x10045fb70
Load commands bash · at 7:34 ↗
otool -l MagicNumbers | grep LC_SEGMENT -A8
Disassembly bash · at 10:31 ↗
otool -tV MagicNumbers -arch arm64
vmmap bash · at 11:32 ↗
vmmap MagicNumbers | grep __TEXT
Function starts bash · at 15:09 ↗
symbols -onlyFuncStartsData -arch arm64 MagicNumbers
nlist_64 objectivec · at 17:06 ↗
struct nlist_64 {
    union {
        uint32_t  n_strx;
    } n_un;
    uint8_t n_type;
    uint8_t n_sect;
    uint16_t n_desc;
    uint64_t n_value; 
};
Direct symbols with nm bash · at 17:59 ↗
nm -arch arm64 —defined-only --numeric-sort MagicNumbers
Demangled direct symbols with nm bash · at 18:30 ↗
nm -arch arm64 —defined-only --numeric-sort MagicNumbers | xcrun swift-demangle
Demangled direct symbols with the symbols tool bash · at 18:43 ↗
symbols -arch arm64 -onlyNListData MagicNumbers
Indirect symbols with nm bash · at 23:06 ↗
nm -m —arch arm64 --undefined-only --numeric-sort MagicNumbers
Examining dSYMs with dwarfdump bash · at 27:16 ↗
dwarfdump -v -debug-info -arch arm64 MagicNumbers.dSYM
atos symbolication without inlined functions bash · at 29:25 ↗
atos -o MagicNumbers.dSYM/Contents/Resources/DWARF/MagicNumbers -arch arm64 —l 0x10045c000 0x10045fb70
Examining debugging symbols bash · at 32:29 ↗
dsymutil --dump-debug-map -arch arm64 MagicNumbers
Examining dSYM UUIDs bash · at 33:59 ↗
symbols -uuid MagicNumbers.dSYM
Verifying DWARF bash · at 34:03 ↗
dwarfdump —verify MagicNumbers.dSYM
Verifying entitlements and codesigning bash · at 35:09 ↗
codesign --display -v  --entitlements :- MagicApp.app