Hi all,
I've noticed that unsetting soft breaks is currently broken on BE MIPS
4Kc targets.

This patch fix it by using target_read_u32() and target_read_u16()
instead of target_read_memory().

BR,
Drasko
From 8a24b7dc8db8a8b8193030ee210a9964792a0dc5 Mon Sep 17 00:00:00 2001
From: Drasko DRASKOVIC <drasko.drasko...@gmail.com>
Date: Mon, 27 Jun 2011 20:15:04 +0200
Subject: [PATCH] [MIPS32] Fix soft breakpoint unsetting endianess

In order to verify that curent instruction is indeed BP,
we compare it's read value to MIPS32_SDBBP. For this comparison
to work, we have to use read function that correctly handles endianess
differences between the host and the target (i.e. use target_read_u32()
instead of target_read_memory()).
---
 src/target/mips_m4k.c |    6 ++----
 1 files changed, 2 insertions(+), 4 deletions(-)

diff --git a/src/target/mips_m4k.c b/src/target/mips_m4k.c
index 03c9969..840eb3b 100644
--- a/src/target/mips_m4k.c
+++ b/src/target/mips_m4k.c
@@ -611,8 +611,7 @@ static int mips_m4k_unset_breakpoint(struct target *target,
 			uint32_t current_instr;
 
 			/* check that user program has not modified breakpoint instruction */
-			if ((retval = target_read_memory(target, breakpoint->address, 4, 1,
-					(uint8_t*)&current_instr)) != ERROR_OK)
+			if ((retval = target_read_u32(target, breakpoint->address, &current_instr)) != ERROR_OK)
 			{
 				return retval;
 			}
@@ -630,8 +629,7 @@ static int mips_m4k_unset_breakpoint(struct target *target,
 			uint16_t current_instr;
 
 			/* check that user program has not modified breakpoint instruction */
-			if ((retval = target_read_memory(target, breakpoint->address, 2, 1,
-					(uint8_t*)&current_instr)) != ERROR_OK)
+			if ((retval = target_read_u16(target, breakpoint->address, &current_instr)) != ERROR_OK)
 			{
 				return retval;
 			}
-- 
1.5.6.5

_______________________________________________
Openocd-development mailing list
Openocd-development@lists.berlios.de
https://lists.berlios.de/mailman/listinfo/openocd-development

Reply via email to