Skip to content

gh-115999: Add PyCodeObject.co_tlbc to the debug offsets #134286

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 20, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions Include/internal/pycore_debug_offsets.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,13 @@ extern "C" {
#ifdef Py_GIL_DISABLED
# define _Py_Debug_gilruntimestate_enabled offsetof(struct _gil_runtime_state, enabled)
# define _Py_Debug_Free_Threaded 1
# define _Py_Debug_code_object_co_tlbc offsetof(PyCodeObject, co_tlbc)
# define _Py_Debug_interpreter_frame_tlbc_index offsetof(_PyInterpreterFrame, tlbc_index)
#else
# define _Py_Debug_gilruntimestate_enabled 0
# define _Py_Debug_Free_Threaded 0
# define _Py_Debug_code_object_co_tlbc 0
# define _Py_Debug_interpreter_frame_tlbc_index 0
#endif


Expand Down Expand Up @@ -109,6 +113,7 @@ typedef struct _Py_DebugOffsets {
uint64_t localsplus;
uint64_t owner;
uint64_t stackpointer;
uint64_t tlbc_index;
} interpreter_frame;

// Code object offset;
Expand All @@ -123,6 +128,7 @@ typedef struct _Py_DebugOffsets {
uint64_t localsplusnames;
uint64_t localspluskinds;
uint64_t co_code_adaptive;
uint64_t co_tlbc;
} code_object;

// PyObject offset;
Expand Down Expand Up @@ -265,6 +271,7 @@ typedef struct _Py_DebugOffsets {
.localsplus = offsetof(_PyInterpreterFrame, localsplus), \
.owner = offsetof(_PyInterpreterFrame, owner), \
.stackpointer = offsetof(_PyInterpreterFrame, stackpointer), \
.tlbc_index = _Py_Debug_interpreter_frame_tlbc_index, \
}, \
.code_object = { \
.size = sizeof(PyCodeObject), \
Expand All @@ -277,6 +284,7 @@ typedef struct _Py_DebugOffsets {
.localsplusnames = offsetof(PyCodeObject, co_localsplusnames), \
.localspluskinds = offsetof(PyCodeObject, co_localspluskinds), \
.co_code_adaptive = offsetof(PyCodeObject, co_code_adaptive), \
.co_tlbc = _Py_Debug_code_object_co_tlbc, \
}, \
.pyobject = { \
.size = sizeof(PyObject), \
Expand Down
Loading