diff options
author | Michael Buch <michaelbuch12@gmail.com> | 2024-06-14 11:49:12 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-06-14 11:49:12 +0100 |
commit | b650764b16b5c8790325775ac5f87f0b1c0beca7 (patch) | |
tree | d507081a96561f950184d6df96af4e3f8c98f816 /lldb | |
parent | 71f8b441ed6a944ceb4530b49e8588dcbb1e0066 (diff) | |
download | llvm-b650764b16b5c8790325775ac5f87f0b1c0beca7.zip llvm-b650764b16b5c8790325775ac5f87f0b1c0beca7.tar.gz llvm-b650764b16b5c8790325775ac5f87f0b1c0beca7.tar.bz2 |
[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
Diffstat (limited to 'lldb')
-rw-r--r-- | lldb/test/Shell/Expr/Inputs/objc-cast.cpp | 1 | ||||
-rw-r--r-- | lldb/test/Shell/Expr/TestObjCIDCast.test | 9 |
2 files changed, 10 insertions, 0 deletions
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 0000000..76e8197 --- /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 0000000..0611171 --- /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 |