-
Notifications
You must be signed in to change notification settings - Fork 341
[lldb][formatter] Add children of Swift Tasks #10057
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][formatter] Add children of Swift Tasks #10057
Conversation
@swift-ci test |
mangledTypenameForTasksTuple(tasks.size()); | ||
CompilerType tasks_tuple_type = | ||
m_ts->GetTypeFromMangledTypename(ConstString(mangled_typename)); | ||
DataExtractor data{tasks.data(), tasks.size() * sizeof(tasks[0]), |
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.
The use of sizeof
raises an eyebrow. Wouldn't you want the size of a task on the target here? (For example because of 32-bit pointers on watchOS)
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.
The reason I did this is because data at hand (an lldb defined struct, AsyncTaskInfo
), is internal lldb data. It comes from the target, but at this point it's internal data, not target data. Does that sound reasonable to you? It definitely felt like an uncommon scenario as I wrote this.
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.
Oh, if this is a host
data structure then this is of course fine!
CompilerType tasks_tuple_type = | ||
m_ts->GetTypeFromMangledTypename(ConstString(mangled_typename)); | ||
DataExtractor data{tasks.data(), tasks.size() * sizeof(tasks[0]), | ||
endian::InlHostByteOrder(), sizeof(void *)}; |
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.
Maybe use multiples of the pointer size on the target, since we still need to bake in this knowledge.
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.
Same comment, may have been my misunderstanding!
structure->addChild( | ||
factory.createNode(Kind::Module, ::swift::STDLIB_NAME), factory); | ||
structure->addChild( | ||
factory.createNode(Kind::Identifier, "UnsafeCurrentTask"), factory); |
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.
In case you didn't already know, we also have
CompilerType
CreateTupleType(const std::vector<TupleElement> &elements);
in TypeSystemSwift.
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 didn't, thanks.
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.
hmm, that interface isn't a match for this use case. I don't have a CompilerType
instance for the element types. I could create one, but is it worth it to mangle the element type only for CreateTupleType
to demangle it?
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.
Probably 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 is great! Just a couple questions inside.
@swift-ci test |
@swift-ci test macOS |
When displaying a Swift `Task`, include its child tasks. This adds a `children` child to the `Task` synthetic provider. The type of `children` is a dynamically constructed tuple of N `UnsafeCurrentTask`, where N is the number of child tasks. This allows users to see structured concurrency child tasks, in particular `async let` child tasks, and `TaskGroup` child tasks. (cherry-picked from commit 0e7ec03)
When displaying a Swift `Task`, include its child tasks. This adds a `children` child to the `Task` synthetic provider. The type of `children` is a dynamically constructed tuple of N `UnsafeCurrentTask`, where N is the number of child tasks. This allows users to see structured concurrency child tasks, in particular `async let` child tasks, and `TaskGroup` child tasks. (cherry-picked from commit 0e7ec03)
When displaying a Swift
Task
, include its child tasks.This adds a
children
child to theTask
synthetic provider. The type ofchildren
is a dynamically constructed tuple of NUnsafeCurrentTask
, where N is the number of child tasks.This allows users to see structured concurrency child tasks, in particular
async let
child tasks, andTaskGroup
child tasks.