pkgsrc-WIP-changes archive

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

lldb-netbsd: Introduce SetStoppedByBreakpoint() kill SingleStep()



Module Name:	pkgsrc-wip
Committed By:	Kamil Rytarowski <n54%gmx.com@localhost>
Pushed By:	kamil
Date:		Sat Jan 21 14:55:27 2017 +0100
Changeset:	efe5087cd7be3e7c9da8e61bb881b63f8c35c8a6

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

Log Message:
lldb-netbsd: Introduce SetStoppedByBreakpoint() kill SingleStep()

Stop on breakpoint and resume from breakpoint works.

$ lldb ./int3
(lldb) target create "./int3"
Current executable set to './int3' (x86_64).
(lldb) r
Hello world!
Process 29578 launched: './int3' (x86_64)
Process 29578 stopped
* thread #1, stop reason = signal SIGTRAP
    frame #0:
(lldb) c
Process 29578 resuming
Process 29578 exited with status = 0 (0x00000000)
(lldb)

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=efe5087cd7be3e7c9da8e61bb881b63f8c35c8a6

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

diffstat:
 lldb-netbsd/distinfo                               |  6 +++---
 ..._Plugins_Process_NetBSD_NativeProcessNetBSD.cpp |  7 +++++--
 ...e_Plugins_Process_NetBSD_NativeThreadNetBSD.cpp | 23 ++++++++++------------
 ...rce_Plugins_Process_NetBSD_NativeThreadNetBSD.h |  8 +++-----
 4 files changed, 21 insertions(+), 23 deletions(-)

diffs:
diff --git a/lldb-netbsd/distinfo b/lldb-netbsd/distinfo
index 0eb0e44..e66c258 100644
--- a/lldb-netbsd/distinfo
+++ b/lldb-netbsd/distinfo
@@ -28,10 +28,10 @@ SHA1 (patch-source_Plugins_Platform_NetBSD_PlatformNetBSD.cpp) = 129e853c1f93f06
 SHA1 (patch-source_Plugins_Platform_NetBSD_PlatformNetBSD.h) = 4327a21e79378b8f35adb07614adb41c37bbaf61
 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) = 82352e295c00c6fe810aa88e9b92eea556adf544
+SHA1 (patch-source_Plugins_Process_NetBSD_NativeProcessNetBSD.cpp) = f2ed22a7b37a07fc89160760cd8c03fdb5b154cb
 SHA1 (patch-source_Plugins_Process_NetBSD_NativeProcessNetBSD.h) = bdd9fe37e47de8fa626c7eacf81e07d47a76787c
-SHA1 (patch-source_Plugins_Process_NetBSD_NativeThreadNetBSD.cpp) = 9fd955c9d472531e2d6293d0fa4ff237af4be405
-SHA1 (patch-source_Plugins_Process_NetBSD_NativeThreadNetBSD.h) = 52686c2b13e9de5be9818668750b27b5c37843a7
+SHA1 (patch-source_Plugins_Process_NetBSD_NativeThreadNetBSD.cpp) = a92c655c447cc0829fdb48786f474929f09e1a71
+SHA1 (patch-source_Plugins_Process_NetBSD_NativeThreadNetBSD.h) = d251c4f1b52089f96d435a99f45353aa3992924a
 SHA1 (patch-tools_lldb-mi_MICmnBase.cpp) = 851c82ac61e1241018755fbd7236af00379ac986
 SHA1 (patch-tools_lldb-mi_MICmnBase.h) = f550d5e10bcf02fb46472733acdbb820791f22e5
 SHA1 (patch-tools_lldb-mi_MIDriver.cpp) = bf1b5399e82bcfe54d6d852f64ed155328f2064d
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 7b5088d..039a385 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-01-20 20:30:48.330267591 +0000
 +++ source/Plugins/Process/NetBSD/NativeProcessNetBSD.cpp
-@@ -0,0 +1,1384 @@
+@@ -0,0 +1,1387 @@
 +//===-- NativeProcessNetBSD.cpp -------------------------------- -*- C++ -*-===//
 +//
 +//                     The LLVM Compiler Infrastructure
@@ -538,7 +538,10 @@ $NetBSD$
 +    case SIGTRAP:
 +      switch (info.psi_siginfo.si_code) {
 +      case TRAP_BRKPT:
-+        printf("Breakpoint reported\n");
++        for (const auto &thread_sp : m_threads) {
++          static_pointer_cast<NativeThreadNetBSD>(thread_sp)->SetStoppedByBreakpoint();
++        }
++        SetState(StateType::eStateStopped, true);
 +        break;
 +      case TRAP_TRACE:
 +        for (const auto &thread_sp : m_threads) {
diff --git a/lldb-netbsd/patches/patch-source_Plugins_Process_NetBSD_NativeThreadNetBSD.cpp b/lldb-netbsd/patches/patch-source_Plugins_Process_NetBSD_NativeThreadNetBSD.cpp
index 6677cf6..90f318d 100644
--- a/lldb-netbsd/patches/patch-source_Plugins_Process_NetBSD_NativeThreadNetBSD.cpp
+++ b/lldb-netbsd/patches/patch-source_Plugins_Process_NetBSD_NativeThreadNetBSD.cpp
@@ -2,7 +2,7 @@ $NetBSD$
 
 --- source/Plugins/Process/NetBSD/NativeThreadNetBSD.cpp.orig	2017-01-20 20:30:48.343442890 +0000
 +++ source/Plugins/Process/NetBSD/NativeThreadNetBSD.cpp
-@@ -0,0 +1,391 @@
+@@ -0,0 +1,388 @@
 +//===-- NativeThreadNetBSD.cpp --------------------------------- -*- C++ -*-===//
 +//
 +//                     The LLVM Compiler Infrastructure
@@ -150,18 +150,6 @@ $NetBSD$
 +  return Error();
 +}
 +
-+Error NativeThreadNetBSD::SingleStep(uint32_t signo) {
-+  const StateType new_state = StateType::eStateStepping;
-+  m_state = new_state;
-+  m_stop_info.reason = StopReason::eStopReasonNone;
-+
-+  intptr_t data = 0;
-+  if (signo != LLDB_INVALID_SIGNAL_NUMBER)
-+    data = signo;
-+
-+  return NativeProcessNetBSD::PtraceWrapper(PT_STEP, GetID(), (void *)1, data);
-+}
-+
 +void NativeThreadNetBSD::SetStoppedBySignal(uint32_t signo,
 +                                            const siginfo_t *info) {
 +  Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_THREAD));
@@ -388,6 +376,15 @@ $NetBSD$
 +  m_stop_info.details.signal.signo = SIGTRAP;
 +}
 +
++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;
++}
++
 +NativeProcessNetBSD &NativeThreadNetBSD::GetProcess() {
 +  auto process_sp = std::static_pointer_cast<NativeProcessNetBSD>(
 +      NativeThreadProtocol::GetProcess());
diff --git a/lldb-netbsd/patches/patch-source_Plugins_Process_NetBSD_NativeThreadNetBSD.h b/lldb-netbsd/patches/patch-source_Plugins_Process_NetBSD_NativeThreadNetBSD.h
index 57e3d48..0a44210 100644
--- a/lldb-netbsd/patches/patch-source_Plugins_Process_NetBSD_NativeThreadNetBSD.h
+++ b/lldb-netbsd/patches/patch-source_Plugins_Process_NetBSD_NativeThreadNetBSD.h
@@ -2,7 +2,7 @@ $NetBSD$
 
 --- source/Plugins/Process/NetBSD/NativeThreadNetBSD.h.orig	2017-01-20 20:30:48.349697339 +0000
 +++ source/Plugins/Process/NetBSD/NativeThreadNetBSD.h
-@@ -0,0 +1,89 @@
+@@ -0,0 +1,87 @@
 +//===-- NativeThreadNetBSD.h ----------------------------------- -*- C++ -*-===//
 +//
 +//                     The LLVM Compiler Infrastructure
@@ -57,16 +57,14 @@ $NetBSD$
 +  // Interface for friend classes
 +  // ---------------------------------------------------------------------
 +
-+  /// Single steps the thread.  If @p signo is anything but
-+  /// LLDB_INVALID_SIGNAL_NUMBER, deliver that signal to the thread.
-+  Error SingleStep(uint32_t signo);
-+
 +  void SetStoppedBySignal(uint32_t signo, const siginfo_t *info = nullptr);
 +
 +  void SetStoppedByExec();
 +
 +  void SetStoppedByTrace();
 +
++  void SetStoppedByBreakpoint();
++
 +  void SetRunning();
 +
 +  void SetStepping();


Home | Main Index | Thread Index | Old Index