summaryrefslogtreecommitdiffstats
path: root/Include/internal/pycore_runtime_init.h
diff options
context:
space:
mode:
authorPablo Galindo Salgado <Pablogsal@gmail.com>2023-07-11 19:35:41 (GMT)
committerGitHub <noreply@github.com>2023-07-11 19:35:41 (GMT)
commitb444bfb0a325dea8c29f7b1828233b00fbf4a1cb (patch)
tree30abfc128a3533d961158ec46743e7bf4dc98cff /Include/internal/pycore_runtime_init.h
parent579aa89e68a6607398317a50586af781981e89fb (diff)
downloadcpython-b444bfb0a325dea8c29f7b1828233b00fbf4a1cb.zip
cpython-b444bfb0a325dea8c29f7b1828233b00fbf4a1cb.tar.gz
cpython-b444bfb0a325dea8c29f7b1828233b00fbf4a1cb.tar.bz2
gh-106597: Add debugging struct with offsets for out-of-process tools (#106598)
Diffstat (limited to 'Include/internal/pycore_runtime_init.h')
-rw-r--r--Include/internal/pycore_runtime_init.h58
1 files changed, 57 insertions, 1 deletions
diff --git a/Include/internal/pycore_runtime_init.h b/Include/internal/pycore_runtime_init.h
index b507de0..e72e742 100644
--- a/Include/internal/pycore_runtime_init.h
+++ b/Include/internal/pycore_runtime_init.h
@@ -21,9 +21,65 @@ extern PyTypeObject _PyExc_MemoryError;
/* The static initializers defined here should only be used
in the runtime init code (in pystate.c and pylifecycle.c). */
-
#define _PyRuntimeState_INIT(runtime) \
{ \
+ .debug_offsets = { \
+ .cookie = "xdebugpy", \
+ .version = PY_VERSION_HEX, \
+ .runtime_state = { \
+ .finalizing = offsetof(_PyRuntimeState, _finalizing), \
+ .interpreters_head = offsetof(_PyRuntimeState, interpreters.head), \
+ }, \
+ .interpreter_state = { \
+ .next = offsetof(PyInterpreterState, next), \
+ .threads_head = offsetof(PyInterpreterState, threads.head), \
+ .gc = offsetof(PyInterpreterState, gc), \
+ .imports_modules = offsetof(PyInterpreterState, imports.modules), \
+ .sysdict = offsetof(PyInterpreterState, sysdict), \
+ .builtins = offsetof(PyInterpreterState, builtins), \
+ .ceval_gil = offsetof(PyInterpreterState, ceval.gil), \
+ .gil_runtime_state_locked = offsetof(PyInterpreterState, _gil.locked), \
+ .gil_runtime_state_holder = offsetof(PyInterpreterState, _gil.last_holder), \
+ }, \
+ .thread_state = { \
+ .prev = offsetof(PyThreadState, prev), \
+ .next = offsetof(PyThreadState, next), \
+ .interp = offsetof(PyThreadState, interp), \
+ .cframe = offsetof(PyThreadState, cframe), \
+ .thread_id = offsetof(PyThreadState, thread_id), \
+ .native_thread_id = offsetof(PyThreadState, native_thread_id), \
+ }, \
+ .interpreter_frame = { \
+ .previous = offsetof(_PyInterpreterFrame, previous), \
+ .executable = offsetof(_PyInterpreterFrame, f_executable), \
+ .prev_instr = offsetof(_PyInterpreterFrame, prev_instr), \
+ .localsplus = offsetof(_PyInterpreterFrame, localsplus), \
+ .owner = offsetof(_PyInterpreterFrame, owner), \
+ }, \
+ .cframe = { \
+ .current_frame = offsetof(_PyCFrame, current_frame), \
+ .previous = offsetof(_PyCFrame, previous), \
+ }, \
+ .code_object = { \
+ .filename = offsetof(PyCodeObject, co_filename), \
+ .name = offsetof(PyCodeObject, co_name), \
+ .linetable = offsetof(PyCodeObject, co_linetable), \
+ .firstlineno = offsetof(PyCodeObject, co_firstlineno), \
+ .argcount = offsetof(PyCodeObject, co_argcount), \
+ .localsplusnames = offsetof(PyCodeObject, co_localsplusnames), \
+ .localspluskinds = offsetof(PyCodeObject, co_localspluskinds), \
+ .co_code_adaptive = offsetof(PyCodeObject, co_code_adaptive), \
+ }, \
+ .pyobject = { \
+ .ob_type = offsetof(PyObject, ob_type), \
+ }, \
+ .type_object = { \
+ .tp_name = offsetof(PyTypeObject, tp_name), \
+ }, \
+ .tuple_object = { \
+ .ob_item = offsetof(PyTupleObject, ob_item), \
+ }, \
+ }, \
.allocators = { \
.standard = _pymem_allocators_standard_INIT(runtime), \
.debug = _pymem_allocators_debug_INIT, \