C99 printf() -Werror fixes
[fw/openocd] / src / target / breakpoints.c
index c73d1f9aa4b7f0192475b2051a6436cd7695adf4..b1faf5ad38df1f31823c8abe75ed21bfe20d5637 100644 (file)
 #include "config.h"
 #endif
 
-#include <stdlib.h>
-
-#include "binarybuffer.h"
 #include "target.h"
 #include "log.h"
-#include "types.h"
-
 #include "breakpoints.h"
 
-char *breakpoint_type_strings[] =
+
+static char *breakpoint_type_strings[] =
 {
        "hardware",
        "software"
 };
 
-char *watchpoint_rw_strings[] =
+static char *watchpoint_rw_strings[] =
 {
        "read",
        "write",
        "access"
 };
 
-int breakpoint_add(target_t *target, u32 address, u32 length, enum breakpoint_type type)
+int breakpoint_add(target_t *target, uint32_t address, uint32_t length, enum breakpoint_type type)
 {
        breakpoint_t *breakpoint = target->breakpoints;
        breakpoint_t **breakpoint_p = &target->breakpoints;
@@ -65,7 +61,7 @@ int breakpoint_add(target_t *target, u32 address, u32 length, enum breakpoint_ty
        (*breakpoint_p)->orig_instr = malloc(length);
        (*breakpoint_p)->next = NULL;
        
-       if ((retval = target->type->add_breakpoint(target, *breakpoint_p)) != ERROR_OK)
+       if ((retval = target_add_breakpoint(target, *breakpoint_p)) != ERROR_OK)
        {
                switch (retval)
                {
@@ -88,7 +84,7 @@ int breakpoint_add(target_t *target, u32 address, u32 length, enum breakpoint_ty
                }
        }
        
-       LOG_DEBUG("added %s breakpoint at 0x%8.8x of length 0x%8.8x", 
+       LOG_DEBUG("added %s breakpoint at 0x%8.8" PRIx32 " of length 0x%8.8x", 
                breakpoint_type_strings[(*breakpoint_p)->type],
                (*breakpoint_p)->address, (*breakpoint_p)->length);
        
@@ -112,14 +108,14 @@ static void breakpoint_free(target_t *target, breakpoint_t *breakpoint_remove)
        if (breakpoint==NULL)
                return;
        
-       target->type->remove_breakpoint(target, breakpoint);
+       target_remove_breakpoint(target, breakpoint);
        
        (*breakpoint_p) = breakpoint->next;
        free(breakpoint->orig_instr);
        free(breakpoint);
 }
 
-void breakpoint_remove(target_t *target, u32 address)
+void breakpoint_remove(target_t *target, uint32_t address)
 {
        breakpoint_t *breakpoint = target->breakpoints;
        breakpoint_t **breakpoint_p = &target->breakpoints;
@@ -138,7 +134,7 @@ void breakpoint_remove(target_t *target, u32 address)
        }
        else
        {
-               LOG_ERROR("no breakpoint at address 0x%8.8x found", address);
+               LOG_ERROR("no breakpoint at address 0x%8.8" PRIx32 " found", address);
        }
 }
 
@@ -151,7 +147,7 @@ void breakpoint_clear_target(target_t *target)
        }
 }
 
-breakpoint_t* breakpoint_find(target_t *target, u32 address)
+breakpoint_t* breakpoint_find(target_t *target, uint32_t address)
 {
        breakpoint_t *breakpoint = target->breakpoints;
        
@@ -165,7 +161,7 @@ breakpoint_t* breakpoint_find(target_t *target, u32 address)
        return NULL;
 }
 
-int watchpoint_add(target_t *target, u32 address, u32 length, enum watchpoint_rw rw, u32 value, u32 mask)
+int watchpoint_add(target_t *target, uint32_t address, uint32_t length, enum watchpoint_rw rw, uint32_t value, uint32_t mask)
 {
        watchpoint_t *watchpoint = target->watchpoints;
        watchpoint_t **watchpoint_p = &target->watchpoints;
@@ -188,7 +184,7 @@ int watchpoint_add(target_t *target, u32 address, u32 length, enum watchpoint_rw
        (*watchpoint_p)->set = 0;
        (*watchpoint_p)->next = NULL;
                
-       if ((retval = target->type->add_watchpoint(target, *watchpoint_p)) != ERROR_OK)
+       if ((retval = target_add_watchpoint(target, *watchpoint_p)) != ERROR_OK)
        {
                switch (retval)
                {
@@ -211,7 +207,7 @@ int watchpoint_add(target_t *target, u32 address, u32 length, enum watchpoint_rw
                }
        }
        
-       LOG_DEBUG("added %s watchpoint at 0x%8.8x of length 0x%8.8x",
+       LOG_DEBUG("added %s watchpoint at 0x%8.8" PRIx32 " of length 0x%8.8x",
                watchpoint_rw_strings[(*watchpoint_p)->rw],
                (*watchpoint_p)->address, (*watchpoint_p)->length);
        
@@ -233,14 +229,12 @@ static void watchpoint_free(target_t *target, watchpoint_t *watchpoint_remove)
        
        if (watchpoint==NULL)
                return;
-       target->type->remove_watchpoint(target, watchpoint);
+       target_remove_watchpoint(target, watchpoint);
        (*watchpoint_p) = watchpoint->next;
        free(watchpoint);
 }
 
-
-
-void watchpoint_remove(target_t *target, u32 address)
+void watchpoint_remove(target_t *target, uint32_t address)
 {
        watchpoint_t *watchpoint = target->watchpoints;
        watchpoint_t **watchpoint_p = &target->watchpoints;
@@ -259,11 +253,10 @@ void watchpoint_remove(target_t *target, u32 address)
        }
        else
        {
-               LOG_ERROR("no watchpoint at address 0x%8.8x found", address);
+               LOG_ERROR("no watchpoint at address 0x%8.8" PRIx32 " found", address);
        }
 }
 
-
 void watchpoint_clear_target(target_t *target)
 {
        watchpoint_t *watchpoint;