Skip to content

Commit 8d15c88

Browse files
Merge pull request #8148 from adrian-prantl/unsupported-debuginfo
Emit a warning when parsing unsupported debug info.
2 parents e2de39e + e6914f6 commit 8d15c88

File tree

2 files changed

+25
-0
lines changed

2 files changed

+25
-0
lines changed

lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
#include "llvm/Support/Casting.h"
1414
#include "llvm/Support/Threading.h"
1515

16+
#include "lldb/Core/Debugger.h"
1617
#include "lldb/Core/Module.h"
1718
#include "lldb/Core/ModuleList.h"
1819
#include "lldb/Core/ModuleSpec.h"
@@ -652,6 +653,15 @@ DWARFCompileUnit *SymbolFileDWARF::GetDWARFCompileUnit(CompileUnit *comp_unit) {
652653
if (dwarf_cu && dwarf_cu->GetUserData() == nullptr)
653654
dwarf_cu->SetUserData(comp_unit);
654655

656+
// This branch has several known issues in the DWARF 5 parser. Let users know.
657+
if (dwarf_cu && dwarf_cu->GetVersion() > 4) {
658+
static llvm::once_flag g_once_flag;
659+
llvm::call_once(g_once_flag, []() {
660+
Debugger::ReportError(
661+
"This version of LLDB does not support DWARF version 5 or later.");
662+
});
663+
}
664+
655665
// It must be DWARFCompileUnit when it created a CompileUnit.
656666
return llvm::cast_or_null<DWARFCompileUnit>(dwarf_cu);
657667
}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
// Test that optimized flag is properly included in DWARF.
2+
3+
// -gsplit-dwarf is supported only on Linux.
4+
// REQUIRES: system-darwin
5+
6+
// This test uses lldb's embedded python interpreter
7+
// REQUIRES: python
8+
9+
// RUN: %clang_host %s -g -gdwarf-5 -c -o %t.o
10+
// RUN: %clang_host %t.o -o %t.exe
11+
// RUN: %lldb %t.exe -b -o 'b main' -o r -o q 2>&1 | FileCheck %s
12+
13+
// CHECK: error: This version of LLDB does not support DWARF version 5 or later.
14+
15+
int main(void) { return 0; }

0 commit comments

Comments
 (0)