-
Notifications
You must be signed in to change notification settings - Fork 341
[lldb] Adapt class resolution to work without reflection in binaries #8105
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
[lldb] Adapt class resolution to work without reflection in binaries #8105
Conversation
5e1a1dc
to
c375d88
Compare
|
||
if (supers.size() == 0) { | ||
LLDBTypeInfoProvider tip(*this, *instance_ts); | ||
// Try out the instance pointer based super class traversion first, as its |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// Try out the instance pointer based super class traversion first, as its | |
// Try out the instance-pointer-based super class traversal first, as its |
reflection_ctx->ForEachSuperClassType(&tip, ts->GetDescriptorFinder(), tr, | ||
superclass_finder); | ||
|
||
if (supers.empty()) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why twice the same condition in a row?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Dynamic type resolution first tries the pointer-based ForEachSuperClassType
, if that fails, it tries the typeref-based ForEachSuperClassType
, if that also fails then we're out of luck.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think my question was aiming at: does ForEachSuperClassType modify supers
?
Otherwise why isn't this
if (supers.empty()) {
ForEachSuperClassType ...;
LLDB_LOG
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, it's being captured by reference by the superclass_finder
lambda
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you add a test for this?
This is not testable by itself, I'll add a test to #8112 which works in conjunction with this patch to debug embedded Swift programs. |
c375d88
to
c543eec
Compare
@swift-ci test |
@swift-ci test Windows |
|
||
auto start = | ||
m_reflection_ctx.computeUnalignedFieldStartOffset(type_ref); | ||
if (!start) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you wrap this in if(GetLog(LLDBLog::Types)), so we don't do the string operations if we don't log?
When metadata is stripped (or simply not emitted) in the binary, querying reflection information starting out from a class's instance pointer will not work. Adapt SwiftLanguageRuntimeDynamicTypeResolution to handle this use case gracefully.
c543eec
to
305488b
Compare
@swift-ci test |
@swift-ci test Windows |
1 similar comment
@swift-ci test Windows |
When metadata is stripped (or simply not emitted) in the binary, querying reflection information starting out from a class's instance pointer will not work. Adapt SwiftLanguageRuntimeDynamicTypeResolution to handle this use case gracefully.