Does the attached patch fix the problem?


-- 
Øyvind Harboe

Can Zylin Consulting help on your project?

US toll free 1-866-980-3434 / International +47 51 63 25 00

http://www.zylin.com/zy1000.html
ARM7 ARM9 ARM11 XScale Cortex
JTAG debugger and flash programmer
From f41192ab7ff1da1d9b6ac7908987de8478a35db4 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=C3=98yvind=20Harboe?= <oyvind.har...@zylin.com>
Date: Sat, 13 Nov 2010 13:03:29 +0100
Subject: [PATCH] gdb: fix occasional crash when flash probe failed
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Signed-off-by: Øyvind Harboe <oyvind.har...@zylin.com>
---
 src/server/gdb_server.c |   10 +++++++---
 1 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/src/server/gdb_server.c b/src/server/gdb_server.c
index 9503a13..77142df 100644
--- a/src/server/gdb_server.c
+++ b/src/server/gdb_server.c
@@ -833,9 +833,6 @@ static int gdb_new_connection(struct connection *connection)
 	breakpoint_clear_target(gdb_service->target);
 	watchpoint_clear_target(gdb_service->target);
 
-	/* register callback to be informed about target events */
-	target_register_event_callback(gdb_target_callback_event_handler, connection);
-
 	/* remove the initial ACK from the incoming buffer */
 	if ((retval = gdb_get_char(connection, &initial_ack)) != ERROR_OK)
 		return retval;
@@ -873,6 +870,13 @@ static int gdb_new_connection(struct connection *connection)
 		  target_name(gdb_service->target),
 		  target_state_name(gdb_service->target));
 
+	/* DANGER! If we fail subsequently, we must remove this handler,
+	 * otherwise we occasionally see crashes as the timer can invoke the
+	 * callback fn.
+	 *
+	 * register callback to be informed about target events */
+	target_register_event_callback(gdb_target_callback_event_handler, connection);
+
 	return ERROR_OK;
 }
 
-- 
1.7.0.4

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

Reply via email to