This is an automated email from Gerrit.

"Tim Nordell <tnord...@airgain.com>" just uploaded a new patch set to Gerrit, 
which you can find at https://review.openocd.org/c/openocd/+/7178

-- gerrit

commit 782c0abf3d915b1a4dfc6c6a39e467bf2c814cf1
Author: Tim Nordell <tnord...@airgain.com>
Date:   Wed Sep 7 11:52:09 2022 -0500

    rtos: Fold is_symbol_mandatory into rtos_qsymbol(..)
    
    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 <tnord...@airgain.com>
    Change-Id: If803332373825b73bc986bd4ea7dfaee9c625c0a

diff --git a/src/rtos/rtos.c b/src/rtos/rtos.c
index f4f288607e..3aa6ab4664 100644
--- a/src/rtos/rtos.c
+++ b/src/rtos/rtos.c
@@ -200,14 +200,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
@@ -247,22 +239,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';
+                       }
                }
        }
 

-- 

Reply via email to