-
Notifications
You must be signed in to change notification settings - Fork 341
[lldb][swift] Add function to extract funclet numbers #10247
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][swift] Add function to extract funclet numbers #10247
Conversation
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.
Looks good. I have a few comments.
if (node_id) | ||
return node_id->getIndex(); |
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.
since I've seen all sorts of invariants break with demangled node trees, this should probably include a check to node_id->hasIndex()
.
using namespace swift::Demangle; | ||
Context ctx; | ||
NodePointer node = SwiftLanguageRuntime::DemangleSymbolAsNode(name, ctx); | ||
return GetFuncletNumber(node); |
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 there be a log (perhaps verbose only) to capture symbols that fail to get a funclet number?
return GetFuncletNumber(node); | |
auto number = GetFuncletNumber(node); | |
if (node && !number) | |
LLDB_LOG(..., "could not get funclet number for mangled name {0}", name); | |
return number; |
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 challenge with this is that the StringRef
overload of this function is only used for testing.
The real users of this function will use the NodePointer
overload (which is called by the StringRef overload), as they use the NodePointer
for other purposes. As such, we wouldn't be logging on the most important path (there is no way to grab the name from the NodePointer).
With that in mind, I'll make sure to add logging on the next PR, the one that uses these functions to filter breakpoints.
if (!IsSwiftMangledName(name)) | ||
return {}; |
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 this is redundant.
Async functions are broken into many pieces, and each piece is identified by an integer number in the mangling scheme. This establishes an ordering between funclets which we can exploit, in a subsequent commit, to filter out multiple breakpoints locations attributed to the same line. An exception: entry funclets don't have such a number. This commit assigns 0 to them, to better reflect the intent of ordering funclets.
298995a
to
9cb2811
Compare
@swift-ci test |
Async functions are broken into many pieces, and each piece is identified by an integer number in the mangling scheme. This establishes an ordering between funclets which we can exploit, in a subsequent commit, to filter out multiple breakpoints locations attributed to the same line.
An exception: entry funclets don't have such a number. This commit assigns 0 to them, to better reflect the intent of ordering funclets.