diff options
author | Fangrui Song <maskray@google.com> | 2018-11-11 18:57:28 +0000 |
---|---|---|
committer | Fangrui Song <maskray@google.com> | 2018-11-11 18:57:28 +0000 |
commit | 158b26213f3a35da7250cd8e6f259e2799acaf7a (patch) | |
tree | aebb9c5df1f37617aeba9959e59efb332d9c30bd /llvm/lib/DebugInfo/DWARF/DWARFContext.cpp | |
parent | f8f140dd559f8385eb2a5fbbdafe83b6e1fef153 (diff) | |
download | bcm5719-llvm-158b26213f3a35da7250cd8e6f259e2799acaf7a.tar.gz bcm5719-llvm-158b26213f3a35da7250cd8e6f259e2799acaf7a.zip |
[DWARF] Change pubnames to use DWARFSection instead of StringRef
Summary: The debug_info_offset values in .debug_{,gnu_}pub{name,types} may be relocated. Change it to DWARFSection so that we can get relocated values.
Reviewers: ruiu, dblaikie, grimar, JDevlieghere
Reviewed By: JDevlieghere
Subscribers: aprantl, JDevlieghere, llvm-commits
Differential Revision: https://reviews.llvm.org/D54375
llvm-svn: 346615
Diffstat (limited to 'llvm/lib/DebugInfo/DWARF/DWARFContext.cpp')
-rw-r--r-- | llvm/lib/DebugInfo/DWARF/DWARFContext.cpp | 40 |
1 files changed, 20 insertions, 20 deletions
diff --git a/llvm/lib/DebugInfo/DWARF/DWARFContext.cpp b/llvm/lib/DebugInfo/DWARF/DWARFContext.cpp index 7ab54de6bc4..5b5587f5a1d 100644 --- a/llvm/lib/DebugInfo/DWARF/DWARFContext.cpp +++ b/llvm/lib/DebugInfo/DWARF/DWARFContext.cpp @@ -549,24 +549,24 @@ void DWARFContext::dump( } if (shouldDump(Explicit, ".debug_pubnames", DIDT_ID_DebugPubnames, - DObj->getPubNamesSection())) - DWARFDebugPubTable(DObj->getPubNamesSection(), isLittleEndian(), false) + DObj->getPubNamesSection().Data)) + DWARFDebugPubTable(*DObj, DObj->getPubNamesSection(), isLittleEndian(), false) .dump(OS); if (shouldDump(Explicit, ".debug_pubtypes", DIDT_ID_DebugPubtypes, - DObj->getPubTypesSection())) - DWARFDebugPubTable(DObj->getPubTypesSection(), isLittleEndian(), false) + DObj->getPubTypesSection().Data)) + DWARFDebugPubTable(*DObj, DObj->getPubTypesSection(), isLittleEndian(), false) .dump(OS); if (shouldDump(Explicit, ".debug_gnu_pubnames", DIDT_ID_DebugGnuPubnames, - DObj->getGnuPubNamesSection())) - DWARFDebugPubTable(DObj->getGnuPubNamesSection(), isLittleEndian(), + DObj->getGnuPubNamesSection().Data)) + DWARFDebugPubTable(*DObj, DObj->getGnuPubNamesSection(), isLittleEndian(), true /* GnuStyle */) .dump(OS); if (shouldDump(Explicit, ".debug_gnu_pubtypes", DIDT_ID_DebugGnuPubtypes, - DObj->getGnuPubTypesSection())) - DWARFDebugPubTable(DObj->getGnuPubTypesSection(), isLittleEndian(), + DObj->getGnuPubTypesSection().Data)) + DWARFDebugPubTable(*DObj, DObj->getGnuPubTypesSection(), isLittleEndian(), true /* GnuStyle */) .dump(OS); @@ -1265,6 +1265,10 @@ class DWARFObjInMemory final : public DWARFObject { DWARFSectionMap AppleNamespacesSection; DWARFSectionMap AppleObjCSection; DWARFSectionMap DebugNamesSection; + DWARFSectionMap PubNamesSection; + DWARFSectionMap PubTypesSection; + DWARFSectionMap GnuPubNamesSection; + DWARFSectionMap GnuPubTypesSection; DWARFSectionMap *mapNameToDWARFSection(StringRef Name) { return StringSwitch<DWARFSectionMap *>(Name) @@ -1281,6 +1285,10 @@ class DWARFObjInMemory final : public DWARFObject { .Case("debug_str_offsets.dwo", &StringOffsetDWOSection) .Case("debug_addr", &AddrSection) .Case("apple_names", &AppleNamesSection) + .Case("debug_pubnames", &PubNamesSection) + .Case("debug_pubtypes", &PubTypesSection) + .Case("debug_gnu_pubnames", &GnuPubNamesSection) + .Case("debug_gnu_pubtypes", &GnuPubTypesSection) .Case("apple_types", &AppleTypesSection) .Case("apple_namespaces", &AppleNamespacesSection) .Case("apple_namespac", &AppleNamespacesSection) @@ -1294,12 +1302,8 @@ class DWARFObjInMemory final : public DWARFObject { StringRef EHFrameSection; StringRef StringSection; StringRef MacinfoSection; - StringRef PubNamesSection; - StringRef PubTypesSection; - StringRef GnuPubNamesSection; StringRef AbbrevDWOSection; StringRef StringDWOSection; - StringRef GnuPubTypesSection; StringRef CUIndexSection; StringRef GdbIndexSection; StringRef TUIndexSection; @@ -1319,10 +1323,6 @@ class DWARFObjInMemory final : public DWARFObject { .Case("eh_frame", &EHFrameSection) .Case("debug_str", &StringSection) .Case("debug_macinfo", &MacinfoSection) - .Case("debug_pubnames", &PubNamesSection) - .Case("debug_pubtypes", &PubTypesSection) - .Case("debug_gnu_pubnames", &GnuPubNamesSection) - .Case("debug_gnu_pubtypes", &GnuPubTypesSection) .Case("debug_abbrev.dwo", &AbbrevDWOSection) .Case("debug_str.dwo", &StringDWOSection) .Case("debug_cu_index", &CUIndexSection) @@ -1598,12 +1598,12 @@ public: return RnglistsSection; } StringRef getMacinfoSection() const override { return MacinfoSection; } - StringRef getPubNamesSection() const override { return PubNamesSection; } - StringRef getPubTypesSection() const override { return PubTypesSection; } - StringRef getGnuPubNamesSection() const override { + const DWARFSection &getPubNamesSection() const override { return PubNamesSection; } + const DWARFSection &getPubTypesSection() const override { return PubTypesSection; } + const DWARFSection &getGnuPubNamesSection() const override { return GnuPubNamesSection; } - StringRef getGnuPubTypesSection() const override { + const DWARFSection &getGnuPubTypesSection() const override { return GnuPubTypesSection; } const DWARFSection &getAppleNamesSection() const override { |