This is the mail archive of the mailing list for the GDB project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [RFA] valprint.c / *-valprint.c: Don't lose `embedded_offset'

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

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]