On Mon, 25 May 2009, David Brownell wrote:

> On Monday 25 May 2009, Nicolas Pitre wrote:
> > On Sat, 23 May 2009, David Brownell wrote:
> > 
> > > I see messages about needing to increase some GDB timeout/interval.  But
> > > that's foolishness, since I'm not even working with GDB when they start
> > > spamming me.
> > 
> > This is indeed really irritating.
> > 
> > What about those messages being displayed only when a gdb connection is 
> > actually in use?
> 
> That'd be a start; it'd address the symptom, which is
> better than nothing.

Here it is.  I'd call it a stop gap for 0.2.0 until a proper post-0.2.0 
solution is developed.
diff --git a/src/helper/log.c b/src/helper/log.c
index 4ba0dd6..549d712 100644
--- a/src/helper/log.c
+++ b/src/helper/log.c
@@ -385,7 +385,19 @@ void keep_alive()
        current_time=timeval_ms();
        if (current_time-last_time>1000)
        {
-               LOG_WARNING("keep_alive() was not invoked in the 1000ms 
timelimit. GDB alive packet not sent! (%lld). Workaround: increase \"set 
remotetimeout\" in GDB", current_time-last_time);
+               extern int gdb_actual_connections;
+
+               if (gdb_actual_connections)
+                       LOG_WARNING("keep_alive() was not invoked in the "
+                               "1000ms timelimit. GDB alive packet not "
+                               "sent! (%lld). Workaround: increase "
+                               "\"set remotetimeout\" in GDB",
+                               current_time-last_time);
+               else
+                       LOG_DEBUG("keep_alive() was not invoked in the "
+                               "1000ms timelimit (%lld). This may cause "
+                               "trouble with GDB connections.",
+                               current_time-last_time);
        }
        if (current_time-last_time>500)
        {
diff --git a/src/server/gdb_server.c b/src/server/gdb_server.c
index f4e9c32..c012738 100644
--- a/src/server/gdb_server.c
+++ b/src/server/gdb_server.c
@@ -61,6 +61,10 @@ enum gdb_detach_mode
 /* target behaviour on gdb detach */
 enum gdb_detach_mode detach_mode = GDB_DETACH_RESUME;
 
+/* number of gdb connections, mainly to supress gdb related debugging spam
+ * in helper/log.c when no gdb connections are actually active */
+int gdb_actual_connections;
+
 /* set if we are sending a memory map to gdb
  * via qXfer:memory-map:read packet */
 /* enabled by default*/
@@ -797,6 +801,9 @@ int gdb_new_connection(connection_t *connection)
        if (initial_ack != '+')
                gdb_putback_char(connection, initial_ack);
        target_call_event_callbacks(gdb_service->target, 
TARGET_EVENT_GDB_ATTACH );
+
+       gdb_actual_connections++;
+
        return ERROR_OK;
 }
 
@@ -805,6 +812,8 @@ int gdb_connection_closed(connection_t *connection)
        gdb_service_t *gdb_service = connection->service->priv;
        gdb_connection_t *gdb_connection = connection->priv;
 
+       gdb_actual_connections--;
+
        /* see if an image built with vFlash commands is left */
        if (gdb_connection->vflash_image)
        {
_______________________________________________
Openocd-development mailing list
[email protected]
https://lists.berlios.de/mailman/listinfo/openocd-development

Reply via email to