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.
This commit is contained in:
Andrew Cagney 2003-02-01 23:34:05 +00:00
parent b66cc1a0d2
commit 9a043c1d0c
6 changed files with 66 additions and 30 deletions

View 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

View 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 *);

View 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);

View 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;

View 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.

View 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)