From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 15164 invoked by alias); 27 Sep 2006 18:22:24 -0000 Received: (qmail 15155 invoked by uid 22791); 27 Sep 2006 18:22:23 -0000 X-Spam-Check-By: sourceware.org Received: from nevyn.them.org (HELO nevyn.them.org) (66.93.172.17) by sourceware.org (qpsmtpd/0.31.1) with ESMTP; Wed, 27 Sep 2006 18:22:17 +0000 Received: from drow by nevyn.them.org with local (Exim 4.54) id 1GSe2t-0001aX-Ia; Wed, 27 Sep 2006 14:22:11 -0400 Date: Wed, 27 Sep 2006 18:22:00 -0000 From: Daniel Jacobowitz To: Michael Snyder Cc: Jan Kratochvil , gdb-patches@sourceware.org Subject: Re: [patch] Cut memory address width Message-ID: <20060927182211.GB5635@nevyn.them.org> Mail-Followup-To: Michael Snyder , Jan Kratochvil , gdb-patches@sourceware.org References: <20060927161501.GA23340@host0.dyn.jankratochvil.net> <1159381222.9768.43.camel@localhost.localdomain> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1159381222.9768.43.camel@localhost.localdomain> User-Agent: Mutt/1.5.13 (2006-08-11) X-IsSubscribed: yes Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2006-09/txt/msg00195.txt.bz2 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