uint64_t->target_addr_t for stack pointers.
[openocd.git] / src / rtos / rtos.c
index 54e9926f1cc222f3da9e3da98cf278e8cd6fa63a..f401c3d30bdacfe7b07b6c1d5f6324b35ff64c6c 100644 (file)
@@ -152,7 +152,7 @@ int rtos_create(struct jim_getopt_info *goi, struct target *target)
        }
 
        for (x = 0; rtos_types[x]; x++)
-               if (0 == strcmp(cp, rtos_types[x]->name))
+               if (strcmp(cp, rtos_types[x]->name) == 0)
                        return os_alloc_create(target, rtos_types[x]);
 
        Jim_SetResultFormatted(goi->interp, "Unknown RTOS type %s, try one of: ", cp);
@@ -234,7 +234,7 @@ int rtos_qsymbol(struct connection *connection, char const *packet, int packet_s
        uint64_t addr = 0;
        size_t reply_len;
        char reply[GDB_BUFFER_SIZE + 1], cur_sym[GDB_BUFFER_SIZE / 2 + 1] = ""; /* Extra byte for null-termination */
-       struct symbol_table_elem *next_sym = NULL;
+       struct symbol_table_elem *next_sym;
        struct target *target = get_target_from_connection(connection);
        struct rtos *os = target->rtos;
 
@@ -266,8 +266,17 @@ int rtos_qsymbol(struct connection *connection, char const *packet, int packet_s
                        cur_sym[0] = '\x00';
                }
        }
+
+       LOG_DEBUG("RTOS: Address of symbol '%s' is 0x%" PRIx64, cur_sym, addr);
+
        next_sym = next_symbol(os, cur_sym, addr);
 
+       /* Should never happen unless the debugger misbehaves */
+       if (!next_sym) {
+               LOG_WARNING("RTOS: Debugger sent us qSymbol with '%s' that we did not ask for", cur_sym);
+               goto done;
+       }
+
        if (!next_sym->symbol_name) {
                /* No more symbols need looking up */
 
@@ -291,6 +300,8 @@ int rtos_qsymbol(struct connection *connection, char const *packet, int packet_s
                goto done;
        }
 
+       LOG_DEBUG("RTOS: Requesting symbol lookup of '%s' from the debugger", next_sym->symbol_name);
+
        reply_len = snprintf(reply, sizeof(reply), "qSymbol:");
        reply_len += hexify(reply + reply_len,
                (const uint8_t *)next_sym->symbol_name, strlen(next_sym->symbol_name),
@@ -306,13 +317,13 @@ int rtos_thread_packet(struct connection *connection, char const *packet, int pa
        struct target *target = get_target_from_connection(connection);
 
        if (strncmp(packet, "qThreadExtraInfo,", 17) == 0) {
-               if ((target->rtos) && (target->rtos->thread_details != NULL) &&
+               if ((target->rtos) && (target->rtos->thread_details) &&
                                (target->rtos->thread_count != 0)) {
                        threadid_t threadid = 0;
                        int found = -1;
                        sscanf(packet, "qThreadExtraInfo,%" SCNx64, &threadid);
 
-                       if ((target->rtos) && (target->rtos->thread_details != NULL)) {
+                       if ((target->rtos) && (target->rtos->thread_details)) {
                                int thread_num;
                                for (thread_num = 0; thread_num < target->rtos->thread_count; thread_num++) {
                                        if (target->rtos->thread_details[thread_num].threadid == threadid) {
@@ -416,7 +427,7 @@ int rtos_thread_packet(struct connection *connection, char const *packet, int pa
                threadid_t threadid;
                int found = -1;
                sscanf(packet, "T%" SCNx64, &threadid);
-               if ((target->rtos) && (target->rtos->thread_details != NULL)) {
+               if ((target->rtos) && (target->rtos->thread_details)) {
                        int thread_num;
                        for (thread_num = 0; thread_num < target->rtos->thread_count; thread_num++) {
                                if (target->rtos->thread_details[thread_num].threadid == threadid) {
@@ -564,7 +575,7 @@ int rtos_set_reg(struct connection *connection, int reg_num,
        struct target *target = get_target_from_connection(connection);
        int64_t current_threadid = target->rtos->current_threadid;
        if ((target->rtos) &&
-                       (target->rtos->type->set_reg != NULL) &&
+                       (target->rtos->type->set_reg) &&
                        (current_threadid != -1) &&
                        (current_threadid != 0)) {
                return target->rtos->type->set_reg(target->rtos, reg_num, reg_value);
@@ -605,7 +616,7 @@ int rtos_generic_stack_read(struct target *target,
                LOG_OUTPUT("\r\n");
 #endif
 
-       int64_t new_stack_ptr;
+       target_addr_t new_stack_ptr;
        if (stacking->calculate_process_stack) {
                new_stack_ptr = stacking->calculate_process_stack(target,
                                stack_data, stacking, stack_ptr);
@@ -657,7 +668,7 @@ static int rtos_try_next(struct target *target)
 
 int rtos_update_threads(struct target *target)
 {
-       if ((target->rtos) && (target->rtos->type != NULL))
+       if ((target->rtos) && (target->rtos->type))
                target->rtos->type->update_threads(target->rtos);
        return ERROR_OK;
 }

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)