Pass breakpoint length to target.

This commit is contained in:
Gareth McMullin 2016-04-16 16:22:35 -07:00
parent 459bae4ea1
commit 60f3be501e
3 changed files with 14 additions and 12 deletions

View File

@ -67,8 +67,8 @@ static int cortexm_halt_wait(target *t);
static void cortexm_halt_request(target *t); static void cortexm_halt_request(target *t);
static int cortexm_fault_unwind(target *t); static int cortexm_fault_unwind(target *t);
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);
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);
static int cortexm_set_hw_wp(target *t, uint8_t type, 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); 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 following routines implement hardware breakpoints.
* The Flash Patch and Breakpoint (FPB) system is used. */ * 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; struct cortexm_priv *priv = t->priv;
uint32_t val = addr; uint32_t val = addr;
unsigned i; unsigned i;
@ -693,8 +694,9 @@ static int cortexm_set_hw_bp(target *t, uint32_t addr)
return 0; 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; struct cortexm_priv *priv = t->priv;
unsigned i; unsigned i;

View File

@ -452,9 +452,9 @@ handle_z_packet(char *packet, int plen)
switch(type) { switch(type) {
case 1: /* Hardware breakpoint */ case 1: /* Hardware breakpoint */
if(set) if(set)
ret = target_set_hw_bp(cur_target, addr); ret = target_set_hw_bp(cur_target, addr, len);
else else
ret = target_clear_hw_bp(cur_target, addr); ret = target_clear_hw_bp(cur_target, addr, len);
break; break;
case 2: case 2:

View File

@ -76,11 +76,11 @@ target *target_attach(target *t, target_destroy_callback destroy_cb);
(target)->halt_resume((target), (step)) (target)->halt_resume((target), (step))
/* Break-/watchpoint functions */ /* Break-/watchpoint functions */
#define target_set_hw_bp(target, addr) \ #define target_set_hw_bp(target, addr, len) \
(target)->set_hw_bp((target), (addr)) (target)->set_hw_bp((target), (addr), (len))
#define target_clear_hw_bp(target, addr) \ #define target_clear_hw_bp(target, addr, len) \
(target)->clear_hw_bp((target), (addr)) (target)->clear_hw_bp((target), (addr), (len))
#define target_set_hw_wp(target, type, 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); void (*halt_resume)(target *t, bool step);
/* Break-/watchpoint functions */ /* Break-/watchpoint functions */
int (*set_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); 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 (*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); int (*clear_hw_wp)(target *t, uint8_t type, uint32_t addr, uint8_t len);