dsymutil on OSX
Johan Engelen via digitalmars-d-ldc
digitalmars-d-ldc at puremagic.com
Wed Jul 19 15:20:47 PDT 2017
I have spent almost two hours figuring out why I didn't see
line numbers in the stack traces output by AddressSanitizer. Or:
I _am_ seeing them when running the sanitized binary manually,
but do not see line numbers when running an automated (lit-based)
Finally, it turns out that llvm-symbolizer does not show line
numbers in stack traces for our binaries unless dsymutil is run
on the executable. AddressSanitizer automatically searches the
path for llvm-symbolizer, and our lit-based testsuite adds the
llvm bin dir to the path, so it will find llvm-symbolizer. When
running the sanitized binary manually, llvm-symbolizer was not on
the path, and apparently another symbolizing method is used that
_does_ show line numbers.
There is a note about this in Address Sanitizer documentation...
Clang runs dsymutil (depending on what kind of build is done), to
prevent exactly these kinds of problems. Running dsymutil makes
linking slower, so I don't know whether we want to add this or
What do you think?
Mainly I want to tell you that if you are seeing missing
debuginfo issues, you should check whether they are resolved
after running dsymutil on the executable.
I also found that OSX only supports Dwarf version 2 (instead of
our higher default):
But I see in Clang's source that since OSX 10.11 (El Capitan, the
one I am on, lagging behind one version), Dwarf 4 is supported.
More information about the digitalmars-d-ldc