From fd49f5e96778239d5c9ed172239a6857aa60cbea Mon Sep 17 00:00:00 2001 From: Tim Newsome Date: Mon, 7 Jan 2019 12:17:41 -0800 Subject: 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 --- src/target/riscv/riscv.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) 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; -- cgit v1.1