pkgsrc-WIP-changes archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

lldb-netbsd: Kill another PTRACE_POKEDATA, Comment out procfilereader



Module Name:	pkgsrc-wip
Committed By:	Kamil Rytarowski <n54%gmx.com@localhost>
Pushed By:	kamil
Date:		Mon Dec 19 03:03:45 2016 +0100
Changeset:	407247ebfa6edcf14b8c8ec4f746757114c08711

Modified Files:
	lldb-netbsd/distinfo
	lldb-netbsd/patches/patch-source_Plugins_Process_NetBSD_NativeProcessNetBSD.cpp
	lldb-netbsd/patches/patch-source_Plugins_Process_NetBSD_NativeProcessNetBSD.h

Log Message:
lldb-netbsd: Kill another PTRACE_POKEDATA, Comment out procfilereader

These changes are preparing the code to be built and improve later.

Sponsored by <The NetBSD Foundation>

To see a diff of this commit:
https://wip.pkgsrc.org/cgi-bin/gitweb.cgi?p=pkgsrc-wip.git;a=commitdiff;h=407247ebfa6edcf14b8c8ec4f746757114c08711

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

diffstat:
 lldb-netbsd/distinfo                               |  4 +-
 ..._Plugins_Process_NetBSD_NativeProcessNetBSD.cpp | 81 +++++++---------------
 ...ce_Plugins_Process_NetBSD_NativeProcessNetBSD.h |  9 +--
 3 files changed, 28 insertions(+), 66 deletions(-)

diffs:
diff --git a/lldb-netbsd/distinfo b/lldb-netbsd/distinfo
index f3415be..2a815cd 100644
--- a/lldb-netbsd/distinfo
+++ b/lldb-netbsd/distinfo
@@ -20,8 +20,8 @@ SHA1 (patch-source_Host_netbsd_HostThreadNetBSD.cpp) = a1b0fbdad062309a845cfefe4
 SHA1 (patch-source_Host_netbsd_ThisThread.cpp) = f0d32c81bc1b8fe9aeb86519ea46ba2cb16571c2
 SHA1 (patch-source_Plugins_Process_CMakeLists.txt) = c0168f81da56d9896eb414e6b8bb7262de04ac33
 SHA1 (patch-source_Plugins_Process_NetBSD_CMakeLists.txt) = df17afdf71c29d945c887e318718904793cd48ad
-SHA1 (patch-source_Plugins_Process_NetBSD_NativeProcessNetBSD.cpp) = a8d0c21f775aa8e0acfb1051716785897a6d560c
-SHA1 (patch-source_Plugins_Process_NetBSD_NativeProcessNetBSD.h) = 7cf588554bab15f4cc5c8510e92884af52fff7e4
+SHA1 (patch-source_Plugins_Process_NetBSD_NativeProcessNetBSD.cpp) = f83c6cdb1c66713707e723a342ddfd864048ddba
+SHA1 (patch-source_Plugins_Process_NetBSD_NativeProcessNetBSD.h) = 4f2ef718b2780d4407fd7fa950848aa51605c7fd
 SHA1 (patch-source_Plugins_Process_NetBSD_NativeThreadNetBSD.cpp) = 739cb25a654c746a6e6a7ed818b824205411e4fe
 SHA1 (patch-source_Plugins_Process_NetBSD_NativeThreadNetBSD.h) = b65394500b6c5d01fcf3294a57ec5a8a086df45a
 SHA1 (patch-tools_lldb-mi_MICmnBase.cpp) = 851c82ac61e1241018755fbd7236af00379ac986
diff --git a/lldb-netbsd/patches/patch-source_Plugins_Process_NetBSD_NativeProcessNetBSD.cpp b/lldb-netbsd/patches/patch-source_Plugins_Process_NetBSD_NativeProcessNetBSD.cpp
index 5312759..575d189 100644
--- a/lldb-netbsd/patches/patch-source_Plugins_Process_NetBSD_NativeProcessNetBSD.cpp
+++ b/lldb-netbsd/patches/patch-source_Plugins_Process_NetBSD_NativeProcessNetBSD.cpp
@@ -2,7 +2,7 @@ $NetBSD$
 
 --- source/Plugins/Process/NetBSD/NativeProcessNetBSD.cpp.orig	2016-12-19 01:22:58.080559848 +0000
 +++ source/Plugins/Process/NetBSD/NativeProcessNetBSD.cpp
-@@ -0,0 +1,1853 @@
+@@ -0,0 +1,1820 @@
 +//===-- NativeProcessNetBSD.cpp -------------------------------- -*- C++ -*-===//
 +//
 +//                     The LLVM Compiler Infrastructure
@@ -1383,8 +1383,8 @@ $NetBSD$
 +Error NativeProcessNetBSD::WriteMemory(lldb::addr_t addr, const void *buf,
 +                                      size_t size, size_t &bytes_written) {
 +  const unsigned char *src = static_cast<const unsigned char *>(buf);
-+  size_t remainder;
 +  Error error;
++  struct ptrace_io_desc io;
 +
 +  Log *log(ProcessPOSIXLog::GetLogIfAllCategoriesSet(POSIX_LOG_ALL));
 +  if (log)
@@ -1394,70 +1394,31 @@ $NetBSD$
 +    log->Printf("NativeProcessNetBSD::%s(0x%" PRIx64 ", %p, %zu)", __FUNCTION__,
 +                addr, buf, size);
 +
-+  for (bytes_written = 0; bytes_written < size; bytes_written += remainder) {
-+    remainder = size - bytes_written;
-+    remainder = remainder > k_ptrace_word_size ? k_ptrace_word_size : remainder;
-+
-+    if (remainder == k_ptrace_word_size) {
-+      unsigned long data = 0;
-+      memcpy(&data, src, k_ptrace_word_size);
-+
-+      if (log && ProcessPOSIXLog::AtTopNestLevel() &&
-+          (log->GetMask().Test(POSIX_LOG_MEMORY_DATA_LONG) ||
-+           (log->GetMask().Test(POSIX_LOG_MEMORY_DATA_SHORT) &&
-+            size <= POSIX_LOG_MEMORY_SHORT_BYTES)))
-+        log->Printf("NativeProcessNetBSD::%s() [%p]:0x%lx (0x%lx)", __FUNCTION__,
-+                    (void *)addr, *(const unsigned long *)src, data);
-+
-+      error = NativeProcessNetBSD::PtraceWrapper(PTRACE_POKEDATA, GetID(),
-+                                                (void *)addr, (void *)data);
-+      if (error.Fail()) {
-+        if (log)
-+          ProcessPOSIXLog::DecNestLevel();
-+        return error;
-+      }
-+    } else {
-+      unsigned char buff[8];
-+      size_t bytes_read;
-+      error = ReadMemory(addr, buff, k_ptrace_word_size, bytes_read);
-+      if (error.Fail()) {
-+        if (log)
-+          ProcessPOSIXLog::DecNestLevel();
-+        return error;
-+      }
-+
-+      memcpy(buff, src, remainder);
++  bytes_written = 0;
++  io.piod_op = PIOD_WRITE_D;
++  io.piod_len = size;
 +
-+      size_t bytes_written_rec;
-+      error = WriteMemory(addr, buff, k_ptrace_word_size, bytes_written_rec);
-+      if (error.Fail()) {
-+        if (log)
-+          ProcessPOSIXLog::DecNestLevel();
-+        return error;
-+      }
++  do {
++    io.piod_offs = (void *)(src + bytes_written);
++    io.piod_offs = (void *)(addr + bytes_written);
 +
-+      if (log && ProcessPOSIXLog::AtTopNestLevel() &&
-+          (log->GetMask().Test(POSIX_LOG_MEMORY_DATA_LONG) ||
-+           (log->GetMask().Test(POSIX_LOG_MEMORY_DATA_SHORT) &&
-+            size <= POSIX_LOG_MEMORY_SHORT_BYTES)))
-+        log->Printf("NativeProcessNetBSD::%s() [%p]:0x%lx (0x%lx)", __FUNCTION__,
-+                    (void *)addr, *(const unsigned long *)src,
-+                    *(unsigned long *)buff);
++    Error error = NativeProcessNetBSD::PtraceWrapper(
++        PT_IO, GetID(), &io);
++    if (error.Fail()) {
++      if (log)
++        ProcessPOSIXLog::DecNestLevel();
++      return error;
 +    }
 +
-+    addr += k_ptrace_word_size;
-+    src += k_ptrace_word_size;
-+  }
++    bytes_written = io.piod_len;
++    io.piod_len = size - bytes_written;
++  } while(bytes_written < size);
++
 +  if (log)
 +    ProcessPOSIXLog::DecNestLevel();
 +  return error;
 +}
 +
-+Error NativeProcessNetBSD::GetEventMessage(lldb::tid_t tid,
-+                                          unsigned long *message) {
-+  return PtraceWrapper(PTRACE_GETEVENTMSG, tid, nullptr, message);
-+}
-+
 +bool NativeProcessNetBSD::HasThreadNoLock(lldb::tid_t thread_id) {
 +  for (auto thread_sp : m_threads) {
 +    assert(thread_sp && "thread list should not contain NULL threads");
@@ -1618,6 +1579,7 @@ $NetBSD$
 +
 +  bool found = false;
 +  file_spec.Clear();
++#if 0
 +  ProcFileReader::ProcessLineByLine(
 +      GetID(), "maps", [&](const std::string &line) {
 +        SmallVector<StringRef, 16> columns;
@@ -1633,6 +1595,7 @@ $NetBSD$
 +        found = true;
 +        return false; // we are done
 +      });
++#endif
 +
 +  if (!found)
 +    return Error("Module file (%s) not found in /proc/%" PRIu64 "/maps file!",
@@ -1644,6 +1607,7 @@ $NetBSD$
 +Error NativeProcessNetBSD::GetFileLoadAddress(const llvm::StringRef &file_name,
 +                                             lldb::addr_t &load_addr) {
 +  load_addr = LLDB_INVALID_ADDRESS;
++#if 0
 +  Error error = ProcFileReader::ProcessLineByLine(
 +      GetID(), "maps", [&](const std::string &line) -> bool {
 +        StringRef maps_row(line);
@@ -1667,6 +1631,9 @@ $NetBSD$
 +        // Return true to continue reading the proc file
 +        return true;
 +      });
++#else
++  Error error;
++#endif
 +  return error;
 +}
 +
diff --git a/lldb-netbsd/patches/patch-source_Plugins_Process_NetBSD_NativeProcessNetBSD.h b/lldb-netbsd/patches/patch-source_Plugins_Process_NetBSD_NativeProcessNetBSD.h
index b0d80fc..beccf88 100644
--- a/lldb-netbsd/patches/patch-source_Plugins_Process_NetBSD_NativeProcessNetBSD.h
+++ b/lldb-netbsd/patches/patch-source_Plugins_Process_NetBSD_NativeProcessNetBSD.h
@@ -1,8 +1,8 @@
 $NetBSD$
 
---- source/Plugins/Process/NetBSD/NativeProcessNetBSD.h.orig	2016-12-17 13:23:23.783483302 +0000
+--- source/Plugins/Process/NetBSD/NativeProcessNetBSD.h.orig	2016-12-19 01:22:58.087120268 +0000
 +++ source/Plugins/Process/NetBSD/NativeProcessNetBSD.h
-@@ -0,0 +1,191 @@
+@@ -0,0 +1,186 @@
 +//===-- NativeProcessNetBSD.h ---------------------------------- -*- C++ -*-===//
 +//
 +//                     The LLVM Compiler Infrastructure
@@ -169,11 +169,6 @@ $NetBSD$
 +  /// memory region pointed to by @p siginfo.
 +  Error GetSignalInfo(lldb::tid_t tid, void *siginfo);
 +
-+  /// Writes the raw event message code (vis-a-vis PTRACE_GETEVENTMSG)
-+  /// corresponding to the given thread ID to the memory pointed to by @p
-+  /// message.
-+  Error GetEventMessage(lldb::tid_t tid, unsigned long *message);
-+
 +  void NotifyThreadDeath(lldb::tid_t tid);
 +
 +  Error Detach(lldb::tid_t tid);


Home | Main Index | Thread Index | Old Index