From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 393 invoked by alias); 13 Jan 2009 12:09:07 -0000 Received: (qmail 383 invoked by uid 22791); 13 Jan 2009 12:09:06 -0000 X-SWARE-Spam-Status: No, hits=-2.4 required=5.0 tests=AWL,BAYES_00 X-Spam-Check-By: sourceware.org Received: from rock.gnat.com (HELO rock.gnat.com) (205.232.38.15) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 13 Jan 2009 12:08:30 +0000 Received: from localhost (localhost.localdomain [127.0.0.1]) by filtered-rock.gnat.com (Postfix) with ESMTP id 134692A963C; Tue, 13 Jan 2009 07:08:29 -0500 (EST) Received: from rock.gnat.com ([127.0.0.1]) by localhost (rock.gnat.com [127.0.0.1]) (amavisd-new, port 10024) with LMTP id KiMHqxGM2omr; Tue, 13 Jan 2009 07:08:29 -0500 (EST) Received: from joel.gnat.com (localhost.localdomain [127.0.0.1]) by rock.gnat.com (Postfix) with ESMTP id 0BE0A2A9631; Tue, 13 Jan 2009 07:08:28 -0500 (EST) Received: by joel.gnat.com (Postfix, from userid 1000) id 12791E7ACD; Tue, 13 Jan 2009 16:08:21 +0400 (RET) Date: Tue, 13 Jan 2009 12:09:00 -0000 From: Joel Brobecker To: Mark Kettenis Cc: ktietz70@googlemail.com, Kai.Tietz@onevision.com, gdb-patches@sourceware.org Subject: Re: [RFC] convert a host address to a string Message-ID: <20090113120821.GZ24105@adacore.com> References: <20090109131227.GL24105@adacore.com> <20090110071137.GN24105@adacore.com> <90baa01f0901100530t6590599bucfaa12aea8898c57@mail.gmail.com> <200901101403.n0AE3PYP005895@brahms.sibelius.xs4all.nl> <90baa01f0901100614n31183205vbd43992f8b8f574e@mail.gmail.com> <200901101421.n0AELbwx014532@brahms.sibelius.xs4all.nl> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="xA/XKXTdy9G3iaIz" Content-Disposition: inline In-Reply-To: <200901101421.n0AELbwx014532@brahms.sibelius.xs4all.nl> User-Agent: Mutt/1.4.2.2i 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-01/txt/msg00278.txt.bz2 --xA/XKXTdy9G3iaIz Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-length: 371 Here is the patch that I ended checkin in... 2009-01-13 Mark Kettenis * utils.c (host_address_to_string): Reimplement in a way that avoids the cast of the address to long. Tested on x86-linux and x86-windows. I also re-built the debugger on Vista64, and used "set debug arch" to verify that it can print host addresses. -- Joel --xA/XKXTdy9G3iaIz Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="utils.c.diff" Content-length: 705 Index: utils.c =================================================================== RCS file: /cvs/src/src/gdb/utils.c,v retrieving revision 1.203 diff -u -p -r1.203 utils.c --- utils.c 7 Jan 2009 12:11:07 -0000 1.203 +++ utils.c 13 Jan 2009 12:04:25 -0000 @@ -3071,10 +3071,7 @@ host_address_to_string (const void *addr { char *str = get_cell (); - /* We could use the %p conversion specifier to sprintf if we had any - way of knowing whether this host supports it. But the following - should work on the Alpha and on 32 bit machines. */ - sprintf (str, "0x%lx", (unsigned long) addr); + xsnprintf (str, CELLSIZE, "0x%s", phex_nz ((uintptr_t) addr, sizeof (addr))); return str; } --xA/XKXTdy9G3iaIz--