diff options
author | Tim Nordell <tnordell@airgain.com> | 2022-09-07 11:52:09 -0500 |
---|---|---|
committer | Antonio Borneo <borneo.antonio@gmail.com> | 2022-09-17 20:58:37 +0000 |
commit | 68fe396b79a7732d1b0674bc60542bed3e0838b7 (patch) | |
tree | 2af7cd45ad18381f244bc0fb412e8f7eaf0b3813 /src/rtos | |
parent | 9f5a74c228cbab3d80c47c87fa9735167da7eb77 (diff) | |
download | riscv-openocd-68fe396b79a7732d1b0674bc60542bed3e0838b7.zip riscv-openocd-68fe396b79a7732d1b0674bc60542bed3e0838b7.tar.gz riscv-openocd-68fe396b79a7732d1b0674bc60542bed3e0838b7.tar.bz2 |
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 <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>
Diffstat (limited to 'src/rtos')
-rw-r--r-- | src/rtos/rtos.c | 35 |
1 files changed, 15 insertions, 20 deletions
diff --git a/src/rtos/rtos.c b/src/rtos/rtos.c index 3c3896d..ccf15c7 100644 --- a/src/rtos/rtos.c +++ b/src/rtos/rtos.c @@ -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'; + } } } |