mm: use shced_backtrace and skip the first numbers in mm backatrace
beacause the first numbers backtrace in mm node is same, skip them to show more useful backtrace. Signed-off-by: wangbowen6 <wangbowen6@xiaomi.com>
This commit is contained in:
parent
c9e3a0669f
commit
2dedaa449b
12
mm/Kconfig
12
mm/Kconfig
|
@ -228,6 +228,13 @@ config MM_HEAP_MEMPOOL_CHUNK_SIZE
|
|||
---help---
|
||||
This size describes the multiple mempool chunk size.
|
||||
|
||||
config MM_HEAP_MEMPOOL_BACKTRACE_SKIP
|
||||
int "The skip depth of backtrace for mempool"
|
||||
default 6
|
||||
depends on MM_HEAP_MEMPOOL_THRESHOLD != 0 && MM_BACKTRACE > 0
|
||||
---help---
|
||||
This number is the skipped backtrace depth for mempool.
|
||||
|
||||
config FS_PROCFS_EXCLUDE_MEMPOOL
|
||||
bool "Exclude mempool"
|
||||
default DEFAULT_SMALL
|
||||
|
@ -304,6 +311,11 @@ config MM_BACKTRACE
|
|||
config: disable backtrace by -1, only record pid info by zero and
|
||||
enable record backtrace info by 8(fixed depth).
|
||||
|
||||
config MM_BACKTRACE_SKIP
|
||||
int "The skip depth of backtrace"
|
||||
depends on MM_BACKTRACE > 0
|
||||
default 3
|
||||
|
||||
config MM_BACKTRACE_DEFAULT
|
||||
bool "Enable the backtrace record by default"
|
||||
default n
|
||||
|
|
|
@ -23,7 +23,6 @@
|
|||
****************************************************************************/
|
||||
|
||||
#include <assert.h>
|
||||
#include <execinfo.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdio.h>
|
||||
#include <syslog.h>
|
||||
|
@ -94,7 +93,9 @@ static inline void mempool_add_backtrace(FAR struct mempool_s *pool,
|
|||
# if CONFIG_MM_BACKTRACE > 0
|
||||
if (pool->procfs.backtrace)
|
||||
{
|
||||
int result = backtrace(buf->backtrace, CONFIG_MM_BACKTRACE);
|
||||
int result = sched_backtrace(buf->pid, buf->backtrace,
|
||||
CONFIG_MM_BACKTRACE,
|
||||
CONFIG_MM_HEAP_MEMPOOL_BACKTRACE_SKIP);
|
||||
if (result < CONFIG_MM_BACKTRACE)
|
||||
{
|
||||
buf->backtrace[result] = NULL;
|
||||
|
|
|
@ -34,7 +34,6 @@
|
|||
#include <nuttx/mm/mempool.h>
|
||||
|
||||
#include <assert.h>
|
||||
#include <execinfo.h>
|
||||
#include <sys/types.h>
|
||||
#include <stdbool.h>
|
||||
#include <string.h>
|
||||
|
@ -89,7 +88,8 @@
|
|||
tcb = nxsched_get_tcb(tmp->pid); \
|
||||
if ((heap)->mm_procfs.backtrace || (tcb && tcb->flags & TCB_FLAG_HEAP_DUMP)) \
|
||||
{ \
|
||||
int n = backtrace(tmp->backtrace, CONFIG_MM_BACKTRACE); \
|
||||
int n = sched_backtrace(tmp->pid, tmp->backtrace, CONFIG_MM_BACKTRACE, \
|
||||
CONFIG_MM_BACKTRACE_SKIP); \
|
||||
if (n < CONFIG_MM_BACKTRACE) \
|
||||
{ \
|
||||
tmp->backtrace[n] = NULL; \
|
||||
|
|
|
@ -28,7 +28,6 @@
|
|||
#include <errno.h>
|
||||
#include <assert.h>
|
||||
#include <debug.h>
|
||||
#include <execinfo.h>
|
||||
#include <sched.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
@ -150,7 +149,9 @@ static void memdump_backtrace(FAR struct mm_heap_s *heap,
|
|||
if (heap->mm_procfs.backtrace ||
|
||||
(tcb && tcb->flags & TCB_FLAG_HEAP_DUMP))
|
||||
{
|
||||
int ret = backtrace(buf->backtrace, CONFIG_MM_BACKTRACE);
|
||||
int ret = sched_backtrace(buf->pid, buf->backtrace,
|
||||
CONFIG_MM_BACKTRACE,
|
||||
CONFIG_MM_BACKTRACE_SKIP);
|
||||
if (ret < CONFIG_MM_BACKTRACE)
|
||||
{
|
||||
buf->backtrace[ret] = NULL;
|
||||
|
|
Loading…
Reference in New Issue