rtos: Fold is_symbol_mandatory into rtos_qsymbol(..) 78/7178/3
authorTim Nordell <tnordell@airgain.com>
Wed, 7 Sep 2022 16:52:09 +0000 (11:52 -0500)
committerAntonio Borneo <borneo.antonio@gmail.com>
Sat, 17 Sep 2022 20:58:37 +0000 (20:58 +0000)
This is in preparation for a future commit that looks for an optional
suffix of .lto_priv.0 on the symbol name.

Signed-off-by: Tim Nordell <tnordell@airgain.com>
Change-Id: If803332373825b73bc986bd4ea7dfaee9c625c0a
Reviewed-on: https://review.openocd.org/c/openocd/+/7178
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
src/rtos/rtos.c

index 3c3896de307e06d44ba9b9f5a21ce9aa63f413f5..ccf15c7c783a094fdfc15df7cb5070cc79c7f2ca 100644 (file)
@@ -198,14 +198,6 @@ static struct symbol_table_elem *next_symbol(struct rtos *os, char *cur_symbol,
        return s;
 }
 
-/* searches for 'symbol' in the lookup table for 'os' and returns TRUE,
- * if 'symbol' is not declared optional */
-static bool is_symbol_mandatory(const struct rtos *os, const char *symbol)
-{
-       struct symbol_table_elem *s = find_symbol(os, symbol);
-       return s && !s->optional;
-}
-
 /* rtos_qsymbol() processes and replies to all qSymbol packets from GDB.
  *
  * GDB sends a qSymbol:: packet (empty address, empty name) to notify
@@ -245,22 +237,25 @@ int rtos_qsymbol(struct connection *connection, char const *packet, int packet_s
        cur_sym[len] = 0;
 
        if ((strcmp(packet, "qSymbol::") != 0) &&               /* GDB is not offering symbol lookup for the first time */
-           (!sscanf(packet, "qSymbol:%" SCNx64 ":", &addr)) && /* GDB did not find an address for a symbol */
-           is_symbol_mandatory(os, cur_sym)) {                                 /* the symbol is mandatory for this RTOS */
+           (!sscanf(packet, "qSymbol:%" SCNx64 ":", &addr))) { /* GDB did not find an address for a symbol */
 
                /* GDB could not find an address for the previous symbol */
-               if (!target->rtos_auto_detect) {
-                       LOG_WARNING("RTOS %s not detected. (GDB could not find symbol \'%s\')", os->type->name, cur_sym);
-                       goto done;
-               } else {
-                       /* Autodetecting RTOS - try next RTOS */
-                       if (!rtos_try_next(target)) {
-                               LOG_WARNING("No RTOS could be auto-detected!");
+               struct symbol_table_elem *sym = find_symbol(os, cur_sym);
+
+               if (sym && !sym->optional) {    /* the symbol is mandatory for this RTOS */
+                       if (!target->rtos_auto_detect) {
+                               LOG_WARNING("RTOS %s not detected. (GDB could not find symbol \'%s\')", os->type->name, cur_sym);
                                goto done;
-                       }
+                       } else {
+                               /* Autodetecting RTOS - try next RTOS */
+                               if (!rtos_try_next(target)) {
+                                       LOG_WARNING("No RTOS could be auto-detected!");
+                                       goto done;
+                               }
 
-                       /* Next RTOS selected - invalidate current symbol */
-                       cur_sym[0] = '\x00';
+                               /* Next RTOS selected - invalidate current symbol */
+                               cur_sym[0] = '\x00';
+                       }
                }
        }
 

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)