[Lldb-commits] [lldb] b650764 - [lldb][test] Add test for completing ObjCObjectType (#95405)
via lldb-commits
lldb-commits at lists.llvm.org
Fri Jun 14 03:49:17 PDT 2024
Author: Michael Buch
Date: 2024-06-14T11:49:12+01:00
New Revision: b650764b16b5c8790325775ac5f87f0b1c0beca7
URL: https://github.com/llvm/llvm-project/commit/b650764b16b5c8790325775ac5f87f0b1c0beca7
DIFF: https://github.com/llvm/llvm-project/commit/b650764b16b5c8790325775ac5f87f0b1c0beca7.diff
LOG: [lldb][test] Add test for completing ObjCObjectType (#95405)
This is a minimal reproducer for a crash where we would try to call
`DumpTypeDescription` on an incomplete type. This crash surfaced as part
of an NFC refactor of some of the logic in `GetCompleteQualType`:
```
(lldb) expr -l objc -- *(id)0x1234
Stack dump:
0. Program arguments: ./bin/lldb a.out -o "b main" -o run -o "expr -l objc -- *(id)0x1234"
Stack dump without symbol names (ensure you have llvm-symbolizer in your PATH or set the environment var LLVM_SYMBOLIZER_PATH to point to it):
0 lldb 0x0000000102ec768c llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) + 56
1 lldb 0x0000000102ec6010 llvm::sys::RunSignalHandlers() + 112
2 lldb 0x0000000102ec7fa8 SignalHandler(int) + 292
3 libsystem_platform.dylib 0x000000018c7a8c44 _sigtramp + 56
4 LLDB 0x0000000116b2030c lldb_private::TypeSystemClang::DumpTypeDescription(void*, lldb_private::Stream&, lldb::DescriptionLevel, lldb_private::ExecutionContextScope*) + 588
5 LLDB 0x00000001166b5124 lldb_private::CompilerType::DumpTypeDescription(lldb_private::Stream*, lldb::DescriptionLevel, lldb_private::ExecutionContextScope*) const + 228
6 LLDB 0x0000000116d4f08c IRForTarget::CreateResultVariable(llvm::Function&) + 2076
```
rdar://129633122
Added:
lldb/test/Shell/Expr/Inputs/objc-cast.cpp
lldb/test/Shell/Expr/TestObjCIDCast.test
Modified:
Removed:
################################################################################
diff --git a/lldb/test/Shell/Expr/Inputs/objc-cast.cpp b/lldb/test/Shell/Expr/Inputs/objc-cast.cpp
new file mode 100644
index 0000000000000..76e8197013aab
--- /dev/null
+++ b/lldb/test/Shell/Expr/Inputs/objc-cast.cpp
@@ -0,0 +1 @@
+int main() { return 0; }
diff --git a/lldb/test/Shell/Expr/TestObjCIDCast.test b/lldb/test/Shell/Expr/TestObjCIDCast.test
new file mode 100644
index 0000000000000..0611171da09e2
--- /dev/null
+++ b/lldb/test/Shell/Expr/TestObjCIDCast.test
@@ -0,0 +1,9 @@
+// UNSUPPORTED: system-linux, system-windows
+//
+// RUN: %clangxx_host %p/Inputs/objc-cast.cpp -g -o %t
+// RUN: %lldb %t \
+// RUN: -o "b main" -o run -o "expression --language objc -- *(id)0x1" \
+// RUN: 2>&1 | FileCheck %s
+
+// CHECK: (lldb) expression --language objc -- *(id)0x1
+// CHECK: error: Couldn't apply expression side effects : Couldn't dematerialize a result variable: couldn't read its memory
More information about the lldb-commits
mailing list