Re: 8-byte register values on a 32-bit machine

Mark Kettenis
2003-03-01T13:35:56Z

Michael Elizabeth Chastain <mec@shout.net> writes:

> I saw a regression in gdb.base/store.exp this week:
>
> gdb.base/store.exp: new check struct 4
> PASS -> FAIL
>
> This happens with gcc 2.95.3 -gdwarf-2.
>
> This happens because gcc 2.95.3 puts an 8-byte variable into a pair of
> 4-byte registers. (gcc 3.2.2 puts the variable into memory so the
> problem never arises -- but I bet it will come back for things like
> FORTRAN complex numbers, which are very natural for register pairs).

Please see the thread starting with:

http://sources.redhat.com/ml/gdb/2003-02/msg00007.html

for a related discussion.

> But I suspect that gcc 2.95.3 tells us about just one register and that
> we can't win. But gdb can at least say "hmmm, you are trying to print 8
> bytes from reg0, I can't do that", rather than print 4 bytes of correct
> information and 4 bytes of rat poison. I think that would be acceptable
> support for 2.95.3.

Yup, that's defenitely what it does for stabs, and from looking at the
code, it does it for other debug formats as well (including dwarf-2).
Right now, GDB interprets this as that the variable is stored in
consecutive registers starting at the register number indicated by the
debug info. I have a strong suspicion that there are several GDB
targets that rely on this behaviour. However, it isn't working for
the i386 since GCC allocates the registers in an order that's
different from the order that GDB uses.