pkgsrc-WIP-changes archive

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

lldb-git: work-in-progress to extract sole breakpoint tracing



Module Name:	pkgsrc-wip
Committed By:	Kamil Rytarowski <n54%gmx.com@localhost>
Pushed By:	kamil
Date:		Sun Mar 26 00:17:36 2017 +0100
Changeset:	6cef8287c9a4e91e3fc241bf617defac56ed1dfb

Modified Files:
	lldb-git/distinfo
	lldb-git/patches/patch-source_Plugins_Process_NetBSD_NativeProcessNetBSD.cpp
	lldb-git/patches/patch-source_Plugins_Process_NetBSD_NativeProcessNetBSD.h
Added Files:
	lldb-git/patches/patch-source_Plugins_Process_NetBSD_NativeThreadNetBSD.cpp
	lldb-git/patches/patch-source_Plugins_Process_NetBSD_NativeThreadNetBSD.h

Log Message:
lldb-git: work-in-progress to extract sole breakpoint tracing

This package is intended to handle only breakpoints and be sent
upstream.

This revision adds:

NativeProcessNetBSD
 - convert_pid_status_to_exit_type()
 - convert_pid_status_to_return_code()
 - GetSoftwareBreakpointPCOffset()
 - FixupBreakpointPCAsNeeded()
 - MonitorSignal()
 - MonitorCallback()
 - MonitorExited()
 - MonitorSIGSTOP()
 - MonitorSIGTRAP()
 - m_arch
NativeThreadNetBSD
 - SetStoppedBySignal
 - SetStoppedByBreakpoint
 - SetStopped
 - m_state
 - m_stop_info
 - m_stop_description

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=6cef8287c9a4e91e3fc241bf617defac56ed1dfb

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

diffstat:
 lldb-git/distinfo                                  |   6 +-
 ..._Plugins_Process_NetBSD_NativeProcessNetBSD.cpp | 271 ++++++++++++++-------
 ...ce_Plugins_Process_NetBSD_NativeProcessNetBSD.h |  14 +-
 ...e_Plugins_Process_NetBSD_NativeThreadNetBSD.cpp |  61 +++++
 ...rce_Plugins_Process_NetBSD_NativeThreadNetBSD.h |  27 ++
 5 files changed, 286 insertions(+), 93 deletions(-)

diffs:
diff --git a/lldb-git/distinfo b/lldb-git/distinfo
index abfc3e452a..02348391bc 100644
--- a/lldb-git/distinfo
+++ b/lldb-git/distinfo
@@ -12,5 +12,7 @@ Size (libcxx-3.6.2.src.tar.xz) = 944020 bytes
 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_Plugins_Process_NetBSD_NativeProcessNetBSD.cpp) = 646d2fc08a0ff62e675aafe06c9647e4c28c2743
-SHA1 (patch-source_Plugins_Process_NetBSD_NativeProcessNetBSD.h) = ee35eb0b2cde562d36bcd2018496dfbae5379d8b
+SHA1 (patch-source_Plugins_Process_NetBSD_NativeProcessNetBSD.cpp) = c3edad360e4dea3f24b020656129b7fd9af42612
+SHA1 (patch-source_Plugins_Process_NetBSD_NativeProcessNetBSD.h) = 0fc3b114e53abc1f52836531eddf7b1ac9d9c9bd
+SHA1 (patch-source_Plugins_Process_NetBSD_NativeThreadNetBSD.cpp) = 99031f666f449032ffd645edf6e92f25b790bfa6
+SHA1 (patch-source_Plugins_Process_NetBSD_NativeThreadNetBSD.h) = 0460e9f7cf9414cabfd0b70ff8311acd8280fb13
diff --git a/lldb-git/patches/patch-source_Plugins_Process_NetBSD_NativeProcessNetBSD.cpp b/lldb-git/patches/patch-source_Plugins_Process_NetBSD_NativeProcessNetBSD.cpp
index 1adb6d470e..32b7a85844 100644
--- a/lldb-git/patches/patch-source_Plugins_Process_NetBSD_NativeProcessNetBSD.cpp
+++ b/lldb-git/patches/patch-source_Plugins_Process_NetBSD_NativeProcessNetBSD.cpp
@@ -2,105 +2,80 @@ $NetBSD$
 
 --- source/Plugins/Process/NetBSD/NativeProcessNetBSD.cpp.orig	2017-03-21 17:54:57.000000000 +0000
 +++ source/Plugins/Process/NetBSD/NativeProcessNetBSD.cpp
-@@ -11,6 +11,7 @@
- 
- // C Includes
- 
-+
+@@ -14,18 +14,49 @@
  // C++ Includes
  
  // Other libraries and framework includes
-@@ -20,6 +21,8 @@
+-
+ #include "Plugins/Process/POSIX/ProcessPOSIXLog.h"
++#include "lldb/Host/common/NativeBreakpoint.h"
++#include "lldb/Host/common/NativeRegisterContext.h"
++#include "lldb/Target/Process.h"
+ 
  // System includes - They have to be included after framework includes because
  // they define some
  // macros which collide with variable names in other modules
 +#include <sys/types.h>
 +#include <sys/ptrace.h>
++#include <sys/wait.h>
  
  using namespace lldb;
  using namespace lldb_private;
-@@ -49,3 +52,155 @@ Error NativeProcessProtocol::Attach(
+ using namespace lldb_private::process_netbsd;
+ using namespace llvm;
+ 
++static ExitType convert_pid_status_to_exit_type(int status) {
++  if (WIFEXITED(status))
++    return ExitType::eExitTypeExit;
++  else if (WIFSIGNALED(status))
++    return ExitType::eExitTypeSignal;
++  else if (WIFSTOPPED(status))
++    return ExitType::eExitTypeStop;
++  else {
++    // We don't know what this is.
++    return ExitType::eExitTypeInvalid;
++  }
++}
++
++static int convert_pid_status_to_return_code(int status) {
++  if (WIFEXITED(status))
++    return WEXITSTATUS(status);
++  else if (WIFSIGNALED(status))
++    return WTERMSIG(status);
++  else if (WIFSTOPPED(status))
++    return WSTOPSIG(status);
++  else {
++    // We don't know what this is.
++    return ExitType::eExitTypeInvalid;
++  }
++}
++
+ // -----------------------------------------------------------------------------
+ // Public Static Methods
+ // -----------------------------------------------------------------------------
+@@ -48,4 +79,215 @@ Error NativeProcessProtocol::Attach(
+ // -----------------------------------------------------------------------------
  
  NativeProcessNetBSD::NativeProcessNetBSD()
-     : NativeProcessProtocol(LLDB_INVALID_PROCESS_ID) {}
+-    : NativeProcessProtocol(LLDB_INVALID_PROCESS_ID) {}
++    : NativeProcessProtocol(LLDB_INVALID_PROCESS_ID), m_arch() {}
 +
 +// Handles all waitpid events from the inferior process.
-+void NativeProcessNetBSD::MonitorCallback(lldb::pid_t pid,
-+                                         int signal) {
++void NativeProcessNetBSD::MonitorCallback(lldb::pid_t pid, int signal) {
 +  Log *log(ProcessPOSIXLog::GetLogIfAllCategoriesSet(POSIX_LOG_PROCESS));
 +
-+  ptrace_siginfo_t info;
-+  const auto siginfo_err = PtraceWrapper(PT_GET_SIGINFO, pid, &info, sizeof(info));
-+    
-+  ptrace_state_t state;
-+  const auto state_err = PtraceWrapper(PT_GET_PROCESS_STATE, pid, &state, sizeof(state));
-+    
-+  printf("Signal received signo=%d errno=%d code=%d\n", info.psi_siginfo.si_signo,
-+    info.psi_siginfo.si_errno, info.psi_siginfo.si_code); 
-+                  
-+  // Get details on the signal raised.
-+  if (siginfo_err.Success() && state_err.Success()) {
-+    switch (info.psi_siginfo.si_signo) {
-+    case SIGTRAP:
-+      switch (info.psi_siginfo.si_code) {
-+      case TRAP_BRKPT:
-+        for (const auto &thread_sp : m_threads) {                                                                                     
-+          static_pointer_cast<NativeThreadNetBSD>(thread_sp)->SetStoppedByBreakpoint();
-+          FixupBreakpointPCAsNeeded(*static_pointer_cast<NativeThreadNetBSD>(thread_sp));
-+        }
-+        SetState(StateType::eStateStopped, true);
-+        break;
-+      case TRAP_TRACE:
-+        for (const auto &thread_sp : m_threads) {
-+          static_pointer_cast<NativeThreadNetBSD>(thread_sp)->SetStoppedByTrace();
-+        }
-+        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));
-+        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;                                                                                                                   
-+          }
-+        }
-+
-+
-+    case SIGSTOP:
-+      break;
-+    default:
-+      // Other signals
-+#if 0
-+      if (m_signals_to_ignore.find(signo) != m_signals_to_ignore.end()) {
-+        ResumeThread(thread, thread.GetState(), signo);                                                                               
-+        return;
-+      }
-+#endif
-+
-+      for (const auto &thread_sp : m_threads) {
-+        static_pointer_cast<NativeThreadNetBSD>(thread_sp)->SetStoppedBySignal(info.psi_siginfo.si_signo, &info.psi_siginfo);
-+      }
-+      SetState(StateType::eStateStopped, true);
-+    }
++  switch (signal) {
++  case SIGTRAP:
++    return MonitorSIGTRAP(pid);
++  case SIGSTOP:
++    return MonitorSIGSTOP(pid);
++  default:
++    return MonitorSignal(pid, signal);
 +  }
 +}
 +
-+void NativeProcessNetBSD::MonitorExited(lldb::pid_t pid, int signal, int status) {
++void NativeProcessNetBSD::MonitorExited(lldb::pid_t pid, int signal,
++                                        int status) {
 +  Log *log(ProcessPOSIXLog::GetLogIfAllCategoriesSet(POSIX_LOG_PROCESS));
 +
 +  LLDB_LOG(log, "got exit signal({0}) , pid = {1}", signal, pid);
@@ -119,15 +94,18 @@ $NetBSD$
 +  Log *log(ProcessPOSIXLog::GetLogIfAllCategoriesSet(POSIX_LOG_PROCESS));
 +  ptrace_siginfo_t info;
 +
-+  const auto siginfo_err = PtraceWrapper(PT_GET_SIGINFO, pid, &info, sizeof(info));
++  const auto siginfo_err =
++      PtraceWrapper(PT_GET_SIGINFO, pid, &info, sizeof(info));
 +
 +  // Get details on the signal raised.
 +  if (siginfo_err.Success()) {
 +    // Handle SIGSTOP from LLGS (LLDB GDB Server)
-+    if (info.psi_siginfo.si_code == SI_USER && info.psi_siginfo.si_pid == ::getpid()) {
++    if (info.psi_siginfo.si_code == SI_USER &&
++        info.psi_siginfo.si_pid == ::getpid()) {
 +      /* Stop Tracking All Threads attached to Process */
 +      for (const auto &thread_sp : m_threads) {
-+        static_pointer_cast<NativeThreadNetBSD>(thread_sp)->SetStoppedBySignal(SIGSTOP, &info.psi_siginfo);
++        static_pointer_cast<NativeThreadNetBSD>(thread_sp)->SetStoppedBySignal(
++            SIGSTOP, &info.psi_siginfo);
 +      }
 +    }
 +  }
@@ -137,23 +115,41 @@ $NetBSD$
 +  Log *log(ProcessPOSIXLog::GetLogIfAllCategoriesSet(POSIX_LOG_PROCESS));
 +  ptrace_siginfo_t info;
 +
-+  const auto siginfo_err = PtraceWrapper(PT_GET_SIGINFO, pid, &info, sizeof(info));
++  const auto siginfo_err =
++      PtraceWrapper(PT_GET_SIGINFO, pid, &info, sizeof(info));
 +
 +  // Get details on the signal raised.
 +  if (siginfo_err.Success()) {
 +    switch (info.psi_siginfo.si_code) {
 +    case TRAP_BRKPT:
 +      for (const auto &thread_sp : m_threads) {
-+        static_pointer_cast<NativeThreadNetBSD>(thread_sp)->SetStoppedByBreakpoint();                                                                                                       
-+        FixupBreakpointPCAsNeeded(*static_pointer_cast<NativeThreadNetBSD>(thread_sp));
++        static_pointer_cast<NativeThreadNetBSD>(thread_sp)
++            ->SetStoppedByBreakpoint();
++        FixupBreakpointPCAsNeeded(
++            *static_pointer_cast<NativeThreadNetBSD>(thread_sp));
 +      }
 +      SetState(StateType::eStateStopped, true);
 +      break;
++    }
 +  }
 +}
 +
++void NativeProcessNetBSD::MonitorSignal(lldb::pid_t pid, int signal) {
++  Log *log(ProcessPOSIXLog::GetLogIfAllCategoriesSet(POSIX_LOG_PROCESS));
++
++  ptrace_siginfo_t info;
++  const auto siginfo_err =
++      PtraceWrapper(PT_GET_SIGINFO, pid, &info, sizeof(info));
++
++  for (const auto &thread_sp : m_threads) {
++    static_pointer_cast<NativeThreadNetBSD>(thread_sp)->SetStoppedBySignal(
++        info.psi_siginfo.si_signo, &info.psi_siginfo);
++  }
++  SetState(StateType::eStateStopped, true);
++}
++
 +Error NativeProcessNetBSD::PtraceWrapper(int req, lldb::pid_t pid, void *addr,
-+                                        int data, int *result) {
++                                         int data, int *result) {
 +  Log *log(ProcessPOSIXLog::GetLogIfAllCategoriesSet(POSIX_LOG_PTRACE));
 +  Error error;
 +  int ret;
@@ -167,11 +163,110 @@ $NetBSD$
 +  if (result)
 +    *result = ret;
 +
-+  LLDB_LOG(log, "ptrace({0}, {1}, {2}, {3}, {4})={6:x}", req, pid, addr,
-+           data, ret);
++  LLDB_LOG(log, "ptrace({0}, {1}, {2}, {3}, {4})={6:x}", req, pid, addr, data,
++           ret);
 +
 +  if (error.Fail())
 +    LLDB_LOG(log, "ptrace() failed: {0}", error);
 +
 +  return error;
 +}
++
++Error NativeProcessNetBSD::GetSoftwareBreakpointPCOffset(
++    uint32_t &actual_opcode_size) {
++  // FIXME put this behind a breakpoint protocol class that can be
++  // set per architecture.  Need ARM, MIPS support here.
++  static const uint8_t g_i386_opcode[] = {0xCC};
++  switch (m_arch.GetMachine()) {
++  case llvm::Triple::x86_64:
++    actual_opcode_size = static_cast<uint32_t>(sizeof(g_i386_opcode));
++    return Error();
++  default:
++    assert(false && "CPU type not supported!");
++    return Error("CPU type not supported");
++  }
++}
++
++Error NativeProcessNetBSD::FixupBreakpointPCAsNeeded(
++    NativeThreadNetBSD &thread) {
++  Log *log(ProcessPOSIXLog::GetLogIfAllCategoriesSet(POSIX_LOG_BREAKPOINTS));
++  Error error;
++  // Find out the size of a breakpoint (might depend on where we are in the
++  // code).
++  NativeRegisterContextSP context_sp = thread.GetRegisterContext();
++  if (!context_sp) {
++    error.SetErrorString("cannot get a NativeRegisterContext for the thread");
++    LLDB_LOG(log, "failed: {0}", error);
++    return error;
++  }
++  uint32_t breakpoint_size = 0;
++  error = GetSoftwareBreakpointPCOffset(breakpoint_size);
++  if (error.Fail()) {
++    LLDB_LOG(log, "GetBreakpointSize() failed: {0}", error);
++    return error;
++  } else
++    LLDB_LOG(log, "breakpoint size: {0}", breakpoint_size);
++  // First try probing for a breakpoint at a software breakpoint location: PC -
++  // breakpoint size.
++  const lldb::addr_t initial_pc_addr =
++      context_sp->GetPCfromBreakpointLocation();
++  lldb::addr_t breakpoint_addr = initial_pc_addr;
++  if (breakpoint_size > 0) {
++    // Do not allow breakpoint probe to wrap around.
++    if (breakpoint_addr >= breakpoint_size)
++      breakpoint_addr -= breakpoint_size;
++  }
++  // Check if we stopped because of a breakpoint.
++  NativeBreakpointSP breakpoint_sp;
++  error = m_breakpoint_list.GetBreakpoint(breakpoint_addr, breakpoint_sp);
++  if (!error.Success() || !breakpoint_sp) {
++    // We didn't find one at a software probe location.  Nothing to do.
++    LLDB_LOG(log,
++             "pid {0} no lldb breakpoint found at current pc with "
++             "adjustment: {1}",
++             GetID(), breakpoint_addr);
++    return Error();
++  }
++  // If the breakpoint is not a software breakpoint, nothing to do.
++  if (!breakpoint_sp->IsSoftwareBreakpoint()) {
++    LLDB_LOG(
++        log,
++        "pid {0} breakpoint found at {1:x}, not software, nothing to adjust",
++        GetID(), breakpoint_addr);
++    return Error();
++  }
++  //
++  // We have a software breakpoint and need to adjust the PC.
++  //
++  // Sanity check.
++  if (breakpoint_size == 0) {
++    // Nothing to do!  How did we get here?
++    LLDB_LOG(log,
++             "pid {0} breakpoint found at {1:x}, it is software, but the "
++             "size is zero, nothing to do (unexpected)",
++             GetID(), breakpoint_addr);
++    return Error();
++  }
++  //
++  // We have a software breakpoint and need to adjust the PC.
++  //
++  // Sanity check.
++  if (breakpoint_size == 0) {
++    // Nothing to do!  How did we get here?
++    LLDB_LOG(log,
++             "pid {0} breakpoint found at {1:x}, it is software, but the "
++             "size is zero, nothing to do (unexpected)",
++             GetID(), breakpoint_addr);
++    return Error();
++  }
++  // Change the program counter.
++  LLDB_LOG(log, "pid {0} tid {1}: changing PC from {2:x} to {3:x}", GetID(),
++           thread.GetID(), initial_pc_addr, breakpoint_addr);
++  error = context_sp->SetPC(breakpoint_addr);
++  if (error.Fail()) {
++    LLDB_LOG(log, "pid {0} tid {1}: failed to set PC: {2}", GetID(),
++             thread.GetID(), error);
++    return error;
++  }
++  return error;
++}
diff --git a/lldb-git/patches/patch-source_Plugins_Process_NetBSD_NativeProcessNetBSD.h b/lldb-git/patches/patch-source_Plugins_Process_NetBSD_NativeProcessNetBSD.h
index c51e0bcb9a..427d0e9bcd 100644
--- a/lldb-git/patches/patch-source_Plugins_Process_NetBSD_NativeProcessNetBSD.h
+++ b/lldb-git/patches/patch-source_Plugins_Process_NetBSD_NativeProcessNetBSD.h
@@ -2,11 +2,10 @@ $NetBSD$
 
 --- source/Plugins/Process/NetBSD/NativeProcessNetBSD.h.orig	2017-03-21 17:54:57.000000000 +0000
 +++ source/Plugins/Process/NetBSD/NativeProcessNetBSD.h
-@@ -39,8 +39,20 @@ class NativeProcessNetBSD : public Nativ
+@@ -39,8 +39,28 @@ class NativeProcessNetBSD : public Nativ
        lldb::pid_t pid, NativeProcessProtocol::NativeDelegate &native_delegate,
        MainLoop &mainloop, NativeProcessProtocolSP &process_sp);
  
-+
 +  // ---------------------------------------------------------------------
 +  // Interface used by NativeRegisterContext-derived classes.
 +  // ---------------------------------------------------------------------
@@ -14,12 +13,21 @@ $NetBSD$
 +                             int data = 0, int *result = nullptr);
 +
  private:
++  ArchSpec m_arch;
++
 +  // ---------------------------------------------------------------------
 +  // Private Instance Methods
 +  // ---------------------------------------------------------------------
    NativeProcessNetBSD();
 +
-+  void MonitorCallback(lldb::pid_t pid, bool exited, int signal, int status);
++  void MonitorCallback(lldb::pid_t pid, int signal);
++  void MonitorExited(lldb::pid_t pid, int signal, int status);
++  void MonitorSIGSTOP(lldb::pid_t pid);
++  void MonitorSIGTRAP(lldb::pid_t pid);
++  void MonitorSignal(lldb::pid_t pid, int signal);
++
++  Error GetSoftwareBreakpointPCOffset(uint32_t &actual_opcode_size);
++  Error FixupBreakpointPCAsNeeded(NativeThreadNetBSD &thread);
  };
  
  } // namespace process_netbsd
diff --git a/lldb-git/patches/patch-source_Plugins_Process_NetBSD_NativeThreadNetBSD.cpp b/lldb-git/patches/patch-source_Plugins_Process_NetBSD_NativeThreadNetBSD.cpp
new file mode 100644
index 0000000000..9797be2e26
--- /dev/null
+++ b/lldb-git/patches/patch-source_Plugins_Process_NetBSD_NativeThreadNetBSD.cpp
@@ -0,0 +1,61 @@
+$NetBSD$
+
+--- source/Plugins/Process/NetBSD/NativeThreadNetBSD.cpp.orig	2017-03-21 17:54:57.000000000 +0000
++++ source/Plugins/Process/NetBSD/NativeThreadNetBSD.cpp
+@@ -12,6 +12,11 @@
+ 
+ #include "NativeProcessNetBSD.h"
+ 
++#include "Plugins/Process/POSIX/CrashReason.h"
++#include "Plugins/Process/POSIX/ProcessPOSIXLog.h"
++#include "lldb/Core/RegisterValue.h"
++#include "lldb/Core/State.h"
++
+ using namespace lldb;
+ using namespace lldb_private;
+ using namespace lldb_private::process_netbsd;
+@@ -19,3 +24,44 @@ using namespace lldb_private::process_ne
+ NativeThreadNetBSD::NativeThreadNetBSD(NativeProcessNetBSD *process,
+                                        lldb::tid_t tid)
+     : NativeThreadProtocol(process, tid) {}
++
++void NativeThreadNetBSD::SetStoppedBySignal(uint32_t signo,
++                                            const siginfo_t *info) {
++  Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_THREAD));
++  if (log)
++    log->Printf("NativeThreadNetBSD::%s called with signal 0x%02" PRIx32,
++                __FUNCTION__, signo);
++
++  SetStopped();
++
++  m_stop_info.reason = StopReason::eStopReasonSignal;
++  m_stop_info.details.signal.signo = signo;
++
++  m_stop_description.clear();
++  if (info) {
++    switch (signo) {
++    case SIGSEGV:
++    case SIGBUS:
++    case SIGFPE:
++    case SIGILL:
++      const auto reason = GetCrashReason(*info);
++      m_stop_description = GetCrashReasonString(reason, *info);
++      break;
++    }
++  }
++}
++
++void NativeThreadNetBSD::SetStoppedByBreakpoint() {
++  Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_THREAD));
++  if (log)
++    log->Printf("NativeThreadNetBSD::%s()", __FUNCTION__);
++  SetStopped();
++  m_stop_info.reason = StopReason::eStopReasonBreakpoint;
++  m_stop_info.details.signal.signo = SIGTRAP;
++}
++
++void NativeThreadNetBSD::SetStopped() {
++  const StateType new_state = StateType::eStateStopped;
++  m_state = new_state;
++  m_stop_description.clear();
++}
diff --git a/lldb-git/patches/patch-source_Plugins_Process_NetBSD_NativeThreadNetBSD.h b/lldb-git/patches/patch-source_Plugins_Process_NetBSD_NativeThreadNetBSD.h
new file mode 100644
index 0000000000..3cc9a22b9f
--- /dev/null
+++ b/lldb-git/patches/patch-source_Plugins_Process_NetBSD_NativeThreadNetBSD.h
@@ -0,0 +1,27 @@
+$NetBSD$
+
+--- source/Plugins/Process/NetBSD/NativeThreadNetBSD.h.orig	2017-03-21 17:54:57.000000000 +0000
++++ source/Plugins/Process/NetBSD/NativeThreadNetBSD.h
+@@ -22,6 +22,22 @@ class NativeThreadNetBSD : public Native
+ 
+ public:
+   NativeThreadNetBSD(NativeProcessNetBSD *process, lldb::tid_t tid);
++
++private:
++  // ---------------------------------------------------------------------
++  // Interface for friend classes
++  // ---------------------------------------------------------------------
++
++  void SetStoppedBySignal(uint32_t signo, const siginfo_t *info = nullptr);
++  void SetStoppedByBreakpoint();
++  void SetStopped();
++
++  // ---------------------------------------------------------------------
++  // Member Variables
++  // ---------------------------------------------------------------------
++  lldb::StateType m_state;
++  ThreadStopInfo m_stop_info;
++  std::string m_stop_description;
+ };
+ 
+ typedef std::shared_ptr<NativeThreadNetBSD> NativeThreadNetBSDSP;


Home | Main Index | Thread Index | Old Index