Change last-ditch magic address in IRMemoryMap::FindSpace
authorJason Molenda <jason@molenda.com>
Mon, 14 Nov 2022 17:50:58 +0000 (09:50 -0800)
committerJason Molenda <jason@molenda.com>
Mon, 14 Nov 2022 17:54:05 +0000 (09:54 -0800)
commit53c45df5ed1b8ac606f7388cec025aaba0dee9ba
treeffbf5009e27dc6eb37fd32958d9b4e2a6bbc2ed1
parent22339e52da4e88af499e232e452f4d8bb358fa05
Change last-ditch magic address in IRMemoryMap::FindSpace

When we cannot allocate memory in the inferior process, the IR
interpreter's IRMemoryMap::FindSpace will create an lldb local
buffer and assign it an address range in the inferior address
space.  When the interpreter sees an address in that range, it
will read/write from the local buffer instead of the target.  If
this magic address overlaps with actual data in the target, the
target cannot be accessed through expressions.

Instead of using a high memory address that is validly addressable,
this patch uses an address that cannot be accessed on 64-bit systems
that don't actually use all 64 bits of the virtual address.

Differential Revision: https://reviews.llvm.org/D137682
rdar://96248287
lldb/source/Expression/DWARFExpression.cpp
lldb/source/Expression/IRMemoryMap.cpp
lldb/test/API/lang/c/high-mem-global/Makefile [new file with mode: 0644]
lldb/test/API/lang/c/high-mem-global/TestHighMemGlobal.py [new file with mode: 0644]
lldb/test/API/lang/c/high-mem-global/main.c [new file with mode: 0644]