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

Jan Kratochvil
2009-04-29T20:45:55Z

On Wed, 29 Apr 2009 22:29:16 +0200, Jan Kratochvil wrote:
> 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.

That's not true, even gdb.i386 has sizeof (CORE_ADDR) == 8. But the behavior
is as described.

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

Sorry,
Jan