This is an automated email from the ASF dual-hosted git repository.

GUIDINGLI pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git

commit 9a20768c40c799d7877641c0c5edbeaa4331ca13
Author: Bowen Wang <[email protected]>
AuthorDate: Thu Sep 5 23:22:54 2024 +0800

    coredump: do not dump non-writeable memory segment
    
    elf_emit_memory() writes every region of the core file, including the
    read-only ones (text, rodata), which a debugger cannot use to change
    state and which can be large on a small target.  Only the writeable
    segments are needed to reconstruct what the crashed task could modify.
    
    PF_REGISTER regions are handled before this point and are unaffected.
    
    Signed-off-by: Bowen Wang <[email protected]>
---
 sched/misc/coredump.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/sched/misc/coredump.c b/sched/misc/coredump.c
index b72aff10838..d919ae47588 100644
--- a/sched/misc/coredump.c
+++ b/sched/misc/coredump.c
@@ -545,6 +545,13 @@ static void elf_emit_memory(FAR struct elf_dumpinfo_s 
*cinfo, int memsegs)
         }
       else
         {
+          /* Skip the Non-Write segment because it's unnecessary. */
+
+          if ((cinfo->regions[i].flags & PF_W) == 0)
+            {
+              continue;
+            }
+
           elf_emit(cinfo, (FAR void *)cinfo->regions[i].start,
                    cinfo->regions[i].end - cinfo->regions[i].start);
         }

Reply via email to