This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [patch] Cut memory address width
- 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, 27 Sep 2006 21:01:11 +0200 (CEST)
- Subject: Re: [patch] Cut memory address width
- References: <20060927161501.GA23340@host0.dyn.jankratochvil.net>
> Date: Wed, 27 Sep 2006 18:15:01 +0200
> From: Jan Kratochvil <jan.kratochvil@redhat.com>
>
> Hi,
>
> `x/x $ebx' on gdb/amd64 debugging inferior/i386 causes Cannot access memory at
> address 0xffffce70 (or so) as $ebx is considered `int' and sign-extended to
> 64-bit while the resulting address 0xffffffffffffce70 fails to be accessed.
>
> $esp does not exhibit this problem as it is `builtin_type_void_data_ptr' not
> `builtin_type_int' as $ebx is. Therefore it gets extended as unsigned.
We could change it into an unsigned type, but then "x /x -1" would
still fail, and a think the signed type is a bit more useful than an
unsigned type here.
> Simulate the part of paddress(); it is questionable how deep in the functions
> calling stack the address width cut should be.
Well, your proposed fix is defenitely the wrong place to do it.
This should almost certainly be handled in value.c:value_as_address().
You could add an i386-specific integer_to_address(), that would
truncate the address to 32 bits. But in fact, I can't think of a
reason why truncating to the size of a pointer shouldn't be the
default behaviour.
Mark