procmeminfo:support memdump can show specific task for tlsf

Signed-off-by: anjiahao <anjiahao@xiaomi.com>
Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
This commit is contained in:
anjiahao 2022-11-10 20:32:34 +08:00 committed by Xiang Xiao
parent c386a1a2d9
commit 29404ef54e

View File

@ -38,6 +38,7 @@
#include <nuttx/fs/procfs.h>
#include <nuttx/mutex.h>
#include <nuttx/mm/mm.h>
#include <nuttx/sched.h>
#include <nuttx/mm/mempool.h>
#include "tlsf/tlsf.h"
@ -144,9 +145,15 @@ struct memdump_backtrace_s
static void memdump_backtrace(FAR struct mm_heap_s *heap,
FAR struct memdump_backtrace_s *dump)
{
# if CONFIG_MM_BACKTRACE > 0
FAR struct tcb_s *tcb;
# endif
dump->pid = getpid();
# if CONFIG_MM_BACKTRACE > 0
if (heap->mm_procfs.backtrace)
tcb = nxsched_get_tcb(dump->pid);
if (heap->mm_procfs.backtrace ||
(tcb && tcb->flags & TCB_FLAG_HEAPDUMP))
{
int ret = backtrace(dump->backtrace, CONFIG_MM_BACKTRACE);
while (ret < CONFIG_MM_BACKTRACE)