This is the mail archive of the
gdb-patches@sources.redhat.com
mailing list for the GDB project.
Re: [rfa] lookup_symbol_aux_minsym
Elena Zannoni <ezannoni@redhat.com> writes:
> David Carlton writes:
> > Here's the part of my previous lookup_symbol_aux patch where I combine
> > the two versions of the minsym code into a single function
> > lookup_symbol_aux_minsym. I've tried to mimic the current flow of
> > control as exactly as possible: in particular, this code is run at a
> > different time in HPUXHPPA situations than in other situations, and I
> > preserved the weird circumstances in which the minsym check might lead
> > to a NULL return. (I'm not sure either of those is a good idea, but
> > that's a matter for a separate patch.)
> >
> > Here are the differences between the two versions of the minsym code
> > in the current version of lookup_symbol_aux.
> >
> > * The comments differ, to some extent: I picked whichever version of
> > the comment I liked more.
> >
> > * The non-HP code has
> >
> > s = find_pc_sect_symtab (SYMBOL_VALUE_ADDRESS (msymbol),
> > SYMBOL_BFD_SECTION (msymbol));
> >
> > where the HP code has
> >
> > s = find_pc_symtab (SYMBOL_VALUE_ADDRESS (msymbol));
> >
> > Both seem fine to me; I picked the former, but I don't have a strong
> > feeling about this.
> >
>
> Some random comments....
>
>
> I don't know about this. find_pc_symtab calls find_pc_sect_symtab with
> NULL as section parameter, unless there are overlays involved. I
> don't know if it would make a difference, but it seems that it would
> in case of overlays, because finding the section is a bit more involved.
> Maybe we should adopt the other approach? I.e. use the
>
> s = find_pc_symtab (SYMBOL_VALUE_ADDRESS (msymbol));
>
> What do you think?
Actually, I'm pretty sure we're supposed to use find_pc_sect_symtab.
The non-'sect' version is just for cases where we don't know the
section associated with the address --- when we do know the section,
we should provide it, so find_pc_sect_symtab can do clever
overlay-related things. Since we're starting with a linker symbol, we
definitely know the section, and we should pass that along.