I am adding DWP support to BOLT. At the moment DWP as input, later see if parts of llvm-dwp can be re-used to output DWP directly from bolt.
The Address information is in the main binary, so when DWO CU is created from DWP it is not available. I am exposing a set API so that from user code this can be set.
Example of how I am creating CU from DWP file. https://github.com/facebookincubator/BOLT/blob/0c14e20238604a4c05e174e71676857d45c60a0f/bolt/src/BinaryContext.cpp#L1472
Example of usage of the new API:
Optional<uint64_t> addrOffBase = DwarfUnit->getAddrOffsetSectionBase();
assert(addrOffBase && "Address Offset Section Base is not set.");
DWOCU->setAddrOffsetSection(DwarfUnit->getAddrOffsetSection(), *addrOffBase);
Test Plan:
Details
- Reviewers
dblaikie
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
Can you instead use the API more like the way llvm-symbolizer does - starting with the skeleton CU in the executable and it'll be able to load the dwp itself? (this codepath is already present and more tested, covers other sections like rnglists, etc, that you'll need too)
Hmm. I thought way below is it.
Only relevant code. DwCtx is context of binary.
DWPContext = DwCtx->getDWOContext(opts::DWPPath.c_str()); llvm::Optional<uint64_t> DWOId = DwarfUnit->getDWOId() DWARFCompileUnit *DWOCU = DWPContext.get()->getDWOCompileUnitForHash(*DWOId);
Let me poke around llvm-symbolizer some more. Last time I looked I don't remember seeing low level APIs, and more high level ones.
Yeah, most of the symbolizers APIs are higher level - but what I mean is that the symbolizer libraries use the libDebugInfo[DWARF] APIs in such a way as to correctly wire up the everything when they start from the executables context (rather than the dwp/dwo context) - so doing things the same way (& hopefully sharing as much code as possible) is probably a good direction to look at.
clang-format: please reformat the code