mips_m4k.c: D or I breaks only if they supported.

For example Realtek RTL8186 (Lexra LX5280 core) don't
support break- and watchpoints.

Change-Id: Ie00102da4bf13a8c42a9ad05910c66884f297cfd
Signed-off-by: Oleksij Rempel <linux@rempel-privat.de>
Reviewed-on: http://openocd.zylin.com/1933
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
This commit is contained in:
Oleksij Rempel 2014-01-22 12:27:19 +01:00 committed by Spencer Oliver
parent 02ac60b000
commit ecb6f8c23e
1 changed files with 25 additions and 21 deletions

View File

@ -57,33 +57,37 @@ static int mips_m4k_examine_debug_reason(struct target *target)
int retval; int retval;
if ((target->debug_reason != DBG_REASON_DBGRQ) if ((target->debug_reason != DBG_REASON_DBGRQ)
&& (target->debug_reason != DBG_REASON_SINGLESTEP)) { && (target->debug_reason != DBG_REASON_SINGLESTEP)) {
/* get info about inst breakpoint support */ if (ejtag_info->debug_caps & EJTAG_DCR_IB) {
retval = target_read_u32(target, /* get info about inst breakpoint support */
ejtag_info->ejtag_ibs_addr, &break_status); retval = target_read_u32(target,
if (retval != ERROR_OK) ejtag_info->ejtag_ibs_addr, &break_status);
return retval;
if (break_status & 0x1f) {
/* we have halted on a breakpoint */
retval = target_write_u32(target,
ejtag_info->ejtag_ibs_addr, 0);
if (retval != ERROR_OK) if (retval != ERROR_OK)
return retval; return retval;
target->debug_reason = DBG_REASON_BREAKPOINT; if (break_status & 0x1f) {
/* we have halted on a breakpoint */
retval = target_write_u32(target,
ejtag_info->ejtag_ibs_addr, 0);
if (retval != ERROR_OK)
return retval;
target->debug_reason = DBG_REASON_BREAKPOINT;
}
} }
/* get info about data breakpoint support */ if (ejtag_info->debug_caps & EJTAG_DCR_DB) {
retval = target_read_u32(target, /* get info about data breakpoint support */
ejtag_info->ejtag_dbs_addr, &break_status); retval = target_read_u32(target,
if (retval != ERROR_OK) ejtag_info->ejtag_dbs_addr, &break_status);
return retval;
if (break_status & 0x1f) {
/* we have halted on a breakpoint */
retval = target_write_u32(target,
ejtag_info->ejtag_dbs_addr, 0);
if (retval != ERROR_OK) if (retval != ERROR_OK)
return retval; return retval;
target->debug_reason = DBG_REASON_WATCHPOINT; if (break_status & 0x1f) {
/* we have halted on a breakpoint */
retval = target_write_u32(target,
ejtag_info->ejtag_dbs_addr, 0);
if (retval != ERROR_OK)
return retval;
target->debug_reason = DBG_REASON_WATCHPOINT;
}
} }
} }