mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2025-03-07 11:59:09 +00:00
DebugInfo: Refactor named section dumping into a reusable helper
Currently the section name (& possibly number) is only printed on addresses in ranges - but no reason it couldn't also be displayed on other addresses (like low/high PC). Refactor in that direction by pulling out the section lookup and name ambiguity dumping logic into a reusable helper. llvm-svn: 349995
This commit is contained in:
parent
f7bc814186
commit
da4066e34a
@ -75,6 +75,8 @@ public:
|
||||
bool isFormClass(FormClass FC) const;
|
||||
const DWARFUnit *getUnit() const { return U; }
|
||||
void dump(raw_ostream &OS, DIDumpOptions DumpOpts = DIDumpOptions()) const;
|
||||
static void dumpAddressSection(const DWARFObject &Obj, raw_ostream &OS,
|
||||
DIDumpOptions DumpOpts, uint64_t SectionIndex);
|
||||
|
||||
/// Extracts a value in \p Data at offset \p *OffsetPtr. The information
|
||||
/// in \p FormParams is needed to interpret some forms. The optional
|
||||
|
@ -71,15 +71,7 @@ static void dumpRanges(const DWARFObject &Obj, raw_ostream &OS,
|
||||
OS.indent(Indent);
|
||||
R.dump(OS, AddressSize);
|
||||
|
||||
if (SectionNames.empty() || R.SectionIndex == -1ULL)
|
||||
continue;
|
||||
|
||||
StringRef Name = SectionNames[R.SectionIndex].Name;
|
||||
OS << " \"" << Name << '\"';
|
||||
|
||||
// Print section index if name is not unique.
|
||||
if (!SectionNames[R.SectionIndex].IsNameUnique)
|
||||
OS << format(" [%" PRIu64 "]", R.SectionIndex);
|
||||
DWARFFormValue::dumpAddressSection(Obj, OS, DumpOpts, R.SectionIndex);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -331,6 +331,21 @@ bool DWARFFormValue::extractValue(const DWARFDataExtractor &Data,
|
||||
return true;
|
||||
}
|
||||
|
||||
void DWARFFormValue::dumpAddressSection(const DWARFObject &Obj, raw_ostream &OS,
|
||||
DIDumpOptions DumpOpts,
|
||||
uint64_t SectionIndex) {
|
||||
if (!DumpOpts.Verbose || SectionIndex == -1ULL)
|
||||
return;
|
||||
ArrayRef<SectionName> SectionNames = Obj.getSectionNames();
|
||||
const auto &SecRef = SectionNames[SectionIndex];
|
||||
|
||||
OS << " \"" << SecRef.Name << '\"';
|
||||
|
||||
// Print section index if name is not unique.
|
||||
if (!SecRef.IsNameUnique)
|
||||
OS << format(" [%" PRIu64 "]", SectionIndex);
|
||||
}
|
||||
|
||||
void DWARFFormValue::dump(raw_ostream &OS, DIDumpOptions DumpOpts) const {
|
||||
uint64_t UValue = Value.uval;
|
||||
bool CURelativeOffset = false;
|
||||
|
Loading…
x
Reference in New Issue
Block a user