Re: [rfa] Deprecate msymbol.info, add msymbol.bfd_symbol?

Michael Elizabeth Chastain
2003-10-11T20:22:41Z

ac says:

sym = lookup_minimal_symbol_by_pc (memaddr);
if (sym && sym->bfd_symbol is "elf like")
return (ELF_ST_TYPE (((elf_symbol_type *)
(sym->bfd_symbol))->internal_elf_sym.st_info) == STT_LOPROC)
else
return 0;

Okay, I see. The existing code has a hook in the symbol reader that
reads the bfd symbol and calls MSYMBOL_SET_SPECIAL to stash some bits in
msymbol.info for later. You would get rid of the hook or simplify and
just store a simple pointer in msymbol.bfd_symbol. Have I got that
right?

Sounds like a great idea to me. A bunch of squirrelly caching and
casting code would go away.

/* Pass symbol size field in via BFD. FIXME!!! */
size = ((elf_symbol_type *) sym)->internal_elf_sym.st_size;
msym = record_minimal_symbol_and_info
((char *) sym->name, symaddr,
ms_type, (void *) size, sym->section, objfile);

Yeah, for this code, you could either have msymbol.size or use the
information available from msymbol.bfd_symbol. Anything but
mysmbol.info.

> This could immediatly eliminate two of them. I think the coff version
> of ARM could also be eliminated if coffread (yea, right ... :-) fully
> utilized BFD.

I'm saying that this code is already dead:

gdb_assert (sizeof (void *) >= sizeof (cs->c_sclass));
msym = prim_record_minimal_symbol_and_info
(cs->c_name, tmpaddr, ms_type, (void *) (long) cs->c_sclass,
sec, NULL, objfile);

I'm not sure about these lines immediately after it:

if (msym)
COFF_MAKE_MSYMBOL_SPECIAL (cs->c_sclass, msym);

I think you are saying that coffread.c can be made to work using
the new fields. I don't know whether the existing code works or not,
I'm juse pointing to the deadness.

Michael C