[libcpu.aarch64] add rt_backtrace function. (#6982)

* [libcpu.aarch64] add rt_backtrace function.
This commit is contained in:
Bernard Xiong 2023-02-27 10:04:10 +08:00 committed by GitHub
parent ab7ab19be5
commit f295d3df78
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 0 deletions

View File

@ -55,3 +55,14 @@ void backtrace(unsigned long pc, unsigned long lr, unsigned long fp)
walk_unwind(lr, fp);
rt_kprintf("\n");
}
int rt_backtrace(void)
{
unsigned long pc = (unsigned long)backtrace;
unsigned long ra = (unsigned long)__builtin_return_address(0U);
unsigned long fr = (unsigned long)__builtin_frame_address(0U);
backtrace(pc, ra, fr);
return 0;
}
MSH_CMD_EXPORT_ALIAS(rt_backtrace, bt_test, backtrace test);

View File

@ -18,5 +18,6 @@ struct bt_frame
};
void backtrace(unsigned long pc, unsigned long lr, unsigned long fp);
int rt_backtrace(void);
#endif /*__BACKTRACE_H__*/