aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhilipp Wagner <mail@philipp-wagner.com>2019-05-20 21:35:58 +0100
committerTim Newsome <tim@sifive.com>2019-05-20 13:35:58 -0700
commit45b5178b1a0e8d66fa436c4cce48e1959e9b7326 (patch)
treeb7b64af80a0c9b1dd7c4ba7d4771fedd796e5f34
parentda12994d9d014a9e0060616e560d1ebd7c7f4472 (diff)
downloadriscv-openocd-45b5178b1a0e8d66fa436c4cce48e1959e9b7326.zip
riscv-openocd-45b5178b1a0e8d66fa436c4cce48e1959e9b7326.tar.gz
riscv-openocd-45b5178b1a0e8d66fa436c4cce48e1959e9b7326.tar.bz2
RISC-V compliance test: target must be examined (#367)
The test assumes that the target has been examined. If that fails (for whatever reason) the test will segfault: Program received signal SIGSEGV, Segmentation fault. register_cache_invalidate (cache=0x0) at ../src/target/register.c:109 109 struct reg *reg = cache->reg_list; (gdb) bt 0 register_cache_invalidate (cache=0x0) at ../src/target/register.c:109 1 0x0000000000520735 in riscv_invalidate_register_cache (target=target@entry=0x779b50) at ../src/target/riscv/riscv.c:2160 2 0x000000000052224f in riscv_halt_all_harts (target=target@entry=0x779b50) at ../src/target/riscv/riscv.c:2022 3 0x0000000000574e82 in riscv013_test_compliance (target=0x779b50) at ../src/target/riscv/riscv-013.c:3600
-rw-r--r--src/target/riscv/riscv-013.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/target/riscv/riscv-013.c b/src/target/riscv/riscv-013.c
index 41af815..a3381b6 100644
--- a/src/target/riscv/riscv-013.c
+++ b/src/target/riscv/riscv-013.c
@@ -3723,6 +3723,12 @@ int riscv013_test_compliance(struct target *target)
return ERROR_FAIL;
}
+ if (!target_was_examined(target)) {
+ LOG_ERROR("Cannot run compliance test, because target has not yet "
+ "been examined, or the examination failed.\n");
+ return ERROR_FAIL;
+ }
+
int total_tests = 0;
int passed_tests = 0;