coredump: support coredump save to block device when crash

Signed-off-by: anjiahao <anjiahao@xiaomi.com>
This commit is contained in:
anjiahao
2023-11-09 12:02:37 +08:00
committed by Xiang Xiao
parent 542a5555d3
commit 35051dd715
12 changed files with 441 additions and 71 deletions
+13 -1
View File
@@ -29,6 +29,7 @@
#include <spawn.h>
#include <sys/types.h>
#include <sys/utsname.h>
#include <nuttx/sched.h>
#include <nuttx/streams.h>
@@ -38,7 +39,8 @@
* Pre-processor Definitions
****************************************************************************/
#define BINFMT_NALLOC 4
#define BINFMT_NALLOC 4
#define COREDUMP_MAGIC 0x434f5245
/****************************************************************************
* Public Types
@@ -138,6 +140,16 @@ struct binfmt_s
pid_t pid);
};
/* Coredump information for block header */
struct coredump_info_s
{
uint32_t magic;
struct utsname name;
time_t time;
size_t size;
};
/****************************************************************************
* Public Data
****************************************************************************/
+30
View File
@@ -63,4 +63,34 @@ ssize_t parse_memory_region(FAR const char *format,
FAR struct memory_region_s *region,
size_t num);
/****************************************************************************
* Name: alloc_memory_region
*
* Input Parameters:
* format - The format string to parse. <start>,<end>,<flags>,...
* start - The start address of the memory region
* end - The end address of the memory region
* flags - Readable 0x1, writable 0x2, executable 0x4
* example: 0x1000,0x2000,0x1,0x2000,0x3000,0x3,0x3000,0x4000,0x7
*
* Return:
* The parsed memory region list on success; NULL on failure.
* The boundary value of the memory region is zero.
* The return value need free by caller.
*
****************************************************************************/
FAR struct memory_region_s *
alloc_memory_region(FAR const char *format);
/****************************************************************************
* Name: free_memory_region
*
* Input Parameters:
* region - The memory region list to free.
*
****************************************************************************/
void free_memory_region(FAR struct memory_region_s *region);
#endif /* __INCLUDE_MEMORYREGION_H */