rtos : current_threadid move to rtos context
authorMichel JAOUEN <michel.jaouen@stericsson.com>
Tue, 3 Jan 2012 15:07:55 +0000 (16:07 +0100)
committerØyvind Harboe <oyvindharboe@gmail.com>
Sun, 15 Jan 2012 22:09:27 +0000 (22:09 +0000)
Change-Id: I49d9d6d64c418be601d8723cb3eea9c3716ecb6b
Signed-off-by: Michel JAOUEN <michel.jaouen@stericsson.com>
Reviewed-on: http://openocd.zylin.com/343
Tested-by: jenkins
Reviewed-by: Evan Hunter <evan@ozhiker.com>
Reviewed-by: Øyvind Harboe <oyvindharboe@gmail.com>
src/rtos/rtos.c
src/rtos/rtos.h

index f7d948660ca768d57c1b0af45057fe1d934c9c15..78a7e9d2ff6f5e0345e8a53ab9b634f1f8f5a782 100644 (file)
@@ -29,7 +29,6 @@
 #include "server/gdb_server.h"
 
 
-static int64_t current_threadid = -1;
 
 static void hex_to_str( char* dst, char * hex_src );
 static int str_to_hex( char* hex_dst, char* src );
@@ -55,7 +54,6 @@ int rtos_create(Jim_GetOptInfo *goi, struct target * target)
 {
        int x;
        char *cp;
-
        if (! goi->isconfigure) {
                if (goi->argc != 0) {
                        if (goi->argc != 0) {
@@ -115,6 +113,7 @@ int rtos_create(Jim_GetOptInfo *goi, struct target * target)
        /* Create it */
        target->rtos = calloc(1,sizeof(struct rtos));
        target->rtos->type = rtos_types[x];
+       target->rtos->current_threadid = -1;
        target->rtos->current_thread = 0;
        target->rtos->symbols = NULL;
        target->rtos->target = target;
@@ -426,7 +425,7 @@ int rtos_thread_packet(struct connection *connection, char *packet, int packet_s
        else if ( packet[0] == 'H') // Set current thread ( 'c' for step and continue, 'g' for all other operations )
        {
                if ((packet[1] == 'g') && (target->rtos != NULL))
-                       sscanf(packet, "Hg%16" SCNx64, &current_threadid);
+                       sscanf(packet, "Hg%16" SCNx64, &target->rtos->current_threadid);
                gdb_put_packet(connection, "OK", 2);
                return ERROR_OK;
        }
@@ -437,7 +436,7 @@ int rtos_thread_packet(struct connection *connection, char *packet, int packet_s
 int rtos_get_gdb_reg_list(struct connection *connection)
 {
        struct target *target = get_target_from_connection(connection);
-
+       int64_t current_threadid = target->rtos->current_threadid;
        if ( ( target->rtos != NULL ) &&
                 ( current_threadid != -1 ) &&
                 ( current_threadid != 0 ) &&
index 93a980e239e46d2c25254cb9b54739e7d23effe8..df0812fc6c1d67332a0271ce1a5187ef16b4bb99 100644 (file)
@@ -57,7 +57,8 @@ struct rtos
 
        symbol_table_elem_t * symbols;
        struct target *target;
-
+       /*  add a context variable instead of global variable */
+       int64_t current_threadid;
        threadid_t current_thread;
        struct thread_detail* thread_details;
        int thread_count;

Linking to existing account procedure

If you already have an account and want to add another login method you MUST first sign in with your existing account and then change URL to read https://review.openocd.org/login/?link to get to this page again but this time it'll work for linking. Thank you.

SSH host keys fingerprints

1024 SHA256:YKx8b7u5ZWdcbp7/4AeXNaqElP49m6QrwfXaqQGJAOk gerrit-code-review@openocd.zylin.com (DSA)
384 SHA256:jHIbSQa4REvwCFG4cq5LBlBLxmxSqelQPem/EXIrxjk gerrit-code-review@openocd.org (ECDSA)
521 SHA256:UAOPYkU9Fjtcao0Ul/Rrlnj/OsQvt+pgdYSZ4jOYdgs gerrit-code-review@openocd.org (ECDSA)
256 SHA256:A13M5QlnozFOvTllybRZH6vm7iSt0XLxbA48yfc2yfY gerrit-code-review@openocd.org (ECDSA)
256 SHA256:spYMBqEYoAOtK7yZBrcwE8ZpYt6b68Cfh9yEVetvbXg gerrit-code-review@openocd.org (ED25519)
+--[ED25519 256]--+
|=..              |
|+o..   .         |
|*.o   . .        |
|+B . . .         |
|Bo. = o S        |
|Oo.+ + =         |
|oB=.* = . o      |
| =+=.+   + E     |
|. .=o   . o      |
+----[SHA256]-----+
2048 SHA256:0Onrb7/PHjpo6iVZ7xQX2riKN83FJ3KGU0TvI0TaFG4 gerrit-code-review@openocd.zylin.com (RSA)