From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 7931 invoked by alias); 3 Sep 2009 13:01:28 -0000 Received: (qmail 7372 invoked by uid 22791); 3 Sep 2009 13:01:26 -0000 X-SWARE-Spam-Status: No, hits=-0.9 required=5.0 tests=AWL,BAYES_40,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 13:01:19 +0000 Received: from int-mx02.intmail.prod.int.phx2.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id n83Cp8i1003351; Thu, 3 Sep 2009 08:51:08 -0400 Received: from hase.home (vpn-10-8.str.redhat.com [10.32.10.8]) by int-mx02.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id n83Cp6DZ016416; Thu, 3 Sep 2009 08:51:07 -0400 From: Andreas Schwab To: freindlyuser@hushmail.com Cc: gdb@sourceware.org Subject: Re: 64bit pointer References: <20090903122141.4BD7DB8043@smtp.hushmail.com> X-Yow: NANCY!! Why is everything RED?! Date: Thu, 03 Sep 2009 13:01:00 -0000 In-Reply-To: <20090903122141.4BD7DB8043@smtp.hushmail.com> (freindlyuser@hushmail.com's message of "Thu, 03 Sep 2009 12:21:41 +0000") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii 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/msg00036.txt.bz2 freindlyuser@hushmail.com writes: > I didn't know if this was a bug or if I was just doing something > wrong. Basically when I try to use * to get the value pointed to by > something it gives me 32 bits of the pointer which is actually a > 64bit address. > > > (gdb) x/s *($rdi+0x8) > 0x4210a9b7:
> (gdb) x/x $rdi+0x8 > 0x3a9b4210b7a4: 0x00003a9b4210a9b7 > (gdb) x/s 0x00003a9b4210a9b7 > 0x3a9b4210a9b7: "The string it points to" > > In the above I wanted to read the string pointed to by the pointer > at $rdi+0x8 > > Should this be happening? Since the type of $rdi is not a pointer, gdb is just being helpful and implicitly converts the value to (int *) before applying the indirection operator. > Should I be using a different command or something different to the > asterisk? > 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). There are several options: - Add a cast, {type} is short for *(type *): (gdb) x/s {char *}($rdi+8) - Use the $__ convenience variable after examining the address: (gdb) x/x $rdi+8 (gdb) x/s $__ Andreas. -- Andreas Schwab, schwab@redhat.com GPG Key fingerprint = D4E8 DBE3 3813 BB5D FA84 5EC7 45C6 250E 6F00 984E "And now for something completely different."