8000 Add debug offsets for free threaded builds by pablogsal · Pull Request #123041 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

Add debug offsets for free threaded builds #123041

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 6 commits into from
Aug 15, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Next Next commit
Add debug offsets that can help in free threaded builds
Signed-off-by: Pablo Galindo <pablogsal@gmail.com>
  • Loading branch information
pablogsal committed Aug 15, 2024
commit 41d291cc9501fd8b6432c26bc44c7aa677b9f214
38 changes: 38 additions & 0 deletions Include/internal/pycore_runtime.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@
typedef struct _Py_DebugOffsets {
char cookie[8];
uint64_t version;
uint64_t free_threaded;

Check failure on line 56 in Include/internal/pycore_runtime.h

View workflow job for this annotation

GitHub Actions / Windows / build (arm64)

too many initializers [D:\a\cpython\cpython\PCbuild\_freeze_module.vcxproj]

Check failure on line 56 in Include/internal/pycore_runtime.h

View workflow job for this annotation

GitHub Actions / Windows / build (arm64)

too many initializers [D:\a\cpython\cpython\PCbuild\_freeze_module.vcxproj]
// Runtime state offset;
struct _runtime_state {
uint64_t size;
Expand All @@ -70,6 +71,7 @@
uint64_t imports_modules;
uint64_t sysdict;
uint64_t builtins;
uint64_t _gil;
uint64_t ceval_gil;
uint64_t gil_runtime_state_locked;
uint64_t gil_runtime_state_holder;
Expand Down Expand Up @@ -122,14 +124,50 @@
struct _type_object {
uint64_t size;
uint64_t tp_name;
uint64_t tp_repr;
uint64_t tp_flags;
} type_object;

// PyTuple object offset;
struct _tuple_object {
uint64_t size;
uint64_t ob_item;
uint64_t ob_size;
} tuple_object;

// PyList object offset;
struct _list_object {
uint64_t size;
uint64_t ob_item;
} list_object;

// PyDict object offset;
struct _dict_object {
uint64_t size;
uint64_t ma_keys;
uint64_t ma_values;
} dict_object;

// PyFloat object offset;
struct _float_object {
uint64_t size;
uint64_t ob_fval;
} float_object;

// PyLong object offset;
struct _long_object {
uint64_t size;
uint64_t lv_tag;
uint64_t ob_digit;
} long_object;

// PyBytes object offset;
struct _bytes_object {
uint64_t size;
uint64_t ob_size;
uint64_t ob_sval;
} bytes_object;

// Unicode object offset;
struct _unicode_object {
uint64_t size;
Expand Down
28 changes: 28 additions & 0 deletions Include/internal/pycore_runtime_init.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
.debug_offsets = { \
.cookie = "xdebugpy", \
.version = PY_VERSION_HEX, \
.free_threaded = Py_GIL_DISABLED, \

Check failure on line 37 in Include/internal/pycore_runtime_init.h

View workflow job for this annotation

GitHub Actions / Hypothesis tests on Ubuntu

‘Py_GIL_DISABLED’ undeclared here (not in a function)

Check failure on line 37 in Include/internal/pycore_runtime_init.h

View workflow job for this annotation

GitHub Actions / Hypothesis tests on Ubuntu

‘Py_GIL_DISABLED’ undeclared here (not in a function)

Check failure on line 37 in Include/internal/pycore_runtime_init.h

View workflow job for this annotation

GitHub Actions / Address sanitizer

‘Py_GIL_DISABLED’ undeclared here (not in a function)

Check failure on line 37 in Include/internal/pycore_runtime_init.h

View workflow job for this annotation

GitHub Actions / Address sanitizer

‘Py_GIL_DISABLED’ undeclared here (not in a function)
.runtime_state = { \
.size = sizeof(_PyRuntimeState), \
.finalizing = offsetof(_PyRuntimeState, _finalizing), \
Expand All @@ -48,6 +49,7 @@
.imports_modules = offsetof(PyInterpreterState, imports.modules), \
.sysdict = offsetof(PyInterpreterState, sysdict), \
.builtins = offsetof(PyInterpreterState, builtins), \
._gil = offsetof(PyInterpreterState, _gil), \
.ceval_gil = offsetof(PyInterpreterState, ceval.gil), \
.gil_runtime_state_locked = offsetof(PyInterpreterState, _gil.locked), \
.gil_runtime_state_holder = offsetof(PyInterpreterState, _gil.last_holder), \
Expand Down Expand Up @@ -90,10 +92,36 @@
.type_object = { \
.size = sizeof(PyTypeObject), \
.tp_name = offsetof(PyTypeObject, tp_name), \
.tp_repr = offsetof(PyTypeObject, tp_repr), \
.tp_flags = offsetof(PyTypeObject, tp_flags), \
}, \
.tuple_object = { \
.size = sizeof(PyTupleObject), \
.ob_item = offsetof(PyTupleObject, ob_item), \
.ob_size = offsetof(PyTupleObject, ob_base.ob_size), \
}, \
.list_object = { \
.size = sizeof(PyListObject), \
.ob_item = offsetof(PyListObject, ob_item), \
}, \
.dict_object = { \
.size = sizeof(PyDictObject), \
742F .ma_keys = offsetof(PyDictObject, ma_keys), \
.ma_values = offsetof(PyDictObject, ma_values), \
}, \
.float_object = { \
.size = sizeof(PyFloatObject), \
.ob_fval = offsetof(PyFloatObject, ob_fval), \
}, \
.long_object = { \
.size = sizeof(PyLongObject), \
.lv_tag = offsetof(_PyLongValue, lv_tag), \
.ob_digit = offsetof(_PyLongValue, ob_digit), \
}, \
.bytes_object = { \
.size = sizeof(PyBytesObject), \
.ob_size = offsetof(PyBytesObject, ob_base.ob_size), \
.ob_sval = offsetof(PyBytesObject, ob_sval), \
}, \
.unicode_object = { \
.size = sizeof(PyUnicodeObject), \
Expand Down
Loading
0