After building a program with zig build-exe -fno-strip helloworld.zig
, I noticed that there aren’t any DWARF debug segments in the resulting macho binary (I’m on macos), nor does zig output a .dSYM bundle — yet lldb
is able to to show symbolicated information when debugging helloworld
.
As best I can tell, the debug information is in helloworld.o
. So I have a few questions:
- does lldb look for debug info in
<executable_name>.o
by convention, or is there some way the macho executable says “my debug info is in helloworld.o”? (I’m thinking of how .dSYM’s can be found by the UUID located in the macho’s UUID load command, for binaries created by clang) - If the debug info really is in the .o, aren’t all the symbol addresses wrong due to the offsetting that occurs due to the linking process?