[Lldb-commits] [PATCH] [LLDB][MIPS] Getting correct flags for MIPS

Nitesh Jain nitesh.jain at imgtec.com
Mon Jun 29 05:59:55 PDT 2015


REPOSITORY
  rL LLVM

http://reviews.llvm.org/D10685

Files:
  include/lldb/Target/Platform.h
  source/Plugins/Platform/Linux/PlatformLinux.cpp
  source/Plugins/Platform/Linux/PlatformLinux.h
  source/Plugins/Process/Utility/InferiorCallPOSIX.cpp
  source/Target/Platform.cpp

Index: include/lldb/Target/Platform.h
===================================================================
--- include/lldb/Target/Platform.h
+++ include/lldb/Target/Platform.h
@@ -752,7 +752,7 @@
         Unlink(const FileSpec &file_spec);
 
         virtual uint64_t
-        ConvertMmapFlagsToPlatform(unsigned flags);
+        ConvertMmapFlagsToPlatform(const ArchSpec &arch, unsigned flags);
 
         virtual bool
         GetSupportsRSync ()
Index: source/Plugins/Platform/Linux/PlatformLinux.cpp
===================================================================
--- source/Plugins/Platform/Linux/PlatformLinux.cpp
+++ source/Plugins/Platform/Linux/PlatformLinux.cpp
@@ -896,12 +896,21 @@
 }
 
 uint64_t
-PlatformLinux::ConvertMmapFlagsToPlatform(unsigned flags)
+PlatformLinux::ConvertMmapFlagsToPlatform(const ArchSpec &arch, unsigned flags)
 {
     uint64_t flags_platform = 0;
+    uint64_t map_anon = MAP_ANON;
+
+    // To get correct flags for MIPS Architecture
+    if (arch.GetTriple ().getArch () == llvm::Triple::mips64
+       || arch.GetTriple ().getArch () == llvm::Triple::mips64el 
+       || arch.GetTriple ().getArch () == llvm::Triple::mips 
+       || arch.GetTriple ().getArch () == llvm::Triple::mipsel)
+           map_anon = 0x800;
+
     if (flags & eMmapFlagsPrivate)
         flags_platform |= MAP_PRIVATE;
     if (flags & eMmapFlagsAnon)
-        flags_platform |= MAP_ANON;
+        flags_platform |= map_anon;
     return flags_platform;
 }
Index: source/Plugins/Platform/Linux/PlatformLinux.h
===================================================================
--- source/Plugins/Platform/Linux/PlatformLinux.h
+++ source/Plugins/Platform/Linux/PlatformLinux.h
@@ -120,7 +120,7 @@
                              NativeProcessProtocolSP &process_sp) override;
 
         uint64_t
-        ConvertMmapFlagsToPlatform(unsigned flags) override;
+        ConvertMmapFlagsToPlatform(const ArchSpec &arch, unsigned flags) override;
 
     private:
         DISALLOW_COPY_AND_ASSIGN (PlatformLinux);
Index: source/Plugins/Process/Utility/InferiorCallPOSIX.cpp
===================================================================
--- source/Plugins/Process/Utility/InferiorCallPOSIX.cpp
+++ source/Plugins/Process/Utility/InferiorCallPOSIX.cpp
@@ -86,7 +86,8 @@
                 prot_arg |= PROT_WRITE;
             }
 
-            flags_arg = process->GetTarget().GetPlatform()->ConvertMmapFlagsToPlatform(flags);
+            const ArchSpec arch =  process->GetTarget().GetArchitecture();
+            flags_arg = process->GetTarget().GetPlatform()->ConvertMmapFlagsToPlatform(arch,flags);
 
             AddressRange mmap_range;
             if (sc.GetAddressRange(range_scope, 0, use_inline_block_range, mmap_range))
Index: source/Target/Platform.cpp
===================================================================
--- source/Target/Platform.cpp
+++ source/Target/Platform.cpp
@@ -1500,13 +1500,21 @@
 }
 
 uint64_t
-Platform::ConvertMmapFlagsToPlatform(unsigned flags)
+Platform::ConvertMmapFlagsToPlatform(const ArchSpec &arch, unsigned flags)
 {
+    uint64_t map_anon = MAP_ANON;
     uint64_t flags_platform = 0;
+
+    if (arch.GetTriple ().getArch () == llvm::Triple::mips64 
+       || arch.GetTriple ().getArch () == llvm::Triple::mips64el 
+       || arch.GetTriple ().getArch () == llvm::Triple::mips 
+       || arch.GetTriple ().getArch () == llvm::Triple::mipsel)
+           map_anon = 0x800;
+
     if (flags & eMmapFlagsPrivate)
         flags_platform |= MAP_PRIVATE;
     if (flags & eMmapFlagsAnon)
-        flags_platform |= MAP_ANON;
+        flags_platform |= map_anon;
     return flags_platform;
 }

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D10685.28665.patch
Type: text/x-patch
Size: 3665 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20150629/1fcc2469/attachment.bin>


More information about the lldb-commits mailing list