mm: add kmm/umm_memdump

Signed-off-by: yinshengkai <yinshengkai@xiaomi.com>
This commit is contained in:
yinshengkai 2022-10-28 11:47:18 +08:00 committed by Xiang Xiao
parent c8670cf2eb
commit 65dc1fe0fc
6 changed files with 105 additions and 0 deletions

View File

@ -100,6 +100,7 @@ extern "C"
# define kmm_free(p) free(p)
# define kmm_mallinfo() mallinfo()
# define kmm_heapmember(p) umm_heapmember(p)
# define kmm_memdump(p) umm_memdump(p)
#else
/* Otherwise, the kernel-space allocators are declared in

View File

@ -239,6 +239,12 @@ FAR void *mm_zalloc(FAR struct mm_heap_s *heap, size_t size);
FAR void *kmm_zalloc(size_t size);
#endif
/* Functions contained in kmm_memdump.c *************************************/
#ifdef CONFIG_MM_KERNEL_HEAP
void kmm_memdump(pid_t pid);
#endif
/* Functions contained in mm_memalign.c *************************************/
FAR void *mm_memalign(FAR struct mm_heap_s *heap, size_t alignment,
@ -325,6 +331,10 @@ void mm_checkcorruption(FAR struct mm_heap_s *heap);
FAR void umm_checkcorruption(void);
/* Functions contained in umm_memdump.c *************************************/
void umm_memdump(pid_t pid);
/* Functions contained in kmm_checkcorruption.c *****************************/
#ifdef CONFIG_MM_KERNEL_HEAP

View File

@ -25,6 +25,7 @@ ifeq ($(CONFIG_MM_KERNEL_HEAP),y)
CSRCS += kmm_initialize.c kmm_addregion.c kmm_malloc_size.c
CSRCS += kmm_brkaddr.c kmm_calloc.c kmm_extend.c kmm_free.c kmm_mallinfo.c
CSRCS += kmm_malloc.c kmm_memalign.c kmm_realloc.c kmm_zalloc.c kmm_heapmember.c
CSRCS += kmm_memdump.c
ifeq ($(CONFIG_DEBUG_MM),y)
CSRCS += kmm_checkcorruption.c

47
mm/kmm_heap/kmm_memdump.c Normal file
View File

@ -0,0 +1,47 @@
/****************************************************************************
* mm/kmm_heap/kmm_memdump.c
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership. The
* ASF licenses this file to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance with the
* License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*
****************************************************************************/
/****************************************************************************
* Included Files
****************************************************************************/
#include <nuttx/config.h>
#include <nuttx/mm/mm.h>
#ifdef CONFIG_MM_KERNEL_HEAP
/****************************************************************************
* Public Functions
****************************************************************************/
/****************************************************************************
* Name: kmm_memdump
*
* Description:
* Dump the memory block allocated by this task
*
****************************************************************************/
void kmm_memdump(pid_t pid)
{
mm_memdump(g_kmmheap, pid);
}
#endif /* CONFIG_MM_KERNEL_HEAP */

View File

@ -23,6 +23,7 @@
CSRCS += umm_globals.c umm_initialize.c umm_addregion.c umm_malloc_size.c
CSRCS += umm_brkaddr.c umm_calloc.c umm_extend.c umm_free.c umm_mallinfo.c
CSRCS += umm_malloc.c umm_memalign.c umm_realloc.c umm_zalloc.c umm_heapmember.c
CSRCS += umm_memdump.c
ifeq ($(CONFIG_BUILD_KERNEL),y)
CSRCS += umm_sbrk.c

45
mm/umm_heap/umm_memdump.c Normal file
View File

@ -0,0 +1,45 @@
/****************************************************************************
* mm/umm_heap/umm_memdump.c
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership. The
* ASF licenses this file to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance with the
* License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*
****************************************************************************/
/****************************************************************************
* Included Files
****************************************************************************/
#include <nuttx/config.h>
#include <nuttx/mm/mm.h>
#include "umm_heap/umm_heap.h"
/****************************************************************************
* Public Functions
****************************************************************************/
/****************************************************************************
* Name: umm_memdump
*
* Description:
* Dump the memory block allocated by this task
*
****************************************************************************/
void umm_memdump(pid_t pid)
{
mm_memdump(USR_HEAP, pid);
}