From 4882de94cc62e65bd687f0fe03df2e95259b51e4 Mon Sep 17 00:00:00 2001 From: Tim Newsome Date: Mon, 10 Oct 2016 08:22:51 -0700 Subject: [PATCH] Display pc to the user in 'monitor reset init'. Change-Id: Ifb8df31954dfc5a3badef4f0a29eb510a97310a2 --- src/target/riscv/riscv.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/src/target/riscv/riscv.c b/src/target/riscv/riscv.c index 0d78c7a13..7bfe93f4e 100644 --- a/src/target/riscv/riscv.c +++ b/src/target/riscv/riscv.c @@ -1975,7 +1975,6 @@ static int handle_halt(struct target *target, bool announce) } int cause = get_field(info->dcsr, DCSR_CAUSE); - LOG_DEBUG("halt cause is %d; dcsr=0x%" PRIx64, cause, info->dcsr); switch (cause) { case DCSR_CAUSE_SWBP: target->debug_reason = DBG_REASON_BREAKPOINT; @@ -2028,7 +2027,19 @@ static int handle_halt(struct target *target, bool announce) target_call_event_callbacks(target, TARGET_EVENT_HALTED); } - LOG_DEBUG("halted at 0x%" PRIx64, info->dpc); + const char *cause_string[] = { + "none", + "software breakpoint", + "hardware trigger", + "debug interrupt", + "step", + "halt" + }; + // This is logged to the user so that gdb will show it when a user types + // 'monitor reset init'. At that time gdb appears to have the pc cached + // still so if a user manually inspects the pc it will still have the old + // value. + LOG_USER("halted at 0x%" PRIx64 " due to %s", info->dpc, cause_string[cause]); return ERROR_OK; }