diff options
author | vpalatin <vpalatin@b42882b7-edfa-0310-969c-e2dbd0fdcd60> | 2007-12-04 12:56:46 +0000 |
---|---|---|
committer | vpalatin <vpalatin@b42882b7-edfa-0310-969c-e2dbd0fdcd60> | 2007-12-04 12:56:46 +0000 |
commit | ba379aa80eb34949f6bf5011d6406547ee59961e (patch) | |
tree | d1ae2541ca79c1a89902c7e94926788da9e7d71d /src/target | |
parent | d6fae6fe0231887cb2a72b81d9084ee8f45efb84 (diff) | |
download | openocd+libswd-ba379aa80eb34949f6bf5011d6406547ee59961e.tar.gz openocd+libswd-ba379aa80eb34949f6bf5011d6406547ee59961e.tar.bz2 openocd+libswd-ba379aa80eb34949f6bf5011d6406547ee59961e.tar.xz openocd+libswd-ba379aa80eb34949f6bf5011d6406547ee59961e.zip |
Do not overwrite code when removing software breakpoint if it no longer contains bkpt instruction.
(thanks to oyvind harboe for bug report and test)
git-svn-id: svn://svn.berlios.de/openocd/trunk@214 b42882b7-edfa-0310-969c-e2dbd0fdcd60
Diffstat (limited to 'src/target')
-rw-r--r-- | src/target/arm7_9_common.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/src/target/arm7_9_common.c b/src/target/arm7_9_common.c index e596d057..b5434d68 100644 --- a/src/target/arm7_9_common.c +++ b/src/target/arm7_9_common.c @@ -243,11 +243,19 @@ int arm7_9_unset_breakpoint(struct target_s *target, breakpoint_t *breakpoint) /* restore original instruction (kept in target endianness) */ if (breakpoint->length == 4) { - target->type->write_memory(target, breakpoint->address, 4, 1, breakpoint->orig_instr); + u32 current_instr; + /* check that user program as not modified breakpoint instruction */ + target->type->read_memory(target, breakpoint->address, 4, 1, (u8*)¤t_instr); + if (current_instr==arm7_9->arm_bkpt) + target->type->write_memory(target, breakpoint->address, 4, 1, breakpoint->orig_instr); } else { - target->type->write_memory(target, breakpoint->address, 2, 1, breakpoint->orig_instr); + u16 current_instr; + /* check that user program as not modified breakpoint instruction */ + target->type->read_memory(target, breakpoint->address, 2, 1, (u8*)¤t_instr); + if (current_instr==arm7_9->thumb_bkpt) + target->type->write_memory(target, breakpoint->address, 2, 1, breakpoint->orig_instr); } breakpoint->set = 0; } |