Skip to content

Commit

Permalink
Merge pull request #924 from riscv/unavailable_step
Browse files Browse the repository at this point in the history
server/gdb_server: Step unavailable targets.
  • Loading branch information
timsifive authored Oct 5, 2023
2 parents 599e0a2 + 944fe66 commit 28f630d
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions src/server/gdb_server.c
Original file line number Diff line number Diff line change
Expand Up @@ -3176,9 +3176,15 @@ static bool gdb_handle_vcont_packet(struct connection *connection, const char *p
return true;
}

retval = target_step(ct, current_pc, 0, 0);
if (retval == ERROR_TARGET_NOT_HALTED)
LOG_INFO("target %s was not halted when step was requested", target_name(ct));
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, 0);
if (retval == ERROR_TARGET_NOT_HALTED)
LOG_INFO("target %s was not halted when step was requested", target_name(ct));
}

/* if step was successful send a reply back to gdb */
if (retval == ERROR_OK) {
Expand Down

0 comments on commit 28f630d

Please sign in to comment.