From ca9dfdfaecaa13fc075858a2965fd2f43e7bc8e1 Mon Sep 17 00:00:00 2001 From: Raphael Isemann Date: Sun, 21 Jul 2019 10:31:13 +0000 Subject: [lldb] Fix crash when looking up type coming from the ClangModuleDeclVendor Summary: We assume in LLDB that every type comes from an ASTContext with an associated ClangASTContext. However the types inside the ClangModuleDeclVendor don't have a ClangASTContext so we end up crashing whenever we create a CompilerType for one of these types. Simplest way to trigger this bug is to just look up NSObject from a module: (lldb) expr @import Foundation (lldb) type lookup NSObject Assertion failed: (m_type_system != nullptr), function CompilerType, file /Users/teemperor/llvm1/llvm-project/lldb/source/Symbol/CompilerType.cpp, line 39. This patch just creates a ClangASTContext for the ASTContext used by ClangModuleDeclVendor. Reviewers: davide, shafik Reviewed By: davide Subscribers: lldb-commits Tags: #lldb Differential Revision: https://reviews.llvm.org/D64989 llvm-svn: 366653 --- .../Python/lldbsuite/test/lang/objc/modules/TestObjCModules.py | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'lldb/packages/Python/lldbsuite/test') diff --git a/lldb/packages/Python/lldbsuite/test/lang/objc/modules/TestObjCModules.py b/lldb/packages/Python/lldbsuite/test/lang/objc/modules/TestObjCModules.py index 8f5c407000c..4e40c58effa 100644 --- a/lldb/packages/Python/lldbsuite/test/lang/objc/modules/TestObjCModules.py +++ b/lldb/packages/Python/lldbsuite/test/lang/objc/modules/TestObjCModules.py @@ -60,6 +60,10 @@ class ObjCModulesTestCase(TestBase): "int", "4"]) + # Type lookup should still work and print something reasonable + # for types from the module. + self.expect("type lookup NSObject", substrs=["instanceMethod"]) + self.expect("expr string.length", VARIABLES_DISPLAYED_CORRECTLY, substrs=["NSUInteger", "5"]) -- cgit v1.2.3