Author: vedantk Date: Thu May 31 15:09:00 2018 New Revision: 333698 URL: http://llvm.org/viewvc/llvm-project?rev=333698&view=rev Log: [IRMemoryMap] Test host-side allocations
r333583 introduced testing for IRMemoryMap's process-side allocations (eAllocationPolicyProcessOnly). This adds support for the host-side variety (eAllocationPolicyHostOnly). Modified: lldb/trunk/lit/Expr/TestIRMemoryMap.test lldb/trunk/tools/lldb-test/lldb-test.cpp Modified: lldb/trunk/lit/Expr/TestIRMemoryMap.test URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/Expr/TestIRMemoryMap.test?rev=333698&r1=333697&r2=333698&view=diff ============================================================================== --- lldb/trunk/lit/Expr/TestIRMemoryMap.test (original) +++ lldb/trunk/lit/Expr/TestIRMemoryMap.test Thu May 31 15:09:00 2018 @@ -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 Modified: lldb/trunk/tools/lldb-test/lldb-test.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/lldb-test/lldb-test.cpp?rev=333698&r1=333697&r2=333698&view=diff ============================================================================== --- lldb/trunk/tools/lldb-test/lldb-test.cpp (original) +++ lldb/trunk/tools/lldb-test/lldb-test.cpp Thu May 31 15:09:00 2018 @@ -159,6 +159,10 @@ static cl::opt<std::string> CommandFile( cl::desc("<command-file>"), cl::init("-"), cl::sub(IRMemoryMapSubcommand)); +static cl::opt<bool> UseHostOnlyAllocationPolicy( + "host-only", cl::desc("Use the host-only allocation policy"), + cl::init(false), cl::sub(IRMemoryMapSubcommand)); + using AllocationT = std::pair<addr_t, addr_t>; bool areAllocationsOverlapping(const AllocationT &L, const AllocationT &R); using AddrIntervalMap = @@ -521,14 +525,16 @@ bool opts::irmemorymap::evalMalloc(IRMem 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; _______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits