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


On Wed, Sep 27, 2006 at 11:20:22AM -0700, Michael Snyder wrote:
> On Wed, 2006-09-27 at 18:15 +0200, Jan Kratochvil wrote:
> > 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.
> > 
> > Simulate the part of paddress(); it is questionable how deep in the functions
> > calling stack the address width cut should be.
> 
> Yes, but I think the assumption is that esp is most commonly used 
> to hold an address, while ebx is most commonly used to hold an integer.
> Hence the default types.
> 
> I would tend to say that what the user should do is use an explicit
> cast.  As is, he is using an implicit cast and not getting what he
> expects.

What's interesting is why this behavior is different on x86_64 and
i386.  Where are we doing the sign extension - that's probably where it
should be fixed, if anywhere.


-- 
Daniel Jacobowitz
CodeSourcery


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