Skip to content

Commit 01ca83a

Browse files
author
Jeffrey Tan
committed
Fix GetDIE is outside of its CU error from .debug_names
1 parent fc1a44f commit 01ca83a

File tree

2 files changed

+25
-2
lines changed

2 files changed

+25
-2
lines changed

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

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -131,8 +131,12 @@ DebugNamesDWARFIndex::GetNonSkeletonUnit(const DebugNames::Entry &entry) const {
131131
unit_offset = entry.getLocalTUOffset();
132132
if (unit_offset) {
133133
if (DWARFUnit *cu = m_debug_info.GetUnitAtOffset(DIERef::Section::DebugInfo,
134-
*unit_offset))
135-
return &cu->GetNonSkeletonUnit();
134+
*unit_offset)) {
135+
DWARFUnit &ret = cu->GetNonSkeletonUnit();
136+
if (ret.IsSkeletonUnit())
137+
return nullptr;
138+
return &ret;
139+
}
136140
}
137141
return nullptr;
138142
}
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
/// Check that LLDB does not emit "GetDIE for DIE {{0x[0-9a-f]+}} is outside of its CU"
2+
/// error message when user is searching for a matching symbol from .debug_names
3+
/// and fail to locate the corresponding .dwo file.
4+
5+
/// -gsplit-dwarf is supported only on Linux.
6+
// REQUIRES: system-linux
7+
8+
// RUN: %clang_host -g -gsplit-dwarf -gpubnames -gdwarf-5 %s -o main
9+
/// Remove the DWO file away from the expected location so that LLDB won't find the DWO next to the binary.
10+
// RUN: rm *.dwo
11+
// RUN: %lldb --no-lldbinit main \
12+
// RUN: -o "b main" --batch 2>&1 | FileCheck %s
13+
14+
// CHECK: warning: {{.*}}main unable to locate separate debug file (dwo, dwp). Debugging will be degraded.
15+
// CHECK-NOT: main GetDIE for DIE {{0x[0-9a-f]+}} is outside of its CU {{0x[0-9a-f]+}}
16+
17+
int num = 5;
18+
19+
int main(void) { return 0; }

0 commit comments

Comments
 (0)