You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by GitBox <gi...@apache.org> on 2022/08/30 04:26:12 UTC

[GitHub] [incubator-nuttx] no1wudi commented on a diff in pull request #6957: riscv: Dump trap val in exception handler

no1wudi commented on code in PR #6957:
URL: https://github.com/apache/incubator-nuttx/pull/6957#discussion_r957992392


##########
arch/risc-v/src/common/riscv_exception.c:
##########
@@ -73,15 +73,15 @@ int riscv_exception(int mcause, void *regs, void *args)
 {
   uintptr_t cause = mcause & RISCV_IRQ_MASK;
 
-  if (mcause > RISCV_MAX_EXCEPTION)
-    {
-      _alert("EXCEPTION: Unknown.  MCAUSE: %" PRIxREG "\n", cause);
-    }
-  else
-    {
-      _alert("EXCEPTION: %s. MCAUSE: %" PRIxREG "\n",
-             g_reasons_str[cause], cause);
-    }
+  _alert("EXCEPTION: %s. MCAUSE: %" PRIxREG ", MTVAL: %" PRIxREG "\n",
+         mcause > RISCV_MAX_EXCEPTION ? "Unknown" : g_reasons_str[cause],
+         cause,
+#ifdef CONFIG_ARCH_USE_S_MODE
+         READ_CSR(CSR_STVAL)

Review Comment:
   OK



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org