From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 6471 invoked by alias); 16 Apr 2009 18:24:53 -0000 Received: (qmail 6463 invoked by uid 22791); 16 Apr 2009 18:24:52 -0000 X-SWARE-Spam-Status: No, hits=-2.4 required=5.0 tests=AWL,BAYES_00,SPF_PASS X-Spam-Check-By: sourceware.org Received: from mail.codesourcery.com (HELO mail.codesourcery.com) (65.74.133.4) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 16 Apr 2009 18:24:47 +0000 Received: (qmail 3806 invoked from network); 16 Apr 2009 18:24:44 -0000 Received: from unknown (HELO orlando) (pedro@127.0.0.2) by mail.codesourcery.com with ESMTPA; 16 Apr 2009 18:24:44 -0000 From: Pedro Alves To: gdb-patches@sourceware.org Subject: Re: [commit] Fix compilation warning in procfs.c on mips-irix Date: Thu, 16 Apr 2009 18:24:00 -0000 User-Agent: KMail/1.9.10 Cc: Joel Brobecker References: <20090416173025.GO7557@adacore.com> In-Reply-To: <20090416173025.GO7557@adacore.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200904161924.52037.pedro@codesourcery.com> X-IsSubscribed: yes 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-04/txt/msg00379.txt.bz2 On Thursday 16 April 2009 18:30:25, Joel Brobecker wrote: > While I was building GDB on mips-irix, I noticed a couple of warnings, > so I decided to fix them. > > On mips-irix, the pr_vaddr field is a caddr, and apparently, CORE_ADDR > is not the same size as this type. So we need to cast it to an integer > type with the same size first, and then to CORE_ADDR. { - return (*func) ((CORE_ADDR) map->pr_vaddr, + return (*func) ((CORE_ADDR) (uintptr_t) map->pr_vaddr, map->pr_size, (map->pr_mflags & MA_READ) != 0, (map->pr_mflags & MA_WRITE) != 0, Isn't this a problem for MIPS, due to pointer sign-extension? proc-service has these utility routines to handle the similar case on mips-linux: /* Convert a psaddr_t to a CORE_ADDR. */ static CORE_ADDR ps_addr_to_core_addr (psaddr_t addr) { if (exec_bfd && bfd_get_sign_extend_vma (exec_bfd)) return (intptr_t) addr; else return (uintptr_t) addr; } /* Convert a CORE_ADDR to a psaddr_t. */ static psaddr_t core_addr_to_ps_addr (CORE_ADDR addr) { if (exec_bfd && bfd_get_sign_extend_vma (exec_bfd)) return (psaddr_t) (intptr_t) addr; else return (psaddr_t) (uintptr_t) addr; } -- Pedro Alves