diff options
| author | Robert Flack <flackr@gmail.com> | 2015-05-09 15:53:31 +0000 |
|---|---|---|
| committer | Robert Flack <flackr@gmail.com> | 2015-05-09 15:53:31 +0000 |
| commit | 96ad3de54bae1148b0c0e490b3e61515baf215d6 (patch) | |
| tree | acab1f7df18c544735149792bd872ca2cd4dcb28 /lldb/source/Plugins/Platform/Linux | |
| parent | 3e6070ef038168de377889abf48e61168eac26ab (diff) | |
| download | bcm5719-llvm-96ad3de54bae1148b0c0e490b3e61515baf215d6.tar.gz bcm5719-llvm-96ad3de54bae1148b0c0e490b3e61515baf215d6.zip | |
Convert mmap options for target in InferiorCallMmap.
Converts the MAP_PRIVATE and MAP_ANON options to the target platform constants
(on which the call runs) rather than using those of the compiled host.
Test Plan:
Run test suite, the following tests requiring memory allocation / JIT support
begin passing when running mac -> linux:
Test11588.py
TestAnonymous.py
TestBreakpointConditions.py
TestCPPStaticMethods.py
TestCStrings.py
TestCallStdStringFunction.py
TestDataFormatterCpp.py
TestDataFormatterStdList.py
TestExprDoesntBlock.py
TestExprHelpExamples.py
TestFunctionTypes.py
TestPrintfAfterUp.py
TestSBValuePersist.py
TestSetValues.py
Differential Revision: http://reviews.llvm.org/D9511
llvm-svn: 236933
Diffstat (limited to 'lldb/source/Plugins/Platform/Linux')
| -rw-r--r-- | lldb/source/Plugins/Platform/Linux/PlatformLinux.cpp | 41 | ||||
| -rw-r--r-- | lldb/source/Plugins/Platform/Linux/PlatformLinux.h | 3 |
2 files changed, 28 insertions, 16 deletions
diff --git a/lldb/source/Plugins/Platform/Linux/PlatformLinux.cpp b/lldb/source/Plugins/Platform/Linux/PlatformLinux.cpp index c2ef981580c..740cf095f82 100644 --- a/lldb/source/Plugins/Platform/Linux/PlatformLinux.cpp +++ b/lldb/source/Plugins/Platform/Linux/PlatformLinux.cpp @@ -14,6 +14,7 @@ // C Includes #include <stdio.h> +#include <vector> #ifndef LLDB_DISABLE_POSIX #include <sys/utsname.h> #endif @@ -42,6 +43,11 @@ #include "../../Process/Linux/NativeProcessLinux.h" #endif +// Define these constants from Linux mman.h for use when targetting +// remote linux systems even when host has different values. +#define MAP_PRIVATE 2 +#define MAP_ANON 0x20 + using namespace lldb; using namespace lldb_private; using namespace lldb_private::platform_linux; @@ -492,22 +498,14 @@ PlatformLinux::FindProcesses (const ProcessInstanceInfoMatch &match_info, bool PlatformLinux::GetSupportedArchitectureAtIndex (uint32_t idx, ArchSpec &arch) { - if (idx == 0) - { - arch = HostInfo::GetArchitecture(HostInfo::eArchKindDefault); - return arch.IsValid(); - } - else if (idx == 1) - { - // If the default host architecture is 64-bit, look for a 32-bit variant - ArchSpec hostArch = HostInfo::GetArchitecture(HostInfo::eArchKindDefault); - if (hostArch.IsValid() && hostArch.GetTriple().isArch64Bit()) - { - arch = HostInfo::GetArchitecture(HostInfo::eArchKind32); - return arch.IsValid(); - } - } - return false; + static std::vector<ArchSpec> architectures = { + ArchSpec("x86_64-unknown-linux-gnu"), + ArchSpec("i386-unknown-linux-gnu"), + }; + if (idx >= architectures.size()) + return false; + arch = architectures[idx]; + return true; } void @@ -911,3 +909,14 @@ PlatformLinux::AttachNativeProcess (lldb::pid_t pid, return process_linux::NativeProcessLinux::AttachToProcess (pid, native_delegate, process_sp); #endif } + +uint64_t +PlatformLinux::ConvertMmapFlagsToPlatform(unsigned flags) +{ + uint64_t flags_platform = 0; + if (flags & eMmapFlagsPrivate) + flags_platform |= MAP_PRIVATE; + if (flags & eMmapFlagsAnon) + flags_platform |= MAP_ANON; + return flags_platform; +} diff --git a/lldb/source/Plugins/Platform/Linux/PlatformLinux.h b/lldb/source/Plugins/Platform/Linux/PlatformLinux.h index 626b58fe509..4caf5352ad7 100644 --- a/lldb/source/Plugins/Platform/Linux/PlatformLinux.h +++ b/lldb/source/Plugins/Platform/Linux/PlatformLinux.h @@ -119,6 +119,9 @@ namespace platform_linux { NativeProcessProtocol::NativeDelegate &native_delegate, NativeProcessProtocolSP &process_sp) override; + uint64_t + ConvertMmapFlagsToPlatform(unsigned flags) override; + static bool UseLlgsForLocalDebugging (); |

