diff options
author | Paul Robinson <paul.robinson@sony.com> | 2018-01-29 20:57:43 +0000 |
---|---|---|
committer | Paul Robinson <paul.robinson@sony.com> | 2018-01-29 20:57:43 +0000 |
commit | bf750c80e9dce1b6e2c270adba64fc85f7fbc861 (patch) | |
tree | d6b8c9388b9ee311cef8cc3b3be2a5aa74751aa8 /llvm/lib/DebugInfo/DWARF/DWARFFormValue.cpp | |
parent | 015184b79ea85a12ba80f49442302361cb2706a8 (diff) | |
download | bcm5719-llvm-bf750c80e9dce1b6e2c270adba64fc85f7fbc861.tar.gz bcm5719-llvm-bf750c80e9dce1b6e2c270adba64fc85f7fbc861.zip |
[DWARFv5] Re-enable dumping a line table with no CU.
r323476 added support for DW_FORM_line_strp, and incorrectly made that
depend on having a DWARFUnit available. We shouldn't be tracking
.debug_line_str in DWARFUnit after all. After this patch, I can do an
NFC follow up and undo a bunch of the "plumbing" part of r323476.
Differential Revision: https://reviews.llvm.org/D42609
llvm-svn: 323691
Diffstat (limited to 'llvm/lib/DebugInfo/DWARF/DWARFFormValue.cpp')
-rw-r--r-- | llvm/lib/DebugInfo/DWARF/DWARFFormValue.cpp | 21 |
1 files changed, 16 insertions, 5 deletions
diff --git a/llvm/lib/DebugInfo/DWARF/DWARFFormValue.cpp b/llvm/lib/DebugInfo/DWARF/DWARFFormValue.cpp index 81b60c57daa..089df4cdc97 100644 --- a/llvm/lib/DebugInfo/DWARF/DWARFFormValue.cpp +++ b/llvm/lib/DebugInfo/DWARF/DWARFFormValue.cpp @@ -293,7 +293,11 @@ bool DWARFFormValue::isFormClass(DWARFFormValue::FormClass FC) const { bool DWARFFormValue::extractValue(const DWARFDataExtractor &Data, uint32_t *OffsetPtr, DWARFFormParams FP, + const DWARFContext *Ctx, const DWARFUnit *CU) { + if (!Ctx && CU) + Ctx = &CU->getContext(); + C = Ctx; U = CU; bool Indirect = false; bool IsBlock = false; @@ -591,11 +595,12 @@ Optional<const char *> DWARFFormValue::getAsCString() const { if (Form == DW_FORM_string) return Value.cstr; // FIXME: Add support for DW_FORM_GNU_strp_alt - if (Form == DW_FORM_GNU_strp_alt || U == nullptr) + if (Form == DW_FORM_GNU_strp_alt || C == nullptr) return None; uint32_t Offset = Value.uval; if (Form == DW_FORM_line_strp) { - if (const char *Str = U->getLineStringExtractor().getCStr(&Offset)) + // .debug_line_str is tracked in the Context. + if (const char *Str = C->getLineStringExtractor().getCStr(&Offset)) return Str; return None; } @@ -603,13 +608,19 @@ Optional<const char *> DWARFFormValue::getAsCString() const { Form == DW_FORM_strx1 || Form == DW_FORM_strx2 || Form == DW_FORM_strx3 || Form == DW_FORM_strx4) { uint64_t StrOffset; - if (!U->getStringOffsetSectionItem(Offset, StrOffset)) + if (!U || !U->getStringOffsetSectionItem(Offset, StrOffset)) return None; Offset = StrOffset; } - if (const char *Str = U->getStringExtractor().getCStr(&Offset)) { - return Str; + // Prefer the Unit's string extractor, because for .dwo it will point to + // .debug_str.dwo, while the Context's extractor always uses .debug_str. + if (U) { + if (const char *Str = U->getStringExtractor().getCStr(&Offset)) + return Str; + return None; } + if (const char *Str = C->getStringExtractor().getCStr(&Offset)) + return Str; return None; } |