From: Joel Brobecker <brobecker@adacore.com>
To: Philippe Waroquiers <philippe.waroquiers@skynet.be>
Cc: Tom Tromey <tom@tromey.com>, gdb-patches@sourceware.org
Subject: Re: [RFAv2 1/3] Use function_name_style to print Ada and C function names
Date: Sat, 26 Jan 2019 06:21:00 -0000 [thread overview]
Message-ID: <20190126062147.GA26587@adacore.com> (raw)
In-Reply-To: <1547899873.15869.5.camel@skynet.be>
> > 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.
I reviewed the situation, and I think Philippe is right in the sense
that when this function is called with a name, it's an actual function's
name.
When one declares a function type in Ada, it has to be an access
type (the Ada equivalent of a pointer). And the target (function)
declaration is anonymous. This is what it looks like:
type FA is access procedure (A : System.Address);
So, while the access type has a name ("FA"), the function type
itself does not. From there, the only way I could see that
the function might be called with a name is if it is given
a symbol which is a procedure (not an access to that symbol).
In that case, it would be legitimate to stylize the name as
a function name. But in practice, it's hard to make GDB call
that function with a name, because you can't really put
the function name within an Ada expression without taking
it's address (in Ada, this is a parameterless function call).
The only way I could find that allowed me to trigger this function
call with a non-NULL name was with "maintenance print symbols FILENAME".
In that situation, we're back to the reasoning above that function
types have no name unless they are tied to a real function, and
thus "name" seems to always represent a function name.
With all that, I'm wondering if Philippe had other examples
where he can demonstrate the usefulness of this patch.
At the moment, if the maintenance command is the only case,
knowing that the output gets sent to a file, rather than
stdout, and thus should not be stylized, are there other
situations I couldn't think of where this patch would be
useful?
--
Joel
next prev parent reply other threads:[~2019-01-26 6:21 UTC|newest]
Thread overview: 15+ 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 3/3] Make symtab.c " 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-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 [this message]
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
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=20190126062147.GA26587@adacore.com \
--to=brobecker@adacore.com \
--cc=gdb-patches@sourceware.org \
--cc=philippe.waroquiers@skynet.be \
--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