Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Daniel Jacobowitz <drow@false.org>
To: Paul Pluzhnikov <ppluzhnikov@google.com>
Cc: gdb-patches@sourceware.org
Subject: Re: [RFA] Patch for PR gdb/2477
Date: Mon, 14 Jul 2008 17:43:00 -0000	[thread overview]
Message-ID: <20080714174245.GA9888@caradoc.them.org> (raw)
In-Reply-To: <20080714173149.A03E63A67B4@localhost>

On Mon, Jul 14, 2008 at 10:31:49AM -0700, Paul Pluzhnikov wrote:
> Greetings,
> 
> Attached patch fixes error in printing NULL pointers when "set print object on".
>  http://sourceware.org/cgi-bin/gnatsweb.pl?cmd=view&database=gdb&pr=2477
> and adds a test case for it.
> 
> Ok to commit?

Thanks for fixing this.  The patch isn't OK, but it points to the
right solution so we can get it fixed up in no time.  The test is OK.

> @@ -89,7 +89,8 @@ value_virtual_fn_field (struct value **a
>  struct type *
>  value_rtti_type (struct value *v, int *full, int *top, int *using_enc)
>  {
> -  if ((current_cp_abi.rtti_type) == NULL)
> +  if ((current_cp_abi.rtti_type) == NULL
> +      || VALUE_ADDRESS (v) == 0)
>      return NULL;
>    return (*current_cp_abi.rtti_type) (v, full, top, using_enc);
>  }

There's nothing special about zero.  It's just an unreadable memory
address; the same problem will reappear with any other invalid
pointer.  So what we need is to catch memory errors.  There's no way
at present to separate them from other errors, but that's not a big
problem.

So if we use TRY_CATCH and RETURN_MASK_ERROR around the call to
current_cp_abi.rtti_type, we can return NULL in the error case.

-- 
Daniel Jacobowitz
CodeSourcery


  reply	other threads:[~2008-07-14 17:43 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-07-14 17:32 Paul Pluzhnikov
2008-07-14 17:43 ` Daniel Jacobowitz [this message]
2008-07-14 18:12   ` Paul Pluzhnikov
2008-07-14 18:21     ` Daniel Jacobowitz
2008-07-14 18:30       ` Paul Pluzhnikov
2008-07-15 18:52     ` Ulrich Weigand
2008-07-15 19:03       ` Daniel Jacobowitz
2008-07-15 19:16         ` Paul Pluzhnikov
2008-07-15 20:04           ` Ulrich Weigand
2008-07-15 19:04       ` Paul Pluzhnikov

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=20080714174245.GA9888@caradoc.them.org \
    --to=drow@false.org \
    --cc=gdb-patches@sourceware.org \
    --cc=ppluzhnikov@google.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