Skip to content

Commit 7d04fce

Browse files
authored
Merge macOS discovery improvements from #147
Use dyld UUID entries for runtime discovery and defer asyncio offset lookup.
2 parents 3a2ecd0 + 896f61f commit 7d04fce

2 files changed

Lines changed: 142 additions & 313 deletions

File tree

‎Modules/_remote_debugging/module.c‎

Lines changed: 2 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -384,12 +384,6 @@ _remote_debugging_RemoteUnwinder___init___impl(RemoteUnwinderObject *self,
384384
return -1;
385385
}
386386

387-
self->runtime_start_address = _Py_RemoteDebug_GetPyRuntimeAddress(&self->handle);
388-
if (self->runtime_start_address == 0) {
389-
set_exception_cause(self, PyExc_RuntimeError, "Failed to get Python runtime address");
390-
return -1;
391-
}
392-
393387
if (_Py_RemoteDebug_ReadDebugOffsets(&self->handle,
394388
&self->runtime_start_address,
395389
&self->debug_offsets) < 0)
@@ -404,20 +398,8 @@ _remote_debugging_RemoteUnwinder___init___impl(RemoteUnwinderObject *self,
404398
return -1;
405399
}
406400

407-
// Try to read async debug offsets, but don't fail if they're not available
408-
self->async_debug_offsets_available = 1;
409-
int async_debug_result = read_async_debug(self);
410-
if (async_debug_result == PY_REMOTE_DEBUG_INVALID_ASYNC_DEBUG_OFFSETS) {
411-
return -1;
412-
}
413-
if (async_debug_result < 0) {
414-
if (_Py_RemoteDebug_HasPermissionError()) {
415-
return -1;
416-
}
417-
PyErr_Clear();
418-
memset(&self->async_debug_offsets, 0, sizeof(self->async_debug_offsets));
419-
self->async_debug_offsets_available = 0;
420-
}
401+
self->async_debug_offsets_available = 0;
402+
memset(&self->async_debug_offsets, 0, sizeof(self->async_debug_offsets));
421403

422404
if (populate_initial_state_data(all_threads, self, self->runtime_start_address,
423405
&self->interpreter_addr ,&self->tstate_addr) < 0)
@@ -1392,11 +1374,6 @@ init_runtime_offsets(RuntimeOffsets *offsets, pid_t pid, int debug)
13921374
set_exception_cause(offsets, PyExc_RuntimeError, "Failed to initialize process handle");
13931375
return -1;
13941376
}
1395-
offsets->runtime_start_address = _Py_RemoteDebug_GetPyRuntimeAddress(&offsets->handle);
1396-
if (offsets->runtime_start_address == 0) {
1397-
set_exception_cause(offsets, PyExc_RuntimeError, "Failed to get Python runtime address");
1398-
goto error;
1399-
}
14001377
if (_Py_RemoteDebug_ReadDebugOffsets(&offsets->handle,
14011378
&offsets->runtime_start_address,
14021379
&offsets->debug_offsets) < 0)

0 commit comments

Comments
 (0)