[Lldb-commits] [lldb] r241045 - [LLDB][MIPS] Getting correct flags for MIPS

Mohit K. Bhakkad mohit.bhakkad at gmail.com
Mon Jun 29 23:29:12 PDT 2015


Author: mohit.bhakkad
Date: Tue Jun 30 01:29:12 2015
New Revision: 241045

URL: http://llvm.org/viewvc/llvm-project?rev=241045&view=rev
Log:
[LLDB][MIPS] Getting correct flags for MIPS
Patch by Nitesh Jain

Reviewers: clayborg, ovyalov, emaste.
Subscribers: jaydeep, bhushan, dsanders, mohit.bhakkad, sagar, labath, tberghammer, lldb-commits.
Differential Revision: http://reviews.llvm.org/D10685

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

Modified: lldb/trunk/include/lldb/Target/Platform.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Target/Platform.h?rev=241045&r1=241044&r2=241045&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Target/Platform.h (original)
+++ lldb/trunk/include/lldb/Target/Platform.h Tue Jun 30 01:29:12 2015
@@ -752,7 +752,7 @@ class ModuleCache;
         Unlink(const FileSpec &file_spec);
 
         virtual uint64_t
-        ConvertMmapFlagsToPlatform(unsigned flags);
+        ConvertMmapFlagsToPlatform(const ArchSpec &arch, unsigned flags);
 
         virtual bool
         GetSupportsRSync ()

Modified: lldb/trunk/source/Plugins/Platform/Linux/PlatformLinux.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Platform/Linux/PlatformLinux.cpp?rev=241045&r1=241044&r2=241045&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Platform/Linux/PlatformLinux.cpp (original)
+++ lldb/trunk/source/Plugins/Platform/Linux/PlatformLinux.cpp Tue Jun 30 01:29:12 2015
@@ -896,12 +896,21 @@ PlatformLinux::AttachNativeProcess (lldb
 }
 
 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;
 }

Modified: lldb/trunk/source/Plugins/Platform/Linux/PlatformLinux.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Platform/Linux/PlatformLinux.h?rev=241045&r1=241044&r2=241045&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Platform/Linux/PlatformLinux.h (original)
+++ lldb/trunk/source/Plugins/Platform/Linux/PlatformLinux.h Tue Jun 30 01:29:12 2015
@@ -120,7 +120,7 @@ namespace platform_linux {
                              NativeProcessProtocolSP &process_sp) override;
 
         uint64_t
-        ConvertMmapFlagsToPlatform(unsigned flags) override;
+        ConvertMmapFlagsToPlatform(const ArchSpec &arch, unsigned flags) override;
 
     private:
         DISALLOW_COPY_AND_ASSIGN (PlatformLinux);

Modified: lldb/trunk/source/Plugins/Process/Utility/InferiorCallPOSIX.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Utility/InferiorCallPOSIX.cpp?rev=241045&r1=241044&r2=241045&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/Utility/InferiorCallPOSIX.cpp (original)
+++ lldb/trunk/source/Plugins/Process/Utility/InferiorCallPOSIX.cpp Tue Jun 30 01:29:12 2015
@@ -86,7 +86,8 @@ lldb_private::InferiorCallMmap (Process
                 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))

Modified: lldb/trunk/source/Target/Platform.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/Platform.cpp?rev=241045&r1=241044&r2=241045&view=diff
==============================================================================
--- lldb/trunk/source/Target/Platform.cpp (original)
+++ lldb/trunk/source/Target/Platform.cpp Tue Jun 30 01:29:12 2015
@@ -1500,7 +1500,7 @@ Platform::Unlink(const FileSpec &path)
 }
 
 uint64_t
-Platform::ConvertMmapFlagsToPlatform(unsigned flags)
+Platform::ConvertMmapFlagsToPlatform(const ArchSpec &arch, unsigned flags)
 {
     uint64_t flags_platform = 0;
     if (flags & eMmapFlagsPrivate)





More information about the lldb-commits mailing list