-
-
Notifications
You must be signed in to change notification settings - Fork 30.9k
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
bpo-45637: Store the frame pointer in the cframe #29267
bpo-45637: Store the frame pointer in the cframe #29267
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.
This PR would break all current out-of-process debuggers and profilers. All these tools are reliying on iterating over all the active frames by accessing the current frame from the thread states that are obtained from the _PyRuntime symbol. Removing it from there will be a masive breakage for all these tools.
Edit: See new comment
When you're done making the requested changes, leave the comment: |
Hmmm, I just saw the current frame is still accessible through the In short, I still prefer this approach: #29257 |
Either we store a pointer to the current frame in the Regarding efficiency, storing it the cframe is (in theory) more efficient as the hottest accesses to the frame are in the interpreter. |
I agree, but we are talking about not making life more difficult for other tools not about efficiency. I think this would be workable, but I am a bit concerned about the extra hoop through the |
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.
Wait, hold on, I am cheching and this approach sadly doesn't work with threads as cframe
is still optimized out in threads :(
See: #29257 (comment) |
I think we need to just mark the test as skippable if Python is compiled with optimizations, which is the case in the ASAN build. |
What does 'optimized out' mean here? |
It means that gdb cannot read the value and shows it as "optimized out". This is a common problem if the DWARF data is not good enough to reconstruct whatever dance the optimizer is doing. |
This provides better machine level debugger support. Since the cframe is always in memory, it can be reliably found by debuggers, unlike the
frame
local variable which might be (ideally should be) in a register.In theory performance might improve a bit as the cframe is on the C stack, the fastest memory to access in any system. However benchmarking results are just noise; at least it isn't obviously slower.
https://bugs.python.org/issue45637