arch: limit output maximum size stackdump when sp is not within stack
Signed-off-by: Jiuzhu Dong <dongjiuzhu1@xiaomi.com>
This commit is contained in:
parent
136b1d6d42
commit
9d4549d48b
4 changed files with 26 additions and 0 deletions
|
@ -837,6 +837,11 @@ config ARCH_STACKDUMP
|
|||
---help---
|
||||
Enable to do stack dumps after assertions
|
||||
|
||||
config ARCH_STACKDUMP_MAX_LENGTH
|
||||
int "The maximum length for dump stack on assertions"
|
||||
depends on ARCH_STACKDUMP
|
||||
default 0
|
||||
|
||||
config DUMP_ON_EXIT
|
||||
bool "Dump all tasks state on exit"
|
||||
default n
|
||||
|
|
|
@ -362,6 +362,13 @@ static void arm_dump_stack(const char *tag, uint32_t sp,
|
|||
size -= remain;
|
||||
#endif
|
||||
|
||||
#if CONFIG_ARCH_STACKDUMP_MAX_LENGTH > 0
|
||||
if (size > CONFIG_ARCH_STACKDUMP_MAX_LENGTH)
|
||||
{
|
||||
size = CONFIG_ARCH_STACKDUMP_MAX_LENGTH;
|
||||
}
|
||||
#endif
|
||||
|
||||
arm_stackdump(base, base + size);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -339,6 +339,13 @@ static void riscv_dump_stack(const char *tag, uintptr_t sp,
|
|||
size -= remain;
|
||||
#endif
|
||||
|
||||
#if CONFIG_ARCH_STACKDUMP_MAX_LENGTH > 0
|
||||
if (size > CONFIG_ARCH_STACKDUMP_MAX_LENGTH)
|
||||
{
|
||||
size = CONFIG_ARCH_STACKDUMP_MAX_LENGTH;
|
||||
}
|
||||
#endif
|
||||
|
||||
riscv_stackdump(base, base + size);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -308,6 +308,13 @@ static void xtensa_dump_stack(const char *tag, uint32_t sp,
|
|||
size = used;
|
||||
#endif
|
||||
|
||||
#if CONFIG_ARCH_STACKDUMP_MAX_LENGTH > 0
|
||||
if (size > CONFIG_ARCH_STACKDUMP_MAX_LENGTH)
|
||||
{
|
||||
size = CONFIG_ARCH_STACKDUMP_MAX_LENGTH;
|
||||
}
|
||||
#endif
|
||||
|
||||
xtensa_stackdump(base, base + size);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue