summaryrefslogtreecommitdiffstats
path: root/llvm/lib/DebugInfo/Symbolize/Symbolize.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/lib/DebugInfo/Symbolize/Symbolize.cpp')
-rw-r--r--llvm/lib/DebugInfo/Symbolize/Symbolize.cpp9
1 files changed, 6 insertions, 3 deletions
diff --git a/llvm/lib/DebugInfo/Symbolize/Symbolize.cpp b/llvm/lib/DebugInfo/Symbolize/Symbolize.cpp
index 7e91a20416b..00e4139c0ba 100644
--- a/llvm/lib/DebugInfo/Symbolize/Symbolize.cpp
+++ b/llvm/lib/DebugInfo/Symbolize/Symbolize.cpp
@@ -221,9 +221,12 @@ bool getGNUDebuglinkContents(const ObjectFile *Obj, std::string &DebugName,
Section.getName(Name);
Name = Name.substr(Name.find_first_not_of("._"));
if (Name == "gnu_debuglink") {
- StringRef Data;
- Section.getContents(Data);
- DataExtractor DE(Data, Obj->isLittleEndian(), 0);
+ Expected<StringRef> ContentsOrErr = Section.getContents();
+ if (!ContentsOrErr) {
+ consumeError(ContentsOrErr.takeError());
+ return false;
+ }
+ DataExtractor DE(*ContentsOrErr, Obj->isLittleEndian(), 0);
uint32_t Offset = 0;
if (const char *DebugNameStr = DE.getCStr(&Offset)) {
// 4-byte align the offset.
OpenPOWER on IntegriCloud