This is an automated email from Gerrit.

"Artemiy Volkov <arte...@synopsys.com>" just uploaded a new patch set to 
Gerrit, which you can find at https://review.openocd.org/c/openocd/+/7816

-- gerrit

commit 7ab25a2135c56fc42922e0e4b95e3236d357a746
Author: Evgeniy Didin <di...@synopsys.com>
Date:   Fri Jul 31 00:13:12 2020 +0300

    target/arc: restore breakpoints in arc_resume()
    
    Presently, we rely on gdb to restore break/watchpoints upon resuming
    execution in arc_resume(). This leads to problems in absence of gdb
    (more specifically, when handle_breakpoints is true); for instance, a
    breakpoint temporarily removed in arc_step() will not be reactivated.
    This patch rectifies this problem by explicitly re-enabling all
    breakpoints and watchpoints in arc_resume().
    
    This has previously been committed to the Zephyr project's openocd repo
    (see https://github.com/zephyrproject-rtos/openocd/pull/31).
    
    Change-Id: I59e9c91270ef0b5fd19cfc570663dc67a6022dbd
    Signed-off-by: Evgeniy Didin <di...@synopsys.com>
    Signed-off-by: Stephanos Ioannidis <r...@stephanos.io>
    Signed-off-by: Artemiy Volkov <arte...@synopsys.com>

diff --git a/src/target/arc.c b/src/target/arc.c
index 9ae3ae6104..2e2efa645b 100644
--- a/src/target/arc.c
+++ b/src/target/arc.c
@@ -50,6 +50,8 @@
 
 static int arc_remove_watchpoint(struct target *target,
        struct watchpoint *watchpoint);
+static int arc_enable_watchpoints(struct target *target);
+static int arc_enable_breakpoints(struct target *target);
 
 void arc_reg_data_type_add(struct target *target,
                struct arc_reg_data_type *data_type)
@@ -1266,6 +1268,14 @@ static int arc_resume(struct target *target, int 
current, target_addr_t address,
                return ERROR_TARGET_NOT_HALTED;
        }
 
+       if (!debug_execution) {
+               /* (gdb) continue = execute until we hit break/watch-point */
+               LOG_DEBUG("we are in debug execution mode");
+               target_free_all_working_areas(target);
+               CHECK_RETVAL(arc_enable_breakpoints(target));
+               CHECK_RETVAL(arc_enable_watchpoints(target));
+       }
+
        /* current = 1: continue on current PC, otherwise continue at <address> 
*/
        if (!current) {
                target_buffer_set_u32(target, pc->value, address);
@@ -1668,6 +1678,19 @@ static int arc_unset_breakpoint(struct target *target,
        return retval;
 }
 
+static int arc_enable_breakpoints(struct target *target)
+{
+       struct breakpoint *breakpoint = target->breakpoints;
+
+       /* set any pending breakpoints */
+       while (breakpoint) {
+               if (!breakpoint->is_set)
+                       CHECK_RETVAL(arc_set_breakpoint(target, breakpoint));
+               breakpoint = breakpoint->next;
+       }
+
+       return ERROR_OK;
+}
 
 static int arc_add_breakpoint(struct target *target, struct breakpoint 
*breakpoint)
 {
@@ -1905,6 +1928,20 @@ static int arc_unset_watchpoint(struct target *target,
        return retval;
 }
 
+static int arc_enable_watchpoints(struct target *target)
+{
+       struct watchpoint *watchpoint = target->watchpoints;
+
+       /* set any pending watchpoints */
+       while (watchpoint) {
+               if (!watchpoint->is_set)
+                       CHECK_RETVAL(arc_set_watchpoint(target, watchpoint));
+               watchpoint = watchpoint->next;
+       }
+
+       return ERROR_OK;
+}
+
 static int arc_add_watchpoint(struct target *target,
        struct watchpoint *watchpoint)
 {

-- 

Reply via email to