aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorTim Newsome <tim@sifive.com>2023-05-16 10:21:57 -0700
committerTim Newsome <tim@sifive.com>2023-05-26 13:00:13 -0700
commit21433e83eeda7abe621027f12d588ebdea7760d3 (patch)
tree8187cbd9361f78e4378d7b6dad3547cc6ed72f95 /src
parent82ed02f92aeb073232d04d9c3be3bb57ed7cebce (diff)
downloadriscv-openocd-21433e83eeda7abe621027f12d588ebdea7760d3.zip
riscv-openocd-21433e83eeda7abe621027f12d588ebdea7760d3.tar.gz
riscv-openocd-21433e83eeda7abe621027f12d588ebdea7760d3.tar.bz2
target: poll() failure does not mean the target halted.
Poll failure just means poll failed. It's safer to assume the target is still running, because then if it is running and subsequently halts we can relay this to gdb correctly. We can't do the other way around, because once gdb thinks the target has halted, it can't deal with it spontaneously running. Change-Id: Idb56137f1d6baa9afc1b0e55e4a48f407b8ebe83 Signed-off-by: Tim Newsome <tim@sifive.com>
Diffstat (limited to 'src')
-rw-r--r--src/target/riscv/riscv-013.c12
-rw-r--r--src/target/target.c12
2 files changed, 13 insertions, 11 deletions
diff --git a/src/target/riscv/riscv-013.c b/src/target/riscv/riscv-013.c
index facab13..eded3b1 100644
--- a/src/target/riscv/riscv-013.c
+++ b/src/target/riscv/riscv-013.c
@@ -589,17 +589,15 @@ static int dmi_op_timeout(struct target *target, uint32_t *data_in,
} else if (status == DMI_STATUS_SUCCESS) {
break;
} else {
- LOG_ERROR("failed %s at 0x%x, status=%d", op_name, address, status);
dtmcontrol_scan(target, DTM_DTMCS_DMIRESET);
- return ERROR_FAIL;
+ break;
}
if (time(NULL) - start > timeout_sec)
return ERROR_TIMEOUT_REACHED;
}
if (status != DMI_STATUS_SUCCESS) {
- LOG_ERROR("Failed %s at 0x%x; status=%d", op_name, address, status);
- dtmcontrol_scan(target, DTM_DTMCS_DMIRESET);
+ LOG_TARGET_ERROR(target, "Failed DMI %s at 0x%x; status=%d", op_name, address, status);
return ERROR_FAIL;
}
@@ -618,10 +616,12 @@ static int dmi_op_timeout(struct target *target, uint32_t *data_in,
break;
} else {
if (data_in) {
- LOG_ERROR("Failed %s (NOP) at 0x%x; value=0x%x, status=%d",
+ LOG_TARGET_ERROR(target,
+ "Failed DMI %s (NOP) at 0x%x; value=0x%x, status=%d",
op_name, address, *data_in, status);
} else {
- LOG_ERROR("Failed %s (NOP) at 0x%x; status=%d", op_name, address,
+ LOG_TARGET_ERROR(target,
+ "Failed DMI %s (NOP) at 0x%x; status=%d", op_name, address,
status);
}
dtmcontrol_scan(target, DTM_DTMCS_DMIRESET);
diff --git a/src/target/target.c b/src/target/target.c
index 62ef4d2..581f5ef 100644
--- a/src/target/target.c
+++ b/src/target/target.c
@@ -3055,9 +3055,12 @@ static int handle_target(void *priv)
/* Increase interval between polling up to 5000ms */
target->backoff.interval = MAX(polling_interval,
MIN(target->backoff.interval * 2 + 1, 5000));
- /* Tell GDB to halt the debugger. This allows the user to run
- * monitor commands to handle the situation. */
- target_call_event_callbacks(target, TARGET_EVENT_GDB_HALT);
+ /* Do *not* tell gdb the target halted. This might just
+ * be a hiccup. We have no reason to believe the target
+ * is halted, and if it is running while gdb thinks it's
+ * halted things just get unnecessarily confused. gdb
+ * users can hit ^C if the need to interact with the
+ * target. */
}
target->backoff.next_attempt = timeval_ms() + target->backoff.interval;
LOG_TARGET_DEBUG(target, "target_poll() -> %d, next attempt in %dms",
@@ -3067,8 +3070,7 @@ static int handle_target(void *priv)
target_reset_examined(target);
retval = target_examine_one(target);
if (retval != ERROR_OK) {
- LOG_TARGET_DEBUG(target, "Examination failed, GDB will be halted. "
- "Polling again in %dms",
+ LOG_TARGET_DEBUG(target, "Examination failed. Polling again in %dms",
target->backoff.interval);
return retval;
}