From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 7436 invoked by alias); 29 Apr 2009 19:05:00 -0000 Received: (qmail 7428 invoked by uid 22791); 29 Apr 2009 19:04:57 -0000 X-SWARE-Spam-Status: No, hits=-2.5 required=5.0 tests=AWL,BAYES_00 X-Spam-Check-By: sourceware.org Received: from sibelius.xs4all.nl (HELO sibelius.xs4all.nl) (82.92.89.47) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 29 Apr 2009 19:04:51 +0000 Received: from brahms.sibelius.xs4all.nl (kettenis@localhost [127.0.0.1]) by brahms.sibelius.xs4all.nl (8.14.3/8.14.3) with ESMTP id n3TJ4XL1022371; Wed, 29 Apr 2009 21:04:33 +0200 (CEST) Received: (from kettenis@localhost) by brahms.sibelius.xs4all.nl (8.14.3/8.14.3/Submit) id n3TJ4X7m000790; Wed, 29 Apr 2009 21:04:33 +0200 (CEST) Date: Wed, 29 Apr 2009 19:05:00 -0000 Message-Id: <200904291904.n3TJ4X7m000790@brahms.sibelius.xs4all.nl> From: Mark Kettenis To: jan.kratochvil@redhat.com CC: gdb-patches@sourceware.org In-reply-to: <20090429102719.GA10117@host0.dyn.jankratochvil.net> (message from Jan Kratochvil on Wed, 29 Apr 2009 12:27:19 +0200) Subject: Re: [patch] Fix i386 memory-by-register access on amd64 References: <20090429102719.GA10117@host0.dyn.jankratochvil.net> Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2009-04/txt/msg00789.txt.bz2 > Date: Wed, 29 Apr 2009 12:27:19 +0200 > From: Jan Kratochvil > > 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 > > 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?