Rather than issuing a halt and then stepi/resume, just wait for target to halt.
Issue a sterner warning via gdb console that any gdb register changes will be ignored in this case. Signed-off-by: Øyvind Harboe <oyvind.har...@zylin.com> --- src/server/gdb_server.c | 12 ++++++++---- 1 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/server/gdb_server.c b/src/server/gdb_server.c index 6ed7243..92bb352 100644 --- a/src/server/gdb_server.c +++ b/src/server/gdb_server.c @@ -2197,12 +2197,13 @@ static int gdb_input_inner(struct connection *connection) log_add_callback(gdb_log_callback, connection); bool nostep = false; + bool already_running = false; if (target->state == TARGET_RUNNING) { - LOG_WARNING("The target is already running. Halt target before stepi/continue."); - retval = target_halt(target); - if (retval == ERROR_OK) - retval = target_wait_state(target, TARGET_HALTED, 100); + LOG_WARNING("WARNING! The target is already running. " + "All changes GDB did to registers will be discarded! " + "Waiting for target to halt."); + already_running = true; } else if (target->state != TARGET_HALTED) { LOG_WARNING("The target is not in the halted nor running stated, stepi/continue ignored."); @@ -2231,6 +2232,9 @@ static int gdb_input_inner(struct connection *connection) /* stop forwarding log packets! */ log_remove_callback(gdb_log_callback, connection); + } else if (already_running) + { + /* we are already running, we'll wait for the target to halt */ } else { /* We're running/stepping, in which case we can -- 1.6.3.3 _______________________________________________ Openocd-development mailing list Openocd-development@lists.berlios.de https://lists.berlios.de/mailman/listinfo/openocd-development