From 5a7cff26a502ecc5dbd027ebb9d28d95782681a8 Mon Sep 17 00:00:00 2001 From: Michel Jaouen Date: Mon, 3 Oct 2011 19:05:59 +0200 Subject: [PATCH] breakpoint : smp software breakpoint issue MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Change-Id: Iefe78bad71d4fdb38ae412ab8fe2f6282836c22e Signed-off-by: Øyvind Harboe Reviewed-on: http://openocd.zylin.com/14 Tested-by: Spencer Oliver Reviewed-by: Spencer Oliver --- src/target/breakpoints.c | 15 ++++++++++++--- src/target/target.c | 7 +++++++ 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/src/target/breakpoints.c b/src/target/breakpoints.c index e722f67e..c0905ede 100644 --- a/src/target/breakpoints.c +++ b/src/target/breakpoints.c @@ -228,6 +228,9 @@ int breakpoint_add(struct target *target, uint32_t address, uint32_t length, enu struct target_list *head; struct target *curr; head = target->head; + if (type == BKPT_SOFT) + return(breakpoint_add_internal(head->target, address,length, type)); + while(head != (struct target_list*)NULL) { curr = head->target; @@ -312,7 +315,7 @@ static void breakpoint_free(struct target *target, struct breakpoint *breakpoint free(breakpoint); } -void breakpoint_remove_internal(struct target *target, uint32_t address) +int breakpoint_remove_internal(struct target *target, uint32_t address) { struct breakpoint *breakpoint = target->breakpoints; @@ -330,14 +333,18 @@ void breakpoint_remove_internal(struct target *target, uint32_t address) if (breakpoint) { breakpoint_free(target, breakpoint); + return 1; } else { - LOG_ERROR("no breakpoint at address 0x%8.8" PRIx32 " found", address); + if (!target->smp) + LOG_ERROR("no breakpoint at address 0x%8.8" PRIx32 " found", address); + return 0; } } void breakpoint_remove(struct target *target, uint32_t address) { + int found = 0; if (target->smp) { struct target_list *head; @@ -346,9 +353,11 @@ void breakpoint_remove(struct target *target, uint32_t address) while(head != (struct target_list*)NULL) { curr = head->target; - breakpoint_remove_internal(curr, address); + found += breakpoint_remove_internal(curr, address); head = head->next; } + if (found == 0) + LOG_ERROR("no breakpoint at address 0x%8.8" PRIx32 " found", address); } else breakpoint_remove_internal(target, address); } diff --git a/src/target/target.c b/src/target/target.c index 6a60b4ea..e03b3989 100644 --- a/src/target/target.c +++ b/src/target/target.c @@ -3098,6 +3098,13 @@ COMMAND_HANDLER(handle_bp_command) { case 0: return handle_bp_command_list(CMD_CTX); + + case 2: + asid = 0; + COMMAND_PARSE_NUMBER(u32, CMD_ARGV[0], addr); + COMMAND_PARSE_NUMBER(u32, CMD_ARGV[1], length); + return handle_bp_command_set(CMD_CTX, addr, asid, length, hw); + case 3: if(strcmp(CMD_ARGV[2], "hw") == 0) -- 2.39.5