pkgsrc-WIP-changes archive

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

lldb-netbsd: Adapt local changes to upstream review



Module Name:	pkgsrc-wip
Committed By:	Kamil Rytarowski <n54%gmx.com@localhost>
Pushed By:	kamil
Date:		Thu Mar 30 20:39:28 2017 +0200
Changeset:	1cbd314a074d34b7355d2824f7be384948a99849

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

Log Message:
lldb-netbsd: Adapt local changes to upstream review

https://reviews.llvm.org/D31450

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=1cbd314a074d34b7355d2824f7be384948a99849

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

diffstat:
 lldb-netbsd/distinfo                               |  5 +-
 ...ins_DynamicLoader_POSIX-DYLD_DYLDRendezvous.cpp | 12 ++-
 ..._Plugins_Process_NetBSD_NativeProcessNetBSD.cpp | 99 +++++++++++++++++-----
 ...ce_Plugins_Process_NetBSD_NativeProcessNetBSD.h | 13 +++
 4 files changed, 105 insertions(+), 24 deletions(-)

diffs:
diff --git a/lldb-netbsd/distinfo b/lldb-netbsd/distinfo
index 30f5c3640d..fef69bd169 100644
--- a/lldb-netbsd/distinfo
+++ b/lldb-netbsd/distinfo
@@ -13,8 +13,9 @@ SHA1 (llvm-3.6.2.src.tar.xz) = 7a00257eb2bc9431e4c77c3a36b033072c54bc7e
 RMD160 (llvm-3.6.2.src.tar.xz) = 521cbc5fe2925ea3c6e90c7a31f752a04045c972
 Size (llvm-3.6.2.src.tar.xz) = 12802380 bytes
 SHA1 (patch-source_Host_common_Host.cpp) = 7d48b8bb1e4350ba6d3ddc6357b9b8dc82d6b32d
-SHA1 (patch-source_Plugins_DynamicLoader_POSIX-DYLD_DYLDRendezvous.cpp) = 32d683eb388ded96e7f9aedec827202b5b056392
-SHA1 (patch-source_Plugins_Process_NetBSD_NativeProcessNetBSD.cpp) = 307ddb37500be7c7bfba196a9ec8017df726a2b7
+SHA1 (patch-source_Plugins_DynamicLoader_POSIX-DYLD_DYLDRendezvous.cpp) = efc346d0376ddc66634bba00029deadc442a4841
+SHA1 (patch-source_Plugins_Process_NetBSD_NativeProcessNetBSD.cpp) = 13e713d4d24ed996a6043928895ede9e3d2619f7
+SHA1 (patch-source_Plugins_Process_NetBSD_NativeProcessNetBSD.h) = ff143109aee8e96b5c0112da5c29227702f5142a
 SHA1 (patch-source_Plugins_Process_NetBSD_NativeRegisterContextNetBSD.cpp) = 1c4e5f6f6bf6f665ed659b195de02f7ca26827c9
 SHA1 (patch-source_Plugins_Process_NetBSD_NativeRegisterContextNetBSD.h) = 7438ec533021afadea9f0b8ef28a4432b1fe682c
 SHA1 (patch-source_Plugins_Process_NetBSD_NativeRegisterContextNetBSD__x86__64.cpp) = ea9781e8a37719bee1baad234f3a59720a1720d4
diff --git a/lldb-netbsd/patches/patch-source_Plugins_DynamicLoader_POSIX-DYLD_DYLDRendezvous.cpp b/lldb-netbsd/patches/patch-source_Plugins_DynamicLoader_POSIX-DYLD_DYLDRendezvous.cpp
index 86f38c054e..7d0de23e38 100644
--- a/lldb-netbsd/patches/patch-source_Plugins_DynamicLoader_POSIX-DYLD_DYLDRendezvous.cpp
+++ b/lldb-netbsd/patches/patch-source_Plugins_DynamicLoader_POSIX-DYLD_DYLDRendezvous.cpp
@@ -1,8 +1,16 @@
 $NetBSD$
 
---- source/Plugins/DynamicLoader/POSIX-DYLD/DYLDRendezvous.cpp.orig	2017-02-04 18:35:34.000000000 +0000
+--- source/Plugins/DynamicLoader/POSIX-DYLD/DYLDRendezvous.cpp.orig	2017-03-23 15:49:52.000000000 +0000
 +++ source/Plugins/DynamicLoader/POSIX-DYLD/DYLDRendezvous.cpp
-@@ -385,6 +385,7 @@ bool DYLDRendezvous::SOEntryIsMainExecut
+@@ -379,12 +379,13 @@ bool DYLDRendezvous::RemoveSOEntries() {
+ }
+ 
+ bool DYLDRendezvous::SOEntryIsMainExecutable(const SOEntry &entry) {
+-  // On Linux the executable is indicated by an empty path in the entry. On
+-  // FreeBSD and on Android it is the full path to the executable.
++  // On some systes the executable is indicated by an empty path in the entry.
++  // On others it is the full path to the executable.
+ 
    auto triple = m_process->GetTarget().GetArchitecture().GetTriple();
    switch (triple.getOS()) {
    case llvm::Triple::FreeBSD:
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 088a3019d5..9533f91b54 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	2017-03-29 00:14:15.000000000 +0000
 +++ source/Plugins/Process/NetBSD/NativeProcessNetBSD.cpp
-@@ -235,6 +235,39 @@ void NativeProcessNetBSD::MonitorSIGTRAP
+@@ -235,6 +235,24 @@ void NativeProcessNetBSD::MonitorSIGTRAP
        }
        SetState(StateType::eStateStopped, true);
        break;
@@ -13,26 +13,11 @@ $NetBSD$
 +      SetState(StateType::eStateStopped, true);
 +      break;
 +    case TRAP_EXEC: {
-+      // Clear old threads
-+      m_threads.clear();
-+
-+      // Initialize new thread
-+      struct ptrace_lwpinfo info = {};
-+      Error error = PtraceWrapper(PT_LWPINFO, pid, &info, sizeof(info));
++      Error error = ReinitializeThreads();
 +      if (error.Fail()) {
 +        SetState(StateType::eStateInvalid);
 +        return;
 +      }
-+      // Reinitialize from scratch threads and register them in process
-+      while (info.pl_lwpid != 0) {
-+        NativeThreadNetBSDSP thread_sp = AddThread(info.pl_lwpid);
-+        thread_sp->SetStoppedByExec();
-+        error = PtraceWrapper(PT_LWPINFO, pid, &info, sizeof(info));
-+        if (error.Fail()) {
-+          SetState(StateType::eStateInvalid);
-+          return;
-+        }
-+      }
 +
 +      // Let our delegate know we have just exec'd.
 +      NotifyDidExec();
@@ -42,7 +27,7 @@ $NetBSD$
      }
    }
  }
-@@ -389,11 +422,13 @@ Error NativeProcessNetBSD::Resume(const 
+@@ -389,11 +407,13 @@ Error NativeProcessNetBSD::Resume(const 
      return Error();
    }
  
@@ -58,7 +43,7 @@ $NetBSD$
      if (!error.Success())
        return error;
      for (const auto &thread_sp : m_threads) {
-@@ -403,7 +438,15 @@ Error NativeProcessNetBSD::Resume(const 
+@@ -403,7 +423,15 @@ Error NativeProcessNetBSD::Resume(const 
      break;
    }
    case eStateStepping:
@@ -75,7 +60,31 @@ $NetBSD$
      break;
  
    case eStateSuspended:
-@@ -850,9 +893,6 @@ NativeThreadNetBSDSP NativeProcessNetBSD
+@@ -732,22 +760,11 @@ Error NativeProcessNetBSD::LaunchInferio
+ 
+   ResolveProcessArchitecture(m_pid, m_arch);
+ 
+-  /* Initialize threads */
+-  struct ptrace_lwpinfo info = {};
+-  error = PtraceWrapper(PT_LWPINFO, pid, &info, sizeof(info));
++  error = ReinitializeThreads();
+   if (error.Fail()) {
+     SetState(StateType::eStateInvalid);
+     return error;
+   }
+-  while (info.pl_lwpid != 0) {
+-    NativeThreadNetBSDSP thread_sp = AddThread(info.pl_lwpid);
+-    thread_sp->SetStoppedBySignal(SIGSTOP);
+-    error = PtraceWrapper(PT_LWPINFO, pid, &info, sizeof(info));
+-    if (error.Fail()) {
+-      SetState(StateType::eStateInvalid);
+-      return error;
+-    }
+-  }
+ 
+   /* Set process stopped */
+   SetState(StateType::eStateStopped);
+@@ -850,9 +867,6 @@ NativeThreadNetBSDSP NativeProcessNetBSD
  ::pid_t NativeProcessNetBSD::Attach(lldb::pid_t pid, Error &error) {
    Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_PROCESS));
  
@@ -85,3 +94,53 @@ $NetBSD$
    if (pid <= 1) {
      error.SetErrorToGenericError();
      error.SetErrorString("Attaching to process 1 is not allowed.");
+@@ -874,21 +888,11 @@ NativeThreadNetBSDSP NativeProcessNetBSD
+   m_pid = pid;
+ 
+   /* Initialize threads */
+-  struct ptrace_lwpinfo info = {};
+-  error = PtraceWrapper(PT_LWPINFO, pid, &info, sizeof(info));
++  error = ReinitializeThreads();
+   if (error.Fail()) {
+     SetState(StateType::eStateInvalid);
+     return -1;
+   }
+-  while (info.pl_lwpid != 0) {
+-    NativeThreadNetBSDSP thread_sp = AddThread(info.pl_lwpid);
+-    thread_sp->SetStoppedBySignal(SIGSTOP);
+-    error = PtraceWrapper(PT_LWPINFO, pid, &info, sizeof(info));
+-    if (error.Fail()) {
+-      SetState(StateType::eStateInvalid);
+-      return -1;
+-    }
+-  }
+ 
+   // Let our process instance know the thread has stopped.
+   SetState(StateType::eStateStopped);
+@@ -989,3 +993,26 @@ NativeProcessNetBSD::GetAuxvData() const
+ 
+   return buf;
+ }
++
++Error NativeProcessNetBSD::ReinitializeThreads() {
++  // Clear old threads
++  m_threads.clear();
++
++  // Initialize new thread
++  struct ptrace_lwpinfo info = {};
++  Error error = PtraceWrapper(PT_LWPINFO, GetID(), &info, sizeof(info));
++  if (error.Fail()) {
++    return error;
++  }
++  // Reinitialize from scratch threads and register them in process
++  while (info.pl_lwpid != 0) {
++    NativeThreadNetBSDSP thread_sp = AddThread(info.pl_lwpid);
++    thread_sp->SetStoppedByExec();
++    error = PtraceWrapper(PT_LWPINFO, GetID(), &info, sizeof(info));
++    if (error.Fail()) {
++      return error;
++    }
++  }
++
++  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
new file mode 100644
index 0000000000..f62f1ca800
--- /dev/null
+++ b/lldb-netbsd/patches/patch-source_Plugins_Process_NetBSD_NativeProcessNetBSD.h
@@ -0,0 +1,13 @@
+$NetBSD$
+
+--- source/Plugins/Process/NetBSD/NativeProcessNetBSD.h.orig	2017-03-29 00:14:15.000000000 +0000
++++ source/Plugins/Process/NetBSD/NativeProcessNetBSD.h
+@@ -131,6 +131,8 @@ private:
+   void SigchldHandler();
+ 
+   ::pid_t Attach(lldb::pid_t pid, Error &error);
++
++  Error ReinitializeThreads();
+ };
+ 
+ } // namespace process_netbsd


Home | Main Index | Thread Index | Old Index