-
Notifications
You must be signed in to change notification settings - Fork 343
Return a SwiftArrayEmptyBufferHandler if loc points to an EmptyArray Symbol. #10920
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
base: next
Are you sure you want to change the base?
Return a SwiftArrayEmptyBufferHandler if loc points to an EmptyArray Symbol. #10920
Conversation
…Symbol. If we have a ValueObjectSP who's storage_location points to a S_swiftEmptyArrayStorage symbol, return a SwiftArrayEmptyBufferHandler
// a SwiftArrayEmptyBufferHandler. | ||
if (auto *symbol = addr.CalculateSymbolContextSymbol()) { | ||
auto mangledName = symbol->GetMangled().GetMangledName().GetStringRef(); | ||
if (mangledName == "$ss19__EmptyArrayStorageCN") { |
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.
should this be _swiftEmptyArrayStorage
?
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 am checking the mangled name:
> xcrun swift-demangle ss19__EmptyArrayStorageCN
$ss19__EmptyArrayStorageCN ---> type metadata for Swift.__EmptyArrayStorage
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.
When I inspect an empty array, I see:
(lldb) v -R -T -d no-dynamic-values
(Swift.Array<main.P>) x = {
(Swift._ArrayBuffer<main.P>) _buffer = {
(Swift._BridgeStorage<Swift.__ContiguousArrayStorageBase>) _storage = {
(Builtin.BridgeObject) rawValue = 0x00000001f52cd120 _swiftEmptyArrayStorage
}
}
}
I don't see where $ss19__EmptyArrayStorageCN
comes into play. Also the PR description mentions _swiftEmptyArrayStorage
but the changed code does not.
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.
This mangled name is for the type metadata for Swift.__EmptyArrayStorage
.
- You probably want to match against
Swift.__EmptyArrayStorage
itself. - Instead of depending on the mangling it would be better to use the helpers in SwiftDemangling.h to make sure you have the expected demangle tree for a class with the right name in STDLIB_MODULENAME.
target, process, thread, breakpoint1 = lldbutil.run_to_source_breakpoint( | ||
self, "break here", filespec | ||
) | ||
self.expect("p x", substrs=["([a.P]) 0 values {}"]) |
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.
for tests we use frame var
or expr
to be explicit whether it's use expression evaluation or not.
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.
Even better would be
x = self.frame().FindVariable("x")
lldbutil.check_variable(self, x, summary="0 values")
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.
or self.assertEqual(x.GetSummary(), "0 values")
|
||
self.build() | ||
filespec = lldb.SBFileSpec("main.swift") | ||
target, process, thread, breakpoint1 = lldbutil.run_to_source_breakpoint( |
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.
target, process, thread, breakpoint1 = lldbutil.run_to_source_breakpoint( | |
lldbutil.run_to_source_breakpoint( |
self.build() | ||
filespec = lldb.SBFileSpec("main.swift") | ||
target, process, thread, breakpoint1 = lldbutil.run_to_source_breakpoint( | ||
self, "break here", filespec |
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.
self, "break here", filespec | |
self, "break here", lldb.SBFileSpec("main.swift") |
If we have a ValueObjectSP who's storage_location points to a
S_swiftEmptyArrayStorage
symbol, return aSwiftArrayEmptyBufferHandler