This is an automated email from Gerrit.

"Tomas Vanek <van...@fbl.cz>" just uploaded a new patch set to Gerrit, which 
you can find at https://review.openocd.org/c/openocd/+/8913

-- gerrit

commit e2ecdacef65747e3e34212078a5c2dbe5ba6ee03
Author: Tim Newsome <t...@sifive.com>
Date:   Thu Sep 14 12:10:45 2023 -0700

    server/gdb_server: Step unavailable targets.
    
    When gdb requests to step an unavailable target, report success. When
    the target becomes available, the step can complete.
    
    Imported from
    https://github.com/riscv-collab/riscv-openocd/pull/924
    
    Change-Id: I969ab56139f72a757552928d59edf6eabd598fa4
    Signed-off-by: Tim Newsome <t...@sifive.com>

diff --git a/src/server/gdb_server.c b/src/server/gdb_server.c
index 7b41f487b2..312c592234 100644
--- a/src/server/gdb_server.c
+++ b/src/server/gdb_server.c
@@ -3152,9 +3152,15 @@ static bool gdb_handle_vcont_packet(struct connection 
*connection, const char *p
                        return true;
                }
 
-               retval = target_step(ct, current_pc, 0, false);
-               if (retval == ERROR_TARGET_NOT_HALTED)
-                       LOG_TARGET_INFO(ct, "target was not halted when step 
was requested");
+               if (ct->state == TARGET_UNAVAILABLE) {
+                       LOG_TARGET_ERROR(ct, "Target is unavailable, so cannot 
be stepped. "
+                               "Pretending to gdb that it is running until 
it's available again.");
+                       retval = ERROR_FAIL;
+               } else {
+                       retval = target_step(ct, current_pc, 0, false);
+                       if (retval == ERROR_TARGET_NOT_HALTED)
+                               LOG_TARGET_INFO(ct, "target was not halted when 
step was requested");
+               }
 
                /* if step was successful send a reply back to gdb */
                if (retval == ERROR_OK) {

-- 

Reply via email to