]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
2003-02-01 Andrew Cagney <ac131313@redhat.com>
authorAndrew Cagney <cagney@redhat.com>
Sat, 1 Feb 2003 23:34:05 +0000 (23:34 +0000)
committerAndrew Cagney <cagney@redhat.com>
Sat, 1 Feb 2003 23:34:05 +0000 (23:34 +0000)
* 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.

gdb/ChangeLog
gdb/defs.h
gdb/hppa-tdep.c
gdb/procfs.c
gdb/somsolib.c
gdb/utils.c

index 6e544a3b8bd2fd7429e9aa7838458387606b2367..e82f4be7bc59130334c5d43156bdd1a5fb2cd10f 100644 (file)
@@ -1,3 +1,17 @@
+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.
+       
 2003-02-01  Andrew Cagney  <ac131313@redhat.com>
 
        * gdb_dirent.h: Mark up valid uses of <dirent.h>, d_namelen and
index 0d413d4acd0890e876c62f6b0d4df2f5a4079293..d2a16158d3724e7ab62c9730c755ac8e4ad28da2 100644 (file)
@@ -374,9 +374,6 @@ extern int query (const char *, ...) ATTR_FORMAT (printf, 1, 2);
 
 extern void init_page_info (void);
 
-extern CORE_ADDR host_pointer_to_address (void *ptr);
-extern void *address_to_host_pointer (CORE_ADDR addr);
-
 extern char *gdb_realpath (const char *);
 extern char *xfullpath (const char *);
 
index ba3d63c89b6f1dc05218789f47bd941eb590f9c6..6c0093407141cd9e7b14eeff39284cd84c16692d 100644 (file)
@@ -4555,6 +4555,16 @@ child_get_current_exception_event (void)
   return &current_ex_event;
 }
 
+/* Instead of this nasty cast, add a method pvoid() that prints out a
+   host VOID data type (remember %p isn't portable).  */
+
+static CORE_ADDR
+hppa_pointer_to_address_hack (void *ptr)
+{
+  gdb_assert (sizeof (ptr) == TYPE_LENGTH (builtin_type_void_data_ptr));
+  return POINTER_TO_ADDRESS (builtin_type_void_data_ptr, &ptr);
+}
+
 static void
 unwind_command (char *exp, int from_tty)
 {
@@ -4577,7 +4587,7 @@ unwind_command (char *exp, int from_tty)
     }
 
   printf_unfiltered ("unwind_table_entry (0x%s):\n",
-                    paddr_nz (host_pointer_to_address (u)));
+                    paddr_nz (hppa_pointer_to_address_hack (u)));
 
   printf_unfiltered ("\tregion_start = ");
   print_address (u->region_start, gdb_stdout);
index fe5987601c607ccdb72f1472e55c695ab641777f..bf488a61c944cd0692792184e3a62d9146834c26 100644 (file)
@@ -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;
 
index 474e2574c15039436b5efc7ed0114381a320a190..c66946bfb7de2bcd5081ff4e9cb47fe13f938e6f 100644 (file)
@@ -401,6 +401,21 @@ som_solib_load_symbols (struct so_list *so, char *name, int from_tty,
 }
 
 
+/* FIXME: cagney/2003-02-01: This just isn't right.  Given an address
+   within the target's address space, this converts the value into an
+   address within the host's (i.e., GDB's) address space.  Given that
+   the host/target address spaces are separate, this can't be right.  */
+
+static void *
+hpux_address_to_host_pointer_hack (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;
+}
+
 /* Add symbols from shared libraries into the symtab list, unless the
    size threshold specified by auto_solib_limit (in megabytes) would
    be exceeded.  */
@@ -715,8 +730,10 @@ som_solib_add (char *arg_string, int from_tty, struct target_ops *target, int re
       if (status != 0)
        goto err;
 
+      /* FIXME: cagney/2003-02-01: I think som_solib.next should be a
+         CORE_ADDR.  */
       new_so->som_solib.next =
-       address_to_host_pointer (extract_unsigned_integer (buf, 4));
+       hpux_address_to_host_pointer_hack (extract_unsigned_integer (buf, 4));
 
       /* Note that we don't re-set "addr" to the next pointer
        * until after we've read the trailing data.
index e7353bf5d066e721ba13981a6827d52be28cbc6d..0e92b21b0410bfdc95199277ae7f15e3f9ead298 100644 (file)
@@ -2602,25 +2602,6 @@ phex_nz (ULONGEST l, int sizeof_l)
 }
 
 
-/* Convert to / from the hosts pointer to GDB's internal CORE_ADDR
-   using the target's conversion routines. */
-CORE_ADDR
-host_pointer_to_address (void *ptr)
-{
-  gdb_assert (sizeof (ptr) == TYPE_LENGTH (builtin_type_void_data_ptr));
-  return POINTER_TO_ADDRESS (builtin_type_void_data_ptr, &ptr);
-}
-
-void *
-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;
-}
-
 /* Convert a CORE_ADDR into a string.  */
 const char *
 core_addr_to_string (const CORE_ADDR addr)