[Lldb-commits] [PATCH] D34776: Make i386-*-freebsd expression work on JIT path

2017-07-01 Thread Karnajit Wangkhem via Phabricator via lldb-commits
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

[Lldb-commits] [PATCH] D34929: respect target.x86-disassembly-flavor when using `memory read`

2017-07-01 Thread Jeffrey Crowell via Phabricator via lldb-commits
crowell created this revision.
crowell added a project: LLDB.

in DataDumpExtractor, respect the disassembly flavor, useful for using `x/i 
(gdb-style)` or `memory read --format instruction`

  (lldb) x/i $pc
  ->  0x113fe: 48 c7 85 50 fb ff ff 00 00 00 00  movq   $0x0, -0x4b0(%rbp)
  (lldb) settings set target.x86-disassembly-flavor intel
  (lldb) x/i $pc
  ->  0x113fe: 48 c7 85 50 fb ff ff 00 00 00 00  movqword ptr [rbp - 
0x4b0], 0x0

instead of how it was previously

  (lldb) x/i $pc
  ->  0x113fe: 48 c7 85 50 fb ff ff 00 00 00 00  movq   $0x0, -0x4b0(%rbp)
  (lldb) settings set target.x86-disassembly-flavor intel
  (lldb) x/i $pc
  ->  0x113fe: 48 c7 85 50 fb ff ff 00 00 00 00  movq   $0x0, -0x4b0(%rbp)


Repository:
  rL LLVM

https://reviews.llvm.org/D34929

Files:
  source/Core/DumpDataExtractor.cpp


Index: source/Core/DumpDataExtractor.cpp
===
--- source/Core/DumpDataExtractor.cpp
+++ source/Core/DumpDataExtractor.cpp
@@ -154,7 +154,8 @@
   target_sp = exe_scope->CalculateTarget();
 if (target_sp) {
   DisassemblerSP disassembler_sp(Disassembler::FindPlugin(
-  target_sp->GetArchitecture(), nullptr, nullptr));
+  target_sp->GetArchitecture(),
+  target_sp->GetDisassemblyFlavor(), nullptr));
   if (disassembler_sp) {
 lldb::addr_t addr = base_addr + start_offset;
 lldb_private::Address so_addr;


Index: source/Core/DumpDataExtractor.cpp
===
--- source/Core/DumpDataExtractor.cpp
+++ source/Core/DumpDataExtractor.cpp
@@ -154,7 +154,8 @@
   target_sp = exe_scope->CalculateTarget();
 if (target_sp) {
   DisassemblerSP disassembler_sp(Disassembler::FindPlugin(
-  target_sp->GetArchitecture(), nullptr, nullptr));
+  target_sp->GetArchitecture(),
+  target_sp->GetDisassemblyFlavor(), nullptr));
   if (disassembler_sp) {
 lldb::addr_t addr = base_addr + start_offset;
 lldb_private::Address so_addr;
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits