Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Pedro Alves <pedro@codesourcery.com>
To: gdb-patches@sourceware.org
Cc: Tom Tromey <tromey@redhat.com>, Joel Brobecker <brobecker@adacore.com>
Subject: Re: [RFA] valprint.c / *-valprint.c: Don't lose `embedded_offset'
Date: Mon, 18 Oct 2010 12:14:00 -0000	[thread overview]
Message-ID: <201010181314.00657.pedro@codesourcery.com> (raw)
In-Reply-To: <201010072025.07762.pedro@codesourcery.com>

On Thursday 07 October 2010 20:25:07, Pedro Alves wrote:
> > I think we should just get rid of val_print entirely, and only have
> > value_print, passing around values.  If that is not efficient enough
> > (too much copying or something), we can change struct value to make it
> > efficient.
> > 
> > What do you think of that?
> 
> Should be possible.  Actually, I did go one step further, because it
> occured to me that I might as well add an assertion to val_print that
> valaddr is in fact always equal to value->contents.  See patch below
> that applies on top of yesterday's.  I don't know why that didn't occur
> to me sooner.  :-)  This passes regression testing as well.
> 
> So, the steps I guess would be:
> 
>  - apply yesterday's and this patch.
> 
>  - add an assertion to val_print forbidding a NULL struct value, and
>    fix all callers to make sure to construct a value.  Not sure how
>    many there are, might not be that many.  I now that "info reg" is
>    one case.

Just FYI, found out that it made my life easier to do this step as well.
I also added a bunch of "valaddr == value->contents" assertions throughout
all of *-valprint.c.  There weren't that many cases that needed fixing.

>  - get rid of valaddr and address from all the val_print methods,
>    getting at the contents of the passed in value instead.  It's also
>    nice to get rid of the `address' parameter, because not all values
>    actually have a notion of value.  Currently, passing around an
>    address is an abstraction violation.
> 
>  - investigate whether passing an offset around is cool, or whether
>    we need something like a new value type that provides a view into
>    another value, and pass that around instead?

-- 
Pedro Alves


      reply	other threads:[~2010-10-18 12:14 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-10-07  1:07 Pedro Alves
2010-10-07 18:13 ` Tom Tromey
2010-10-07 19:25   ` Pedro Alves
2010-10-18 12:14     ` Pedro Alves [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=201010181314.00657.pedro@codesourcery.com \
    --to=pedro@codesourcery.com \
    --cc=brobecker@adacore.com \
    --cc=gdb-patches@sourceware.org \
    --cc=tromey@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