diff --git a/lldb/source/Plugins/SymbolFile/PDB/PDBASTParser.cpp b/lldb/source/Plugins/SymbolFile/PDB/PDBASTParser.cpp --- a/lldb/source/Plugins/SymbolFile/PDB/PDBASTParser.cpp +++ b/lldb/source/Plugins/SymbolFile/PDB/PDBASTParser.cpp @@ -345,6 +345,10 @@ return name == "`anonymous namespace'" || name == "`anonymous-namespace'"; } +static bool IsSpecialNameObjC(llvm::StringRef name) { + return name == "objc_object" || name == "objc_class"; +} + static clang::CallingConv TranslateCallingConvention(PDB_CallingConv pdb_cc) { switch (pdb_cc) { case llvm::codeview::CallingConvention::NearC: @@ -393,16 +397,16 @@ // union Union { short Row; short Col; } // Such symbols will be handled here. - // Some UDT with trival ctor has zero length. Just ignore. - if (udt->getLength() == 0) - return nullptr; - // Ignore unnamed-tag UDTs. std::string name = std::string(MSVCUndecoratedNameParser::DropScope(udt->getName())); if (name.empty()) return nullptr; + // Some UDT with trival ctor has zero length. Just ignore. + if (udt->getLength() == 0 && !IsSpecialNameObjC(name)) + return nullptr; + auto decl_context = GetDeclContextContainingSymbol(type); // PDB has no attribute to encode the language per symbol. We assume @@ -1406,6 +1410,12 @@ TypeSystemClang::CompleteTagDeclarationDefinition(base_comp_type); } + if (TypeSystemClang::IsObjCObjectOrInterfaceType(base_comp_type)) { + m_ast.SetObjCSuperClass(record_type, base_comp_type); + assert(bases_enum.getNext() == nullptr && "Single inheritance only"); + return; + } + auto access = TranslateMemberAccess(base->getAccess()); auto is_virtual = base->isVirtualBaseClass(); diff --git a/lldb/test/Shell/Expr/objc-gnustep-print-pdb.m b/lldb/test/Shell/Expr/objc-gnustep-print-pdb.m --- a/lldb/test/Shell/Expr/objc-gnustep-print-pdb.m +++ b/lldb/test/Shell/Expr/objc-gnustep-print-pdb.m @@ -41,26 +41,30 @@ } @end -// RUN: %lldb -b -o "b objc-gnustep-print-pdb.m:67" -o "run" -o "p ptr" -o "p *ptr" -- %t | FileCheck %s +// RUN: %lldb -b -o "b objc-gnustep-print-pdb.m:72" -o "run" -o "p ptr" -o "p *ptr" -- %t | FileCheck %s // -// CHECK: (lldb) b objc-gnustep-print-pdb.m:67 -// CHECK: Breakpoint {{.*}} at objc-gnustep-print-pdb.m:67 +// CHECK: (lldb) b objc-gnustep-print-pdb.m:72 +// CHECK: Breakpoint {{.*}} at objc-gnustep-print-pdb.m:72 // // CHECK: (lldb) run // CHECK: Process {{[0-9]+}} stopped -// CHECK: frame #0: {{.*}}`main at objc-gnustep-print-pdb.m:67 +// CHECK: frame #0: {{.*}}`main at objc-gnustep-print-pdb.m:72 // // CHECK: (lldb) p ptr // CHECK: (TestObj *) $0 = 0x{{[0-9]+}} // // CHECK: (lldb) p *ptr // CHECK: (TestObj) $1 = { -// CHECK: _int -// CHECK: _float -// CHECK: _char -// CHECK: _ptr_void -// CHECK: _ptr_nsobject -// CHECK: _id_objc +// CHECK: NSObject = { +// CHECK: isa = 0x{{[0-9]+}} +// CHECK: refcount +// CHECK: } +// CHECK: _int = 0 +// CHECK: _float = 0 +// CHECK: _char = '\0' +// CHECK: _ptr_void = 0x{{0+}} +// CHECK: _ptr_nsobject = nil +// CHECK: _id_objc = nil // CHECK: } int main() {