MCPcopy Create free account
hub / github.com/bloomberg/pystack / copyDebugOffsets

Method copyDebugOffsets

src/pystack/_pystack/process.cpp:942–1059  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

940}
941
942bool
943AbstractProcessManager::copyDebugOffsets(Structure<py_runtime_v>& py_runtime, python_v& debug_offsets)
944 const
945{
946 // Fill in a temporary python_v with the offsets from the remote. For fields
947 // that aren't in _Py_DebugOffsets, assume our static offsets are correct.
948
949#define set_size(pystack_struct, size_offset) \
950 debug_offsets.pystack_struct.size = py_runtime.getField(size_offset)
951
952#define set_offset(pystack_field, field_offset_offset) \
953 debug_offsets.pystack_field = {(offset_t)py_runtime.getField(field_offset_offset)}
954
955 set_size(py_runtime, &py_runtime_v::o_dbg_off_runtime_state_struct_size);
956 set_offset(py_runtime.o_finalizing, &py_runtime_v::o_dbg_off_runtime_state_finalizing);
957 set_offset(py_runtime.o_interp_head, &py_runtime_v::o_dbg_off_runtime_state_interpreters_head);
958
959 set_size(py_is, &py_runtime_v::o_dbg_off_interpreter_state_struct_size);
960 set_offset(py_is.o_next, &py_runtime_v::o_dbg_off_interpreter_state_next);
961 set_offset(py_is.o_tstate_head, &py_runtime_v::o_dbg_off_interpreter_state_threads_head);
962 set_offset(py_is.o_gc, &py_runtime_v::o_dbg_off_interpreter_state_gc);
963 set_offset(py_is.o_modules, &py_runtime_v::o_dbg_off_interpreter_state_imports_modules);
964 set_offset(py_is.o_sysdict, &py_runtime_v::o_dbg_off_interpreter_state_sysdict);
965 set_offset(py_is.o_builtins, &py_runtime_v::o_dbg_off_interpreter_state_builtins);
966 set_offset(py_is.o_gil_runtime_state, &py_runtime_v::o_dbg_off_interpreter_state_ceval_gil);
967
968 set_size(py_thread, &py_runtime_v::o_dbg_off_thread_state_struct_size);
969 set_offset(py_thread.o_prev, &py_runtime_v::o_dbg_off_thread_state_prev);
970 set_offset(py_thread.o_next, &py_runtime_v::o_dbg_off_thread_state_next);
971 set_offset(py_thread.o_interp, &py_runtime_v::o_dbg_off_thread_state_interp);
972 set_offset(py_thread.o_frame, &py_runtime_v::o_dbg_off_thread_state_current_frame);
973 set_offset(py_thread.o_thread_id, &py_runtime_v::o_dbg_off_thread_state_thread_id);
974 set_offset(py_thread.o_native_thread_id, &py_runtime_v::o_dbg_off_thread_state_native_thread_id);
975
976 set_size(py_frame, &py_runtime_v::o_dbg_off_interpreter_frame_struct_size);
977 set_offset(py_frame.o_back, &py_runtime_v::o_dbg_off_interpreter_frame_previous);
978 set_offset(py_frame.o_code, &py_runtime_v::o_dbg_off_interpreter_frame_executable);
979 set_offset(py_frame.o_prev_instr, &py_runtime_v::o_dbg_off_interpreter_frame_instr_ptr);
980 set_offset(py_frame.o_localsplus, &py_runtime_v::o_dbg_off_interpreter_frame_localsplus);
981 set_offset(py_frame.o_owner, &py_runtime_v::o_dbg_off_interpreter_frame_owner);
982
983 set_size(py_code, &py_runtime_v::o_dbg_off_code_object_struct_size);
984 set_offset(py_code.o_filename, &py_runtime_v::o_dbg_off_code_object_filename);
985 set_offset(py_code.o_name, &py_runtime_v::o_dbg_off_code_object_name);
986 set_offset(py_code.o_lnotab, &py_runtime_v::o_dbg_off_code_object_linetable);
987 set_offset(py_code.o_firstlineno, &py_runtime_v::o_dbg_off_code_object_firstlineno);
988 set_offset(py_code.o_argcount, &py_runtime_v::o_dbg_off_code_object_argcount);
989 set_offset(py_code.o_varnames, &py_runtime_v::o_dbg_off_code_object_localsplusnames);
990 set_offset(py_code.o_code_adaptive, &py_runtime_v::o_dbg_off_code_object_co_code_adaptive);
991
992 set_size(py_object, &py_runtime_v::o_dbg_off_pyobject_struct_size);
993 set_offset(py_object.o_ob_type, &py_runtime_v::o_dbg_off_pyobject_ob_type);
994
995 set_size(py_type, &py_runtime_v::o_dbg_off_type_object_struct_size);
996 set_offset(py_type.o_tp_name, &py_runtime_v::o_dbg_off_type_object_tp_name);
997 set_offset(py_type.o_tp_repr, &py_runtime_v::o_dbg_off_type_object_tp_repr);
998 set_offset(py_type.o_tp_flags, &py_runtime_v::o_dbg_off_type_object_tp_flags);
999

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected