Skip to content

Commit

Permalink
coredump:update memory region init
Browse files Browse the repository at this point in the history
Signed-off-by: anjiahao <[email protected]>
  • Loading branch information
anjiahao1 authored and xiaoxiang781216 committed Oct 16, 2024
1 parent 47c8d37 commit c98439f
Showing 1 changed file with 17 additions and 8 deletions.
25 changes: 17 additions & 8 deletions system/coredump/coredump.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
****************************************************************************/
Expand Down Expand Up @@ -299,7 +310,6 @@ static void coredump_restore(FAR char *savepath, size_t maxfile)

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
Expand Down Expand Up @@ -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");
Expand All @@ -388,11 +402,6 @@ static int coredump_now(int pid, FAR char *filename)
fclose(file);
}

if (region != NULL)
{
free_memory_region(region);
}

return 0;
}

Expand Down

0 comments on commit c98439f

Please sign in to comment.