From 60f3be501e30f75c1f7f8de05537fa4370913a1d Mon Sep 17 00:00:00 2001 From: Gareth McMullin Date: Sat, 16 Apr 2016 16:22:35 -0700 Subject: [PATCH] Pass breakpoint length to target. --- src/cortexm.c | 10 ++++++---- src/gdb_main.c | 4 ++-- src/include/target.h | 12 ++++++------ 3 files changed, 14 insertions(+), 12 deletions(-) diff --git a/src/cortexm.c b/src/cortexm.c index 5f9c9c1..91da4f5 100644 --- a/src/cortexm.c +++ b/src/cortexm.c @@ -67,8 +67,8 @@ static int cortexm_halt_wait(target *t); static void cortexm_halt_request(target *t); static int cortexm_fault_unwind(target *t); -static int cortexm_set_hw_bp(target *t, uint32_t addr); -static int cortexm_clear_hw_bp(target *t, uint32_t addr); +static int cortexm_set_hw_bp(target *t, uint32_t addr, uint8_t len); +static int cortexm_clear_hw_bp(target *t, uint32_t addr, uint8_t len); static int cortexm_set_hw_wp(target *t, uint8_t type, uint32_t addr, uint8_t len); static int cortexm_clear_hw_wp(target *t, uint8_t type, uint32_t addr, uint8_t len); @@ -669,8 +669,9 @@ int cortexm_run_stub(target *t, uint32_t loadaddr, /* The following routines implement hardware breakpoints. * The Flash Patch and Breakpoint (FPB) system is used. */ -static int cortexm_set_hw_bp(target *t, uint32_t addr) +static int cortexm_set_hw_bp(target *t, uint32_t addr, uint8_t len) { + (void)len; struct cortexm_priv *priv = t->priv; uint32_t val = addr; unsigned i; @@ -693,8 +694,9 @@ static int cortexm_set_hw_bp(target *t, uint32_t addr) return 0; } -static int cortexm_clear_hw_bp(target *t, uint32_t addr) +static int cortexm_clear_hw_bp(target *t, uint32_t addr, uint8_t len) { + (void)len; struct cortexm_priv *priv = t->priv; unsigned i; diff --git a/src/gdb_main.c b/src/gdb_main.c index cec5822..c2f2337 100644 --- a/src/gdb_main.c +++ b/src/gdb_main.c @@ -452,9 +452,9 @@ handle_z_packet(char *packet, int plen) switch(type) { case 1: /* Hardware breakpoint */ if(set) - ret = target_set_hw_bp(cur_target, addr); + ret = target_set_hw_bp(cur_target, addr, len); else - ret = target_clear_hw_bp(cur_target, addr); + ret = target_clear_hw_bp(cur_target, addr, len); break; case 2: diff --git a/src/include/target.h b/src/include/target.h index 9e73279..2fcb4f0 100644 --- a/src/include/target.h +++ b/src/include/target.h @@ -76,11 +76,11 @@ target *target_attach(target *t, target_destroy_callback destroy_cb); (target)->halt_resume((target), (step)) /* Break-/watchpoint functions */ -#define target_set_hw_bp(target, addr) \ - (target)->set_hw_bp((target), (addr)) +#define target_set_hw_bp(target, addr, len) \ + (target)->set_hw_bp((target), (addr), (len)) -#define target_clear_hw_bp(target, addr) \ - (target)->clear_hw_bp((target), (addr)) +#define target_clear_hw_bp(target, addr, len) \ + (target)->clear_hw_bp((target), (addr), (len)) #define target_set_hw_wp(target, type, addr, len) \ @@ -169,8 +169,8 @@ struct target_s { void (*halt_resume)(target *t, bool step); /* Break-/watchpoint functions */ - int (*set_hw_bp)(target *t, uint32_t addr); - int (*clear_hw_bp)(target *t, uint32_t addr); + int (*set_hw_bp)(target *t, uint32_t addr, uint8_t len); + int (*clear_hw_bp)(target *t, uint32_t addr, uint8_t len); int (*set_hw_wp)(target *t, uint8_t type, uint32_t addr, uint8_t len); int (*clear_hw_wp)(target *t, uint8_t type, uint32_t addr, uint8_t len);