Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Mark Kettenis <mark.kettenis@xs4all.nl>
To: gdb-patches@sourceware.org
Subject: Re: RFC: Correct "paddr_t" in gdb_proc_service.h
Date: Wed, 15 Mar 2006 22:44:00 -0000	[thread overview]
Message-ID: <200603152234.k2FMY7kd008466@elgar.sibelius.xs4all.nl> (raw)
In-Reply-To: <20060315163650.GA16226@nevyn.them.org> (message from Daniel 	Jacobowitz on Wed, 15 Mar 2006 11:36:50 -0500)

> Date: Wed, 15 Mar 2006 11:36:50 -0500
> From: Daniel Jacobowitz <drow@false.org>
> 
> If there is no <proc_service.h>, 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.

Yes indeed.  On BSD paddr_t is an usnigned integer type used to store
physical memory addresses

> 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 think that's right, and therefore I don't understand your change at all :(.

> 2006-03-15  Daniel Jacobowitz  <dan@codesourcery.com>
> 
> 	* 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 @@
>  /* <proc_service.h> 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;
>  }
>  
> 


  parent reply	other threads:[~2006-03-15 22:34 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-03-15 17:01 Daniel Jacobowitz
2006-03-15 19:51 ` Michael Snyder
2006-03-15 22:34   ` Daniel Jacobowitz
2006-03-15 22:44 ` Mark Kettenis [this message]
2006-03-15 22:59   ` Daniel Jacobowitz
2006-03-15 23:40     ` Mark Kettenis
2006-03-16  0:21       ` Daniel Jacobowitz
2006-03-16 15:10       ` Michael Snyder

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200603152234.k2FMY7kd008466@elgar.sibelius.xs4all.nl \
    --to=mark.kettenis@xs4all.nl \
    --cc=gdb-patches@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox