Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Fred Fish <fnf@specifix.com>
To: Daniel Jacobowitz <drow@false.org>
Cc: Jim Blandy <jimb@red-bean.com>,
	gdb-patches@sourceware.org, 	fnf@specifix.com
Subject: Re: [PATCH] Fix ptype problem printing typedefs defined differently in different compilation units
Date: Sat, 11 Feb 2006 20:01:00 -0000	[thread overview]
Message-ID: <200602111501.01801.fnf@specifix.com> (raw)
In-Reply-To: <20060211183500.GA25132@nevyn.them.org>

On Saturday 11 February 2006 13:35, Daniel Jacobowitz wrote:
> Don't you get a warning compiling this?

No, I was building without -O, for better debugging of gdb, and that produces
the warning:

  cc1: warning: -Wuninitialized is not supported without -O

for every file, which I ignore.  Building with -O does indeed produce a
warning about val being uninitialized.

> It looks to me like, with objectprint set, ptype and whatis will now
> blow up; they call value_rtti_target_type without initializing val.

Yup.  The fix would be to remove the test of type==NULL and always
initialize val, whether or not ptype_eval finds a type to print.

Apparently we don't have any test in the gdb testsuite that checks
using objectprint, as there we no regressions when I ran it after the
change.

> Also ptype will now do the RTTI lookup; I'm not sure whether it
> should or not.

Not sure either, now that you point it out.

> The documentation for whatis and ptype leaves me way unenlightened
> about what the difference between them is supposed to be; perhaps we
> should eliminate the difference.

Mainly it appears that ptype is expected to print the entire type,
while whatis simply prints the basic info.  I.E.

    (gdb) ptype afoo
    type = struct foo {
        int x;
        int y;
    }

    (gdb) whatis afoo
    type = struct foo
    (gdb)

If we want to keep ptype from doing the RTTI lookup when objectprint is
set, it's easy enough to revert the part of the patch that simplifies
ptype_command into a simple call to whatis_exp.  The meat of the change
that makes "ptype 'foo.c'::afoo" work is the change to ptype_eval to
add the test for an OP_VAR_VALUE expression.  We should probably still
keep the patch to whatis_exp, with the fix to avoid a NULL val of course,
so that both ptype and whatis can use the 'file'::typename syntax.

-Fred


  parent reply	other threads:[~2006-02-11 20:01 UTC|newest]

Thread overview: 38+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-01-03 20:17 Fred Fish
2006-01-03 23:15 ` Jim Blandy
2006-01-04  2:46   ` Fred Fish
2006-01-04  3:45     ` Jim Blandy
2006-01-04 11:15       ` Fred Fish
2006-01-04 21:04       ` Fred Fish
2006-01-05  0:21         ` Jim Blandy
2006-01-05  0:26         ` Jim Blandy
2006-01-05  0:54           ` Daniel Jacobowitz
2006-01-05  4:47             ` Jim Blandy
2006-01-15 18:48         ` Daniel Jacobowitz
2006-01-16  4:22           ` Jim Blandy
2006-01-23 15:27             ` Fred Fish
2006-01-23 16:12               ` Daniel Jacobowitz
2006-01-23 16:43                 ` Fred Fish
2006-01-23 19:17                   ` Jim Blandy
2006-01-23 19:35                     ` Fred Fish
2006-01-23 20:45                       ` Jim Blandy
2006-02-11  0:39                         ` Fred Fish
2006-02-11  0:39                         ` Fred Fish
2006-02-11 18:35                           ` Daniel Jacobowitz
2006-02-11 19:08                             ` Eli Zaretskii
2006-02-11 20:13                               ` Daniel Jacobowitz
2006-02-11 20:01                             ` Fred Fish [this message]
2006-02-11 20:21                               ` Daniel Jacobowitz
2006-02-12 18:49                                 ` Fred Fish
2006-02-14 14:11                                   ` Daniel Jacobowitz
2006-02-14 18:47                                     ` Fred Fish
2006-02-17  0:17                                     ` Fred Fish
2006-02-17  9:15                                       ` Eli Zaretskii
2006-02-17 13:36                                         ` Fred Fish
2006-02-17 20:32                                         ` Fred Fish
2006-02-18  9:27                                           ` Eli Zaretskii
2006-02-18 22:19                                       ` Daniel Jacobowitz
2006-02-20 15:47                                       ` Fred Fish
2006-02-20 16:23                                         ` Daniel Jacobowitz
2006-05-17 19:04                                           ` Fred Fish
2006-01-24 15:23                     ` [commit] " Fred Fish

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=200602111501.01801.fnf@specifix.com \
    --to=fnf@specifix.com \
    --cc=drow@false.org \
    --cc=gdb-patches@sourceware.org \
    --cc=jimb@red-bean.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