mirror of
https://github.com/apache/nuttx-apps.git
synced 2025-07-16 19:23:22 +08:00
coredump:update memory region init
Signed-off-by: anjiahao <anjiahao@xiaomi.com>
This commit is contained in:
parent
47c8d3734a
commit
c98439f9a1
@ -46,6 +46,17 @@
|
||||
typedef CODE void (*dumpfile_cb_t)(FAR char *path, FAR const char *filename,
|
||||
FAR void *arg);
|
||||
|
||||
/****************************************************************************
|
||||
* Private Data
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef CONFIG_BOARD_MEMORY_RANGE
|
||||
static struct memory_region_s g_memory_region[] =
|
||||
{
|
||||
CONFIG_BOARD_MEMORY_RANGE
|
||||
};
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Private Functions
|
||||
****************************************************************************/
|
||||
@ -299,7 +310,6 @@ blkfd_err:
|
||||
|
||||
static int coredump_now(int pid, FAR char *filename)
|
||||
{
|
||||
FAR const struct memory_region_s *region;
|
||||
FAR struct lib_stdoutstream_s *outstream;
|
||||
FAR struct lib_hexdumpstream_s *hstream;
|
||||
#ifdef CONFIG_BOARD_COREDUMP_COMPRESSION
|
||||
@ -373,8 +383,12 @@ static int coredump_now(int pid, FAR char *filename)
|
||||
|
||||
/* Do core dump */
|
||||
|
||||
region = alloc_memory_region(CONFIG_BOARD_MEMORY_RANGE);
|
||||
coredump(region, stream, pid);
|
||||
#ifdef CONFIG_BOARD_MEMORY_RANGE
|
||||
coredump(g_memory_region, stream, pid);
|
||||
#else
|
||||
coredump(NULL, stream, pid);
|
||||
#endif
|
||||
|
||||
setlogmask(logmask);
|
||||
# ifdef CONFIG_BOARD_COREDUMP_COMPRESSION
|
||||
printf("Finish coredump (Compression Enabled).\n");
|
||||
@ -388,11 +402,6 @@ static int coredump_now(int pid, FAR char *filename)
|
||||
fclose(file);
|
||||
}
|
||||
|
||||
if (region != NULL)
|
||||
{
|
||||
free_memory_region(region);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user