[Lldb-commits] [lldb] [lldb] Fix crash missing MSInheritanceAttr on CXXRecordDecl with DWARF on Windows (PR #112928)
Stefan Gränitz via lldb-commits
lldb-commits at lists.llvm.org
Tue Oct 22 02:14:33 PDT 2024
https://github.com/weliveindetail updated https://github.com/llvm/llvm-project/pull/112928
>From bb66f56138cab9651aff4ac09096ede975c90701 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Stefan=20Gr=C3=A4nitz?= <stefan.graenitz at gmail.com>
Date: Fri, 18 Oct 2024 17:44:26 +0200
Subject: [PATCH 1/2] [lldb] Fix crash due to missing MSInheritanceAttr on
CXXRecordDecl for DWARF on Windows
---
lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp | 3 +++
1 file changed, 3 insertions(+)
diff --git a/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp b/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
index fe0c53a7e9a3ea..a23dce97f3f299 100644
--- a/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
+++ b/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
@@ -2771,6 +2771,9 @@ static bool GetCompleteQualType(clang::ASTContext *ast,
ast, llvm::cast<clang::AttributedType>(qual_type)->getModifiedType(),
allow_completion);
+ case clang::Type::MemberPointer:
+ return !qual_type.getTypePtr()->isIncompleteType();
+
default:
break;
}
>From 6f775566a4face29f85286295aafb16c4367a917 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Stefan=20Gr=C3=A4nitz?= <stefan.graenitz at gmail.com>
Date: Tue, 22 Oct 2024 11:11:53 +0200
Subject: [PATCH 2/2] Add test based on
https://reviews.llvm.org/D130942#change-1PvUCFvQjDIO
---
.../Shell/SymbolFile/DWARF/x86/ms-abi.cpp | 45 +++++++++++++++++++
1 file changed, 45 insertions(+)
create mode 100644 lldb/test/Shell/SymbolFile/DWARF/x86/ms-abi.cpp
diff --git a/lldb/test/Shell/SymbolFile/DWARF/x86/ms-abi.cpp b/lldb/test/Shell/SymbolFile/DWARF/x86/ms-abi.cpp
new file mode 100644
index 00000000000000..0e51ec99934f4c
--- /dev/null
+++ b/lldb/test/Shell/SymbolFile/DWARF/x86/ms-abi.cpp
@@ -0,0 +1,45 @@
+// REQUIRES: lld
+
+// Check that we don't crash on variables without MSInheritanceAttr
+
+// RUN: %clang -c --target=x86_64-windows-msvc -gdwarf %s -o %t.obj
+// RUN: lld-link /out:%t.exe %t.obj /nodefaultlib /entry:main /debug
+// RUN: %lldb -f %t.exe -b -o "target variable mp1 mp2 mp3 mp4 mp5 mp6 mp7 mp8 mp9"
+
+class SI {
+ int si;
+};
+struct SI2 {
+ int si2;
+};
+class MI : SI, SI2 {
+ int mi;
+};
+class MI2 : MI {
+ int mi2;
+};
+class VI : virtual MI {
+ int vi;
+};
+class VI2 : virtual SI, virtual SI2 {
+ int vi;
+};
+class /* __unspecified_inheritance*/ UI;
+
+typedef void (SI::*SITYPE)();
+typedef void (MI::*MITYPE)();
+typedef void (MI2::*MI2TYPE)();
+typedef void (VI::*VITYPE)();
+typedef void (VI2::*VI2TYPE)();
+typedef void (UI::*UITYPE)();
+SITYPE mp1 = nullptr;
+MITYPE mp2 = nullptr;
+MI2TYPE mp3 = nullptr;
+VITYPE mp4 = nullptr;
+VI2TYPE mp5 = nullptr;
+UITYPE mp6 = nullptr;
+MITYPE *mp7 = nullptr;
+VI2TYPE *mp8 = nullptr;
+int SI::*mp9 = nullptr;
+
+int main() {}
More information about the lldb-commits
mailing list