This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [patch] Fix i386 memory-by-register access on amd64
- From: Mark Kettenis <mark dot kettenis at xs4all dot nl>
- To: jan dot kratochvil at redhat dot com
- Cc: gdb-patches at sourceware dot org
- Date: Wed, 29 Apr 2009 21:04:33 +0200 (CEST)
- Subject: Re: [patch] Fix i386 memory-by-register access on amd64
- References: <20090429102719.GA10117@host0.dyn.jankratochvil.net>
> Date: Wed, 29 Apr 2009 12:27:19 +0200
> From: Jan Kratochvil <jan.kratochvil@redhat.com>
>
> Hi,
>
> original bugreport:
> https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=181390
>
> (gdb) x/x $esp
> 0xffffce70: 0x00000001
> (gdb) x/x $ebx
> 0xffffce70: Cannot access memory at address 0xffffce70
> (gdb) x/x 0xffffce70
> 0xffffce70: 0x00000001
>
> One point is there should have been printed this error message instead:
> 0xffffffffffffce70: Cannot access memory at address 0xffffffffffffce70
> but this problem is just a consequence of paddress() truncating the printed
> address width. This printing issue is unrelated to the patch below.
>
> The error happens because $ebx is considered signed while $esp unsigned, as
> initialized by i386_register_type (or also amd64_register_type). Therefore
> the address width should be cut to the right size at the right point of
> processing, I hope I caught (one of) such points.
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.
> 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?