From: Philippe Waroquiers <philippe.waroquiers@skynet.be>
To: Pedro Alves <palves@redhat.com>, gdb-patches@sourceware.org
Subject: Re: [RFAv2 3/3] Make symtab.c better styled.
Date: Sat, 09 Feb 2019 10:36:00 -0000 [thread overview]
Message-ID: <1549708558.12345.4.camel@skynet.be> (raw)
In-Reply-To: <393f2825-8cc8-b71a-4e61-1edfd944cb84@redhat.com>
On Thu, 2019-02-07 at 18:58 +0000, Pedro Alves wrote:
> On 01/12/2019 10:28 PM, Philippe Waroquiers wrote:
>
> > @@ -4667,8 +4685,15 @@ print_msymbol_info (struct bound_minimal_symbol msymbol)
> > else
> > tmp = hex_string_custom (BMSYMBOL_VALUE_ADDRESS (msymbol),
> > 16);
> > - printf_filtered ("%s %s\n",
> > - tmp, MSYMBOL_PRINT_NAME (msymbol.minsym));
> > + fputs_styled (tmp, address_style.style (), gdb_stdout);
> > + fputs_filtered (" ", gdb_stdout);
> > + if (msymbol_type_text_p (msymbol))
> > + fputs_styled (MSYMBOL_PRINT_NAME (msymbol.minsym),
> > + function_name_style.style (),
> > + gdb_stdout);
> > + else
> > + fputs_filtered (MSYMBOL_PRINT_NAME (msymbol.minsym), gdb_stdout);
> > + fputs_filtered ("\n", gdb_stdout);
>
> Should this use the existing msymbol_is_function instead?
That is a good question. Note that there was a v3 where
if (msymbol_type_text_p (msymbol))
is replaced by
if (msymbol.minsym->text_p ())
The below summarizes the behavior difference if we change the patch
to rather use msymbol_is_function instead of msymbol.minsym->text_p ():
                            patch   msymbol_is_function
                            -----   -------------------
 mst_unknown
 mst_text,     text_p  function
 mst_text_gnu_ifunc,       text_p  function
 mst_data_gnu_ifunc,     text_p  maybe
 mst_slot_got_plt,     text_p  maybe
 mst_data,                 data_p  maybe
 mst_bss,     data_p  maybe
 mst_abs,     data_p  maybe
 mst_solib_trampoline,     text_p  function
 mst_file_text,     text_p  function
 mst_file_data,     data_p  maybe
 mst_file_bss,     data_p  maybe
 nr_minsym_types
The 'patch' first colummn indicates how the patch classifies a
msymbol type.  The 'msymbol_is_function' describes the behaviour
if msymbol_is_function is used instead of 'text_p'.
maybe indicates msymbol_is_function returns True if the msymbol address
can be converted to a different address using
gdbarch_convert_from_func_ptr_addr.
When trying to use msymbol_is_function, I however do not see
any difference of behavior on debian/amd64with a small executable.
The logic I used for the patch was: there are already 2 places
that define the set of msymbol types that are data, so I assumed
the rest was text, and the resulting type set looked plausible.
It is however somewhat bizarre to have msymbol_is_function that
will sometime say that data is a function (and then 'gives back'
another address than the msymbol address).
So, not very clear which one is better/correct, as this msymbol
concept is not very clear to me, and I see no
difference of behavior to decide which one looks better.
Thanks
Philippe
next prev parent reply other threads:[~2019-02-09 10:36 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-01-12 22:28 [RFAv2 0/3] Have GDB " Philippe Waroquiers
2019-01-12 22:28 ` [RFAv2 2/3] Use address style to print addresses in breakpoint information Philippe Waroquiers
2019-01-12 22:28 ` [RFAv2 1/3] Use function_name_style to print Ada and C function names Philippe Waroquiers
2019-01-17 22:21 ` Tom Tromey
2019-01-19 12:11 ` Philippe Waroquiers
2019-01-26 6:21 ` Joel Brobecker
2019-01-26 11:04 ` Philippe Waroquiers
2019-01-29 20:34 ` Philippe Waroquiers
2019-01-12 22:28 ` [RFAv2 3/3] Make symtab.c better styled Philippe Waroquiers
2019-01-17 22:25 ` Tom Tromey
2019-02-07 18:58 ` Pedro Alves
2019-02-09 10:36 ` Philippe Waroquiers [this message]
2019-02-12 13:27 ` Pedro Alves
2019-02-12 14:04 ` Ulrich Weigand
2019-02-12 14:32 ` Pedro Alves
[not found] <20190212145443.E2799D8028D@oc3748833570.ibm.com>
2019-02-12 15:53 ` Pedro Alves
2019-02-12 18:41 ` Philippe Waroquiers
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1549708558.12345.4.camel@skynet.be \
--to=philippe.waroquiers@skynet.be \
--cc=gdb-patches@sourceware.org \
--cc=palves@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox