This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [RFA][2/5] New port: Cell BE SPU (valops.c fix)
- From: "Mark Kettenis" <mark dot kettenis at xs4all dot nl>
- To: "Ulrich Weigand" <uweigand at de dot ibm dot com>
- Cc: "Daniel Jacobowitz" <drow at false dot org>, gdb-patches at sourceware dot org
- Date: Thu, 23 Nov 2006 20:59:08 +0100 (CET)
- Subject: Re: [RFA][2/5] New port: Cell BE SPU (valops.c fix)
- References: <200611231755.kANHt6g2013138@d12av02.megacenter.de.ibm.com>
> Daniel Jacobowitz wrote:
>
> > I suppose there's times we want to destroy the rest of the register,
> > so knowing where it is in the register isn't enough?
>
> The problem is, we don't *know* where it is in the register.
>
> For example, on the SPU "char" values are placed in byte 3 of
> the 16 bytes of a general purpose register, "short" values are
> placed in bytes 2 and 3, and "int" values are placed in bytes
> 0 .. 3. ("long long" is placed in 0 .. 7.)
>
> However, structs are placed into registers starting from
> byte 0 always.
Which is the same way as structs are stored in memory isn't it?
> So if we have
>
> struct { char x; char y; char z; char w; } s;
> char t;
>
> and both s and t reside in registers, then a value to access
> t would look exactly the same as a value to access s.x (i.e.
> type "char", lval_regnum, value_offset == 0), but to access
> them requires using different bytes of the register.
I actually think the problem is that you're thinking that s.x lives in
a register where it is actually s itself that lives in that register.
So VALUE_TO_REGISTER should be called for the struct itself, not its
char member.
Mark