Re: [RFA 3/3] Make symtab.c better styled.

Philippe Waroquiers
2019-01-12T16:48:34Z

On Sat, 2019-01-12 at 09:26 -0700, Tom Tromey wrote:
> > > > > > "Philippe" == Philippe Waroquiers <philippe.waroquiers@skynet.be> writes:
>
> Philippe> 2019-01-10 Philippe Waroquiers <philippe.waroquiers@skynet.be>
> Philippe> * symtab.c (output_source_filename): Use file name style
> Philippe> to print file name.
> Philippe> (print_symbol_info): Likewise.
> Philippe> (print_msymbol_info): Use address style to print addresses.
>
> Thanks, this is ok.
>
> Philippe> + printf_filtered (" %s\n",
> Philippe> + MSYMBOL_PRINT_NAME (msymbol.minsym));
>
> I suppose this could look at the minsymbol type and use either the
> function or variable styling.
That looks relatively easy to do.
To differentiate between data and text, would the condition
inÂ expand_symtab_containing_pc be ok ?

i.e. variable styling would be used for data, i.e. :
(MSYMBOL_TYPE (msymbol.minsym) == mst_data
Â Â || MSYMBOL_TYPE (msymbol.minsym) == mst_bss
Â Â || MSYMBOL_TYPE (msymbol.minsym) == mst_abs
Â Â || MSYMBOL_TYPE (msymbol.minsym) == mst_file_data
Â Â || MSYMBOL_TYPE (msymbol.minsym) == mst_file_bss))

and function name styling would be used for the rest i.e.:
Â  mst_text, /* Generally executable instructions */
Â  mst_text_gnu_ifunc,Â Â Â Â Â Â Â Â Â Â Â /* Executable code returning address
Â Â Â of executable code */

Â  mst_data_gnu_ifunc, /* Executable code returning address
Â Â Â of executable code */

Â  mst_slot_got_plt, /* GOT entries for .plt sections */
Â  mst_solib_trampoline, /* Shared library trampoline code */
Â  mst_file_text, /* Static version of mst_text */

Philippe