aboutsummaryrefslogtreecommitdiff
path: root/gdb/procfs.c
diff options
context:
space:
mode:
authorAndrew Cagney <cagney@redhat.com>2003-02-01 23:34:05 +0000
committerAndrew Cagney <cagney@redhat.com>2003-02-01 23:34:05 +0000
commit9a043c1d0c3e8a873b2cd90f6e048c77d2efdc8a (patch)
tree58a5484a279efb44d8b29cc0a3acfdcf3abb8078 /gdb/procfs.c
parentb66cc1a0d2931b856edd960b481f7d8c2d75598e (diff)
downloadgdb-9a043c1d0c3e8a873b2cd90f6e048c77d2efdc8a.zip
gdb-9a043c1d0c3e8a873b2cd90f6e048c77d2efdc8a.tar.gz
gdb-9a043c1d0c3e8a873b2cd90f6e048c77d2efdc8a.tar.bz2
2003-02-01 Andrew Cagney <ac131313@redhat.com>
* defs.h (host_pointer_to_address): Delete declaration. (address_to_host_pointer): Delete declaration. * utils.c (host_pointer_to_address): Delete function. (address_to_host_pointer): Delete function. * procfs.c (procfs_address_to_host_pointer): New function. * procfs.c (proc_set_watchpoint): Use. (procfs_can_use_hw_breakpoint): Update comments. * somsolib.c (hpux_address_to_host_pointer_hack): New function. (som_solib_add): Use. * hppa-tdep.c (hppa_pointer_to_address_hack): New function. * hppa-tdep.c (unwind_command): Use.
Diffstat (limited to 'gdb/procfs.c')
-rw-r--r--gdb/procfs.c29
1 files changed, 23 insertions, 6 deletions
diff --git a/gdb/procfs.c b/gdb/procfs.c
index fe59876..bf488a6 100644
--- a/gdb/procfs.c
+++ b/gdb/procfs.c
@@ -2841,6 +2841,19 @@ proc_parent_pid (procinfo *pi)
}
+/* Convert a target address (a.k.a. CORE_ADDR) into a host address
+ (a.k.a void pointer)! */
+
+static void *
+procfs_address_to_host_pointer (CORE_ADDR addr)
+{
+ void *ptr;
+
+ gdb_assert (sizeof (ptr) == TYPE_LENGTH (builtin_type_void_data_ptr));
+ ADDRESS_TO_POINTER (builtin_type_void_data_ptr, &ptr, addr);
+ return ptr;
+}
+
/*
* Function: proc_set_watchpoint
*
@@ -2863,10 +2876,13 @@ proc_set_watchpoint (procinfo *pi, CORE_ADDR addr, int len, int wflags)
prwatch_t *pwatch;
pwatch = (prwatch_t *) &arg.watch;
+ /* NOTE: cagney/2003-02-01: Even more horrible hack. Need to
+ convert a target address into something that can be stored in a
+ native data structure. */
#ifdef PCAGENT /* Horrible hack: only defined on Solaris 2.6+ */
- pwatch->pr_vaddr = (uintptr_t) address_to_host_pointer (addr);
+ pwatch->pr_vaddr = (uintptr_t) procfs_address_to_host_pointer (addr);
#else
- pwatch->pr_vaddr = (caddr_t) address_to_host_pointer (addr);
+ pwatch->pr_vaddr = (caddr_t) procfs_address_to_host_pointer (addr);
#endif
pwatch->pr_size = len;
pwatch->pr_wflags = wflags;
@@ -5163,10 +5179,11 @@ procfs_can_use_hw_breakpoint (int type, int cnt, int othertype)
/* Due to the way that proc_set_watchpoint() is implemented, host
and target pointers must be of the same size. If they are not,
we can't use hardware watchpoints. This limitation is due to the
- fact that proc_set_watchpoint() calls address_to_host_pointer();
- a close inspection of address_to_host_pointer will reveal that
- an internal error will be generated when the host and target
- pointer sizes are different. */
+ fact that proc_set_watchpoint() calls
+ procfs_address_to_host_pointer(); a close inspection of
+ procfs_address_to_host_pointer will reveal that an internal error
+ will be generated when the host and target pointer sizes are
+ different. */
if (sizeof (void *) != TYPE_LENGTH (builtin_type_void_data_ptr))
return 0;