Search code examples
debuggingsymbolslldbdebug-symbolsundefined-symbol

LLDB symbol dumps


I'm trying to understand the following symbol dump from the LLDB shell

(lldb) target create --no-dependents '9.0/Symbols/Library/Application Support/WatchKit/WK'
Current executable set to '9.0/Symbols/Library/Application Support/WatchKit/WK' (armv7k).
(lldb) image list
[  0] 675ED1EB-BAA0-3453-B7B1-3E69310F40FD 0x00004000 9.0/Symbols/Library/Application Support/WatchKit/WK
(lldb) image dump symtab
Dumping symbol table for 1 modules.
Symtab, file = 9.0/Symbols/Library/Application Support/WatchKit/WK, num_symbols = 6:
               Debug symbol
               |Synthetic symbol
               ||Externally Visible
               |||
Index   UserID DSX Type            File Address/Value Load Address       Size               Flags      Name
------- ------ --- --------------- ------------------ ------------------ ------------------ ---------- ----------------------------------
[    0]      0     Code            0x0000000000007fcc                    0x0000000000000030 0x001e0000  stub helpers
[    1]      1   X Data            0x0000000000004000                    0x0000000000003fcc 0x000f0010 _mh_execute_header
[    2]      2   X ReExported                                                               0x000b0000 main -> /System/Library/PrivateFrameworks/SockPuppetGizmo.framework/SockPuppetGizmo`_SPApplicationMain
[    3]      3   X Undefined       0x0000000000000000                    0x0000000000000000 0x00010100 _SPApplicationMain
[    4]      4   X Undefined       0x0000000000000000                    0x0000000000000000 0x00010500 dyld_stub_binder
[    5]      5  S  Trampoline      0x0000000000007ffc                    0x0000000000000004 0x00000000 main

Most of it I can kinda understand because there are addresses and sizes associated with the symbol but some of them I don't understand. In this case there are 2 "undefined" symbols with 0x00 for the address and 0x00 for the size. My question is what do those symbols mean? Does that mean they are resolved at runtime and I really shouldn't be concerned about them when trying to make sense of things in crash logs?


Solution

  • Your guess is correct, Undefined symbols are symbols that one binary wants to use from some other binary. They will get fixed up by the loader when your program runs.

    So for instance, if you write the standard "hello world" program, the main binary will have an Undefined symbol for "printf". BTW, these are the same as the symbols of type U that you see in the output of nm.