assert: show stacks with the sp from regs

1. Get the value of sp from dump regs when an exception occurs,
   to avoid getting the value of fp from up_getsp and causing
   incomplete stack printing.
2. Determine which stack the value belongs to based on the value
   of SP to avoid false reports of stack overflow

Signed-off-by: zhangyuan21 <zhangyuan21@xiaomi.com>
This commit is contained in:
zhangyuan21
2023-04-06 14:32:25 +08:00
committed by Xiang Xiao
parent dec80be431
commit 841b178782
25 changed files with 160 additions and 99 deletions
@@ -41,9 +41,10 @@
* Name: up_getusrsp
****************************************************************************/
uintptr_t up_getusrsp(void)
uintptr_t up_getusrsp(void *regs)
{
return CURRENT_REGS[REG_I6];
uint32_t *ptr = regs;
return ptr[REG_I6];
}
/****************************************************************************