[unix-pc.general] What's in a core file?

brant@manta.UUCP (Brant Cheikes) (05/29/88)

I'm working on undump: it takes an a.out plus a core dump and creates
a new executable image (why is not germane here).  I need to know the
format of a core file -- the core(4) man page is useless, as usual.  I
especially need to know how to read out the user structure (defined in
<sys/user.h>) from the core file.  Attempts to simply:

   /*
    * code swatch
    */
   struct user u;
   FILE *cfp;

   cfp = fopen("core","r");
   fread(&u, sizeof u, 1, cfp);

have failed.  The resulting u is mostly zeros.  Is there anyone out
there who knows how to read core files and could offer some assistance
here?
-- 
Brant Cheikes
University of Pennsylvania
Department of Computer and Information Science
ARPA: brant@linc.cis.upenn.edu, UUCP: ...drexel!manta!brant