karnajitw updated this revision to Diff 104984.
karnajitw added a comment.
Done the changes. Please verify. Tried with RefArray but looks like they don't
work well with copy.
https://reviews.llvm.org/D34776
Files:
include/lldb/Target/Platform.h
source/Plugins/ABI/SysV-i386/ABISysV_i386.cpp
source/Plugins/Platform/FreeBSD/PlatformFreeBSD.cpp
source/Plugins/Platform/FreeBSD/PlatformFreeBSD.h
source/Plugins/Platform/Linux/PlatformLinux.cpp
source/Plugins/Platform/Linux/PlatformLinux.h
source/Plugins/Platform/NetBSD/PlatformNetBSD.cpp
source/Plugins/Platform/NetBSD/PlatformNetBSD.h
source/Plugins/Platform/OpenBSD/PlatformOpenBSD.cpp
source/Plugins/Platform/OpenBSD/PlatformOpenBSD.h
source/Plugins/Process/Utility/InferiorCallPOSIX.cpp
source/Target/Platform.cpp
Index: source/Target/Platform.cpp
===
--- source/Target/Platform.cpp
+++ source/Target/Platform.cpp
@@ -1316,14 +1316,18 @@
return error;
}
-uint64_t Platform::ConvertMmapFlagsToPlatform(const ArchSpec &arch,
- unsigned flags) {
+MmapArgList Platform::GetMmapArgumentList(const ArchSpec &arch, addr_t addr,
+ addr_t length, unsigned prot,
+ unsigned flags, addr_t fd,
+ addr_t offset) {
uint64_t flags_platform = 0;
if (flags & eMmapFlagsPrivate)
flags_platform |= MAP_PRIVATE;
if (flags & eMmapFlagsAnon)
flags_platform |= MAP_ANON;
- return flags_platform;
+
+ MmapArgList args({addr, length, prot, flags_platform, fd, offset});
+ return args;
}
lldb_private::Status Platform::RunShellCommand(
Index: source/Plugins/Process/Utility/InferiorCallPOSIX.cpp
===
--- source/Plugins/Process/Utility/InferiorCallPOSIX.cpp
+++ source/Plugins/Process/Utility/InferiorCallPOSIX.cpp
@@ -64,7 +64,7 @@
options.SetTimeout(std::chrono::milliseconds(500));
options.SetTrapExceptions(false);
- addr_t prot_arg, flags_arg = 0;
+ addr_t prot_arg;
if (prot == eMmapProtNone)
prot_arg = PROT_NONE;
else {
@@ -77,11 +77,6 @@
prot_arg |= PROT_WRITE;
}
- 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)) {
@@ -89,7 +84,10 @@
process->GetTarget().GetScratchClangASTContext();
CompilerType clang_void_ptr_type =
clang_ast_context->GetBasicType(eBasicTypeVoid).GetPointerType();
-lldb::addr_t args[] = {addr, length, prot_arg, flags_arg, fd, offset};
+const ArchSpec arch = process->GetTarget().GetArchitecture();
+MmapArgList args =
+process->GetTarget().GetPlatform()->GetMmapArgumentList(
+arch, addr, length, prot_arg, flags, fd, offset);
lldb::ThreadPlanSP call_plan_sp(
new ThreadPlanCallFunction(*thread, mmap_range.GetBaseAddress(),
clang_void_ptr_type, args, options));
Index: source/Plugins/Platform/OpenBSD/PlatformOpenBSD.h
===
--- source/Plugins/Platform/OpenBSD/PlatformOpenBSD.h
+++ source/Plugins/Platform/OpenBSD/PlatformOpenBSD.h
@@ -53,8 +53,10 @@
void CalculateTrapHandlerSymbolNames() override;
- uint64_t ConvertMmapFlagsToPlatform(const ArchSpec &arch,
- unsigned flags) override;
+ MmapArgList GetMmapArgumentList(const ArchSpec &arch, lldb::addr_t addr,
+ lldb::addr_t length, unsigned prot,
+ unsigned flags, lldb::addr_t fd,
+ lldb::addr_t offset) override;
private:
DISALLOW_COPY_AND_ASSIGN(PlatformOpenBSD);
Index: source/Plugins/Platform/OpenBSD/PlatformOpenBSD.cpp
===
--- source/Plugins/Platform/OpenBSD/PlatformOpenBSD.cpp
+++ source/Plugins/Platform/OpenBSD/PlatformOpenBSD.cpp
@@ -211,8 +211,10 @@
m_trap_handlers.push_back(ConstString("_sigtramp"));
}
-uint64_t PlatformOpenBSD::ConvertMmapFlagsToPlatform(const ArchSpec &arch,
-unsigned flags) {
+MmapArgList PlatformOpenBSD::GetMmapArgumentList(const ArchSpec &arch,
+ addr_t addr, addr_t length,
+ unsigned prot, unsigned flags,
+ addr_t fd, addr_t offset) {
uint64_t f