Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork32.1k
[3.14] gh-91048: Refactor and optimize remote debugging module (#134652)#134673
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Merged
Uh oh!
There was an error while loading.Please reload this page.
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
…#134652)Completely refactor Modules/_remote_debugging_module.c with improvedcode organization, replacing scattered reference counting and errorhandling with centralized goto error paths. This cleanup improvesmaintainability and reduces code duplication throughout the module whilepreserving the same external API.Implement memory page caching optimization in Python/remote_debug.h toavoid repeated reads of the same memory regions during debuggingoperations. The cache stores previously read memory pages and reusesthem for subsequent reads, significantly reducing system calls andimproving performance.Add code object caching mechanism with a new code_object_generationfield in the interpreter state that tracks when code object caches needinvalidation. This allows efficient reuse of parsed code object metadataand eliminates redundant processing of the same code objects acrossdebugging sessions.Optimize memory operations by replacing multiple individual structurecopies with single bulk reads for the same data structures. This reducesthe number of memory operations and system calls required to gatherdebugging information from the target process.Update Makefile.pre.in to include Python/remote_debug.h in the headerslist, ensuring that changes to the remote debugging header force properrecompilation of dependent modules and maintain build consistency acrossthe codebase.Also, make the module compatible with the free threading build as an extra :)Co-authored-by: Łukasz Langa <lukasz@langa.pl>(cherry picked from commit42b25ad)
Checked with the 3.14 release manager for backport ✅ |
1822f33
intopython:3.14 46 checks passed
Uh oh!
There was an error while loading.Please reload this page.
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading.Please reload this page.
Completely refactor Modules/_remote_debugging_module.c with improved code organization, replacing scattered reference counting and error handling with centralized goto error paths. This cleanup improves maintainability and reduces code duplication throughout the module while preserving the same external API.
Implement memory page caching optimization in Python/remote_debug.h to avoid repeated reads of the same memory regions during debugging operations. The cache stores previously read memory pages and reuses them for subsequent reads, significantly reducing system calls and improving performance.
Add code object caching mechanism with a new code_object_generation field in the interpreter state that tracks when code object caches need invalidation. This allows efficient reuse of parsed code object metadata and eliminates redundant processing of the same code objects across debugging sessions.
Optimize memory operations by replacing multiple individual structure copies with single bulk reads for the same data structures. This reduces the number of memory operations and system calls required to gather debugging information from the target process.
Update Makefile.pre.in to include Python/remote_debug.h in the headers list, ensuring that changes to the remote debugging header force proper recompilation of dependent modules and maintain build consistency across the codebase.
Also, make the module compatible with the free threading build as an extra :)
Co-authored-by: Łukasz Langalukasz@langa.pl
(cherry picked from commit42b25ad)
📚 Documentation preview 📚:https://cpython-previews--134673.org.readthedocs.build/