aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim Newsome <tim@sifive.com>2019-01-07 12:17:41 -0800
committerTim Newsome <tim@sifive.com>2019-01-07 12:17:41 -0800
commitfd49f5e96778239d5c9ed172239a6857aa60cbea (patch)
tree0098d583d87e160e6f3cd2720aa4bcbb430dd732
parent6faa9ded26d49bf7d989dfa190a2231b2159c301 (diff)
downloadriscv-openocd-fd49f5e96778239d5c9ed172239a6857aa60cbea.zip
riscv-openocd-fd49f5e96778239d5c9ed172239a6857aa60cbea.tar.gz
riscv-openocd-fd49f5e96778239d5c9ed172239a6857aa60cbea.tar.bz2
Make riscv_get_gdb_reg_list read the registers.
This may not be the correct behavior, but it gets me further through the tests. Change-Id: I6e9b77e927700de706b6ece723f4d530fa566761
-rw-r--r--src/target/riscv/riscv.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/target/riscv/riscv.c b/src/target/riscv/riscv.c
index 0ec2049..d786d56 100644
--- a/src/target/riscv/riscv.c
+++ b/src/target/riscv/riscv.c
@@ -945,10 +945,23 @@ static int riscv_get_gdb_reg_list(struct target *target,
if (!*reg_list)
return ERROR_FAIL;
+ bool read = true;
for (int i = 0; i < *reg_list_size; i++) {
assert(!target->reg_cache->reg_list[i].valid ||
target->reg_cache->reg_list[i].size > 0);
(*reg_list)[i] = &target->reg_cache->reg_list[i];
+ if (read && !target->reg_cache->reg_list[i].valid) {
+ // TODO: Confirm that this function is supposed to actually read
+ // registers. I'm just adding this because maybe
+ // hwthread_get_thread_reg_list() expects it.
+
+ // This function gets called from
+ // gdb_target_description_supported(), and we end up failing in
+ // that case. Allow failures for now.
+ if (target->reg_cache->reg_list[i].type->get(
+ &target->reg_cache->reg_list[i]) != ERROR_OK)
+ read = false;
+ }
}
return ERROR_OK;