mirror of
https://github.com/apache/nuttx-apps.git
synced 2025-07-17 03:36:09 +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,
|
typedef CODE void (*dumpfile_cb_t)(FAR char *path, FAR const char *filename,
|
||||||
FAR void *arg);
|
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
|
* Private Functions
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
@ -299,7 +310,6 @@ blkfd_err:
|
|||||||
|
|
||||||
static int coredump_now(int pid, FAR char *filename)
|
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_stdoutstream_s *outstream;
|
||||||
FAR struct lib_hexdumpstream_s *hstream;
|
FAR struct lib_hexdumpstream_s *hstream;
|
||||||
#ifdef CONFIG_BOARD_COREDUMP_COMPRESSION
|
#ifdef CONFIG_BOARD_COREDUMP_COMPRESSION
|
||||||
@ -373,8 +383,12 @@ static int coredump_now(int pid, FAR char *filename)
|
|||||||
|
|
||||||
/* Do core dump */
|
/* Do core dump */
|
||||||
|
|
||||||
region = alloc_memory_region(CONFIG_BOARD_MEMORY_RANGE);
|
#ifdef CONFIG_BOARD_MEMORY_RANGE
|
||||||
coredump(region, stream, pid);
|
coredump(g_memory_region, stream, pid);
|
||||||
|
#else
|
||||||
|
coredump(NULL, stream, pid);
|
||||||
|
#endif
|
||||||
|
|
||||||
setlogmask(logmask);
|
setlogmask(logmask);
|
||||||
# ifdef CONFIG_BOARD_COREDUMP_COMPRESSION
|
# ifdef CONFIG_BOARD_COREDUMP_COMPRESSION
|
||||||
printf("Finish coredump (Compression Enabled).\n");
|
printf("Finish coredump (Compression Enabled).\n");
|
||||||
@ -388,11 +402,6 @@ static int coredump_now(int pid, FAR char *filename)
|
|||||||
fclose(file);
|
fclose(file);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (region != NULL)
|
|
||||||
{
|
|
||||||
free_memory_region(region);
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user