public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Philippe Waroquiers <philippe.waroquiers@skynet.be>
To: Tom Tromey <tromey@adacore.com>, Keith Seitz <keiths@redhat.com>
Cc: gdb-patches@sourceware.org
Subject: Re: [PATCH] Allow 'ptype/o' for assembly
Date: Fri, 11 Nov 2022 20:50:23 +0100	[thread overview]
Message-ID: <9767e2c450d88795f0a2c47e3c4b78681447bfd9.camel@skynet.be> (raw)
In-Reply-To: <87tu382llr.fsf@tromey.com>

On Wed, 2022-11-09 at 08:28 -0700, Tom Tromey via Gdb-patches wrote:
> > > PR exp/28359 points out that 'ptype/o' does not work when the current
> > > language is "asm".
> 
> Keith> I hesitate to bring this up, but...
> 
> Keith> Why would the current language matter in this case?
> Keith> [I understand that the print options are set before
> Keith> the expression is evaluated...]
> 
> Keith> Since we have the type of the symbol, couldn't we
> Keith> simply use that? Maybe it's not worth being so
> Keith> pedantic?
> 
> Ordinarily this would be fine, but for non-C languages it's sometimes
> useful to "set lang c" and see what the C type-printer thinks.  For
> example, in Ada there are "fat pointers" that are really just a kind of
> struct.  Ada will always print these as ordinary access types, but it
> can be handy to look under the hood and see that it's really a struct
> type.
> 
> Maybe there's some better way to do this kind of thing.  Like we could
> add "ptype/c" for "C style printing".
At work, I relatively often use ptype/o for Ada types.
As it only works in C mode, as part of our zillions of site aliases,
we have added:
  alias Wc = with language c -- with annotate 0 --
(where annotate 0 avoids spurious language switch messages in the output).

So, waiting for Adacore to implement ptype/o for Ada (hint hint :)),
we use e.g.  
  (gdb) Wc ptype/o sometype

Of course, as the type will be searched in C mode, we have to use the
"underlying" type name e.g.   This_Is_A_Package__This_Is_The_Ada_Type
instead of This_Is_A_Package.This_Is_The_Ada_Type

Of course, Wc will work with whatever you want to do with C language temporarily set.
(thanks again to Pedro for the "with" implementation).

Thanks
Philippe



  reply	other threads:[~2022-11-11 19:50 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-08 20:14 Tom Tromey
2022-11-08 21:19 ` Keith Seitz
2022-11-09 15:28   ` Tom Tromey
2022-11-11 19:50     ` Philippe Waroquiers [this message]
2022-11-14 13:32       ` Tom Tromey
2022-11-14 20:05         ` Philippe Waroquiers
2022-11-09 14:47 ` Andrew Burgess

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=9767e2c450d88795f0a2c47e3c4b78681447bfd9.camel@skynet.be \
    --to=philippe.waroquiers@skynet.be \
    --cc=gdb-patches@sourceware.org \
    --cc=keiths@redhat.com \
    --cc=tromey@adacore.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).