This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [RFA 5/6] Add validity bits for psymtab high and low fields
- From: Keith Seitz <keiths at redhat dot com>
- To: Tom Tromey <tom at tromey dot com>, gdb-patches at sourceware dot org
- Date: Fri, 1 Jun 2018 14:22:59 -0700
- Subject: Re: [RFA 5/6] Add validity bits for psymtab high and low fields
- References: <20180503223621.22544-1-tom@tromey.com> <20180503223621.22544-6-tom@tromey.com>
On 05/03/2018 03:36 PM, Tom Tromey wrote:
> Right now some psymtab code checks whether a psymtab's textlow or
> texthigh fields are valid by comparing against 0.
>
> I imagine this is mildly wrong in the current environment, but once
> psymtabs are relocated dynamically, it will no longer be correct,
> because it will be much more normal to see a psymtab with a textlow of
> zero -- this will just mean it appears at the start of the text
> section.
>
Also wrong if 0 is a valid address! [as a recent patch* serves to remind]
> This patch introduces validity bits to handle this situation more
> nicely, and changes users of the code to follow.
>
> ChangeLog
> 2018-05-03 Tom Tromey <tromey@redhat.com>
>
> * dbxread.c (end_psymtab): Use texthigh_valid and textlow_valid.
Does this line not also qualify for texthigh_valid:
if (PSYMTAB_TEXTHIGH (pst) == 0 && last_function_name
&& gdbarch_sofun_address_maybe_missing (gdbarch))
?
There's also this line in dbx_read_symtab that might qualify (from case N_SCOPE):
valu = nlist.n_value + last_function_start;
if (PSYMTAB_TEXTHIGH (pst) == 0 || valu > PSYMTAB_TEXTHIGH (pst))
SET_PSYMTAB_TEXTHIGH (pst, valu);
break;
Also in this function, can textlow_not_set be replaced by textlow_valid? [The same with the textlow_not_set parameter to dbx_end_psymtab?]
> * mdebugread.c (parse_partial_symbols): Use textlow_valid.
> (psymtab_to_symtab_1): Use texthigh_valid and textlow_valid.
> * psympriv.h (struct partial_symtab) <textlow_, texthigh_>: Update
> comment.
> <textlow_valid, texthigh_valid>: New fields.
> (set_psymtab_textlow, set_psymtab_texthigh): New inline functions.
> (SET_PSYMTAB_TEXTLOW, SET_PSYMTAB_TEXTHIGH): Redefine.
> * xcoffread.c (scan_xcoff_symtab): Use textlow_valid.
Otherwise, this all LGTM (IANAM).
Keith
* https://sourceware.org/ml/gdb-patches/2018-05/msg00325.html