Skip to content

Commit

Permalink
[LLDB][MIPS] Getting correct flags for MIPS
Browse files Browse the repository at this point in the history
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

llvm-svn: 241045
  • Loading branch information
Mohit7 committed Jun 30, 2015
1 parent 28dbd3c commit e0d8c42
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 6 deletions.
2 changes: 1 addition & 1 deletion lldb/include/lldb/Target/Platform.h
Expand Up @@ -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 ()
Expand Down
13 changes: 11 additions & 2 deletions lldb/source/Plugins/Platform/Linux/PlatformLinux.cpp
Expand Up @@ -896,12 +896,21 @@ PlatformLinux::AttachNativeProcess (lldb::pid_t pid,
}

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;
}
2 changes: 1 addition & 1 deletion lldb/source/Plugins/Platform/Linux/PlatformLinux.h
Expand Up @@ -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);
Expand Down
3 changes: 2 additions & 1 deletion lldb/source/Plugins/Process/Utility/InferiorCallPOSIX.cpp
Expand Up @@ -86,7 +86,8 @@ lldb_private::InferiorCallMmap (Process *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))
Expand Down
2 changes: 1 addition & 1 deletion lldb/source/Target/Platform.cpp
Expand Up @@ -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)
Expand Down

0 comments on commit e0d8c42

Please sign in to comment.