Mirror of the gdb mailing list
 help / color / mirror / Atom feed
From: Daniel Jacobowitz <drow@mvista.com>
To: Eli Zaretskii <eliz@is.elta.co.il>
Cc: gdb@sources.redhat.com
Subject: Re: RFC: Formatting of type output
Date: Thu, 06 Dec 2001 12:54:00 -0000	[thread overview]
Message-ID: <20011206155526.A11800@nevyn.them.org> (raw)
In-Reply-To: <1659-Thu06Dec2001224222+0200-eliz@is.elta.co.il>

On Thu, Dec 06, 2001 at 10:42:22PM +0200, Eli Zaretskii wrote:
> > Date: Thu, 6 Dec 2001 12:02:05 -0500
> > From: Daniel Jacobowitz <drow@mvista.com>
> > 
> > That means that, regrettably, they are formatted differently; it is closer
> > to the v2 demangler than to the v3 demangler, but different from both
> > (classes get prefixed by "class" even in C++, for example).
> 
> Could you please post a few examples how they are different?  It's
> hard to reason about this without seeing some live examples; I guess
> I don't know enough about this problem to figure this out myself.

Well, here's an example.  v2/stabs:
type = class Class {
  private:
    int xxx;

  public:
    Class & operator=(Class const &);
    Class(Class const &);
    Class(void);
}

v3/stabs (after some patches not yet submitted to eliminate duplicate
constructors):
(gdb) ptype Class
type = class Class {
  private:
    int xxx;

  public:
    Class & operator=(Class const&);
    void Class(Class const&);
    void Class();
}


Notice "const &" becomes "const&" and "(void)" becomes "()".

For v3/dwarf, though:
(gdb) ptype Class
type = class Class {
  private:
    int xxx;

  public:
    Class & operator=(Class const&);
    Class(class Class &);
    Class(void);
}

See the "class Class &"?  That's because Class::Class does not have a
DW_AT_mips_linkage_name, so we use the method argument printer.  class Class
is opaque when the constructor is defined (a bug causes us to have lost
"const" here, I'll fix it).  operator= is still going through the v3
demangler.

Worse, do it a second time in the same GDB session:
type = class Class {
  private:
    int xxx;

  public:
    Class & operator=(Class const&);
    Class(Class &);
    Class(void);
}

And now it matches some combination of the other two.  I'm still trying
to figure out how to suppress "class" properly.

And what I'm proposing is to use the method argument printer all the
time.  If we do that, as it stands now:

(gdb) ptype Class
type = class Class {
  private:
    int xxx;

  public:
    Class & operator=(class Class &);
    Class(Class &);
    Class(void);
}

Now the "class Class" bug shows up earlier, and had the qualifiers not
been trampled we would have gained a space in front of the & for
operator=.

> > Does anything mechanical depend on the format of type output, besides our
> > testsuite?
> 
> The documentation might include some examples which could need to be
> changed.  Obviously, this is not a grave problem, but since you
> asked...

I'll keep it in mind.

-- 
Daniel Jacobowitz                           Carnegie Mellon University
MontaVista Software                         Debian GNU/Linux Developer


  reply	other threads:[~2001-12-06 20:54 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-12-06  9:01 Daniel Jacobowitz
2001-12-06 12:43 ` Eli Zaretskii
2001-12-06 12:54   ` Daniel Jacobowitz [this message]
2001-12-06 13:41     ` Eli Zaretskii
2001-12-06  9:39 Michael Elizabeth Chastain
2001-12-06 12:42 ` Daniel Jacobowitz

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=20011206155526.A11800@nevyn.them.org \
    --to=drow@mvista.com \
    --cc=eliz@is.elta.co.il \
    --cc=gdb@sources.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