comparison dynodump/dynodump.c @ 2:ac2d302a0011 r19-15b2

Import from CVS: tag r19-15b2
author cvs
date Mon, 13 Aug 2007 08:46:35 +0200
parents 376386a54a3c
children 131b0175ea99
comparison
equal deleted inserted replaced
1:c0c6a60d29db 2:ac2d302a0011
71 * modification that occured during the applications execution. 71 * modification that occured during the applications execution.
72 * 72 *
73 * N.B. The above commentary is not quite correct in the flags have been hardwired 73 * N.B. The above commentary is not quite correct in the flags have been hardwired
74 * to RTLD_SAVREL. 74 * to RTLD_SAVREL.
75 */ 75 */
76 #pragma ident "@(#) $Id: dynodump.c,v 1.1.1.1 1996/12/18 03:37:22 steve Exp $ - SMI" 76 #pragma ident "@(#) $Id: dynodump.c,v 1.1.1.2 1996/12/18 03:48:00 steve Exp $ - SMI"
77 77
78 #include <sys/param.h> 78 #include <sys/param.h>
79 #include <sys/procfs.h> 79 #include <sys/procfs.h>
80 #include <fcntl.h> 80 #include <fcntl.h>
81 #include <stdio.h> 81 #include <stdio.h>
97 { 97 {
98 fprintf(stderr, "%s: %s\n", str, elf_errmsg(elf_errno())); 98 fprintf(stderr, "%s: %s\n", str, elf_errmsg(elf_errno()));
99 return (1); 99 return (1);
100 } 100 }
101 101
102 int dynodump (const char * file);
102 int 103 int
103 dynodump(const char * file) 104 dynodump(const char * file)
104 { 105 {
105 Elf *ielf, *oelf; 106 Elf *ielf, *oelf;
106 Ehdr *iehdr, *oehdr; 107 Ehdr *iehdr, *oehdr;
226 227
227 /* 228 /*
228 * Traverse each section from the input file. 229 * Traverse each section from the input file.
229 */ 230 */
230 for (ndx = 1, scn = 0; 231 for (ndx = 1, scn = 0;
231 _icache->c_scn = elf_nextscn(ielf, scn); 232 (_icache->c_scn = elf_nextscn(ielf, scn));
232 ndx++, scn = _icache->c_scn, _icache++) { 233 ndx++, scn = _icache->c_scn, _icache++) {
233 234
234 if ((_icache->c_shdr = shdr = elf_getshdr(_icache->c_scn)) == NULL) 235 if ((_icache->c_shdr = shdr = elf_getshdr(_icache->c_scn)) == NULL)
235 return (elferr("elf_getshdr")); 236 return (elferr("elf_getshdr"));
236 237
466 * Traverse each section from the input file rebuilding the section 467 * Traverse each section from the input file rebuilding the section
467 * header string table as we go. 468 * header string table as we go.
468 */ 469 */
469 _ndx = _addr = 0; 470 _ndx = _addr = 0;
470 for (ndx = 1, scn = 0; 471 for (ndx = 1, scn = 0;
471 _ocache->c_scn = elf_nextscn(oelf, scn); 472 (_ocache->c_scn = elf_nextscn(oelf, scn));
472 ndx++, scn = _ocache->c_scn, _ocache++, _icache++) { 473 ndx++, scn = _ocache->c_scn, _ocache++, _icache++) {
473 474
474 const char *strs; 475 const char *strs;
475 476
476 if (_icache == heap_cache) { 477 if (_icache == heap_cache) {