Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys Re-instate the zero length sections in elf core dumps (t...



details:   https://anonhg.NetBSD.org/src/rev/87a7610bad0e
branches:  trunk
changeset: 792554:87a7610bad0e
user:      dsl <dsl%NetBSD.org@localhost>
date:      Tue Jan 07 07:59:03 2014 +0000

description:
Re-instate the zero length sections in elf core dumps (they probably help
  describe the process memory layout).
Fudge the a.out core code to not dump the entire contents.
I'm not sue that anything can read a.out core files - more progress might
  be made on such dumps by converting the a.out file to elf!

diffstat:

 sys/kern/core_netbsd.c |  11 ++++++++---
 sys/uvm/uvm_coredump.c |   8 ++------
 2 files changed, 10 insertions(+), 9 deletions(-)

diffs (61 lines):

diff -r c948a1587a8f -r 87a7610bad0e sys/kern/core_netbsd.c
--- a/sys/kern/core_netbsd.c    Tue Jan 07 04:46:02 2014 +0000
+++ b/sys/kern/core_netbsd.c    Tue Jan 07 07:59:03 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: core_netbsd.c,v 1.21 2014/01/03 21:12:18 dsl Exp $     */
+/*     $NetBSD: core_netbsd.c,v 1.22 2014/01/07 07:59:03 dsl Exp $     */
 
 /*
  * Copyright (c) 1997 Charles D. Cranor and Washington University.
@@ -45,7 +45,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: core_netbsd.c,v 1.21 2014/01/03 21:12:18 dsl Exp $");
+__KERNEL_RCSID(0, "$NetBSD: core_netbsd.c,v 1.22 2014/01/07 07:59:03 dsl Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_coredump.h"
@@ -133,7 +133,12 @@
         */
        CORE_SETMAGIC(cseg, CORESEGMAGIC, CORE_GETMID(cs->core), flag);
        cseg.c_addr = us->start;
-       cseg.c_size = us->end - us->start;
+
+       if (us->start == us->realend)
+               /* Not really wanted, but counted... */
+               cseg.c_size = 0;
+       else
+               cseg.c_size = us->end - us->start;
 
        error = coredump_write(cs->iocookie, UIO_SYSSPACE,
            &cseg, cs->core.c_seghdrsize);
diff -r c948a1587a8f -r 87a7610bad0e sys/uvm/uvm_coredump.c
--- a/sys/uvm/uvm_coredump.c    Tue Jan 07 04:46:02 2014 +0000
+++ b/sys/uvm/uvm_coredump.c    Tue Jan 07 07:59:03 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: uvm_coredump.c,v 1.5 2014/01/03 21:12:18 dsl Exp $     */
+/*     $NetBSD: uvm_coredump.c,v 1.6 2014/01/07 07:59:03 dsl Exp $     */
 
 /*
  * Copyright (c) 1997 Charles D. Cranor and Washington University.
@@ -62,7 +62,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: uvm_coredump.c,v 1.5 2014/01/03 21:12:18 dsl Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uvm_coredump.c,v 1.6 2014/01/07 07:59:03 dsl Exp $");
 
 /*
  * uvm_coredump.c: glue functions for coredump
@@ -186,10 +186,6 @@
                        }
                }
 
-               /* Ignore empty sections */
-               if (state.start == state.realend)
-                       continue;
-               
                vm_map_unlock_read(map);
                error = (*func)(&state);
                if (error)



Home | Main Index | Thread Index | Old Index