You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by ac...@apache.org on 2021/07/04 21:53:57 UTC

[incubator-nuttx] 05/05: boards/sim: Add asan config to test the custom heap

This is an automated email from the ASF dual-hosted git repository.

acassis pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx.git

commit b3f568c216f7be766dccda538b444fc5cad2ab9b
Author: Xiang Xiao <xi...@xiaomi.com>
AuthorDate: Sun Jun 27 11:41:41 2021 +0800

    boards/sim: Add asan config to test the custom heap
    
    Signed-off-by: Xiang Xiao <xi...@xiaomi.com>
---
 arch/sim/src/sim/up_heap.c                | 10 ++++++----
 boards/sim/sim/sim/configs/asan/defconfig | 32 +++++++++++++++++++++++++++++++
 2 files changed, 38 insertions(+), 4 deletions(-)

diff --git a/arch/sim/src/sim/up_heap.c b/arch/sim/src/sim/up_heap.c
index cd61de4..9af5a8f 100644
--- a/arch/sim/src/sim/up_heap.c
+++ b/arch/sim/src/sim/up_heap.c
@@ -24,11 +24,13 @@
 
 #include <nuttx/config.h>
 
+#include <assert.h>
 #include <string.h>
 #include <malloc.h>
 #include <stdbool.h>
 
 #include <nuttx/arch.h>
+#include <nuttx/fs/procfs.h>
 #include <nuttx/mm/mm.h>
 
 #include "up_internal.h"
@@ -151,10 +153,10 @@ void mm_initialize(FAR struct mm_heap_s *heap, FAR const char *name,
   heap->mm_impl = impl;
 
 #if defined(CONFIG_FS_PROCFS) && !defined(CONFIG_FS_PROCFS_EXCLUDE_MEMINFO)
-  heap_impl->mm_procfs.name = name;
-  heap_impl->mm_procfs.mallinfo = (FAR void *)mm_mallinfo;
-  heap_impl->mm_procfs.user_data = heap;
-  procfs_register_meminfo(&heap_impl->mm_procfs);
+  impl->mm_procfs.name = name;
+  impl->mm_procfs.mallinfo = (FAR void *)mm_mallinfo;
+  impl->mm_procfs.user_data = heap;
+  procfs_register_meminfo(&impl->mm_procfs);
 #endif
 }
 
diff --git a/boards/sim/sim/sim/configs/asan/defconfig b/boards/sim/sim/sim/configs/asan/defconfig
new file mode 100644
index 0000000..f656a29
--- /dev/null
+++ b/boards/sim/sim/sim/configs/asan/defconfig
@@ -0,0 +1,32 @@
+#
+# This file is autogenerated: PLEASE DO NOT EDIT IT.
+#
+# You can use "make menuconfig" to make any modifications to the installed .config file.
+# You can then do "make savedefconfig" to generate a new defconfig file that includes your
+# modifications.
+#
+CONFIG_ARCH="sim"
+CONFIG_ARCH_BOARD="sim"
+CONFIG_ARCH_BOARD_SIM=y
+CONFIG_ARCH_CHIP="sim"
+CONFIG_ARCH_SIM=y
+CONFIG_BOARDCTL_POWEROFF=y
+CONFIG_BUILTIN=y
+CONFIG_DEBUG_SYMBOLS=y
+CONFIG_DEV_LOOP=y
+CONFIG_DEV_ZERO=y
+CONFIG_EXAMPLES_HELLO=y
+CONFIG_FS_BINFS=y
+CONFIG_FS_PROCFS=y
+CONFIG_MM_CUSTOMIZE_MANAGER=y
+CONFIG_NSH_ARCHINIT=y
+CONFIG_NSH_BUILTIN_APPS=y
+CONFIG_NSH_READLINE=y
+CONFIG_READLINE_TABCOMPLETION=y
+CONFIG_SCHED_HAVE_PARENT=y
+CONFIG_SCHED_ONEXIT=y
+CONFIG_SCHED_WAITPID=y
+CONFIG_SIM_SANITIZE=y
+CONFIG_SYSTEM_NSH=y
+CONFIG_TESTING_OSTEST=y
+CONFIG_USER_ENTRYPOINT="nsh_main"