From: David B. <dbr...@us...> - 2009-11-28 20:30:00
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Main OpenOCD repository". The branch, master has been updated via 30f6142fc8570549ff42676ffe16425c6a6ef264 (commit) via acbe054a38a45432f5948026e1e9258b4e2910c2 (commit) via 68889ea02f28bfd61f0b4b85aad4b0bf8826a947 (commit) from 5782999f6030acb560a3b02da10354eb099c45a4 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 30f6142fc8570549ff42676ffe16425c6a6ef264 Author: David Brownell <dbr...@us...> Date: Sat Nov 28 11:28:17 2009 -0800 ARM11: fix dbgtap JTAG_DEBUG There is no DEBUG() macro; don't call one! Always at least *parse* debug code, to help prevent such errors. Signed-off-by: David Brownell <dbr...@us...> diff --git a/src/target/arm11_dbgtap.c b/src/target/arm11_dbgtap.c index b5b02ef..9e43895 100644 --- a/src/target/arm11_dbgtap.c +++ b/src/target/arm11_dbgtap.c @@ -30,9 +30,9 @@ #include "time_support.h" #if 0 -#define JTAG_DEBUG(expr ...) DEBUG(expr) +#define JTAG_DEBUG(expr ...) do { if (1) LOG_DEBUG(expr); } while (0) #else -#define JTAG_DEBUG(expr ...) do {} while (0) +#define JTAG_DEBUG(expr ...) do { if (0) LOG_DEBUG(expr); } while (0) #endif /* commit acbe054a38a45432f5948026e1e9258b4e2910c2 Author: David Brownell <dbr...@us...> Date: Sat Nov 28 10:40:26 2009 -0800 target: uplevel add_{break,watch}point() error checks In target_type.h it's documented that the target must be halted for add_breakpoint() ... and with slight ambiguity, also for its add_watchpoint() sibling. So rather than verifying that constraint in the CPU drivers, do it in the target_add_{break,watch}point() routines. Add minor paranoia on the remove_*point() paths too: save the return value, and print it out in in the LOG_DEBUG message in case it's nonzero. Note that with some current cores, like all ARMv7 ones I've looked at, there's no technical issue preventing watchpoint or breakpoint add/remove operations on active cores. This model seems deeply wired into OpenOCD though. ALSO: the ARM targets were fairly "good" about enforcing that constraint themselves. The MIPS ones were relied on other code to catch such stuff, but it's not clear such code existed ... keep an eye out for new issues on MIPS. Signed-off-by: David Brownell <dbr...@us...> diff --git a/src/target/arm7_9_common.c b/src/target/arm7_9_common.c index f7b8669..b5553cd 100644 --- a/src/target/arm7_9_common.c +++ b/src/target/arm7_9_common.c @@ -426,12 +426,6 @@ int arm7_9_add_breakpoint(struct target *target, struct breakpoint *breakpoint) { struct arm7_9_common *arm7_9 = target_to_arm7_9(target); - if (target->state != TARGET_HALTED) - { - LOG_WARNING("target not halted"); - return ERROR_TARGET_NOT_HALTED; - } - if (arm7_9->breakpoint_count == 0) { /* make sure we don't have any dangling breakpoints. This is vital upon @@ -631,12 +625,6 @@ int arm7_9_add_watchpoint(struct target *target, struct watchpoint *watchpoint) { struct arm7_9_common *arm7_9 = target_to_arm7_9(target); - if (target->state != TARGET_HALTED) - { - LOG_WARNING("target not halted"); - return ERROR_TARGET_NOT_HALTED; - } - if (arm7_9->wp_available < 1) { return ERROR_TARGET_RESOURCE_NOT_AVAILABLE; diff --git a/src/target/breakpoints.c b/src/target/breakpoints.c index 16ab7e0..2542c41 100644 --- a/src/target/breakpoints.c +++ b/src/target/breakpoints.c @@ -109,6 +109,7 @@ static void breakpoint_free(struct target *target, struct breakpoint *breakpoint { struct breakpoint *breakpoint = target->breakpoints; struct breakpoint **breakpoint_p = &target->breakpoints; + int retval; while (breakpoint) { @@ -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); @@ -249,6 +250,7 @@ static void watchpoint_free(struct target *target, struct watchpoint *watchpoint { struct watchpoint *watchpoint = target->watchpoints; struct watchpoint **watchpoint_p = &target->watchpoints; + int retval; while (watchpoint) { @@ -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); } diff --git a/src/target/cortex_m3.c b/src/target/cortex_m3.c index 7cfe540..ad59c78 100644 --- a/src/target/cortex_m3.c +++ b/src/target/cortex_m3.c @@ -1141,13 +1141,6 @@ cortex_m3_add_watchpoint(struct target *target, struct watchpoint *watchpoint) { struct cortex_m3_common *cortex_m3 = target_to_cm3(target); - /* REVISIT why check? DWT can be updated with core running ... */ - if (target->state != TARGET_HALTED) - { - LOG_WARNING("target not halted"); - return ERROR_TARGET_NOT_HALTED; - } - if (cortex_m3->dwt_comp_available < 1) { LOG_DEBUG("no comparators?"); diff --git a/src/target/target.c b/src/target/target.c index a2bd886..28387f4 100644 --- a/src/target/target.c +++ b/src/target/target.c @@ -606,6 +606,10 @@ int target_bulk_write_memory(struct target *target, int target_add_breakpoint(struct target *target, struct breakpoint *breakpoint) { + if (target->state != TARGET_HALTED) { + LOG_WARNING("target %s is not halted", target->cmd_name); + return ERROR_TARGET_NOT_HALTED; + } return target->type->add_breakpoint(target, breakpoint); } int target_remove_breakpoint(struct target *target, @@ -617,6 +621,10 @@ int target_remove_breakpoint(struct target *target, int target_add_watchpoint(struct target *target, struct watchpoint *watchpoint) { + if (target->state != TARGET_HALTED) { + LOG_WARNING("target %s is not halted", target->cmd_name); + return ERROR_TARGET_NOT_HALTED; + } return target->type->add_watchpoint(target, watchpoint); } int target_remove_watchpoint(struct target *target, diff --git a/src/target/target_type.h b/src/target/target_type.h index 333b58b..d141608 100644 --- a/src/target/target_type.h +++ b/src/target/target_type.h @@ -124,18 +124,24 @@ struct target_type * Target must be halted while this is invoked as this * will actually set up breakpoints on target. * - * The breakpoint hardware will be set up upon adding the first breakpoint. + * The breakpoint hardware will be set up upon adding the + * first breakpoint. * * Upon GDB connection all breakpoints/watchpoints are cleared. */ int (*add_breakpoint)(struct target *target, struct breakpoint *breakpoint); - /* remove breakpoint. hw will only be updated if the target is currently halted. + /* remove breakpoint. hw will only be updated if the target + * is currently halted. * However, this method can be invoked on unresponsive targets. */ int (*remove_breakpoint)(struct target *target, struct breakpoint *breakpoint); + + /* add watchpoint ... see add_breakpoint() comment above. */ int (*add_watchpoint)(struct target *target, struct watchpoint *watchpoint); - /* remove watchpoint. hw will only be updated if the target is currently halted. + + /* remove watchpoint. hw will only be updated if the target + * is currently halted. * However, this method can be invoked on unresponsive targets. */ int (*remove_watchpoint)(struct target *target, struct watchpoint *watchpoint); diff --git a/src/target/xscale.c b/src/target/xscale.c index 1a18ab8..49653a9 100644 --- a/src/target/xscale.c +++ b/src/target/xscale.c @@ -2137,12 +2137,6 @@ static int xscale_add_breakpoint(struct target *target, { struct xscale_common *xscale = target_to_xscale(target); - if (target->state != TARGET_HALTED) - { - LOG_WARNING("target not halted"); - return ERROR_TARGET_NOT_HALTED; - } - if ((breakpoint->type == BKPT_HARD) && (xscale->ibcr_available < 1)) { LOG_INFO("no breakpoint unit available for hardware breakpoint"); @@ -2300,12 +2294,6 @@ static int xscale_add_watchpoint(struct target *target, { struct xscale_common *xscale = target_to_xscale(target); - if (target->state != TARGET_HALTED) - { - LOG_WARNING("target not halted"); - return ERROR_TARGET_NOT_HALTED; - } - if (xscale->dbr_available < 1) { return ERROR_TARGET_RESOURCE_NOT_AVAILABLE; commit 68889ea02f28bfd61f0b4b85aad4b0bf8826a947 Author: David Brownell <dbr...@us...> Date: Sat Nov 28 10:36:32 2009 -0800 target: remove unused TARGET_EVENT_OLD_* symbols Just two *_OLD_* symbols left... Signed-off-by: David Brownell <dbr...@us...> diff --git a/src/target/target.h b/src/target/target.h index 55e9088..009ec17 100644 --- a/src/target/target.h +++ b/src/target/target.h @@ -172,8 +172,6 @@ enum target_event * - June/July/Aug 2008 * - Duane Ellis */ TARGET_EVENT_OLD_gdb_program_config, - TARGET_EVENT_OLD_pre_reset, - TARGET_EVENT_OLD_post_reset, TARGET_EVENT_OLD_pre_resume, /* allow GDB to do stuff before others handle the halted event, ----------------------------------------------------------------------- Summary of changes: src/target/arm11_dbgtap.c | 4 ++-- src/target/arm7_9_common.c | 12 ------------ src/target/breakpoints.c | 10 ++++++---- src/target/cortex_m3.c | 7 ------- src/target/target.c | 8 ++++++++ src/target/target.h | 2 -- src/target/target_type.h | 12 +++++++++--- src/target/xscale.c | 12 ------------ 8 files changed, 25 insertions(+), 42 deletions(-) hooks/post-receive -- Main OpenOCD repository |