https://github.com/robk-dev updated 
https://github.com/llvm/llvm-project/pull/216711

>From d5b5edb2026ca75ade12ac6bdaf553e9e651f2f6 Mon Sep 17 00:00:00 2001
From: Rob <[email protected]>
Date: Wed, 12 Aug 2026 23:37:16 +0100
Subject: [PATCH] [lldb] Guard MS inheritance model against non-CXXRecordDecl
 DWARF types

CompleteRecordType() computes the MSInheritanceAttr for the Microsoft
C++ ABI by calling calculateInheritanceModel() on the record's
CXXRecordDecl. Objective-C interface types complete through the same
path but are ObjCInterfaceDecls, so GetAsCXXRecordDecl() returns null
and the Microsoft-ABI block crashed on every Objective-C type
completion for *-windows-msvc targets. Guard it the same way as the
SetRecordLayout call above.

Found debugging GNUstep Objective-C programs on Windows, where any
`frame variable` touching an object type crashed LLDB.

Assisted-by: Claude Fable 5
---
 .../source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp 
b/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
index b60f1d9e41958..24b5d73fd1d80 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
@@ -2244,8 +2244,10 @@ bool DWARFASTParserClang::CompleteRecordType(const 
DWARFDIE &die,
 
   // DWARF doesn't have the attribute, but we can infer the value the same way
   // as Clang Sema does. It's required to calculate the size of pointers to
-  // member functions of this type.
-  if (m_ast.getASTContext().getTargetInfo().getCXXABI().isMicrosoft()) {
+  // member functions of this type. Objective-C interface types reach this
+  // point too but are not CXXRecordDecls, so record_decl may be null here.
+  if (record_decl &&
+      m_ast.getASTContext().getTargetInfo().getCXXABI().isMicrosoft()) {
     auto IM = record_decl->calculateInheritanceModel();
     record_decl->addAttr(clang::MSInheritanceAttr::CreateImplicit(
         m_ast.getASTContext(), true, {},

_______________________________________________
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to