Skip to content

Commit 0886a07

Browse files
Fix reading gc_stats according last changes
1 parent 2c1d70c commit 0886a07

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

Modules/_remote_debugging/gc_stats.h

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -115,13 +115,22 @@ get_gc_stats_from_interpreter_state(RuntimeOffsets *offsets,
115115
unsigned long iid,
116116
void *context)
117117
{
118-
struct gc_stats stats;
119-
uintptr_t gc_stats_address = interpreter_state_addr
118+
uintptr_t gc_stats_addr;
119+
uintptr_t gc_stats_pointer_address = interpreter_state_addr
120120
+ offsets->debug_offsets.interpreter_state.gc
121121
+ offsets->debug_offsets.gc.generation_stats;
122+
if (_Py_RemoteDebug_ReadRemoteMemory(&offsets->handle,
123+
gc_stats_pointer_address,
124+
sizeof(gc_stats_addr),
125+
&gc_stats_addr) < 0) {
126+
PyErr_SetString(PyExc_RuntimeError, "Failed to read GC state address");
127+
return -1;
128+
}
129+
130+
struct gc_stats stats;
122131
uint64_t gc_stats_size = offsets->debug_offsets.gc.generation_stats_size;
123132
if (_Py_RemoteDebug_ReadRemoteMemory(&offsets->handle,
124-
gc_stats_address,
133+
gc_stats_addr,
125134
gc_stats_size,
126135
&stats) < 0) {
127136
PyErr_SetString(PyExc_RuntimeError, "Failed to read GC state");

0 commit comments

Comments
 (0)