elf/coredump: add support of dump task stack without memory segments

Signed-off-by: chao an <anchao@xiaomi.com>
This commit is contained in:
chao an
2023-05-22 11:43:08 +08:00
committed by Xiang Xiao
parent 0133831a70
commit 24f4216066
5 changed files with 333 additions and 114 deletions
+3 -2
View File
@@ -44,7 +44,8 @@
****************************************************************************/ ****************************************************************************/
int core_dump(FAR struct memory_region_s *regions, int core_dump(FAR struct memory_region_s *regions,
FAR struct lib_outstream_s *stream) FAR struct lib_outstream_s *stream,
pid_t pid)
{ {
FAR struct binfmt_s *binfmt; FAR struct binfmt_s *binfmt;
int ret = -ENOENT; int ret = -ENOENT;
@@ -55,7 +56,7 @@ int core_dump(FAR struct memory_region_s *regions,
if (binfmt->coredump) if (binfmt->coredump)
{ {
ret = binfmt->coredump(regions, stream); ret = binfmt->coredump(regions, stream, pid);
if (ret == OK) if (ret == OK)
{ {
break; break;
+5 -2
View File
@@ -71,7 +71,8 @@ static int elf_loadbinary(FAR struct binary_s *binp,
int nexports); int nexports);
#ifdef CONFIG_ELF_COREDUMP #ifdef CONFIG_ELF_COREDUMP
static int elf_dumpbinary(FAR struct memory_region_s *regions, static int elf_dumpbinary(FAR struct memory_region_s *regions,
FAR struct lib_outstream_s *stream); FAR struct lib_outstream_s *stream,
pid_t pid);
#endif #endif
#if defined(CONFIG_DEBUG_FEATURES) && defined(CONFIG_DEBUG_BINFMT) #if defined(CONFIG_DEBUG_FEATURES) && defined(CONFIG_DEBUG_BINFMT)
static void elf_dumploadinfo(FAR struct elf_loadinfo_s *loadinfo); static void elf_dumploadinfo(FAR struct elf_loadinfo_s *loadinfo);
@@ -316,12 +317,14 @@ errout_with_init:
#ifdef CONFIG_ELF_COREDUMP #ifdef CONFIG_ELF_COREDUMP
static int elf_dumpbinary(FAR struct memory_region_s *regions, static int elf_dumpbinary(FAR struct memory_region_s *regions,
FAR struct lib_outstream_s *stream) FAR struct lib_outstream_s *stream,
pid_t pid)
{ {
struct elf_dumpinfo_s dumpinfo; struct elf_dumpinfo_s dumpinfo;
dumpinfo.regions = regions; dumpinfo.regions = regions;
dumpinfo.stream = stream; dumpinfo.stream = stream;
dumpinfo.pid = pid;
return elf_coredump(&dumpinfo); return elf_coredump(&dumpinfo);
} }
File diff suppressed because it is too large Load Diff
+4 -2
View File
@@ -139,7 +139,8 @@ struct binfmt_s
/* Unload module callback */ /* Unload module callback */
CODE int (*coredump)(FAR struct memory_region_s *regions, CODE int (*coredump)(FAR struct memory_region_s *regions,
FAR struct lib_outstream_s *stream); FAR struct lib_outstream_s *stream,
pid_t pid);
}; };
/**************************************************************************** /****************************************************************************
@@ -209,7 +210,8 @@ int unregister_binfmt(FAR struct binfmt_s *binfmt);
****************************************************************************/ ****************************************************************************/
int core_dump(FAR struct memory_region_s *regions, int core_dump(FAR struct memory_region_s *regions,
FAR struct lib_outstream_s *stream); FAR struct lib_outstream_s *stream,
pid_t pid);
/**************************************************************************** /****************************************************************************
* Name: load_module * Name: load_module
+1
View File
@@ -141,6 +141,7 @@ struct elf_dumpinfo_s
{ {
FAR struct memory_region_s *regions; FAR struct memory_region_s *regions;
FAR struct lib_outstream_s *stream; FAR struct lib_outstream_s *stream;
pid_t pid;
}; };
#endif #endif