summaryrefslogtreecommitdiffstats
path: root/llvm/lib/DebugInfo
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/lib/DebugInfo')
-rw-r--r--llvm/lib/DebugInfo/DWARF/DWARFContext.cpp13
-rw-r--r--llvm/lib/DebugInfo/Symbolize/SymbolizableObjectFile.cpp9
-rw-r--r--llvm/lib/DebugInfo/Symbolize/Symbolize.cpp6
3 files changed, 20 insertions, 8 deletions
diff --git a/llvm/lib/DebugInfo/DWARF/DWARFContext.cpp b/llvm/lib/DebugInfo/DWARF/DWARFContext.cpp
index 4b66a305a3d..2379ba66aa3 100644
--- a/llvm/lib/DebugInfo/DWARF/DWARFContext.cpp
+++ b/llvm/lib/DebugInfo/DWARF/DWARFContext.cpp
@@ -1506,7 +1506,11 @@ public:
StringMap<unsigned> SectionAmountMap;
for (const SectionRef &Section : Obj.sections()) {
StringRef Name;
- Section.getName(Name);
+ if (auto NameOrErr = Section.getName())
+ Name = *NameOrErr;
+ else
+ consumeError(NameOrErr.takeError());
+
++SectionAmountMap[Name];
SectionNames.push_back({ Name, true });
@@ -1571,12 +1575,15 @@ public:
continue;
StringRef RelSecName;
- StringRef RelSecData;
- RelocatedSection->getName(RelSecName);
+ if (auto NameOrErr = RelocatedSection->getName())
+ RelSecName = *NameOrErr;
+ else
+ consumeError(NameOrErr.takeError());
// If the section we're relocating was relocated already by the JIT,
// then we used the relocated version above, so we do not need to process
// relocations for it now.
+ StringRef RelSecData;
if (L && L->getLoadedSectionContents(*RelocatedSection, RelSecData))
continue;
diff --git a/llvm/lib/DebugInfo/Symbolize/SymbolizableObjectFile.cpp b/llvm/lib/DebugInfo/Symbolize/SymbolizableObjectFile.cpp
index bc4070b1d81..b4d49d9ff95 100644
--- a/llvm/lib/DebugInfo/Symbolize/SymbolizableObjectFile.cpp
+++ b/llvm/lib/DebugInfo/Symbolize/SymbolizableObjectFile.cpp
@@ -54,10 +54,11 @@ SymbolizableObjectFile::create(const object::ObjectFile *Obj,
// PowerPC64 ELF.
if (Obj->getArch() == Triple::ppc64) {
for (section_iterator Section : Obj->sections()) {
- StringRef Name;
- if (auto EC = Section->getName(Name))
- return EC;
- if (Name == ".opd") {
+ Expected<StringRef> NameOrErr = Section->getName();
+ if (!NameOrErr)
+ return errorToErrorCode(NameOrErr.takeError());
+
+ if (*NameOrErr == ".opd") {
Expected<StringRef> E = Section->getContents();
if (!E)
return errorToErrorCode(E.takeError());
diff --git a/llvm/lib/DebugInfo/Symbolize/Symbolize.cpp b/llvm/lib/DebugInfo/Symbolize/Symbolize.cpp
index 271d0cc6f44..a5559373b05 100644
--- a/llvm/lib/DebugInfo/Symbolize/Symbolize.cpp
+++ b/llvm/lib/DebugInfo/Symbolize/Symbolize.cpp
@@ -259,7 +259,11 @@ bool getGNUDebuglinkContents(const ObjectFile *Obj, std::string &DebugName,
return false;
for (const SectionRef &Section : Obj->sections()) {
StringRef Name;
- Section.getName(Name);
+ if (Expected<StringRef> NameOrErr = Section.getName())
+ Name = *NameOrErr;
+ else
+ consumeError(NameOrErr.takeError());
+
Name = Name.substr(Name.find_first_not_of("._"));
if (Name == "gnu_debuglink") {
Expected<StringRef> ContentsOrErr = Section.getContents();
OpenPOWER on IntegriCloud