Skip to content

Commit 66acd1e

Browse files
authored
[LLDB] Ignore actual-needed artificial members in DWARFASTParserClang::ParseSingleMember (#70779)
Address the FIXME, this will allow lldb to print all fields of the generated coroutine frame structure. Fixes #69309.
1 parent c4e57b1 commit 66acd1e

File tree

2 files changed

+26
-3
lines changed

2 files changed

+26
-3
lines changed

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

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,14 @@ static lldb::ModuleSP GetContainingClangModule(const DWARFDIE &die) {
133133
return lldb::ModuleSP();
134134
}
135135

136+
// Returns true if the given artificial field name should be ignored when
137+
// parsing the DWARF.
138+
static bool ShouldIgnoreArtificialField(llvm::StringRef FieldName) {
139+
return FieldName.starts_with("_vptr$")
140+
// gdb emit vtable pointer as "_vptr.classname"
141+
|| FieldName.starts_with("_vptr.");
142+
}
143+
136144
TypeSP DWARFASTParserClang::ParseTypeFromClangModule(const SymbolContext &sc,
137145
const DWARFDIE &die,
138146
Log *log) {
@@ -3059,9 +3067,7 @@ void DWARFASTParserClang::ParseSingleMember(
30593067
// This needs to be done after updating FieldInfo which keeps track of where
30603068
// field start/end so we don't later try to fill the space of this
30613069
// artificial member with (unnamed bitfield) padding.
3062-
// FIXME: This check should verify that this is indeed an artificial member
3063-
// we are supposed to ignore.
3064-
if (attrs.is_artificial) {
3070+
if (attrs.is_artificial && ShouldIgnoreArtificialField(attrs.name)) {
30653071
last_field_info.SetIsArtificial(true);
30663072
return;
30673073
}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# UNSUPPORTED: system-darwin, system-windows
2+
3+
# Make sure the artifical field `vptr.ClassName` from gcc debug info is ignored.
4+
# RUN: %build --compiler=gcc %S/Inputs/debug-types-expressions.cpp -o %t
5+
# RUN: %lldb %t -s %s -o exit | FileCheck %s
6+
7+
breakpoint set -n foo
8+
process launch
9+
10+
# CHECK: Process {{.*}} stopped
11+
12+
frame variable *a
13+
# CHECK-LABEL: frame variable *a
14+
# CHECK: (B) *a = {
15+
# CHECK-NEXT: A = (i = 47)
16+
# CHECK-NEXT: j = 42
17+
# CHECK-NEXT: }

0 commit comments

Comments
 (0)