stack recored:Fixed the problem of missing the 0th data in statistics

Signed-off-by: anjiahao <anjiahao@xiaomi.com>
This commit is contained in:
anjiahao 2024-04-07 17:56:47 +08:00 • committed by Xiang Xiao
parent d6ae4a0342
commit 632b13fe03

View file

@ -1061,12 +1061,13 @@ static ssize_t proc_stack(FAR struct proc_file_s *procfile,
buffer += copysize;
remaining -= copysize;
for (i = tcb->level_deepest - 1; i > 0; i--)
for (i = tcb->level_deepest - 1; i >= 0; i--)
{
linesize = procfs_snprintf(procfile->line, STATUS_LINELEN,
"%-12zu%-pS\n",
tcb->stackrecord_sp_deepest[i - 1] -
tcb->stackrecord_sp_deepest[i],
(i ? tcb->stackrecord_sp_deepest[i - 1] :
tcb->stack_base_ptr + tcb->adj_stack_size)
- tcb->stackrecord_sp_deepest[i],
tcb->stackrecord_pc_deepest[i]);
copysize = procfs_memcpy(procfile->line, linesize, buffer, remaining,
&offset);