Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
a349b17
remap
maurycy Jun 3, 2026
8a748a4
no kind for now
maurycy Jun 3, 2026
69848a4
simpler
maurycy Jun 3, 2026
dcdcaf4
do not continue if the probe failed
maurycy Jun 3, 2026
1574e87
left-over
maurycy Jun 3, 2026
835d070
this is implicit from the RemoteUnwinder
maurycy Jun 3, 2026
9177fdd
use _Py_RemoteDebug_ReadRemoteMemory directly
maurycy Jun 3, 2026
0ac2c11
disable on remap failure immediately
maurycy Jun 3, 2026
89a50d0
dedup `AliasProbe` and `alias_remap_page`
maurycy Jun 3, 2026
ebb527c
FreeBSD style!
maurycy Jun 3, 2026
af4afa1
make clinic, expected_parent is macos-only
maurycy Jun 4, 2026
2069d9d
stop abusing stats for debugging
maurycy Jun 4, 2026
5f7fa96
lazy fail is ok
maurycy Jun 4, 2026
ed09b5e
avoid seq scan in lru; try a set
maurycy Jun 4, 2026
888e300
Revert "avoid seq scan in lru; try a set"
maurycy Jun 4, 2026
9153127
there's task_info, no need to rely on pid+ts
maurycy Jun 9, 2026
0d73d10
never observed stale interp in the wild
maurycy Jun 9, 2026
7fd32ee
mach_port_type...
maurycy Jun 9, 2026
92062b7
notify about death
maurycy Jun 9, 2026
6316fb6
mach_vm_remap(FIXED|OVERWRITE)
maurycy Jun 9, 2026
2bdf0ac
Revert "notify about death"
maurycy Jun 9, 2026
97e67e6
NEVER happened in the wild, across 47m samples with lots of churn;
maurycy Jun 9, 2026
272bb78
poor man's AIMD mach_vm_region_recurse()
maurycy Jun 9, 2026
1a7ee5c
0/800m calls w/ very churny scenarios
maurycy Jun 10, 2026
01f1503
interp_window_{start,size}; 3.4MHz
maurycy Jun 10, 2026
6c24960
vm_max_address
maurycy Jun 10, 2026
c7aedce
some love
maurycy Jun 10, 2026
23d185f
dead prefetch computation on macos
maurycy Jun 10, 2026
6dc7810
do it well, it's now confirmed to bring 3.4-3.6Mhz
maurycy Jun 10, 2026
ddbeacd
build warning
maurycy Jun 10, 2026
01369b7
harden
maurycy Jun 10, 2026
c8ee9c6
disable if target != local vm size
maurycy Jun 10, 2026
48d8c8e
invalid frame != stale map
maurycy Jun 10, 2026
aa1da19
probe check
maurycy Jun 10, 2026
a097833
do not disable permanently on a single remap fail
maurycy Jun 10, 2026
d3dbcfc
KERN_NOT_SUPPORTED + fix stats
maurycy Jun 10, 2026
e6f55b7
better stats, better err handling
maurycy Jun 11, 2026
fcab0de
dead code
maurycy Jun 11, 2026
d0e2f53
aliased read_last_profiled_anchor
maurycy Oct 26, 2026
bc94a39
move to proc_handle_t
maurycy Oct 27, 2026
a140277
read_stack_chunk
maurycy Oct 27, 2026
81c7a13
Merge branch 'upstream-main' into vmremap
maurycy Oct 31, 2026
1b3859e
up
maurycy Oct 31, 2026
742f90e
Merge remote-tracking branch 'origin/main' into vmremap
maurycy Oct 31, 2026
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
16 changes: 12 additions & 4 deletions Modules/_remote_debugging/frame_cache.c
Original file line number Diff line number Diff line change
Expand Up @@ -167,10 +167,18 @@ read_last_profiled_anchor(RemoteUnwinderObject *unwinder,
// remote-memory read.
if (seq_offset == frame_offset + sizeof(uintptr_t)) {
uintptr_t live_anchor[2];
if (_Py_RemoteDebug_ReadRemoteMemory(&unwinder->handle,
thread_state_addr + frame_offset,
sizeof(live_anchor),
live_anchor) < 0) {
int rc = _Py_RemoteDebug_AliasedReadRemoteMemory(&unwinder->handle,
thread_state_addr + frame_offset,
sizeof(live_anchor),
live_anchor);
if (rc < 0) {
return -1;
}
if (rc > 0
&& _Py_RemoteDebug_ReadRemoteMemory(&unwinder->handle,
thread_state_addr + frame_offset,
sizeof(live_anchor),
live_anchor) < 0) {
return -1;
}
anchor->frame = live_anchor[0];
Expand Down
4 changes: 2 additions & 2 deletions Modules/_remote_debugging/frames.c
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ process_single_stack_chunk(
return -1;
}

if (_Py_RemoteDebug_PagedReadRemoteMemory(&unwinder->handle, chunk_addr, current_size, this_chunk) < 0) {
if (_Py_RemoteDebug_ReadRemoteMemory(&unwinder->handle, chunk_addr, current_size, this_chunk) < 0) {
PyMem_RawFree(this_chunk);
set_exception_cause(unwinder, PyExc_RuntimeError, "Failed to read stack chunk");
return -1;
Expand Down Expand Up @@ -65,7 +65,7 @@ process_single_stack_chunk(
}
this_chunk = tmp;

if (_Py_RemoteDebug_PagedReadRemoteMemory(&unwinder->handle, chunk_addr, actual_size, this_chunk) < 0) {
if (_Py_RemoteDebug_ReadRemoteMemory(&unwinder->handle, chunk_addr, actual_size, this_chunk) < 0) {
PyMem_RawFree(this_chunk);
set_exception_cause(unwinder, PyExc_RuntimeError, "Failed to reread stack chunk with correct size");
return -1;
Expand Down
21 changes: 21 additions & 0 deletions Modules/_remote_debugging/module.c
Original file line number Diff line number Diff line change
Expand Up @@ -608,6 +608,27 @@ read_interp_state_and_maybe_thread_frame(
{
prefetch->tstate = NULL;
prefetch->frame = NULL;
int aliased = _Py_RemoteDebug_AliasedReadRemoteMemory(
&unwinder->handle, interpreter_addr, INTERP_STATE_BUFFER_SIZE,
interp_state_buffer);
if (aliased < 0) {
return -1;
}
if (aliased == 0) {
if (prefetch->tstate_addr != 0) {
size_t tstate_size = (size_t)unwinder->debug_offsets.thread_state.size;
int rc = _Py_RemoteDebug_AliasedReadRemoteMemory(
&unwinder->handle, prefetch->tstate_addr, tstate_size,
tstate_buffer);
if (rc == 0) {
prefetch->tstate = tstate_buffer;
}
else if (rc < 0) {
PyErr_Clear();
}
}
return 0;
}
if (prefetch->tstate_addr != 0) {
size_t tstate_size = (size_t)unwinder->debug_offsets.thread_state.size;
_Py_RemoteReadSegment segments[3] = {
Expand Down
15 changes: 12 additions & 3 deletions Modules/_remote_debugging/threads.c
Original file line number Diff line number Diff line change
Expand Up @@ -304,6 +304,11 @@ read_thread_state_and_maybe_frame(
int *frame_read)
{
*frame_read = 0;
int aliased = _Py_RemoteDebug_AliasedReadRemoteMemory(
&unwinder->handle, tstate_addr, tstate_size, tstate_buffer);
if (aliased <= 0) {
return aliased;
}
if (predicted_frame_addr != 0) {
_Py_RemoteReadSegment segments[2] = {
{tstate_addr, tstate_buffer, tstate_size},
Expand Down Expand Up @@ -380,11 +385,15 @@ unwind_stack_for_thread(
}
}
else {
int rc = _Py_RemoteDebug_ReadRemoteMemory(
&unwinder->handle,
int unused_frame_read = 0;
int rc = read_thread_state_and_maybe_frame(
unwinder,
*current_tstate,
(size_t)unwinder->debug_offsets.thread_state.size,
local_ts);
local_ts,
0,
NULL,
&unused_frame_read);
if (rc < 0) {
set_exception_cause(unwinder, PyExc_RuntimeError, "Failed to read thread state");
goto error;
Expand Down
Loading
Loading