-
Notifications
You must be signed in to change notification settings - Fork 362
Fix CPU Profiler with "advanced developer mode" is enabled #9528
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: master
Are you sure you want to change the base?
Conversation
| } | ||
| } else { | ||
| final functions = samples.functions; | ||
| if (functions == null || index >= functions.length) return null; |
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 check index >= functions.length is not strictly necessary but I want to be extra safe.
| "tid": 100, | ||
| "timestamp": 50, | ||
| "stack": [0, 1], | ||
| "_codeStack": [2] |
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.
Before the change, the regression test would fail because we would try to index into functions[2] which only has 2 items
jakemac53
left a comment
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.
🚀
Fixes #9526
Fixes bug in implementation of
getResolvedUrlwhich was throwing an index out of range error when advanced developer mode was enabled.When advanced developer mode is enabled, the CPU profile also includes the code tree. Therefore, in the original ternary,
isCodeTreeis true. The issue happened when_function is vm_service.FuncRef?was false. Then we would fall back to the false case in the ternary. We would then try to index into the profile's functions list with an index that was actually intended for the code objects list.