summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoroharboe <oharboe@b42882b7-edfa-0310-969c-e2dbd0fdcd60>2008-10-28 14:55:25 +0000
committeroharboe <oharboe@b42882b7-edfa-0310-969c-e2dbd0fdcd60>2008-10-28 14:55:25 +0000
commit11ce572bbed985819989e80dff8d6402fd95b673 (patch)
tree5cf93afc6cb52cd9d94462605f23acd32a02941b
parent5f993dc17c92630514287f886cffefc560a98c42 (diff)
downloadopenocd_libswd-11ce572bbed985819989e80dff8d6402fd95b673.tar.gz
openocd_libswd-11ce572bbed985819989e80dff8d6402fd95b673.tar.bz2
openocd_libswd-11ce572bbed985819989e80dff8d6402fd95b673.tar.xz
openocd_libswd-11ce572bbed985819989e80dff8d6402fd95b673.zip
Hongtao Zheng - more fixes to single stepping. Better hiding of details and fixes feroceon regression.
git-svn-id: svn://svn.berlios.de/openocd/trunk@1110 b42882b7-edfa-0310-969c-e2dbd0fdcd60
-rw-r--r--src/target/arm7_9_common.c40
-rw-r--r--src/target/arm7_9_common.h7
-rw-r--r--src/target/arm9tdmi.c7
3 files changed, 17 insertions, 37 deletions
diff --git a/src/target/arm7_9_common.c b/src/target/arm7_9_common.c
index 62045898..c04968ef 100644
--- a/src/target/arm7_9_common.c
+++ b/src/target/arm7_9_common.c
@@ -1553,9 +1553,6 @@ int arm7_9_resume(struct target_s *target, int current, u32 address, int handle_
if (!current)
buf_set_u32(armv4_5->core_cache->reg_list[15].value, 0, 32, address);
- u32 current_pc;
- current_pc = buf_get_u32(armv4_5->core_cache->reg_list[15].value, 0, 32);
-
/* the front-end may request us not to handle breakpoints */
if (handle_breakpoints)
{
@@ -1567,17 +1564,8 @@ int arm7_9_resume(struct target_s *target, int current, u32 address, int handle_
return retval;
}
- u32 next_pc;
- if ((retval = arm_simulate_step(target, &next_pc)) != ERROR_OK)
- {
- u32 current_opcode;
- target_read_u32(target, current_pc, &current_opcode);
- LOG_ERROR("BUG: couldn't calculate PC of next instruction, current opcode was 0x%8.8x", current_opcode);
- return retval;
- }
-
LOG_DEBUG("enable single-step");
- arm7_9->enable_single_step(target, next_pc);
+ arm7_9->enable_single_step(target);
target->debug_reason = DBG_REASON_SINGLESTEP;
@@ -1687,13 +1675,23 @@ int arm7_9_resume(struct target_s *target, int current, u32 address, int handle_
return ERROR_OK;
}
-void arm7_9_enable_eice_step(target_t *target, u32 next_pc)
+void arm7_9_enable_eice_step(target_t *target)
{
armv4_5_common_t *armv4_5 = target->arch_info;
arm7_9_common_t *arm7_9 = armv4_5->arch_info;
+ int retval;
u32 current_pc;
current_pc = buf_get_u32(armv4_5->core_cache->reg_list[15].value, 0, 32);
+
+ u32 next_pc;
+ if ((retval = arm_simulate_step(target, &next_pc)) != ERROR_OK)
+ {
+ u32 current_opcode;
+ target_read_u32(target, current_pc, &current_opcode);
+ LOG_ERROR("BUG: couldn't calculate PC of next instruction, current opcode was 0x%8.8x", current_opcode);
+ return retval;
+ }
if(next_pc != current_pc)
{
@@ -1758,9 +1756,6 @@ int arm7_9_step(struct target_s *target, int current, u32 address, int handle_br
if (!current)
buf_set_u32(armv4_5->core_cache->reg_list[15].value, 0, 32, address);
- u32 current_pc;
- current_pc = buf_get_u32(armv4_5->core_cache->reg_list[15].value, 0, 32);
-
/* the front-end may request us not to handle breakpoints */
if (handle_breakpoints)
if ((breakpoint = breakpoint_find(target, buf_get_u32(armv4_5->core_cache->reg_list[15].value, 0, 32))))
@@ -1771,21 +1766,12 @@ int arm7_9_step(struct target_s *target, int current, u32 address, int handle_br
target->debug_reason = DBG_REASON_SINGLESTEP;
- u32 next_pc;
- if ((retval = arm_simulate_step(target, &next_pc)) != ERROR_OK)
- {
- u32 current_opcode;
- target_read_u32(target, current_pc, &current_opcode);
- LOG_ERROR("BUG: couldn't calculate PC of next instruction, current opcode was 0x%8.8x", current_opcode);
- return retval;
- }
-
if ((retval = arm7_9_restore_context(target)) != ERROR_OK)
{
return retval;
}
- arm7_9->enable_single_step(target, next_pc);
+ arm7_9->enable_single_step(target);
if (armv4_5->core_state == ARMV4_5_STATE_ARM)
{
diff --git a/src/target/arm7_9_common.h b/src/target/arm7_9_common.h
index a975b5f3..73d8f59e 100644
--- a/src/target/arm7_9_common.h
+++ b/src/target/arm7_9_common.h
@@ -8,9 +8,6 @@
* Copyright (C) 2008 by Spencer Oliver *
* spen@spen-soft.co.uk *
* *
- * Copyright (C) 2008 by Hongtao Zheng *
- * hontor@126.com *
- * *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
@@ -96,7 +93,7 @@ typedef struct arm7_9_common_s
void (*branch_resume)(target_t *target);
void (*branch_resume_thumb)(target_t *target);
- void (*enable_single_step)(target_t *target, u32 next_pc);
+ void (*enable_single_step)(target_t *target);
void (*disable_single_step)(target_t *target);
void (*set_special_dbgrq)(target_t *target);
@@ -146,7 +143,7 @@ int arm7_9_remove_breakpoint(struct target_s *target, breakpoint_t *breakpoint);
int arm7_9_add_watchpoint(struct target_s *target, watchpoint_t *watchpoint);
int arm7_9_remove_watchpoint(struct target_s *target, watchpoint_t *watchpoint);
-void arm7_9_enable_eice_step(target_t *target, u32 next_pc);
+void arm7_9_enable_eice_step(target_t *target);
void arm7_9_disable_eice_step(target_t *target);
int arm7_9_execute_sys_speed(struct target_s *target);
diff --git a/src/target/arm9tdmi.c b/src/target/arm9tdmi.c
index 89842d50..69e9b797 100644
--- a/src/target/arm9tdmi.c
+++ b/src/target/arm9tdmi.c
@@ -5,9 +5,6 @@
* Copyright (C) 2008 by Spencer Oliver *
* spen@spen-soft.co.uk *
* *
- * Copyright (C) 2008 by Hongtao Zheng *
- * hontor@126.com *
- * *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
@@ -844,7 +841,7 @@ void arm9tdmi_branch_resume_thumb(target_t *target)
}
-void arm9tdmi_enable_single_step(target_t *target, u32 next_pc)
+void arm9tdmi_enable_single_step(target_t *target)
{
/* get pointers to arch-specific information */
armv4_5_common_t *armv4_5 = target->arch_info;
@@ -857,7 +854,7 @@ void arm9tdmi_enable_single_step(target_t *target, u32 next_pc)
}
else
{
- arm7_9_enable_eice_step(target, next_pc);
+ arm7_9_enable_eice_step(target);
}
}