arch: riscv: print symbol name of mepc
if CONFIG_SYMTAB
is enabled
The mepc register is the address of the instruction that was interrupted, it will make debugging easier if we know the name of the symbol, so print it if `CONFIG_SYMTAB` is enabled. Signed-off-by: Yong Cong Sin <ycsin@meta.com>
This commit is contained in:
parent
c1a925de98
commit
eafc4eff04
1 changed files with 8 additions and 0 deletions
|
@ -4,6 +4,7 @@
|
|||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
#include <zephyr/debug/symtab.h>
|
||||
#include <zephyr/kernel.h>
|
||||
#include <zephyr/kernel_structs.h>
|
||||
#include <kernel_internal.h>
|
||||
|
@ -79,7 +80,14 @@ FUNC_NORETURN void z_riscv_fatal_error_csf(unsigned int reason, const z_arch_esf
|
|||
#endif /* CONFIG_RISCV_ISA_RV32E */
|
||||
LOG_ERR(" sp: " PR_REG, z_riscv_get_sp_before_exc(esf));
|
||||
LOG_ERR(" ra: " PR_REG, esf->ra);
|
||||
#ifndef CONFIG_SYMTAB
|
||||
LOG_ERR(" mepc: " PR_REG, esf->mepc);
|
||||
#else
|
||||
uint32_t offset = 0;
|
||||
const char *name = symtab_find_symbol_name(esf->mepc, &offset);
|
||||
|
||||
LOG_ERR(" mepc: " PR_REG " [%s+0x%x]", esf->mepc, name, offset);
|
||||
#endif
|
||||
LOG_ERR("mstatus: " PR_REG, esf->mstatus);
|
||||
LOG_ERR("");
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue