Browse Source

propagate return status of set_breakpoint() up call chain

Hi everyone,

I figured since I was poking around in the breakpoint code on other arches, I'd
add this change to those arches that don't do it already.  This patch propagates
the return code of <arch>_set_breakpoint() up the call stack.  This ensures that
the higher layer breakpoint infrastructure is aware that an error ocurred, in
which case the breakpoint is not recorded.

Normally I wouldn't touch code that I can't test, but the code is very
uniform across architectures, and the change is rather benign, so I figured
after careful inspection that it is safe.  If the maintainers or others think
this is imprudent, the patch can be dropped.

Also changed the error code to something more appropriate in two cases where
hardware resources are unavailable.

Comments and criticisms of course gratefully received.

Mike

Signed-off-by: Mike Dunn <mikedunn@newsguy.com>
Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
tags/v0.5.0-rc1
Mike Dunn 13 years ago
committed by Øyvind Harboe
parent
commit
81e0d4438e
3 changed files with 5 additions and 9 deletions
  1. +2
    -3
      src/target/cortex_a8.c
  2. +1
    -2
      src/target/cortex_m3.c
  3. +2
    -4
      src/target/mips_m4k.c

+ 2
- 3
src/target/cortex_a8.c View File

@@ -1230,7 +1230,7 @@ static int cortex_a8_set_breakpoint(struct target *target,
if (brp_i >= cortex_a8->brp_num)
{
LOG_ERROR("ERROR Can not find free Breakpoint Register Pair");
return ERROR_FAIL;
return ERROR_TARGET_RESOURCE_NOT_AVAILABLE;
}
breakpoint->set = brp_i + 1;
if (breakpoint->length == 2)
@@ -1360,9 +1360,8 @@ static int cortex_a8_add_breakpoint(struct target *target,

if (breakpoint->type == BKPT_HARD)
cortex_a8->brp_num_available--;
cortex_a8_set_breakpoint(target, breakpoint, 0x00); /* Exact match */

return ERROR_OK;
return cortex_a8_set_breakpoint(target, breakpoint, 0x00); /* Exact match */
}

static int cortex_a8_remove_breakpoint(struct target *target, struct breakpoint *breakpoint)


+ 1
- 2
src/target/cortex_m3.c View File

@@ -1221,9 +1221,8 @@ cortex_m3_add_breakpoint(struct target *target, struct breakpoint *breakpoint)

if (breakpoint->type == BKPT_HARD)
cortex_m3->fp_code_available--;
cortex_m3_set_breakpoint(target, breakpoint);

return ERROR_OK;
return cortex_m3_set_breakpoint(target, breakpoint);
}

static int


+ 2
- 4
src/target/mips_m4k.c View File

@@ -497,7 +497,7 @@ static int mips_m4k_set_breakpoint(struct target *target,
{
LOG_ERROR("Can not find free FP Comparator(bpid: %d)",
breakpoint->unique_id );
return ERROR_FAIL;
return ERROR_TARGET_RESOURCE_NOT_AVAILABLE;
}
breakpoint->set = bp_num + 1;
comparator_list[bp_num].used = 1;
@@ -662,9 +662,7 @@ static int mips_m4k_add_breakpoint(struct target *target, struct breakpoint *bre
mips32->num_inst_bpoints_avail--;
}

mips_m4k_set_breakpoint(target, breakpoint);

return ERROR_OK;
return mips_m4k_set_breakpoint(target, breakpoint);
}

static int mips_m4k_remove_breakpoint(struct target *target,


Loading…
Cancel
Save