This is an automated email from Gerrit.

Matthias Blaicher (matth...@blaicher.com) just uploaded a new patch set to 
Gerrit, which you can find at http://openocd.zylin.com/891

-- gerrit

commit 4ec5cabd74cb9452b6f34037990cce9af7d479b0
Author: Matthias Blaicher <matth...@blaicher.com>
Date:   Wed Oct 3 17:35:35 2012 +0200

    Fix: Automatic RTOS fails if no RTOS matches the current target
    
    If all defined RTOS fail to detect an RTOS, OpenOCD still uses the last 
RTOS in the list. The appended pach fixes the problem for me.
    
    Change-Id: I1501cb6ff7d9ffee1b5d6c247869c968b8d35f74
    Signed-off-by: Matthias Blaicher <matth...@blaicher.com>

diff --git a/src/rtos/rtos.c b/src/rtos/rtos.c
index 524e1da..a1f5415 100644
--- a/src/rtos/rtos.c
+++ b/src/rtos/rtos.c
@@ -287,13 +287,24 @@ int rtos_thread_packet(struct connection *connection, 
char *packet, int packet_s
                gdb_put_packet(connection, "", 0);
                return ERROR_OK;
        } else if (strstr(packet, "qSymbol")) {
-               if (rtos_qsymbol(connection, packet, packet_size) == 1) {
+               if ((rtos_qsymbol(connection, packet, packet_size) == 1) && 
(target->rtos->type != NULL)) {
+                       /* All symbols are resolved and rtos detection 
succeeded. */
                        target->rtos_auto_detect = false;
                        target->rtos->type->create(target);
                        target->rtos->type->update_threads(target->rtos);
                        /* No more symbols needed */
                        gdb_put_packet(connection, "OK", 2);
                }
+
+               if (target->rtos->type == NULL) {
+                       /* Automatically detection of the rtos was not 
successful. */
+                       free((void *)(target->rtos));
+                       target->rtos = NULL;
+
+                       /* No more symbols needed */
+                       gdb_put_packet(connection, "OK", 2);
+               }
+
                return ERROR_OK;
        } else if (strstr(packet, "qfThreadInfo")) {
                int i;
@@ -455,13 +466,13 @@ int rtos_try_next(struct target *target)
        for (x = 0; rtos_types[x]; x++) {
                if (target->rtos->type == rtos_types[x]) {
                        /* found */
+                       target->rtos->type = rtos_types[x+1];
                        if (rtos_types[x+1] != NULL) {
-                               target->rtos->type = rtos_types[x+1];
                                if (target->rtos->symbols != NULL)
                                        free(target->rtos->symbols);
                                return 1;
                        } else {
-                               /* No more rtos types */
+                               /* No more rtos types, target->rtos->type is 
NULL again*/
                                return 0;
                        }
 

-- 

------------------------------------------------------------------------------
Don't let slow site performance ruin your business. Deploy New Relic APM
Deploy New Relic app performance management and know exactly
what is happening inside your Ruby, Python, PHP, Java, and .NET app
Try New Relic at no cost today and get our sweet Data Nerd shirt too!
http://p.sf.net/sfu/newrelic-dev2dev
_______________________________________________
OpenOCD-devel mailing list
OpenOCD-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openocd-devel

Reply via email to