* reading elf file (avr target)
@ 2006-04-11 16:37 diz rael
2006-04-25 17:31 ` Nick Clifton
0 siblings, 1 reply; 2+ messages in thread
From: diz rael @ 2006-04-11 16:37 UTC (permalink / raw)
To: binutils
I'm trying to get the symbol table out of an object
file. I built libbfd from binutils 2.16.1 (tried 2.15
as well) using --enable-target=avr
--enable-install-libbfd, etc. For some reason it does
not read the sym table correctly and the number of
syms seems wrong (ridiculously large). Dereferencing
any element of the symtab raises a seg. fault. Any
ideas as to why this is happening? The weird thing is
that this code used to work for me before a year ago!
- had an earlier version of the toolchain then.
main program:
vmobj = load_obj(obj_name);
...
nvmsym = get_stab(vmobj, &vmstab);
-------------
bfd *load_obj(char *f)
{
bfd *file;
file = bfd_openr(f, "binary");
if (!file || bfd_check_format(file, bfd_object) ==
0 || bfd_get_file_flags(file) & HAS_SYMS == 0)
return NULL;
return file;
}
int get_stab(bfd *file, asymbol ***stab)
{
long storage;
int nsym;
storage = bfd_get_symtab_upper_bound(file);
if (storage < 0)
return UNKNOWN_SYMTAB_SIZE;
*stab = (asymbol **) malloc(storage *
sizeof(**stab));
nsym = bfd_canonicalize_symtab(file, *stab); //
MESSES UP HERE. nsym IS HUGE AND *STAB ENTRIES ARE
INVALID
return nsym;
}
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2006-04-25 17:12 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-04-11 16:37 reading elf file (avr target) diz rael
2006-04-25 17:31 ` Nick Clifton
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).