Skip to content

Commit

Permalink
[lldb][test] Add test for completing ObjCObjectType (llvm#95405)
Browse files Browse the repository at this point in the history
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
  • Loading branch information
Michael137 authored Jun 14, 2024
1 parent 71f8b44 commit b650764
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
1 change: 1 addition & 0 deletions lldb/test/Shell/Expr/Inputs/objc-cast.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
int main() { return 0; }
9 changes: 9 additions & 0 deletions lldb/test/Shell/Expr/TestObjCIDCast.test
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit b650764

Please sign in to comment.