Astolaf.150 net.unix-wizards utcsrgv!utzoo!decvax!ucbvax!mhtsa!harpo!floyd!houxi!ihnss!ihps3!stolaf!borman Tue Feb 23 19:07:10 1982 Re: Core -> a.out conversion program I just got undump to work on our system. We're running a fairly standard version of V7 on an 11/70. Three things that are on interest to everyone are 1) change the declarations of txtcnt and datacnt to unsigned. Failure to do so cause the program to blow up on large programs. 2) in copy_data(), a click to bit conversion should be done on u.u_tsize before adding it to datacnt. 3) type cast long onto the second arg. of the fseeks. The specific changes I made are as follows (sys/sto.h contains #define macros for our current version on UNIX*) Dave Borman !ihnss!ihuxl!stolaf!borman diff undump.orig undump.c 14a15,16 > #include > #include 18c20 --- > #include 21a24,30 > #define N_BADMAG(x) ( (x.a_magic != A_MAGIC1) && (x.a_magic != A_MAGIC2) &&\ > (x.a_magic != A_MAGIC3) && (x.a_magic != A_MAGIC4) &&\ > (x.a_magic != A_MAGIC5) && (x.a_magic != A_MAGIC6) ) > > #define N_TXTOFF(hdr) (sizeof hdr) > #define OMAGIC A_MAGIC1 /* Magic number of Writeable text file */ > #define UPAGES 020 95a105 > 97,99c107,112 ((hdr.a_magic != OMAGIC) && > (hdr.a_text != u.u_exdata.ux_tsize || > hdr.a_data != u.u_exdata.ux_dsize)) || > ((hdr.a_magic == OMAGIC) && > (hdr.a_data + hdr.a_text != u.u_exdata.ux_dsize)) || > hdr.a_entry != u.u_exdata.ux_entloc) 123c136 unsigned txtcnt = hdr.a_text; 125,126c138,139 fseek(new, (long)N_TXTOFF(hdr), 0); > fseek(a_out, (long)N_TXTOFF(hdr), 0); 130c143 fseek(a_out, (long)hdr.a_text, 1); /* skip over text */ 169c182 unsigned datacnt = ctob(u.u_dsize); 172,173c185,186 datacnt += ctob(u.u_tsize); > fseek(core, (long)ctob(UPAGES), 0); 212c225 fseek(a_out, (long)ohdr.a_data, 1); /* skip over data segment */ -------------------------- *UNIX is a Trademark of Bell Laboratories. ----------------------------------------------------------------- gopher://quux.org/ conversion by John Goerzen of http://communication.ucsd.edu/A-News/ This Usenet Oldnews Archive article may be copied and distributed freely, provided: 1. There is no money collected for the text(s) of the articles. 2. The following notice remains appended to each copy: The Usenet Oldnews Archive: Compilation Copyright (C) 1981, 1996 Bruce Jones, Henry Spencer, David Wiseman.