swiftc emits symbols without flags set, which led dsymutil to ignore
them when searching for global symbols, causing dwarf location data
to be omitted. Xcode's dsymutil handles this case correctly, and emits
valid location data. Add this functionality to llvm-dsymutil by
allowing parsing of symbols with no flags set.
Details
- Reviewers
aprantl friss JDevlieghere - Commits
- rG01ab402463f4: [dsymutil] Emit valid debug locations when no symbol flags are set
rGb468fd64f9aa: [dsymutil] Emit valid debug locations when no symbol flags are set
rL315218: [dsymutil] Emit valid debug locations when no symbol flags are set
rL315082: [dsymutil] Emit valid debug locations when no symbol flags are set
Diff Detail
- Build Status
Buildable 10887 Build 10887: arc lint + arc unit
Event Timeline
tools/dsymutil/MachODebugMapParser.cpp | ||
---|---|---|
485–486 | Note that uses SymbolRef::SF_Common instead. |
tools/dsymutil/MachODebugMapParser.cpp | ||
---|---|---|
485–486 | Ah, I didn't realize that the apple fork was open source as well. Are there plans to merge it back into llvm? (probably applies to https://reviews.llvm.org/D38504 as well) |
tools/dsymutil/MachODebugMapParser.cpp | ||
---|---|---|
485–486 | If there are plans to eventually merge the two, these two diffs are just going to cause the forks to diverge and make merging harder (unless I merge them in as copies from what's in the apple version) |
Yes, we are in the process of contributing all changes where this makes sense for back into the llvm.org repository. I wouldn't worry too much about introducing merge conflicts (we can handle that), but we shouldn't change the behavior of the tool (unless you have found a bug in the shipping dsymutil, of course).
I'm running into some issues with using a precompiled binary + object file here. For some reason, the debug info contains an absolute path to the object file instead of a relative path, so dsymutil will fail because it's looking for a path that doesn't exist (ie a path on my local machine). This is true even if I use -fdebug-compilation-dir (it updates the debug info in the IR, but doesn't change where dsymutil looks for the object file). I also tried -add_ast_path, which works as a hacky workaround because it will search the relative path in addition to the absolute path, but that seems like a bad solution.
Interestingly, I tried to reproduce the test object files created in one of the other tests (X86/alias.test), and when I regenerate the object files locally, they switch to absolute paths as well and the test fails.
One way around this would be to go back to compiling/linking the IR file as part of the test, but this requires adding REQUIRES: darwin, for linking to work.
Any thoughts?
Let me know if I misunderstood your question. When creating binary testcases for dsymutil, I usually create them directly in / so the absolute paths don't contain any local directories.
Oh interesting. I tried using PWD=/, but I didn't try actually cd-ing into that directory. I'll try that - thanks!
Note that
https://opensource.apple.com/source/clang/clang-800.0.42.1/src/tools/dsymutil/MachODebugMapParser.cpp.auto.html
uses SymbolRef::SF_Common instead.