From f1e8dee522043b8c8ae0255ade9f5ccdc89eb474 Mon Sep 17 00:00:00 2001 From: Palmer Dabbelt Date: Wed, 30 May 2018 05:54:56 -0700 Subject: [PATCH] Try saving the halted state when examining a target --- src/target/riscv/riscv.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/target/riscv/riscv.c b/src/target/riscv/riscv.c index 74f1c7eca..a6ebd51b0 100644 --- a/src/target/riscv/riscv.c +++ b/src/target/riscv/riscv.c @@ -692,7 +692,11 @@ static int riscv_examine(struct target *target) if (result != ERROR_OK) return result; - return tt->examine(target); + int result = tt->examine(target); + if (result != ERROR_OK) + return result; + + target->state = riscv_is_halted(target) ? TARGET_HALTED : TARGET_RUNNING; } static int oldriscv_poll(struct target *target)