Files
Jonas Devlieghere 0c472c1401 [lldb] Handle partial memory region coverage in IRMemoryMap::FindSpace (#194001)
FindSpace walks process memory regions to find addresses that won't
collide with the inferior's real memory. This is necessary even for
host-only allocations because the IR Interpreter works entirely in
inferior virtual addresses. IRMemoryMap remaps those addresses to read
from host memory instead of inferior memory, so overlapping ranges would
silently read the wrong data.

For WebAssembly, GetMemoryRegionInfo succeeds for the first region
(linear memory) but fails for addresses beyond it. The previous fix
(#193124) skipped the memory region walk entirely when `CanJIT()` is
false. However, as Jason points out, that removes the
collision-avoidance mechanism and risks overlapping with real inferior
memory.

Instead, handle the GetMemoryRegionInfo failure gracefully. If the
target can't describe memory beyond a certain point, treat the remaining
address space as unmapped and use it for the allocation. This preserves
the collision avoidance while avoiding the lldbassert.
2026-04-24 17:34:09 -07:00
..