aboutsummaryrefslogtreecommitdiff
path: root/src/rtos
diff options
context:
space:
mode:
authorJan Matyas <matyas@codasip.com>2021-06-03 16:55:50 +0200
committerAntonio Borneo <borneo.antonio@gmail.com>2021-08-14 13:29:06 +0100
commit41efc6c419cf5c63a1f555dc5b7634a2e18d9c04 (patch)
tree727f52806703630cd690901768f830ae7958b690 /src/rtos
parent69eabf9d61d98e63d68257525e4dca86b17541d9 (diff)
downloadriscv-openocd-41efc6c419cf5c63a1f555dc5b7634a2e18d9c04.zip
riscv-openocd-41efc6c419cf5c63a1f555dc5b7634a2e18d9c04.tar.gz
riscv-openocd-41efc6c419cf5c63a1f555dc5b7634a2e18d9c04.tar.bz2
rtos: add debug prints for qSymbol lookup
- Added two debug prints that allow to inspect the symbol lookup process (carried out via the qSymbol packets). - Added a check for an edge situation when the debugger would send us different symbol than what we asked for (avoids NULL dereference). Change-Id: I84ae1b2b66473eab76a7966c678d2777b6ef48d6 Signed-off-by: Jan Matyas <matyas@codasip.com> Reviewed-on: http://openocd.zylin.com/6287 Tested-by: jenkins Reviewed-by: Tim Newsome <tim@sifive.com> Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Diffstat (limited to 'src/rtos')
-rw-r--r--src/rtos/rtos.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/rtos/rtos.c b/src/rtos/rtos.c
index c9c4efd..0e747e3 100644
--- a/src/rtos/rtos.c
+++ b/src/rtos/rtos.c
@@ -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 == NULL) {
+ 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),