diff --git a/lldb/lit/Expr/TestIRMemoryMap.test b/lldb/lit/Expr/TestIRMemoryMap.test index 8ca467185317..37c59e2dd06d 100644 --- a/lldb/lit/Expr/TestIRMemoryMap.test +++ b/lldb/lit/Expr/TestIRMemoryMap.test @@ -1,3 +1,5 @@ # RUN: %cxx %p/Inputs/call-function.cpp -g -o %t # RUN: lldb-test ir-memory-map %t %S/Inputs/ir-memory-map-basic.test +# RUN: lldb-test ir-memory-map -host-only %t %S/Inputs/ir-memory-map-basic.test # RUN: lldb-test ir-memory-map %t %S/Inputs/ir-memory-map-overlap1.test +# RUN: lldb-test ir-memory-map -host-only %t %S/Inputs/ir-memory-map-overlap1.test diff --git a/lldb/tools/lldb-test/lldb-test.cpp b/lldb/tools/lldb-test/lldb-test.cpp index a7e04318fef5..b06ed7cb49b4 100644 --- a/lldb/tools/lldb-test/lldb-test.cpp +++ b/lldb/tools/lldb-test/lldb-test.cpp @@ -159,6 +159,10 @@ static cl::opt CommandFile(cl::Positional, cl::desc(""), cl::init("-"), cl::sub(IRMemoryMapSubcommand)); +static cl::opt UseHostOnlyAllocationPolicy( + "host-only", cl::desc("Use the host-only allocation policy"), + cl::init(false), cl::sub(IRMemoryMapSubcommand)); + using AllocationT = std::pair; bool areAllocationsOverlapping(const AllocationT &L, const AllocationT &R); using AddrIntervalMap = @@ -521,14 +525,16 @@ bool opts::irmemorymap::evalMalloc(IRMemoryMap &IRMemMap, StringRef Line, exit(1); } + IRMemoryMap::AllocationPolicy AP = + UseHostOnlyAllocationPolicy ? IRMemoryMap::eAllocationPolicyHostOnly + : IRMemoryMap::eAllocationPolicyProcessOnly; + // Issue the malloc in the target process with "-rw" permissions. const uint32_t Permissions = 0x3; const bool ZeroMemory = false; - IRMemoryMap::AllocationPolicy Policy = - IRMemoryMap::eAllocationPolicyProcessOnly; Status ST; addr_t Addr = - IRMemMap.Malloc(Size, Alignment, Permissions, Policy, ZeroMemory, ST); + IRMemMap.Malloc(Size, Alignment, Permissions, AP, ZeroMemory, ST); if (ST.Fail()) { outs() << formatv("Malloc error: {0}\n", ST); return true;