This revision was automatically updated to reflect the committed changes.
Closed by commit rL311002: Make i386-*-freebsd expression work on JIT path
(authored by emaste).
Changed prior to commit:
https://reviews.llvm.org/D34776?vs=104984&id=111331#toc
Repository:
rL LLVM
https://reviews.llvm.org/D34776
Files:
lldb/trunk/include/lldb/Target/Platform.h
lldb/trunk/source/Plugins/ABI/SysV-i386/ABISysV_i386.cpp
lldb/trunk/source/Plugins/Platform/FreeBSD/PlatformFreeBSD.cpp
lldb/trunk/source/Plugins/Platform/FreeBSD/PlatformFreeBSD.h
lldb/trunk/source/Plugins/Platform/Linux/PlatformLinux.cpp
lldb/trunk/source/Plugins/Platform/Linux/PlatformLinux.h
lldb/trunk/source/Plugins/Platform/NetBSD/PlatformNetBSD.cpp
lldb/trunk/source/Plugins/Platform/NetBSD/PlatformNetBSD.h
lldb/trunk/source/Plugins/Platform/OpenBSD/PlatformOpenBSD.cpp
lldb/trunk/source/Plugins/Platform/OpenBSD/PlatformOpenBSD.h
lldb/trunk/source/Plugins/Process/Utility/InferiorCallPOSIX.cpp
lldb/trunk/source/Target/Platform.cpp
Index: lldb/trunk/source/Target/Platform.cpp
===================================================================
--- lldb/trunk/source/Target/Platform.cpp
+++ lldb/trunk/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: lldb/trunk/source/Plugins/ABI/SysV-i386/ABISysV_i386.cpp
===================================================================
--- lldb/trunk/source/Plugins/ABI/SysV-i386/ABISysV_i386.cpp
+++ lldb/trunk/source/Plugins/ABI/SysV-i386/ABISysV_i386.cpp
@@ -206,7 +206,7 @@
ABISysV_i386::CreateInstance(lldb::ProcessSP process_sp, const ArchSpec &arch) {
static ABISP g_abi_sp;
if ((arch.GetTriple().getArch() == llvm::Triple::x86) &&
- arch.GetTriple().isOSLinux()) {
+ (arch.GetTriple().isOSLinux() || arch.GetTriple().isOSFreeBSD())) {
if (!g_abi_sp)
g_abi_sp.reset(new ABISysV_i386(process_sp));
return g_abi_sp;
Index: lldb/trunk/source/Plugins/Platform/NetBSD/PlatformNetBSD.cpp
===================================================================
--- lldb/trunk/source/Plugins/Platform/NetBSD/PlatformNetBSD.cpp
+++ lldb/trunk/source/Plugins/Platform/NetBSD/PlatformNetBSD.cpp
@@ -420,13 +420,17 @@
m_trap_handlers.push_back(ConstString("_sigtramp"));
}
-uint64_t PlatformNetBSD::ConvertMmapFlagsToPlatform(const ArchSpec &arch,
- unsigned flags) {
+MmapArgList PlatformNetBSD::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;
}
Index: lldb/trunk/source/Plugins/Platform/NetBSD/PlatformNetBSD.h
===================================================================
--- lldb/trunk/source/Plugins/Platform/NetBSD/PlatformNetBSD.h
+++ lldb/trunk/source/Plugins/Platform/NetBSD/PlatformNetBSD.h
@@ -59,8 +59,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(PlatformNetBSD);
Index: lldb/trunk/source/Plugins/Platform/Linux/PlatformLinux.h
===================================================================
--- lldb/trunk/source/Plugins/Platform/Linux/PlatformLinux.h
+++ lldb/trunk/source/Plugins/Platform/Linux/PlatformLinux.h
@@ -59,8 +59,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(PlatformLinux);
Index: lldb/trunk/source/Plugins/Platform/Linux/PlatformLinux.cpp
===================================================================
--- lldb/trunk/source/Plugins/Platform/Linux/PlatformLinux.cpp
+++ lldb/trunk/source/Plugins/Platform/Linux/PlatformLinux.cpp
@@ -390,8 +390,10 @@
m_trap_handlers.push_back(ConstString("_sigtramp"));
}
-uint64_t PlatformLinux::ConvertMmapFlagsToPlatform(const ArchSpec &arch,
- unsigned flags) {
+MmapArgList PlatformLinux::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;
uint64_t map_anon = MAP_ANON;
@@ -406,6 +408,8 @@
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;
}
Index: lldb/trunk/source/Plugins/Platform/OpenBSD/PlatformOpenBSD.cpp
===================================================================
--- lldb/trunk/source/Plugins/Platform/OpenBSD/PlatformOpenBSD.cpp
+++ lldb/trunk/source/Plugins/Platform/OpenBSD/PlatformOpenBSD.cpp
@@ -211,13 +211,17 @@
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 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;
}
Index: lldb/trunk/source/Plugins/Platform/OpenBSD/PlatformOpenBSD.h
===================================================================
--- lldb/trunk/source/Plugins/Platform/OpenBSD/PlatformOpenBSD.h
+++ lldb/trunk/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: lldb/trunk/source/Plugins/Platform/FreeBSD/PlatformFreeBSD.h
===================================================================
--- lldb/trunk/source/Plugins/Platform/FreeBSD/PlatformFreeBSD.h
+++ lldb/trunk/source/Plugins/Platform/FreeBSD/PlatformFreeBSD.h
@@ -61,8 +61,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(PlatformFreeBSD);
Index: lldb/trunk/source/Plugins/Platform/FreeBSD/PlatformFreeBSD.cpp
===================================================================
--- lldb/trunk/source/Plugins/Platform/FreeBSD/PlatformFreeBSD.cpp
+++ lldb/trunk/source/Plugins/Platform/FreeBSD/PlatformFreeBSD.cpp
@@ -314,13 +314,19 @@
m_trap_handlers.push_back(ConstString("_sigtramp"));
}
-uint64_t PlatformFreeBSD::ConvertMmapFlagsToPlatform(const ArchSpec &arch,
- unsigned flags) {
+MmapArgList PlatformFreeBSD::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});
+ if (arch.GetTriple().getArch() == llvm::Triple::x86)
+ args.push_back(0);
+ return args;
}
Index: lldb/trunk/source/Plugins/Process/Utility/InferiorCallPOSIX.cpp
===================================================================
--- lldb/trunk/source/Plugins/Process/Utility/InferiorCallPOSIX.cpp
+++ lldb/trunk/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,19 +77,17 @@
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)) {
ClangASTContext *clang_ast_context =
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: lldb/trunk/include/lldb/Target/Platform.h
===================================================================
--- lldb/trunk/include/lldb/Target/Platform.h
+++ lldb/trunk/include/lldb/Target/Platform.h
@@ -53,6 +53,7 @@
};
typedef std::shared_ptr<PlatformProperties> PlatformPropertiesSP;
+typedef llvm::SmallVector<lldb::addr_t, 6> MmapArgList;
//----------------------------------------------------------------------
/// @class Platform Platform.h "lldb/Target/Platform.h"
@@ -628,8 +629,11 @@
virtual Status Unlink(const FileSpec &file_spec);
- virtual uint64_t ConvertMmapFlagsToPlatform(const ArchSpec &arch,
- unsigned flags);
+ virtual 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);
virtual bool GetSupportsRSync() { return m_supports_rsync; }
_______________________________________________
lldb-commits mailing list
[email protected]
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits