From: Philippe Waroquiers <philippe.waroquiers@skynet.be>
To: Tom Tromey <tom@tromey.com>, Joel Brobecker <brobecker@adacore.com>
Cc: gdb-patches@sourceware.org
Subject: Re: [RFAv2 1/3] Use function_name_style to print Ada and C function names
Date: Sat, 19 Jan 2019 12:11:00 -0000 [thread overview]
Message-ID: <1547899873.15869.5.camel@skynet.be> (raw)
In-Reply-To: <877ef2ncvy.fsf@tromey.com>
Thanks for the review.
On Thu, 2019-01-17 at 15:21 -0700, Tom Tromey wrote:
> > > > > > "Philippe" == Philippe Waroquiers <philippe.waroquiers@skynet.be> writes:
>
> Philippe> Note that ada-typeprint.c print_func_type is called with
> Philippe> types representing functions and is also called to print
> Philippe> a function NAME and its type. In such a case, the function
> Philippe> name will be printed using function name style.
>
> In this particular spot it still isn't clear to me if this will
> sometimes style a type name. So, I'm going to defer to Joel on the Ada
> bits.
Would be nice to have Joel confirming, but I am quite confident that
this will only style function names and not type names.
If that can help, here is some more detailed investigations:
First, in Ada, after the keywords procedure/function, and before
the arg list (as printed by print_func_type), you must put
a procedure/function name, no type name can be put there,
so GDB would produce real strange/invalid Ada such as:
procedure Some_Ada_Type_Name (Some_Arg : ...);
This explanation matches the comment of print_func_type:
/* Print function or procedure type TYPE on STREAM.  Make it a header
   for function or procedure NAME if NAME is not null.  */
Also, the type name of an Ada type is accessed via ada_type_name,
that accesses a member of TYPE containing the type name.
To the contrary: the NAME arg of print_func_type is received from
ada_print_type (the single caller of print_func_type),
that passes as NAME its VARSTRING arg.
There are only a few places where ada_print_type is called
with a non null VARSTRING arg, and these are for the names
of fields of record/unchecked unions.
ada_print_type is called (indirectly) by all calls to
print_type (dispatching on the language).
Doing a grep, I found only symtab.c:print_symbol_info
that calls type_print with a non
NULL/non "" VARSTRING arg,
and this piece of code gives "" when the symbol
is a TYPEDEF.
So, I really do not see how that piece of code could style
something else than a function/procedure name.
Thanks
Philippe
next prev parent reply other threads:[~2019-01-19 12:11 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-01-12 22:28 [RFAv2 0/3] Have GDB better styled 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 [this message]
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 2/3] Use address style to print addresses in breakpoint information 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
2019-02-12 13:27 ` Pedro Alves
2019-02-12 14:04 ` Ulrich Weigand
2019-02-12 14:32 ` Pedro Alves
2019-02-12 14:54 ` Ulrich Weigand
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=1547899873.15869.5.camel@skynet.be \
--to=philippe.waroquiers@skynet.be \
--cc=brobecker@adacore.com \
--cc=gdb-patches@sourceware.org \
--cc=tom@tromey.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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).