[llvm] [BOLT][DWARF][NFC] Add option to specify DW_AT_comp_dir (PR #79395)
Maksim Panchenko via llvm-commits
llvm-commits at lists.llvm.org
Wed Jan 24 19:36:22 PST 2024
================
@@ -1574,12 +1575,21 @@ void BinaryContext::preprocessDWODebugInfo() {
for (const std::unique_ptr<DWARFUnit> &CU : DwCtx->compile_units()) {
DWARFUnit *const DwarfUnit = CU.get();
if (std::optional<uint64_t> DWOId = DwarfUnit->getDWOId()) {
- DWARFUnit *DWOCU = DwarfUnit->getNonSkeletonUnitDIE(false).getDwarfUnit();
+ DWARFUnit *DWOCU = nullptr;
+ std::string DWOName = dwarf::toString(
+ DwarfUnit->getUnitDIE().find(
+ {dwarf::DW_AT_dwo_name, dwarf::DW_AT_GNU_dwo_name}),
+ "");
+ if (opts::CompDirOverride.empty()) {
+ DWOCU = DwarfUnit->getNonSkeletonUnitDIE(false).getDwarfUnit();
+ } else {
+ SmallString<16> AbsolutePath;
+ sys::path::append(AbsolutePath, opts::CompDirOverride);
+ sys::path::append(AbsolutePath, DWOName);
+ DWOCU = DwarfUnit->getNonSkeletonUnitDIE(false, AbsolutePath)
----------------
maksfb wrote:
Can you keep just one call to `getNonSkeletonUnitDIE()`, but set `AbsolutePath` only when `CompDirOverride` is set?
https://github.com/llvm/llvm-project/pull/79395
More information about the llvm-commits
mailing list