From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 14384 invoked by alias); 3 Sep 2009 12:33:39 -0000 Received: (qmail 14375 invoked by uid 22791); 3 Sep 2009 12:33:38 -0000 X-SWARE-Spam-Status: No, hits=-2.5 required=5.0 tests=AWL,BAYES_00,SPF_HELO_PASS,SPF_PASS X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 03 Sep 2009 12:33:31 +0000 Received: from int-mx01.intmail.prod.int.phx2.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id n83CXT07021045 for ; Thu, 3 Sep 2009 08:33:29 -0400 Received: from host0.dyn.jankratochvil.net (ovpn01.gateway.prod.ext.phx2.redhat.com [10.5.9.1]) by int-mx01.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id n83CXRFm024000 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Thu, 3 Sep 2009 08:33:29 -0400 Received: from host0.dyn.jankratochvil.net (localhost [127.0.0.1]) by host0.dyn.jankratochvil.net (8.14.3/8.14.3) with ESMTP id n83CXQb0025186; Thu, 3 Sep 2009 14:33:26 +0200 Received: (from jkratoch@localhost) by host0.dyn.jankratochvil.net (8.14.3/8.14.3/Submit) id n83CXPj3025183; Thu, 3 Sep 2009 14:33:25 +0200 Date: Thu, 03 Sep 2009 12:33:00 -0000 From: Jan Kratochvil To: freindlyuser@hushmail.com Cc: gdb@sourceware.org Subject: Re: 64bit pointer Message-ID: <20090903123325.GA24453@host0.dyn.jankratochvil.net> References: <20090903122141.4BD7DB8043@smtp.hushmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20090903122141.4BD7DB8043@smtp.hushmail.com> User-Agent: Mutt/1.5.19 (2009-01-05) X-IsSubscribed: yes Mailing-List: contact gdb-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sourceware.org X-SW-Source: 2009-09/txt/msg00035.txt.bz2 On Thu, 03 Sep 2009 14:21:41 +0200, freindlyuser@hushmail.com wrote: > (gdb) x/s *($rdi+0x8) > 0x4210a9b7:
This syntax is not much recommended, it means the same as: (gdb) x/s *(int *) ($rdi+0x8) 0x4210a9b7:
On 64bit arch sizeof (int) == 4 but sizeof (void *) == 8 so you will not fetch the whole address. > (gdb) x/x $rdi+0x8 > 0x3a9b4210b7a4: 0x00003a9b4210a9b7 > (gdb) x/s 0x00003a9b4210a9b7 > 0x3a9b4210a9b7: "The string it points to" Therefore you want one indirection there. > Should this be happening? Yes. Until GDB forbids dereferencing numeric arguments as `int *' which IMHO is more confusing than convenient. [Would a patch be approved?] > Is there a work around where I can read the data in > 0x00003a9b4210a9b7 without having to manually copy and paste (ie: > in the commands that are executed on a breakpoint). This way it should work: (gdb) x/s *(void **) ($rdi+0x8) OR (gdb) p *(char **) ($rdi+0x8) Regards, Jan