From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 25316 invoked by alias); 9 Jan 2009 13:17:35 -0000 Received: (qmail 25307 invoked by uid 22791); 9 Jan 2009 13:17:34 -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; Fri, 09 Jan 2009 13:17:21 +0000 Received: from localhost (localhost.localdomain [127.0.0.1]) by filtered-rock.gnat.com (Postfix) with ESMTP id A36AE2A9612 for ; Fri, 9 Jan 2009 08:17:19 -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 c2JL+tA44-wH for ; Fri, 9 Jan 2009 08:17:19 -0500 (EST) Received: from joel.gnat.com (localhost.localdomain [127.0.0.1]) by rock.gnat.com (Postfix) with ESMTP id CAE7F2A9636 for ; Fri, 9 Jan 2009 08:17:18 -0500 (EST) Received: by joel.gnat.com (Postfix, from userid 1000) id DCC3CE7ACD; Fri, 9 Jan 2009 17:17:11 +0400 (RET) Date: Fri, 09 Jan 2009 13:17:00 -0000 From: Joel Brobecker To: gdb-patches@sourceware.org Subject: [commit] target.c: fix errors on x86_64-windows due to casting to long Message-ID: <20090109131711.GA24431@adacore.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="gKMricLos+KVdGMg" Content-Disposition: inline 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/msg00192.txt.bz2 --gKMricLos+KVdGMg Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-length: 846 Hello, Continuing on my series of patches to port GDB to x86_64 Windows (Vista), here is a patch that fixes some compilation errors inside target.c which are due to casting pointers to long... As suggested, I modified my original patch to use intptr_t instead of my very-own home-made ptr_int_t. 2009-01-09 Joel Brobecker * target.c (target_xfer_partial): Use host_address_to_string to print the address of readbuf and writebuf. Cast the address of elements inside the myaddr buffer into intptr_t. (deprecated_debug_xfer_memory): Use paddress to print memaddr. Cast the address of elements inside the myaddr buffer into intptr_t. Tested on x86-linux. I will commit tomorrow, since Mark already reviewed this code and suggested the use of the intptr_t type. -- Joel --gKMricLos+KVdGMg Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="cast.diff" Content-length: 1828 diff --git a/gdb/target.c b/gdb/target.c index 0f9e42a..78a0a1b 100644 --- a/gdb/target.c +++ b/gdb/target.c @@ -1200,11 +1200,12 @@ target_xfer_partial (struct target_ops *ops, const unsigned char *myaddr = NULL; fprintf_unfiltered (gdb_stdlog, - "%s:target_xfer_partial (%d, %s, 0x%lx, 0x%lx, %s, %s) = %s", + "%s:target_xfer_partial (%d, %s, %s, %s, %s, %s) = %s", ops->to_shortname, (int) object, (annex ? annex : "(null)"), - (long) readbuf, (long) writebuf, + host_address_to_string (readbuf), + host_address_to_string (writebuf), core_addr_to_string_nz (offset), plongest (len), plongest (retval)); @@ -1219,7 +1220,7 @@ target_xfer_partial (struct target_ops *ops, fputs_unfiltered (", bytes =", gdb_stdlog); for (i = 0; i < retval; i++) { - if ((((long) &(myaddr[i])) & 0xf) == 0) + if ((((intptr_t) &(myaddr[i])) & 0xf) == 0) { if (targetdebug < 2 && i > 0) { @@ -2717,9 +2718,9 @@ deprecated_debug_xfer_memory (CORE_ADDR memaddr, bfd_byte *myaddr, int len, attrib, target); fprintf_unfiltered (gdb_stdlog, - "target_xfer_memory (0x%x, xxx, %d, %s, xxx) = %d", - (unsigned int) memaddr, /* possable truncate long long */ - len, write ? "write" : "read", retval); + "target_xfer_memory (%s, xxx, %d, %s, xxx) = %d", + paddress (memaddr), len, write ? "write" : "read", + retval); if (retval > 0) { @@ -2728,7 +2729,7 @@ deprecated_debug_xfer_memory (CORE_ADDR memaddr, bfd_byte *myaddr, int len, fputs_unfiltered (", bytes =", gdb_stdlog); for (i = 0; i < retval; i++) { - if ((((long) &(myaddr[i])) & 0xf) == 0) + if ((((intptr_t) &(myaddr[i])) & 0xf) == 0) { if (targetdebug < 2 && i > 0) { --gKMricLos+KVdGMg--