bpo-45637: Store the frame pointer in the cframe#29267
bpo-45637: Store the frame pointer in the cframe#29267pablogsal merged 2 commits intopython:mainfrom
Conversation
There was a problem hiding this comment.
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 |
pablogsal
left a comment
There was a problem hiding this comment.
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
framelocal 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