cpython/Objects
Pablo Galindo Salgado 1822f33b1a
[3.14] gh-91048: Refactor and optimize remote debugging module (#134652) (#134673)
gh-91048: Refactor and optimize remote debugging module (#134652)

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 Langa <lukasz@langa.pl>

(cherry picked from commit 42b25ad4d3)
2025-05-25 22:10:20 +00:00
..
clinic
mimalloc
stringlib
abstract.c
boolobject.c
bytearrayobject.c
bytes_methods.c
bytesobject.c [3.14] gh-133767: Fix use-after-free in the unicode-escape decoder with an error handler (GH-129648) (GH-133942) 2025-05-13 16:25:08 +03:00
call.c
capsule.c
cellobject.c
classobject.c Revert "gh-124715: Fix method_dealloc(): use PyObject_GC_UnTrack() (#133199)" (#133434) 2025-05-05 17:04:43 +02:00
codeobject.c [3.14] gh-91048: Refactor and optimize remote debugging module (#134652) (#134673) 2025-05-25 22:10:20 +00:00
complexobject.c
descrobject.c
dictnotes.txt
dictobject.c [3.14] gh-132641: fix race in lru_cache under free-threading (GH-133787) (#133979) 2025-05-14 07:11:38 +00:00
enumobject.c
exceptions.c
fileobject.c
floatobject.c gh-133304: workaround for RISC-V in PyFloat_Pack4/Unpack4() (#133328) 2025-05-03 17:07:52 +02:00
frameobject.c
funcobject.c [3.14] gh-132775: Unrevert "Add _PyCode_VerifyStateless()" (gh-133625) 2025-05-08 00:00:33 +00:00
genericaliasobject.c
genobject.c
interpolationobject.c [3.14] gh-133970: Make PEP750 types generic (GH-133976) (#134029) 2025-05-15 06:39:39 +00:00
iterobject.c
listobject.c
listsort.txt
lnotab_notes.txt
longobject.c [3.14] gh-133583: Add support for fixed size unsigned integers in argument parsing (GH-133584) (GH-133650) 2025-05-08 09:54:44 +00:00
memoryobject.c
methodobject.c
moduleobject.c
namespaceobject.c
object.c [3.14] gh-133980: use atomic store in PyObject_GenericSetDict (GH-133988) (#134354) 2025-05-21 15:06:39 +05:30
object_layout.md
object_layout_312.gv
object_layout_312.png
object_layout_313.gv
object_layout_313.png
object_layout_full_312.gv
object_layout_full_312.png
object_layout_full_313.gv
object_layout_full_313.png
obmalloc.c
odictobject.c
picklebufobject.c
rangeobject.c
README
setobject.c
sliceobject.c
structseq.c
templateobject.c [3.14] gh-134119: Fix crash from calling next() on exhausted template iterator (GH-134120) (#134153) 2025-05-17 19:48:54 +00:00
tupleobject.c
typeobject.c [3.14] gh-133778: Fix setting __annotations__ under PEP 563 (GH-133794) (#134655) 2025-05-25 16:04:22 +00:00
typeslots.inc Revert "gh-133395: add option for extension modules to specialize BINARY_OP/SUBSCR, apply to arrays (#133396)" (#133498) 2025-05-06 13:12:26 +03:00
typeslots.py
typevarobject.c
unicodectype.c
unicodeobject.c [3.14] gh-133968: Add fast path to PyUnicodeWriter_WriteStr() (GH-133969) (#133971) 2025-05-13 13:58:25 +00:00
unicodetype_db.h
unionobject.c
weakrefobject.c

Source files for various builtin objects