[Lldb-commits] [PATCH] D112697: [lldb] Update field offset/sizes when encountering artificial members such as vtable pointers
Raphael Isemann via Phabricator via lldb-commits
lldb-commits at lists.llvm.org
Sat Oct 30 04:22:44 PDT 2021
This revision was automatically updated to reflect the committed changes.
Closed by commit rGe2ede1715d41: [lldb] Update field offset/sizes when encountering artificial members such as… (authored by teemperor).
Herald added a subscriber: lldb-commits.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D112697/new/
https://reviews.llvm.org/D112697
Files:
lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
lldb/test/API/lang/cpp/bitfields/TestCppBitfields.py
lldb/test/API/lang/cpp/bitfields/main.cpp
Index: lldb/test/API/lang/cpp/bitfields/main.cpp
===================================================================
--- lldb/test/API/lang/cpp/bitfields/main.cpp
+++ lldb/test/API/lang/cpp/bitfields/main.cpp
@@ -97,7 +97,7 @@
struct WithVTableAndUnnamed {
virtual ~WithVTableAndUnnamed() {}
- unsigned a : 4;
+ unsigned : 4;
unsigned b : 4;
unsigned c : 4;
};
@@ -146,7 +146,6 @@
with_vtable.b = 0;
with_vtable.c = 5;
- with_vtable_and_unnamed.a = 5;
with_vtable_and_unnamed.b = 0;
with_vtable_and_unnamed.c = 5;
Index: lldb/test/API/lang/cpp/bitfields/TestCppBitfields.py
===================================================================
--- lldb/test/API/lang/cpp/bitfields/TestCppBitfields.py
+++ lldb/test/API/lang/cpp/bitfields/TestCppBitfields.py
@@ -145,8 +145,6 @@
self.expect_expr("base_with_vtable", result_children=base_with_vtable_children)
self.expect_var_path("base_with_vtable", children=base_with_vtable_children)
- # FIXME: These all crash due the vtable ptr.
- @skipIf
@no_debug_info_test
def test_bitfield_behind_vtable_ptr(self):
self.build()
@@ -164,7 +162,7 @@
# Test a class with a vtable ptr and unnamed bitfield directly after.
with_vtable_and_unnamed_children = [
- ValueCheck(name="", type="unsigned int:4", value="0"),
+ ValueCheck(name="", type="int:4", value="0"),
ValueCheck(name="b", type="unsigned int:4", value="0"),
ValueCheck(name="c", type="unsigned int:4", value="5")
]
Index: lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
===================================================================
--- lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
+++ lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
@@ -2675,11 +2675,6 @@
// FIXME: Remove the workarounds below and make this const.
MemberAttributes attrs(die, parent_die, module_sp);
- // Skip artificial members such as vtable pointers.
- // FIXME: This check should verify that this is indeed an artificial member
- // we are supposed to ignore.
- if (attrs.is_artificial)
- return;
const bool class_is_objc_object_or_interface =
TypeSystemClang::IsObjCObjectOrInterfaceType(class_clang_type);
@@ -2845,6 +2840,17 @@
last_field_info.SetIsBitfield(false);
}
+ // Don't turn artificial members such as vtable pointers into real FieldDecls
+ // in our AST. Clang will re-create those articial members and they would
+ // otherwise just overlap in the layout with the FieldDecls we add here.
+ // This needs to be done after updating FieldInfo which keeps track of where
+ // field start/end so we don't later try to fill the the space of this
+ // artificial member with (unnamed bitfield) padding.
+ // FIXME: This check should verify that this is indeed an artificial member
+ // we are supposed to ignore.
+ if (attrs.is_artificial)
+ return;
+
if (!member_clang_type.IsCompleteType())
member_clang_type.GetCompleteType();
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D112697.383574.patch
Type: text/x-patch
Size: 3066 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20211030/a93e6425/attachment-0001.bin>
More information about the lldb-commits
mailing list