Re: [patch] Fix i386 memory-by-register access on amd64

Jan Kratochvil
2009-04-29T20:29:32Z

On Wed, 29 Apr 2009 21:04:33 +0200, Mark Kettenis wrote:
> I'm not sure this is the right solution. On 64-bit machines where
> addresses are signed I think we actually want the sign extension to
> happen.

While not trying to judge what is right or wrong:

I believe gdb.x86_64 debugging gdb.i386 inferior should behave exactly as
gdb.i386 debugging gdb.i386 inferior.

As gdb.i386 already has sizeof (CORE_ADDR) == 4 I find right that gdb.x86_64
with i386 inferior should cut CORE_ADDR whenever possible.

Otherwise we should fix gdb.i386 to also error on this (current behavior) case:
(gdb) x/x 0xfffffffff7ffcfc4
0xf7ffcfc4: 0x00020efc

> > 2006-09-28 Jan Kratochvil <jan.kratochvil@redhat.com>
> >
> > Fix signed 32bit inferior registers on 64bit GDB.
> > * gdb/value.c (value_as_address): Make it static, rename it to ...
> > (value_as_address1): ... this function.
> > (value_as_address): New function.
>
> What is your motiviation for using a wrapper function?

As value_as_address is a long function with many `return' commands. But I do
not have any strong opinion on it - would you like to fill a variable and
using a single exit path which would cut the result width?

Thanks,
Jan