From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 25129 invoked by alias); 3 Jul 2003 16:42:36 -0000 Mailing-List: contact gdb-patches-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sources.redhat.com Received: (qmail 25113 invoked from network); 3 Jul 2003 16:42:34 -0000 Received: from unknown (HELO mx1.redhat.com) (66.187.233.31) by sources.redhat.com with SMTP; 3 Jul 2003 16:42:34 -0000 Received: from int-mx1.corp.redhat.com (int-mx1.corp.redhat.com [172.16.52.254]) by mx1.redhat.com (8.11.6/8.11.6) with ESMTP id h63GgYH25967 for ; Thu, 3 Jul 2003 12:42:34 -0400 Received: from pobox.corp.redhat.com (pobox.corp.redhat.com [172.16.52.156]) by int-mx1.corp.redhat.com (8.11.6/8.11.6) with ESMTP id h63GgYI08733 for ; Thu, 3 Jul 2003 12:42:34 -0400 Received: from localhost.redhat.com (romulus-int.sfbay.redhat.com [172.16.27.46]) by pobox.corp.redhat.com (8.11.6/8.11.6) with ESMTP id h63GgXi14173 for ; Thu, 3 Jul 2003 12:42:33 -0400 Received: by localhost.redhat.com (Postfix, from userid 469) id 71F552CAB2; Thu, 3 Jul 2003 12:49:23 -0400 (EDT) From: Elena Zannoni MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Message-ID: <16132.24210.943200.572653@localhost.redhat.com> Date: Thu, 03 Jul 2003 16:42:00 -0000 To: gdb-patches@sources.redhat.com Subject: [PATCH/RFC] gag some compiler warnings X-SW-Source: 2003-07/txt/msg00079.txt.bz2 I am seeing these on a 64 bit system, when building gdb in 32-bit mode: /home/cygnus/ezannoni/gdb-6/src/gdb/infptrace.c: In function `child_xfer_memory': /home/cygnus/ezannoni/gdb-6/src/gdb/infptrace.c:570: warning: cast to pointer from integer of different size /home/cygnus/ezannoni/gdb-6/src/gdb/infptrace.c:578: warning: cast to pointer from integer of different size /home/cygnus/ezannoni/gdb-6/src/gdb/infptrace.c:590: warning: cast to pointer from integer of different size /home/cygnus/ezannoni/gdb-6/src/gdb/infptrace.c:597: warning: cast to pointer from integer of different size /home/cygnus/ezannoni/gdb-6/src/gdb/infptrace.c:613: warning: cast to pointer from integer of different size The problem is that we pass a CORE_ADDR (which is 8 bytes long) to ptrace and we cast it to PTRACE_ARG3_TYPE (which is 4 bytes long). Is this ok? Not too pretty, I know. elena * infptrace.c (child_xfer_memory): Cast ptrace argument to long, for cases in which CORE_ADDR size and pointer size don't agree. Index: infptrace.c =================================================================== RCS file: /cvs/src/src/gdb/infptrace.c,v retrieving revision 1.26 diff -u -p -r1.26 infptrace.c --- infptrace.c 22 May 2003 15:46:20 -0000 1.26 +++ infptrace.c 3 Jul 2003 15:45:34 -0000 @@ -564,14 +564,14 @@ child_xfer_memory (CORE_ADDR memaddr, ch { /* Need part of initial word -- fetch it. */ buffer[0] = ptrace (PT_READ_I, PIDGET (inferior_ptid), - (PTRACE_ARG3_TYPE) addr, 0); + (PTRACE_ARG3_TYPE) (long) addr, 0); } if (count > 1) /* FIXME, avoid if even boundary. */ { buffer[count - 1] = ptrace (PT_READ_I, PIDGET (inferior_ptid), - ((PTRACE_ARG3_TYPE) + ((PTRACE_ARG3_TYPE) (long) (addr + (count - 1) * sizeof (PTRACE_XFER_TYPE))), 0); } @@ -584,14 +584,14 @@ child_xfer_memory (CORE_ADDR memaddr, ch { errno = 0; ptrace (PT_WRITE_D, PIDGET (inferior_ptid), - (PTRACE_ARG3_TYPE) addr, buffer[i]); + (PTRACE_ARG3_TYPE) (long) addr, buffer[i]); if (errno) { /* Using the appropriate one (I or D) is necessary for Gould NP1, at least. */ errno = 0; ptrace (PT_WRITE_I, PIDGET (inferior_ptid), - (PTRACE_ARG3_TYPE) addr, buffer[i]); + (PTRACE_ARG3_TYPE) (long) addr, buffer[i]); } if (errno) return 0; @@ -607,7 +607,7 @@ child_xfer_memory (CORE_ADDR memaddr, ch { errno = 0; buffer[i] = ptrace (PT_READ_I, PIDGET (inferior_ptid), - (PTRACE_ARG3_TYPE) addr, 0); + (PTRACE_ARG3_TYPE) (long) addr, 0); if (errno) return 0; QUIT;