From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 27150 invoked by alias); 15 Mar 2006 16:36:54 -0000 Received: (qmail 27140 invoked by uid 22791); 15 Mar 2006 16:36:54 -0000 X-Spam-Check-By: sourceware.org Received: from nevyn.them.org (HELO nevyn.them.org) (66.93.172.17) by sourceware.org (qpsmtpd/0.31.1) with ESMTP; Wed, 15 Mar 2006 16:36:53 +0000 Received: from drow by nevyn.them.org with local (Exim 4.54) id 1FJYzS-0004Fq-VV for gdb-patches@sourceware.org; Wed, 15 Mar 2006 11:36:51 -0500 Date: Wed, 15 Mar 2006 17:01:00 -0000 From: Daniel Jacobowitz To: gdb-patches@sourceware.org Subject: RFC: Correct "paddr_t" in gdb_proc_service.h Message-ID: <20060315163650.GA16226@nevyn.them.org> Mail-Followup-To: gdb-patches@sourceware.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.5.8i X-IsSubscribed: yes Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2006-03/txt/msg00192.txt.bz2 If there is no , GDB will typedef unsigned long to paddr_t, which is then used in various libthread_db interfaces. Even when this code was designed to work on Solaris systems in addition to GNU/Linux, this wasn't right; Solaris doesn't provide a paddr_t that has anything to do with libthread_db, only an unrelated one that deals with physical addressing. The type that glibc's libthread_db uses is psaddr_t, which is a pointer type. When I wrote this patch (last year) I went through the original changelog entries for this file from 2000; they suggest that this change is correct and there should be no paddr_t references in GDB. I admit that I can't rememeber now what problem this solved; it may be nothing, just an inconsistency I noticed while working on N32 support. But I think it's a worthwhile change to match the prototypes in libthread_db from whence these functions are called. Any comments on this change? -- Daniel Jacobowitz CodeSourcery 2006-03-15 Daniel Jacobowitz * gdb_proc_service.h (paddr_t): Use psaddr_t if available. * proc-service.c (ps_xfer_memory): Cast paddr_t to unsigned long. (ps_pglobal_lookup): Cast CORE_ADDR to paddr_t. Index: src/gdb/gdb_proc_service.h =================================================================== --- src.orig/gdb/gdb_proc_service.h 2006-03-15 10:21:32.000000000 -0500 +++ src/gdb/gdb_proc_service.h 2006-03-15 10:21:36.000000000 -0500 @@ -1,5 +1,5 @@ /* replacement for systems that don't have it. - Copyright (C) 2000 Free Software Foundation, Inc. + Copyright (C) 2000, 2006 Free Software Foundation, Inc. This file is part of GDB. @@ -48,10 +48,11 @@ typedef enum typedef unsigned int lwpid_t; #endif -typedef unsigned long paddr_t; - #ifndef HAVE_PSADDR_T typedef unsigned long psaddr_t; +typedef unsigned long paddr_t; +#else +typedef psaddr_t paddr_t; #endif #ifndef HAVE_PRGREGSET_T Index: src/gdb/proc-service.c =================================================================== --- src.orig/gdb/proc-service.c 2006-03-15 10:21:32.000000000 -0500 +++ src/gdb/proc-service.c 2006-03-15 10:22:49.000000000 -0500 @@ -75,9 +75,9 @@ ps_xfer_memory (const struct ps_prochand inferior_ptid = pid_to_ptid (ph->pid); if (write) - ret = target_write_memory (addr, buf, len); + ret = target_write_memory ((unsigned long) addr, buf, len); else - ret = target_read_memory (addr, buf, len); + ret = target_read_memory ((unsigned long) addr, buf, len); do_cleanups (old_chain); @@ -181,7 +181,7 @@ ps_pglobal_lookup (gdb_ps_prochandle_t p if (ms == NULL) return PS_NOSYM; - *sym_addr = SYMBOL_VALUE_ADDRESS (ms); + *sym_addr = (paddr_t) (unsigned long) SYMBOL_VALUE_ADDRESS (ms); return PS_OK; }