aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAntonio Borneo <borneo.antonio@gmail.com>2020-12-19 22:31:29 +0100
committerAntonio Borneo <borneo.antonio@gmail.com>2020-12-26 15:48:17 +0000
commitc69b4deae36a7bcbab5df80ec2a5dbfd652e25ac (patch)
tree58fd963057eb5cfdb729c29795272da35d1fa52d /src
parent7f74906c2d18a2347ec392f9a457963bff3f25b8 (diff)
downloadriscv-openocd-c69b4deae36a7bcbab5df80ec2a5dbfd652e25ac.zip
riscv-openocd-c69b4deae36a7bcbab5df80ec2a5dbfd652e25ac.tar.gz
riscv-openocd-c69b4deae36a7bcbab5df80ec2a5dbfd652e25ac.tar.bz2
gdb_server: fix HW thread status at gdb attach
At gdb attach, the event TARGET_EVENT_GDB_ATTACH is in charge of halting the target. For HW thread, rtos_update_threads() should be called after the event to detect and record the new 'halted' status. Instead it is called immediately before the event, thus reading the status before the halt. Move after the event the call to rtos_update_threads(). Change-Id: Iab3480ea0f5283ed6580f0f6c11200083197d1e9 Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: http://openocd.zylin.com/5983 Tested-by: jenkins
Diffstat (limited to 'src')
-rw-r--r--src/server/gdb_server.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/src/server/gdb_server.c b/src/server/gdb_server.c
index c1e90a0..9e44287 100644
--- a/src/server/gdb_server.c
+++ b/src/server/gdb_server.c
@@ -969,15 +969,6 @@ static int gdb_new_connection(struct connection *connection)
breakpoint_clear_target(target);
watchpoint_clear_target(target);
- if (target->rtos) {
- /* clean previous rtos session if supported*/
- if (target->rtos->type->clean)
- target->rtos->type->clean(target);
-
- /* update threads */
- rtos_update_threads(target);
- }
-
/* remove the initial ACK from the incoming buffer */
retval = gdb_get_char(connection, &initial_ack);
if (retval != ERROR_OK)
@@ -990,6 +981,15 @@ static int gdb_new_connection(struct connection *connection)
gdb_putback_char(connection, initial_ack);
target_call_event_callbacks(target, TARGET_EVENT_GDB_ATTACH);
+ if (target->rtos) {
+ /* clean previous rtos session if supported*/
+ if (target->rtos->type->clean)
+ target->rtos->type->clean(target);
+
+ /* update threads */
+ rtos_update_threads(target);
+ }
+
if (gdb_use_memory_map) {
/* Connect must fail if the memory map can't be set up correctly.
*