arch: using remain to ignore invalid stack content when sp is not within stack
Signed-off-by: Jiuzhu Dong <dongjiuzhu1@xiaomi.com>
This commit is contained in:
parent
0ca02a5564
commit
136b1d6d42
3 changed files with 28 additions and 6 deletions
|
@ -352,10 +352,17 @@ static void arm_dump_stack(const char *tag, uint32_t sp,
|
|||
else
|
||||
{
|
||||
_alert("ERROR: %s Stack pointer is not within the stack\n", tag);
|
||||
|
||||
if (force)
|
||||
{
|
||||
arm_stackdump(base, top);
|
||||
#ifdef CONFIG_STACK_COLORATION
|
||||
uint32_t remain;
|
||||
|
||||
remain = size - arm_stack_check((FAR void *)(uintptr_t)base, size);
|
||||
base += remain;
|
||||
size -= remain;
|
||||
#endif
|
||||
|
||||
arm_stackdump(base, base + size);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -331,7 +331,15 @@ static void riscv_dump_stack(const char *tag, uintptr_t sp,
|
|||
|
||||
if (force)
|
||||
{
|
||||
riscv_stackdump(base, top);
|
||||
#ifdef CONFIG_STACK_COLORATION
|
||||
uint32_t remain;
|
||||
|
||||
remain = size - riscv_stack_check((uintptr_t)base, size);
|
||||
base += remain;
|
||||
size -= remain;
|
||||
#endif
|
||||
|
||||
riscv_stackdump(base, base + size);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -281,14 +281,16 @@ static void xtensa_dump_stack(const char *tag, uint32_t sp,
|
|||
uint32_t base, uint32_t size, bool force)
|
||||
{
|
||||
uint32_t top = base + size;
|
||||
#ifdef CONFIG_STACK_COLORATION
|
||||
uint32_t used = xtensa_stack_check((uintptr_t)base, size);
|
||||
#endif
|
||||
|
||||
_alert("%s Stack:\n", tag);
|
||||
_alert("sp: %08" PRIx32 "\n", sp);
|
||||
_alert(" base: %08" PRIx32 "\n", base);
|
||||
_alert(" size: %08" PRIx32 "\n", size);
|
||||
#ifdef CONFIG_STACK_COLORATION
|
||||
_alert(" used: %08" PRIx32 "\n", xtensa_stack_check((uintptr_t)base,
|
||||
size));
|
||||
_alert(" used: %08" PRIx32 "\n", used);
|
||||
#endif
|
||||
|
||||
if (sp >= base && sp < top)
|
||||
|
@ -301,7 +303,12 @@ static void xtensa_dump_stack(const char *tag, uint32_t sp,
|
|||
|
||||
if (force)
|
||||
{
|
||||
xtensa_stackdump(base, top);
|
||||
#ifdef CONFIG_STACK_COLORATION
|
||||
base += size - used;
|
||||
size = used;
|
||||
#endif
|
||||
|
||||
xtensa_stackdump(base, base + size);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue