mem_ap_read_u32 error propagation
[fw/openocd] / src / target / breakpoints.c
index df797e3774017531cc83937fce25f87646f1971d..dc44642f75b396503978c1508087248543aa356d 100644 (file)
@@ -22,7 +22,7 @@
 #endif
 
 #include "target.h"
-#include "log.h"
+#include <helper/log.h>
 #include "breakpoints.h"
 
 
@@ -105,14 +105,15 @@ fail:
 }
 
 /* free up a breakpoint */
-static void breakpoint_free(struct target *target, struct breakpoint *breakpoint_remove)
+static void breakpoint_free(struct target *target, struct breakpoint *breakpoint_to_remove)
 {
        struct breakpoint *breakpoint = target->breakpoints;
        struct breakpoint **breakpoint_p = &target->breakpoints;
+       int retval;
 
        while (breakpoint)
        {
-               if (breakpoint == breakpoint_remove)
+               if (breakpoint == breakpoint_to_remove)
                        break;
                breakpoint_p = &breakpoint->next;
                breakpoint = breakpoint->next;
@@ -121,9 +122,9 @@ static void breakpoint_free(struct target *target, struct breakpoint *breakpoint
        if (breakpoint == NULL)
                return;
 
-       target_remove_breakpoint(target, breakpoint);
+       retval = target_remove_breakpoint(target, breakpoint);
 
-       LOG_DEBUG("BPID: %d", breakpoint->unique_id );
+       LOG_DEBUG("free BPID: %d --> %d", breakpoint->unique_id, retval);
        (*breakpoint_p) = breakpoint->next;
        free(breakpoint->orig_instr);
        free(breakpoint);
@@ -157,7 +158,7 @@ void breakpoint_clear_target(struct target *target)
        struct breakpoint *breakpoint;
 
        LOG_DEBUG("Delete all breakpoints for target: %s",
-                       target_type_name(target));
+                       target_name(target));
        while ((breakpoint = target->breakpoints) != NULL)
        {
                breakpoint_free(target, breakpoint);
@@ -245,14 +246,15 @@ bye:
        return ERROR_OK;
 }
 
-static void watchpoint_free(struct target *target, struct watchpoint *watchpoint_remove)
+static void watchpoint_free(struct target *target, struct watchpoint *watchpoint_to_remove)
 {
        struct watchpoint *watchpoint = target->watchpoints;
        struct watchpoint **watchpoint_p = &target->watchpoints;
+       int retval;
 
        while (watchpoint)
        {
-               if (watchpoint == watchpoint_remove)
+               if (watchpoint == watchpoint_to_remove)
                        break;
                watchpoint_p = &watchpoint->next;
                watchpoint = watchpoint->next;
@@ -260,8 +262,8 @@ static void watchpoint_free(struct target *target, struct watchpoint *watchpoint
 
        if (watchpoint == NULL)
                return;
-       target_remove_watchpoint(target, watchpoint);
-       LOG_DEBUG("WPID: %d", watchpoint->unique_id );
+       retval = target_remove_watchpoint(target, watchpoint);
+       LOG_DEBUG("free WPID: %d --> %d", watchpoint->unique_id, retval);
        (*watchpoint_p) = watchpoint->next;
        free(watchpoint);
 }
@@ -294,7 +296,7 @@ void watchpoint_clear_target(struct target *target)
        struct watchpoint *watchpoint;
 
        LOG_DEBUG("Delete all watchpoints for target: %s",
-                       target_type_name(target));
+                       target_name(target));
        while ((watchpoint = target->watchpoints) != NULL)
        {
                watchpoint_free(target, watchpoint);