mirror of
https://github.com/apache/nuttx.git
synced 2026-06-06 00:14:22 +08:00
xtensa:backtrace: fix backtrace last buffer error in some scene
Signed-off-by: zhuyanlin <zhuyanlin1@xiaomi.com>
This commit is contained in:
committed by
Abdelatif Guettouche
parent
5659f685c1
commit
981282696f
@@ -169,15 +169,12 @@ static int backtrace_stack(uintptr_t *base, uintptr_t *limit,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (; i < size; sp = (uintptr_t *)*(sp - 3))
|
while (i < size)
|
||||||
{
|
{
|
||||||
if (sp > limit || sp < base)
|
|
||||||
{
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
ra = (uintptr_t *)*(sp - 4);
|
ra = (uintptr_t *)*(sp - 4);
|
||||||
if (ra == NULL)
|
sp = (uintptr_t *)*(sp - 3);
|
||||||
|
|
||||||
|
if (sp >= limit || sp < base || ra == NULL)
|
||||||
{
|
{
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -236,7 +233,7 @@ int up_backtrace(struct tcb_s *tcb, void **buffer, int size, int skip)
|
|||||||
if (up_interrupt_context())
|
if (up_interrupt_context())
|
||||||
{
|
{
|
||||||
#if CONFIG_ARCH_INTERRUPTSTACK > 15
|
#if CONFIG_ARCH_INTERRUPTSTACK > 15
|
||||||
uintptr_t istackbase;
|
FAR void *istackbase;
|
||||||
#ifdef CONFIG_SMP
|
#ifdef CONFIG_SMP
|
||||||
istackbase = xtensa_intstack_alloc();
|
istackbase = xtensa_intstack_alloc();
|
||||||
#else
|
#else
|
||||||
@@ -244,9 +241,8 @@ int up_backtrace(struct tcb_s *tcb, void **buffer, int size, int skip)
|
|||||||
#endif
|
#endif
|
||||||
xtensa_window_spill();
|
xtensa_window_spill();
|
||||||
|
|
||||||
ret = backtrace_stack((void *)istackbase,
|
ret = backtrace_stack(istackbase,
|
||||||
(void *)(istackbase +
|
(istackbase + CONFIG_ARCH_INTERRUPTSTACK),
|
||||||
CONFIG_ARCH_INTERRUPTSTACK),
|
|
||||||
(void *)up_getsp(), NULL,
|
(void *)up_getsp(), NULL,
|
||||||
buffer, size, &skip);
|
buffer, size, &skip);
|
||||||
#else
|
#else
|
||||||
|
|||||||
Reference in New Issue
Block a user