[rtems commit] cpukit/libdebugger: Add pure swbreak capability

Joel Sherrill joel at rtems.org
Wed Feb 23 14:26:40 UTC 2022


Module:    rtems
Branch:    master
Commit:    ea1a4fd29b5acc36136db80475d7cf26a052e490
Changeset: http://git.rtems.org/rtems/commit/?id=ea1a4fd29b5acc36136db80475d7cf26a052e490

Author:    Kinsey Moore <kinsey.moore at oarcorp.com>
Date:      Thu Feb 10 10:03:01 2022 -0600

cpukit/libdebugger: Add pure swbreak capability

Add a capability that allows for implementations that operate purely
using software breaks. Due to this implementation method, software
breaks must not be restored until just before returning control to the
thread itself and will be handled by the implementation through thread
switch and interrupt hooks.

---

 cpukit/libdebugger/rtems-debugger-target.h  | 14 +++++++++++---
 cpukit/libdebugger/rtems-debugger-threads.c |  4 +++-
 2 files changed, 14 insertions(+), 4 deletions(-)

diff --git a/cpukit/libdebugger/rtems-debugger-target.h b/cpukit/libdebugger/rtems-debugger-target.h
index 1e132fb..7836f93 100644
--- a/cpukit/libdebugger/rtems-debugger-target.h
+++ b/cpukit/libdebugger/rtems-debugger-target.h
@@ -49,9 +49,17 @@ extern "C" {
 /**
  * Target capabilities mask.
  */
-#define RTEMS_DEBUGGER_TARGET_CAP_SWBREAK   (1 << 0)
-#define RTEMS_DEBUGGER_TARGET_CAP_HWBREAK   (1 << 1)
-#define RTEMS_DEBUGGER_TARGET_CAP_HWWATCH   (1 << 2)
+#define RTEMS_DEBUGGER_TARGET_CAP_SWBREAK      (1 << 0)
+#define RTEMS_DEBUGGER_TARGET_CAP_HWBREAK      (1 << 1)
+#define RTEMS_DEBUGGER_TARGET_CAP_HWWATCH      (1 << 2)
+/*
+ * This target capability indicates that the target implementation uses a pure
+ * software break implementation which must not allow breakpoints to be
+ * inserted before the actual switch to the thread, be it in interrupt context
+ * or otherwise. Such implementations must necessarily implement a thread
+ * switch hook and interrupt hooks to handle these situations.
+ */
+#define RTEMS_DEBUGGER_TARGET_CAP_PURE_SWBREAK (1 << 3)
 
 /**
  * Types of hardware breakpoints.
diff --git a/cpukit/libdebugger/rtems-debugger-threads.c b/cpukit/libdebugger/rtems-debugger-threads.c
index c628c02..841199b 100644
--- a/cpukit/libdebugger/rtems-debugger-threads.c
+++ b/cpukit/libdebugger/rtems-debugger-threads.c
@@ -355,9 +355,11 @@ rtems_debugger_thread_system_resume(bool detaching)
   current = rtems_debugger_thread_current(threads);
   if (current != NULL) {
     size_t i;
+    rtems_debugger_target* target = rtems_debugger->target;
     if (rtems_debugger_verbose())
       rtems_debugger_printf("rtems-db: sys:    : resuming\n");
-    if (!detaching) {
+    if (!detaching
+      && (target->capabilities & RTEMS_DEBUGGER_TARGET_CAP_PURE_SWBREAK) == 0) {
       r = rtems_debugger_target_swbreak_insert();
       if (r == 0)
         r = rtems_debugger_target_hwbreak_insert();



More information about the vc mailing list