25 |
* SUCH DAMAGE. |
* SUCH DAMAGE. |
26 |
* |
* |
27 |
* |
* |
28 |
* $Id: file_aout.c,v 1.2 2007/04/19 15:18:16 debug Exp $ |
* $Id: file_aout.c,v 1.4 2007/06/17 23:32:20 debug Exp $ |
29 |
* |
* |
30 |
* a.out file support. |
* COMMENT: a.out executable file support |
31 |
*/ |
*/ |
32 |
|
|
33 |
/* Note: Included from file.c. */ |
/* Note: Included from file.c. */ |
173 |
off_t oldpos; |
off_t oldpos; |
174 |
|
|
175 |
debug("symbols: %i bytes @ 0x%x\n", symbsize, (int)ftello(f)); |
debug("symbols: %i bytes @ 0x%x\n", symbsize, (int)ftello(f)); |
176 |
syms = malloc(symbsize); |
CHECK_ALLOCATION(syms = malloc(symbsize)); |
|
if (syms == NULL) { |
|
|
fprintf(stderr, "out of memory\n"); |
|
|
exit(1); |
|
|
} |
|
177 |
len = fread(syms, 1, symbsize, f); |
len = fread(syms, 1, symbsize, f); |
178 |
if (len != symbsize) { |
if (len != symbsize) { |
179 |
fprintf(stderr, "error reading symbols from %s\n", |
fprintf(stderr, "error reading symbols from %s\n", |
186 |
strings_len = ftello(f) - oldpos; |
strings_len = ftello(f) - oldpos; |
187 |
fseek(f, oldpos, SEEK_SET); |
fseek(f, oldpos, SEEK_SET); |
188 |
debug("strings: %i bytes @ 0x%x\n", strings_len,(int)ftello(f)); |
debug("strings: %i bytes @ 0x%x\n", strings_len,(int)ftello(f)); |
189 |
string_symbols = malloc(strings_len); |
CHECK_ALLOCATION(string_symbols = malloc(strings_len)); |
|
if (string_symbols == NULL) { |
|
|
fprintf(stderr, "out of memory\n"); |
|
|
exit(1); |
|
|
} |
|
190 |
fread(string_symbols, 1, strings_len, f); |
fread(string_symbols, 1, strings_len, f); |
191 |
|
|
192 |
aout_symbol_ptr = (struct aout_symbol *) syms; |
aout_symbol_ptr = (struct aout_symbol *) syms; |