mirror of https://github.com/python/cpython
gh-106597: Add more offsets to _Py_DebugOffsets (#121311)
Add more offsets to _Py_DebugOffsets We add a few more offsets that are required by some out-of-process tools, such as [Austin](https://github.com/p403n1x87/austin).
This commit is contained in:
parent
9d3c9b822c
commit
c9bdfbe868
|
@ -63,6 +63,7 @@ typedef struct _Py_DebugOffsets {
|
||||||
// Interpreter state offset;
|
// Interpreter state offset;
|
||||||
struct _interpreter_state {
|
struct _interpreter_state {
|
||||||
uint64_t size;
|
uint64_t size;
|
||||||
|
uint64_t id;
|
||||||
uint64_t next;
|
uint64_t next;
|
||||||
uint64_t threads_head;
|
uint64_t threads_head;
|
||||||
uint64_t gc;
|
uint64_t gc;
|
||||||
|
@ -83,6 +84,8 @@ typedef struct _Py_DebugOffsets {
|
||||||
uint64_t current_frame;
|
uint64_t current_frame;
|
||||||
uint64_t thread_id;
|
uint64_t thread_id;
|
||||||
uint64_t native_thread_id;
|
uint64_t native_thread_id;
|
||||||
|
uint64_t datastack_chunk;
|
||||||
|
uint64_t status;
|
||||||
} thread_state;
|
} thread_state;
|
||||||
|
|
||||||
// InterpreterFrame offset;
|
// InterpreterFrame offset;
|
||||||
|
@ -107,6 +110,7 @@ typedef struct _Py_DebugOffsets {
|
||||||
uint64_t size;
|
uint64_t size;
|
||||||
uint64_t filename;
|
uint64_t filename;
|
||||||
uint64_t name;
|
uint64_t name;
|
||||||
|
uint64_t qualname;
|
||||||
uint64_t linetable;
|
uint64_t linetable;
|
||||||
uint64_t firstlineno;
|
uint64_t firstlineno;
|
||||||
uint64_t argcount;
|
uint64_t argcount;
|
||||||
|
@ -140,6 +144,12 @@ typedef struct _Py_DebugOffsets {
|
||||||
uint64_t length;
|
uint64_t length;
|
||||||
size_t asciiobject_size;
|
size_t asciiobject_size;
|
||||||
} unicode_object;
|
} unicode_object;
|
||||||
|
|
||||||
|
// GC runtime state offset;
|
||||||
|
struct _gc {
|
||||||
|
uint64_t size;
|
||||||
|
uint64_t collecting;
|
||||||
|
} gc;
|
||||||
} _Py_DebugOffsets;
|
} _Py_DebugOffsets;
|
||||||
|
|
||||||
/* Reference tracer state */
|
/* Reference tracer state */
|
||||||
|
|
|
@ -41,6 +41,7 @@ extern PyTypeObject _PyExc_MemoryError;
|
||||||
}, \
|
}, \
|
||||||
.interpreter_state = { \
|
.interpreter_state = { \
|
||||||
.size = sizeof(PyInterpreterState), \
|
.size = sizeof(PyInterpreterState), \
|
||||||
|
.id = offsetof(PyInterpreterState, id), \
|
||||||
.next = offsetof(PyInterpreterState, next), \
|
.next = offsetof(PyInterpreterState, next), \
|
||||||
.threads_head = offsetof(PyInterpreterState, threads.head), \
|
.threads_head = offsetof(PyInterpreterState, threads.head), \
|
||||||
.gc = offsetof(PyInterpreterState, gc), \
|
.gc = offsetof(PyInterpreterState, gc), \
|
||||||
|
@ -59,6 +60,8 @@ extern PyTypeObject _PyExc_MemoryError;
|
||||||
.current_frame = offsetof(PyThreadState, current_frame), \
|
.current_frame = offsetof(PyThreadState, current_frame), \
|
||||||
.thread_id = offsetof(PyThreadState, thread_id), \
|
.thread_id = offsetof(PyThreadState, thread_id), \
|
||||||
.native_thread_id = offsetof(PyThreadState, native_thread_id), \
|
.native_thread_id = offsetof(PyThreadState, native_thread_id), \
|
||||||
|
.datastack_chunk = offsetof(PyThreadState, datastack_chunk), \
|
||||||
|
.status = offsetof(PyThreadState, _status), \
|
||||||
}, \
|
}, \
|
||||||
.interpreter_frame = { \
|
.interpreter_frame = { \
|
||||||
.size = sizeof(_PyInterpreterFrame), \
|
.size = sizeof(_PyInterpreterFrame), \
|
||||||
|
@ -72,6 +75,7 @@ extern PyTypeObject _PyExc_MemoryError;
|
||||||
.size = sizeof(PyCodeObject), \
|
.size = sizeof(PyCodeObject), \
|
||||||
.filename = offsetof(PyCodeObject, co_filename), \
|
.filename = offsetof(PyCodeObject, co_filename), \
|
||||||
.name = offsetof(PyCodeObject, co_name), \
|
.name = offsetof(PyCodeObject, co_name), \
|
||||||
|
.qualname = offsetof(PyCodeObject, co_qualname), \
|
||||||
.linetable = offsetof(PyCodeObject, co_linetable), \
|
.linetable = offsetof(PyCodeObject, co_linetable), \
|
||||||
.firstlineno = offsetof(PyCodeObject, co_firstlineno), \
|
.firstlineno = offsetof(PyCodeObject, co_firstlineno), \
|
||||||
.argcount = offsetof(PyCodeObject, co_argcount), \
|
.argcount = offsetof(PyCodeObject, co_argcount), \
|
||||||
|
@ -97,6 +101,10 @@ extern PyTypeObject _PyExc_MemoryError;
|
||||||
.length = offsetof(PyUnicodeObject, _base._base.length), \
|
.length = offsetof(PyUnicodeObject, _base._base.length), \
|
||||||
.asciiobject_size = sizeof(PyASCIIObject), \
|
.asciiobject_size = sizeof(PyASCIIObject), \
|
||||||
}, \
|
}, \
|
||||||
|
.gc = { \
|
||||||
|
.size = sizeof(struct _gc_runtime_state), \
|
||||||
|
.collecting = offsetof(struct _gc_runtime_state, collecting), \
|
||||||
|
}, \
|
||||||
}, \
|
}, \
|
||||||
.allocators = { \
|
.allocators = { \
|
||||||
.standard = _pymem_allocators_standard_INIT(runtime), \
|
.standard = _pymem_allocators_standard_INIT(runtime), \
|
||||||
|
|
Loading…
Reference in New Issue