Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Tom Tromey <tromey@redhat.com>
To: Chris Moller <cmoller@redhat.com>
Cc: gdb-patches@sourceware.org
Subject: Re: beta patch for PR 9065
Date: Tue, 16 Feb 2010 22:25:00 -0000	[thread overview]
Message-ID: <m3635wizsd.fsf@fleche.redhat.com> (raw)
In-Reply-To: <4B7AE477.9060606@redhat.com> (Chris Moller's message of "Tue, 16 	Feb 2010 13:31:19 -0500")

>>>>> "Chris" == Chris Moller <cmoller@redhat.com> writes:

Chris> [Question: Internally, this patch is based on "sizeof" which actually
Chris> creates an int type that, in addition to just being printed, can be
Chris> used for stuff like "set <var> = sizeof(<whatever>)".  The gdb typeid
Chris> doesn't even try to create an analogue to a type_info class, it just
Chris> extracts the name from the appropriate type struct and creates a
Chris> cstring type from it.  Would it be good/essential for the
Chris> implementation to instantiate a real type_info class?  (That, I
Chris> suspect, will be a lot more work...)]

I think it is reasonably important to find the type_info.  Anything else
will yield results which violate the "cut and paste" rule.  E.g., the
user might have a function that takes a `const type_info&' argument.

It may be reasonable to require the user to have libstdc++ debuginfo
installed in order for this to work.  I would accept this as a first
patch (with the usual caveat that if new information arises, etc).

IIRC, the type_info object is stored in some vtable slot in the v3 ABI.
If that is in fact the case then we probably want a new cp-abi function
for this.  In this situation, IMO it is ok for the v2 variant to throw
an exception (or not be implemented, same difference).

One additional possible gotcha is making sure that gdb gives a sensible
error message if the user compiled with -fno-rtti.

Chris> +    {"typeid", TYPEID, OP_NULL, 0},

This is a C++ keyword, so the last field should be 1, not 0.

Chris> +static struct value *evaluate_subexp_for_typeid_type (struct expression *, int *);
Chris> +static struct value *evaluate_subexp_for_typeid_var (struct expression *, int *);

The new style is to put static functions above their uses so we don't
have to have forward declarations.

Tom


      parent reply	other threads:[~2010-02-16 22:25 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-02-16 18:31 Chris Moller
2010-02-16 21:53 ` Daniel Jacobowitz
2010-02-16 22:02   ` Chris Moller
2010-02-16 22:27   ` Tom Tromey
2010-02-16 22:57     ` Daniel Jacobowitz
2010-02-16 22:25 ` Tom Tromey [this message]

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=m3635wizsd.fsf@fleche.redhat.com \
    --to=tromey@redhat.com \
    --cc=cmoller@redhat.com \
    --cc=gdb-patches@sourceware.org \
    /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