Skip to content

[lldb][Type Completion] Fix completion of ObjCObjectTypes #8890

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conversation

Michael137
Copy link

The problem was introduced in:

commit e68f76a9e59104e2bfb972155af8ff04310cd078
Author: Michael Buch <[email protected]>
Date:   Fri Feb 16 14:35:34 2024 +0000

    [lldb][TypeSystemClang][NFCI] Factor completion logic out of GetCompleteQualType

This introduced an incorrect llvm::dyn_cast_or_null check causing us to incorrectly claim that we failed to complete a type.

This manifested in a crash when running following expression:

expr -l objc -- *(id)0x1234

rdar://129633122

@Michael137 Michael137 requested a review from adrian-prantl June 13, 2024 11:15
Copy link

@adrian-prantl adrian-prantl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The patch LGTM, but can you also cherry-pick the accompanying test?

@Michael137
Copy link
Author

@swift-ci test

The problem was introduced in:
```
commit e68f76a9e59104e2bfb972155af8ff04310cd078
Author: Michael Buch <[email protected]>
Date:   Fri Feb 16 14:35:34 2024 +0000

    [lldb][TypeSystemClang][NFCI] Factor completion logic out of GetCompleteQualType
```

This introduced an incorrect `llvm::dyn_cast_or_null` check
causing us to incorrectly claim that we failed to complete a type.

This manifested in a crash when running following expression:
```
expr -l objc -- *(id)0x1234
```

rdar://129633122
This is a minimal reproducer for a crash reported internally
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
@Michael137 Michael137 force-pushed the lldb/crash/get-complete-objc-type-to-6.0 branch from 499db77 to a92275f Compare June 14, 2024 06:34
@Michael137
Copy link
Author

@swift-ci test

@adrian-prantl adrian-prantl merged commit d1048cb into swiftlang:swift/release/6.0 Jun 14, 2024
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants