This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [patch] Cut memory address width


> 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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]