coredump:coredump_set_memory_region to set memory region
Signed-off-by: anjiahao <anjiahao@xiaomi.com>
This commit is contained in:
parent
8d0d1f7571
commit
2ff2b82437
@ -1,5 +1,5 @@
|
||||
/****************************************************************************
|
||||
* sched/misc/coredump.h
|
||||
* include/nuttx/coredump.h
|
||||
*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
@ -18,19 +18,30 @@
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef __SCHED_MISC_COREDUMP_H
|
||||
#define __SCHED_MISC_COREDUMP_H
|
||||
#ifndef __INCLUDE_NUTTX_COREDUMP_H
|
||||
#define __INCLUDE_NUTTX_COREDUMP_H
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/memoryregion.h>
|
||||
#include <unistd.h>
|
||||
|
||||
/****************************************************************************
|
||||
* Public Function Prototypes
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: coredump_set_memory_region
|
||||
*
|
||||
* Description:
|
||||
* Set do coredump memory region.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
int coredump_set_memory_region(FAR struct memory_region_s *region);
|
||||
|
||||
/****************************************************************************
|
||||
* Name: coredump_initialize
|
||||
*
|
||||
@ -55,4 +66,4 @@ int coredump_initialize(void);
|
||||
|
||||
void coredump_dump(pid_t pid);
|
||||
|
||||
#endif /* __SCHED_MISC_COREDUMP_H */
|
||||
#endif /* __INCLUDE_NUTTX_COREDUMP_H */
|
@ -32,6 +32,7 @@
|
||||
|
||||
#include <nuttx/arch.h>
|
||||
#include <nuttx/board.h>
|
||||
#include <nuttx/coredump.h>
|
||||
#include <nuttx/fs/fs.h>
|
||||
#include <nuttx/init.h>
|
||||
#include <nuttx/nuttx.h>
|
||||
@ -49,7 +50,6 @@
|
||||
#include "sched/sched.h"
|
||||
#include "wqueue/wqueue.h"
|
||||
#include "init/init.h"
|
||||
#include "misc/coredump.h"
|
||||
|
||||
#ifdef CONFIG_ETC_ROMFS
|
||||
# include <nuttx/drivers/ramdisk.h>
|
||||
|
@ -26,6 +26,7 @@
|
||||
|
||||
#include <nuttx/arch.h>
|
||||
#include <nuttx/board.h>
|
||||
#include <nuttx/coredump.h>
|
||||
#include <nuttx/irq.h>
|
||||
#include <nuttx/tls.h>
|
||||
#include <nuttx/signal.h>
|
||||
@ -46,7 +47,6 @@
|
||||
#include "irq/irq.h"
|
||||
#include "sched/sched.h"
|
||||
#include "group/group.h"
|
||||
#include "misc/coredump.h"
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
|
@ -23,11 +23,10 @@
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/binfmt/binfmt.h>
|
||||
#include <nuttx/coredump.h>
|
||||
#include <syslog.h>
|
||||
#include <debug.h>
|
||||
|
||||
#include "misc/coredump.h"
|
||||
|
||||
/****************************************************************************
|
||||
* Private Data
|
||||
****************************************************************************/
|
||||
@ -165,6 +164,22 @@ static void coredump_dump_blkdev(pid_t pid)
|
||||
}
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Name: coredump_set_memory_region
|
||||
*
|
||||
* Description:
|
||||
* Set do coredump memory region.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
int coredump_set_memory_region(FAR struct memory_region_s *region)
|
||||
{
|
||||
/* Not free g_regions, because allow call this fun when crash */
|
||||
|
||||
g_regions = region;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: coredump_initialize
|
||||
*
|
||||
@ -180,7 +195,8 @@ int coredump_initialize(void)
|
||||
|
||||
if (CONFIG_BOARD_MEMORY_RANGE[0] != '\0')
|
||||
{
|
||||
g_regions = alloc_memory_region(CONFIG_BOARD_MEMORY_RANGE);
|
||||
coredump_set_memory_region(
|
||||
alloc_memory_region(CONFIG_BOARD_MEMORY_RANGE));
|
||||
if (g_regions == NULL)
|
||||
{
|
||||
_alert("Coredump memory region alloc fail\n");
|
||||
|
Loading…
Reference in New Issue
Block a user