How is DWARF information referenced by zig executable

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:

  1. 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)
  2. 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?

Maybe you can test your own hypothesis by copying the executable to an isolated directory (in /tmp?) and checking if lldb still shows symbolicated info for it?

I had confirmed my hypothesis that the debug information is in the .o file by deleting the .o file. Unfortunately the suggestion to copy the executable to a new directory doesn’t answer the first question in my original post. I had tried it and lldb doesn’t find the symbols, and that doesn’t explain if it fails to find symbols because:
A) lldb, by convention, looks for the .o in the same directory as the executable
B) the executable uses a relative path to say where its .o file is
Thanks for the suggestion though! Guess I’ll look at the lldb source.