change aarch64 trap backtrace & coredump priority rating. (#8008)

This commit is contained in:
geniusgogo 2023-09-11 14:05:41 +08:00 committed by GitHub
parent 012aa117af
commit e8e980879e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 35 additions and 16 deletions

View File

@ -34,19 +34,49 @@ extern long list_thread(void);
#include <lwp_core_dump.h>
#endif
void check_user_fault(struct rt_hw_exp_stack *regs, uint32_t pc_adj, char *info)
static void _check_fault(struct rt_hw_exp_stack *regs, uint32_t pc_adj, char *info)
{
uint32_t mode = regs->cpsr;
if ((mode & 0x1f) == 0x00)
{
rt_kprintf("%s! pc = 0x%08x\n", info, regs->pc - pc_adj);
/* user stack backtrace */
#ifdef RT_USING_LWP
{
rt_thread_t th;
th = rt_thread_self();
if (th && th->lwp)
{
rt_backtrace_user_thread(th);
}
}
#endif
#ifdef LWP_USING_CORE_DUMP
lwp_core_dump(regs, pc_adj);
#endif
backtrace((unsigned long)regs->pc, (unsigned long)regs->x30, (unsigned long)regs->x29);
sys_exit_group(-1);
}
else
{
/* user stack backtrace */
#ifdef RT_USING_LWP
{
rt_thread_t th;
th = rt_thread_self();
if (th && th->lwp)
{
rt_backtrace_user_thread(th);
}
}
#endif
/* kernel stack backtrace */
backtrace((unsigned long)regs->pc, (unsigned long)regs->x30, (unsigned long)regs->x29);
}
}
int _get_type(unsigned long esr)
@ -293,29 +323,18 @@ void rt_hw_trap_exception(struct rt_hw_exp_stack *regs)
process_exception(esr, regs->pc);
rt_hw_show_register(regs);
rt_kprintf("current: %s\n", rt_thread_self()->parent.name);
#ifdef RT_USING_LWP
check_user_fault(regs, 0, "user fault");
#endif
#ifdef RT_USING_FINSH
list_thread();
#endif
#ifdef RT_USING_LWP
{
rt_thread_t th;
th = rt_thread_self();
if (th && th->lwp)
{
rt_backtrace_user_thread(th);
}
}
_check_fault(regs, 0, "user fault");
#endif
backtrace((unsigned long)regs->pc, (unsigned long)regs->x30, (unsigned long)regs->x29);
rt_hw_cpu_shutdown();
}
void rt_hw_trap_serror(struct rt_hw_exp_stack *regs)
{
rt_kprintf("SError\n");