This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [commit] Fix compilation warning in procfs.c on mips-irix
- From: Pedro Alves <pedro at codesourcery dot com>
- To: gdb-patches at sourceware dot org
- Cc: Joel Brobecker <brobecker at adacore dot com>
- Date: Thu, 16 Apr 2009 19:24:51 +0100
- Subject: Re: [commit] Fix compilation warning in procfs.c on mips-irix
- References: <20090416173025.GO7557@adacore.com>
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