cpython/Objects
Pablo Galindo Salgado 42b25ad4d3
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>
2025-05-25 20:19:29 +00:00
..
clinic gh-132661: Implement PEP 750 (#132662) 2025-04-30 11:46:41 +02:00
mimalloc gh-123826: Fix unused function warnings in mimalloc on NetBSD (#123827) 2024-09-09 13:22:28 -04:00
stringlib gh-111178: remove redundant casts for functions with correct signatures (#131673) 2025-04-01 17:18:11 +02:00
abstract.c gh-131238: Remove includes from pycore_interp.h (#131495) 2025-03-20 11:35:23 +00:00
boolobject.c gh-111178: remove redundant casts for functions with correct signatures (#131673) 2025-04-01 17:18:11 +02:00
bytearrayobject.c gh-111178: remove redundant casts for functions with correct signatures (#131673) 2025-04-01 17:18:11 +02:00
bytes_methods.c gh-121165: protect macro expansion of ADJUST_INDICES with do-while(0) (#121166) 2024-07-02 16:27:51 +05:30
bytesobject.c gh-133767: Fix use-after-free in the unicode-escape decoder with an error handler (GH-129648) 2025-05-12 20:42:23 +03:00
call.c gh-106320: Remove _PyFunction_Vectorcall() API (#107071) 2023-07-22 21:44:33 +00:00
capsule.c gh-111178: fix UBSan failures in Objects/capsule.c (GH-128239) 2025-01-08 14:55:04 +01:00
cellobject.c gh-127271: Replace use of PyCell_GET/SET (gh-127272) 2024-12-03 10:33:06 -08:00
classobject.c Revert "gh-124715: Fix method_dealloc(): use PyObject_GC_UnTrack() (#133199)" (#133434) 2025-05-05 17:04:43 +02:00
codeobject.c gh-91048: Refactor and optimize remote debugging module (#134652) 2025-05-25 20:19:29 +00:00
complexobject.c gh-111178: Change Argument Clinic signature for @classmethod (#131157) 2025-03-12 17:42:07 +01:00
descrobject.c GH-124715: Move trashcan mechanism into Py_Dealloc (GH-132280) 2025-04-30 11:37:53 +01:00
dictnotes.txt bpo-46845: Reduce dict size when all keys are Unicode (GH-31564) 2022-03-02 08:09:28 +09:00
dictobject.c gh-132641: fix race in lru_cache under free-threading (#133787) 2025-05-13 17:38:57 +00:00
enumobject.c gh-131525: Cache the result of tuple_hash (#131529) 2025-03-27 09:57:06 -04:00
exceptions.c GH-124715: Move trashcan mechanism into Py_Dealloc (GH-132280) 2025-04-30 11:37:53 +01:00
fileobject.c gh-111178: fix UBSan failures for PyStdPrinter_Object (#131607) 2025-03-24 10:57:14 +01:00
floatobject.c gh-133304: workaround for RISC-V in PyFloat_Pack4/Unpack4() (#133328) 2025-05-03 17:07:52 +02:00
frameobject.c GH-124715: Move trashcan mechanism into Py_Dealloc (GH-132280) 2025-04-30 11:37:53 +01:00
funcobject.c gh-132775: Unrevert "Add _PyCode_VerifyStateless()" (gh-133528) 2025-05-08 00:00:33 +00:00
genericaliasobject.c gh-111178: remove redundant casts for functions with correct signatures (#131673) 2025-04-01 17:18:11 +02:00
genobject.c gh-131738: optimize builtin any/all/tuple calls with a generator expression arg (#131737) 2025-03-28 10:35:20 +00:00
interpolationobject.c gh-133970: Make PEP750 types generic (#133976) 2025-05-15 09:11:46 +03:00
iterobject.c gh-131666: mark anext_awaitable.close as a METH_NOARGS instead of METH_VARARGS (#131671) 2025-03-25 09:03:22 +05:30
listobject.c gh-100239: specialize BINARY_OP/SUBSCR for list-slice (#132626) 2025-05-01 10:28:52 +00:00
listsort.txt GH-116939: Rewrite binarysort() (#116940) 2024-03-21 22:27:25 -05:00
lnotab_notes.txt gh-119786: add code object doc, inline locations.md into it (#126832) 2024-11-22 19:27:41 +00:00
longobject.c gh-133583: Add support for fixed size unsigned integers in argument parsing (GH-133584) 2025-05-08 12:27:50 +03:00
memoryobject.c gh-132776: Revert Moving memoryview XIData Code to memoryobject.c (gh-132960) 2025-04-25 16:43:50 +00:00
methodobject.c GH-124715: Move trashcan mechanism into Py_Dealloc (GH-132280) 2025-04-30 11:37:53 +01:00
moduleobject.c gh-132775: Add _PyModule_GetFilenameObject() and _PyModule_GetFilenameUTF8() (gh-132979) 2025-04-28 12:41:32 -06:00
namespaceobject.c gh-111178: Fix function signatures for test_types (#131455) 2025-03-19 13:46:17 +00:00
object.c gh-133980: use atomic store in PyObject_GenericSetDict (#133988) 2025-05-20 21:11:47 +05:30
object_layout.md GH-115776: Allow any fixed sized object to have inline values (GH-123192) 2024-08-21 15:52:04 +01:00
object_layout_312.gv GH-115776: Embed the values array into the object, for "normal" Python objects. (GH-116115) 2024-04-02 11:59:21 +01:00
object_layout_312.png GH-115776: Embed the values array into the object, for "normal" Python objects. (GH-116115) 2024-04-02 11:59:21 +01:00
object_layout_313.gv GH-115776: Embed the values array into the object, for "normal" Python objects. (GH-116115) 2024-04-02 11:59:21 +01:00
object_layout_313.png GH-115776: Embed the values array into the object, for "normal" Python objects. (GH-116115) 2024-04-02 11:59:21 +01:00
object_layout_full_312.gv GH-96068: Document object layout (GH-96069) 2022-08-23 13:55:43 +01:00
object_layout_full_312.png GH-96068: Document object layout (GH-96069) 2022-08-23 13:55:43 +01:00
object_layout_full_313.gv GH-115776: Embed the values array into the object, for "normal" Python objects. (GH-116115) 2024-04-02 11:59:21 +01:00
object_layout_full_313.png GH-115776: Embed the values array into the object, for "normal" Python objects. (GH-116115) 2024-04-02 11:59:21 +01:00
obmalloc.c gh-131719: add NULL pointer check to _PyMem_FreeDelayed (gh-131720) 2025-03-25 10:49:18 -04:00
odictobject.c GH-124715: Move trashcan mechanism into Py_Dealloc (GH-132280) 2025-04-30 11:37:53 +01:00
picklebufobject.c gh-111178: Fix function signatures for multiple tests (#131496) 2025-03-20 12:27:03 +01:00
rangeobject.c gh-126703: Add freelist for range and range_iter objects (GH-128619) 2025-04-07 04:40:52 +08:00
README
setobject.c GH-124715: Move trashcan mechanism into Py_Dealloc (GH-132280) 2025-04-30 11:37:53 +01:00
sliceobject.c gh-111178: Fix function signatures for multiple tests (#131496) 2025-03-20 12:27:03 +01:00
structseq.c gh-131525: Cache the result of tuple_hash (#131529) 2025-03-27 09:57:06 -04:00
templateobject.c gh-134119: Fix crash from calling next() on exhausted template iterator (#134120) 2025-05-17 12:23:19 -07:00
tupleobject.c GH-124715: Move trashcan mechanism into Py_Dealloc (GH-132280) 2025-04-30 11:37:53 +01:00
typeobject.c gh-133778: Fix setting __annotations__ under PEP 563 (#133794) 2025-05-25 08:38:18 -07: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 gh-124153: Implement PyType_GetBaseByToken() and Py_tp_token slot (GH-124163) 2024-09-18 09:18:19 +02:00
typevarobject.c gh-130931: Add pycore_interpframe.h internal header (#131249) 2025-03-19 18:17:44 +01:00
unicodectype.c gh-82045: Correct and deduplicate "isprintable" docs; add test. (GH-130118) 2025-02-14 18:16:47 +01:00
unicodeobject.c gh-133968: Add fast path to PyUnicodeWriter_WriteStr() (#133969) 2025-05-13 15:31:41 +02:00
unicodetype_db.h closes gh-124016: update Unicode to 16.0.0 (#124017) 2024-09-13 07:47:04 -07:00
unionobject.c gh-132713: Fix typing.Union[index] race condition (#132802) 2025-04-23 15:45:42 +02:00
weakrefobject.c gh-129354: Use PyErr_FormatUnraisable() function (#129511) 2025-01-31 13:16:08 +01:00

Source files for various builtin objects