cpython/Modules/clinic
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
..
_abc.c.h gh-110964: Remove private _PyArg functions (#110966) 2023-10-17 14:30:31 +02:00
_asynciomodule.c.h gh-131525: Cache the result of tuple_hash (#131529) 2025-03-27 09:57:06 -04:00
_bisectmodule.c.h gh-131525: Cache the result of tuple_hash (#131529) 2025-03-27 09:57:06 -04:00
_bz2module.c.h gh-131525: Cache the result of tuple_hash (#131529) 2025-03-27 09:57:06 -04:00
_codecsmodule.c.h gh-131525: Cache the result of tuple_hash (#131529) 2025-03-27 09:57:06 -04:00
_collectionsmodule.c.h gh-131525: Cache the result of tuple_hash (#131529) 2025-03-27 09:57:06 -04:00
_csv.c.h gh-131525: Cache the result of tuple_hash (#131529) 2025-03-27 09:57:06 -04:00
_curses_panel.c.h gh-111178: Generate correct signature for most self converters (#128447) 2025-01-20 12:40:18 +01:00
_cursesmodule.c.h gh-133139: Add curses.assume_default_colors() (GH-133145) 2025-05-03 23:33:22 +03:00
_datetimemodule.c.h gh-131525: Cache the result of tuple_hash (#131529) 2025-03-27 09:57:06 -04:00
_dbmmodule.c.h gh-127081: add critical sections to dbm objects (gh-132749) 2025-05-14 13:49:35 -04:00
_elementtree.c.h gh-131525: Cache the result of tuple_hash (#131529) 2025-03-27 09:57:06 -04:00
_functoolsmodule.c.h gh-131525: Cache the result of tuple_hash (#131529) 2025-03-27 09:57:06 -04:00
_gdbmmodule.c.h gh-127081: add critical sections to dbm objects (gh-132749) 2025-05-14 13:49:35 -04:00
_hashopenssl.c.h gh-132987: Support __index__() in hashlib.scrypt() (GH-133100) 2025-04-29 16:16:05 +03:00
_heapqmodule.c.h gh-110067: Make max heap methods public and add missing ones (GH-130725) 2025-05-05 17:52:49 +02:00
_localemodule.c.h gh-111089: Revert PyUnicode_AsUTF8() changes (#111833) 2023-11-07 22:36:13 +00:00
_lsprof.c.h gh-131525: Cache the result of tuple_hash (#131529) 2025-03-27 09:57:06 -04:00
_lzmamodule.c.h gh-131525: Cache the result of tuple_hash (#131529) 2025-03-27 09:57:06 -04:00
_opcode.c.h gh-131525: Cache the result of tuple_hash (#131529) 2025-03-27 09:57:06 -04:00
_operator.c.h gh-115808: Add `is_none and is_not_none to operator` (#115814) 2024-08-10 20:16:34 +01:00
_pickle.c.h gh-131525: Cache the result of tuple_hash (#131529) 2025-03-27 09:57:06 -04:00
_posixsubprocess.c.h gh-121381 Remove subprocess._USE_VFORK escape hatch (#121383) 2024-07-30 18:39:54 -07:00
_queuemodule.c.h gh-131525: Cache the result of tuple_hash (#131529) 2025-03-27 09:57:06 -04:00
_randommodule.c.h gh-111178: Change Argument Clinic signature for METH_O (#130682) 2025-03-11 16:33:36 +01:00
_remote_debugging_module.c.h gh-91048: Refactor and optimize remote debugging module (#134652) 2025-05-25 20:19:29 +00:00
_ssl.c.h gh-131525: Cache the result of tuple_hash (#131529) 2025-03-27 09:57:06 -04:00
_statisticsmodule.c.h gh-85283: Build _statistics extension with the limited C API (#116927) 2024-03-17 18:59:02 +01:00
_struct.c.h gh-131525: Cache the result of tuple_hash (#131529) 2025-03-27 09:57:06 -04:00
_suggestions.c.h gh-110721: Remove unused code from suggestions.c after moving PyErr_Display to use the traceback module (#113712) 2024-01-08 15:10:45 +00:00
_sysconfig.c.h gh-88402: Add new sysconfig variables on Windows (GH-110049) 2023-10-04 22:50:29 +00:00
_testclinic.c.h gh-132987: Support __index__() for "k" and "K" formats in PyArg_Parse (GH-132988) 2025-04-26 17:14:18 +03:00
_testclinic_depr.c.h Test fixes for 3.15 (GH-133599) 2025-05-07 14:50:39 -05:00
_testclinic_limited.c.h gh-116646: Add limited C API support to AC fildes converter (#116769) 2024-03-14 10:28:58 +01:00
_testinternalcapi.c.h gh-122320: Limit dict key versions used by test_opcache. (gh-132961) 2025-04-28 12:54:55 -07:00
_testmultiphase.c.h gh-131525: Cache the result of tuple_hash (#131529) 2025-03-27 09:57:06 -04:00
_threadmodule.c.h gh-134087: enforce signature of threading.RLock (#134178) 2025-05-19 11:26:14 +02:00
_tkinter.c.h gh-111178: Change Argument Clinic signature for METH_O (#130682) 2025-03-11 16:33:36 +01:00
_tracemalloc.c.h gh-110964: Remove private _PyArg functions (#110966) 2023-10-17 14:30:31 +02:00
_typingmodule.c.h gh-107603: Argument Clinic: Only include pycore_gc.h if needed (#108726) 2023-08-31 23:42:34 +02:00
_weakref.c.h gh-111926: Make weakrefs thread-safe in free-threaded builds (#117168) 2024-04-08 10:58:38 -04:00
_winapi.c.h gh-134041: Make _winapi functions compatible with non-desktop API partitions (GH-134042) 2025-05-15 11:50:46 +00:00
_zoneinfo.c.h gh-131525: Cache the result of tuple_hash (#131529) 2025-03-27 09:57:06 -04:00
arraymodule.c.h gh-111178: Change Argument Clinic signature for METH_O (#130682) 2025-03-11 16:33:36 +01:00
binascii.c.h gh-131525: Cache the result of tuple_hash (#131529) 2025-03-27 09:57:06 -04:00
blake2module.c.h gh-131525: Cache the result of tuple_hash (#131529) 2025-03-27 09:57:06 -04:00
cmathmodule.c.h gh-131525: Cache the result of tuple_hash (#131529) 2025-03-27 09:57:06 -04:00
fcntlmodule.c.h gh-132987: Support __index__() for "k" and "K" formats in PyArg_Parse (GH-132988) 2025-04-26 17:14:18 +03:00
gcmodule.c.h gh-131525: Cache the result of tuple_hash (#131529) 2025-03-27 09:57:06 -04:00
grpmodule.c.h gh-131525: Cache the result of tuple_hash (#131529) 2025-03-27 09:57:06 -04:00
hmacmodule.c.h gh-99108: Implement HACL* HMAC (#130157) 2025-04-04 19:04:00 +02:00
itertoolsmodule.c.h gh-131525: Cache the result of tuple_hash (#131529) 2025-03-27 09:57:06 -04:00
mathmodule.c.h gh-133904: Fix math.factorial documentation (#133907) 2025-05-12 09:41:15 +00:00
md5module.c.h gh-131525: Cache the result of tuple_hash (#131529) 2025-03-27 09:57:06 -04:00
overlapped.c.h gh-131525: Cache the result of tuple_hash (#131529) 2025-03-27 09:57:06 -04:00
posixmodule.c.h gh-133517: Remove os.listdrive, os.listvolumes and os.listmounts in non-desktop Windows builds (GH-133518) 2025-05-07 20:45:42 +01:00
pwdmodule.c.h gh-85283: Build pwd extension with the limited C API (#116841) 2024-03-15 08:49:58 +01:00
pyexpat.c.h gh-131525: Cache the result of tuple_hash (#131529) 2025-03-27 09:57:06 -04:00
readline.c.h gh-126895: Fix readline module in free-threaded build (#131208) 2025-03-17 11:57:11 -04:00
resource.c.h gh-85283: Build resource extension with limited C API (#110989) 2023-10-17 23:52:58 +02:00
selectmodule.c.h gh-131525: Cache the result of tuple_hash (#131529) 2025-03-27 09:57:06 -04:00
sha1module.c.h gh-131525: Cache the result of tuple_hash (#131529) 2025-03-27 09:57:06 -04:00
sha2module.c.h gh-131525: Cache the result of tuple_hash (#131529) 2025-03-27 09:57:06 -04:00
sha3module.c.h gh-131525: Cache the result of tuple_hash (#131529) 2025-03-27 09:57:06 -04:00
signalmodule.c.h gh-132987: Support __index__() for "k" and "K" formats in PyArg_Parse (GH-132988) 2025-04-26 17:14:18 +03:00
socketmodule.c.h gh-133583: Add support for fixed size unsigned integers in argument parsing (GH-133584) 2025-05-08 12:27:50 +03:00
symtablemodule.c.h gh-111089: Revert PyUnicode_AsUTF8() changes (#111833) 2023-11-07 22:36:13 +00:00
syslogmodule.c.h gh-131525: Cache the result of tuple_hash (#131529) 2025-03-27 09:57:06 -04:00
termios.c.h gh-85283: Build termios extension with the limited C API (#116928) 2024-03-17 15:12:29 +00:00
timemodule.c.h gh-111482: Use Argument Clinic for clock_gettime() (#111641) 2023-11-02 14:29:05 +01:00
unicodedata.c.h gh-117557: Improve error messages when a string, bytes or bytearray of length 1 are expected (GH-117631) 2024-05-28 12:01:37 +03:00
zlibmodule.c.h gh-131525: Cache the result of tuple_hash (#131529) 2025-03-27 09:57:06 -04:00