diff options
author | Vedant Kumar <vsk@apple.com> | 2018-05-31 22:09:00 +0000 |
---|---|---|
committer | Vedant Kumar <vsk@apple.com> | 2018-05-31 22:09:00 +0000 |
commit | f616b9db7dc1627e3c892ed1c0a41ffe6213c840 (patch) | |
tree | 6bb630bd748e0ceb16f0907a6a0e49e9a1c79786 /lldb | |
parent | 5b71e75ed34120a6cc0cd5b045558b6900df356b (diff) | |
download | bcm5719-llvm-f616b9db7dc1627e3c892ed1c0a41ffe6213c840.tar.gz bcm5719-llvm-f616b9db7dc1627e3c892ed1c0a41ffe6213c840.zip |
[IRMemoryMap] Test host-side allocations
r333583 introduced testing for IRMemoryMap's process-side allocations
(eAllocationPolicyProcessOnly). This adds support for the host-side
variety (eAllocationPolicyHostOnly).
llvm-svn: 333698
Diffstat (limited to 'lldb')
-rw-r--r-- | lldb/lit/Expr/TestIRMemoryMap.test | 2 | ||||
-rw-r--r-- | lldb/tools/lldb-test/lldb-test.cpp | 12 |
2 files changed, 11 insertions, 3 deletions
diff --git a/lldb/lit/Expr/TestIRMemoryMap.test b/lldb/lit/Expr/TestIRMemoryMap.test index 8ca46718531..37c59e2dd06 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 a7e04318fef..b06ed7cb49b 100644 --- a/lldb/tools/lldb-test/lldb-test.cpp +++ b/lldb/tools/lldb-test/lldb-test.cpp @@ -159,6 +159,10 @@ static cl::opt<std::string> CommandFile(cl::Positional, 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(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; |