arch/arm64: Obtaining the correct fp pointer

Signed-off-by: zhangyuan21 <zhangyuan21@xiaomi.com>
This commit is contained in:
zhangyuan21 2023-03-31 09:50:58 +08:00 committed by Xiang Xiao
parent 49c863f238
commit e4ae2b48b8
2 changed files with 8 additions and 5 deletions

View File

@ -47,7 +47,7 @@ CMN_CSRCS += arm64_nputs.c arm64_idle.c arm64_copystate.c arm64_createstack.c
CMN_CSRCS += arm64_releasestack.c arm64_stackframe.c arm64_usestack.c
CMN_CSRCS += arm64_task_sched.c arm64_exit.c arm64_vfork.c arm64_switchcontext.c
CMN_CSRCS += arm64_schedulesigaction.c arm64_sigdeliver.c
CMN_CSRCS += arm64_backtrace.c arm64_getintstack.c arm64_registerdump.c
CMN_CSRCS += arm64_getintstack.c arm64_registerdump.c
CMN_CSRCS += arm64_perf.c
# Common C source files ( hardware BSP )
@ -115,3 +115,7 @@ endif
ifeq ($(CONFIG_STACK_COLORATION),y)
CMN_CSRCS += arm64_checkstack.c
endif
ifeq ($(CONFIG_SCHED_BACKTRACE),y)
CMN_CSRCS += arm64_backtrace.c
endif

View File

@ -53,14 +53,13 @@ static int backtrace(uintptr_t *base, uintptr_t *limit,
if (pc)
{
i++;
if (*skip-- <= 0)
{
*buffer++ = pc;
buffer[i++] = pc;
}
}
for (; i < size; fp = (uintptr_t *)*(fp - 1), i++)
for (; i < size; fp = (uintptr_t *)*fp)
{
if (fp > limit || fp < base || *fp == 0)
{
@ -69,7 +68,7 @@ static int backtrace(uintptr_t *base, uintptr_t *limit,
if (*skip-- <= 0)
{
*buffer++ = (void *)*fp;
buffer[i++] = (void *)*(fp + 1);
}
}