[rfc][34/37] Eliminate builtin_type_ macros: Use target arch in procfs.c

uweigand
2008-08-31T18:12:57Z

[-- Attachment #1: diff-type-procfs --]
[-- Type: text/plain, Size: 2176 bytes --]

Hello,

procfs.c uses gdbarch_address_to_pointer to convert a target address
into a host address to be passed to the OS when setting watchpoints.

This patch changes procfs_address_to_host_pointer to use the per-target
architecture and its associated pointer types to perform that conversion.
It also removes and unnecessary reference to builtin_type_void_data_ptr
in procfs_auxv_parse.

Bye,
Ulrich

ChangeLog:

* procfs.c (procfs_address_to_host_pointer): Use target_gdbarch
and its associated types to perform pointer conversion.
(procfs_can_use_hw_breakpoint): Likewise.
(procfs_auxv_parse): Remove unused variable.

Index: gdb-head/gdb/procfs.c
===================================================================
--- gdb-head.orig/gdb/procfs.c
+++ gdb-head/gdb/procfs.c
@@ -160,7 +160,6 @@ static int
procfs_auxv_parse (struct target_ops *ops, gdb_byte **readptr,
gdb_byte *endptr, CORE_ADDR *typep, CORE_ADDR *valp)
{
- const int pointer_size = TYPE_LENGTH (builtin_type_void_data_ptr);
gdb_byte *ptr = *readptr;

if (endptr == ptr)
@@ -2899,11 +2898,11 @@ proc_parent_pid (procinfo *pi)
static void *
procfs_address_to_host_pointer (CORE_ADDR addr)
{
+ struct type *ptr_type = builtin_type (target_gdbarch)->builtin_data_ptr;
void *ptr;

- gdb_assert (sizeof (ptr) == TYPE_LENGTH (builtin_type_void_data_ptr));
- gdbarch_address_to_pointer (current_gdbarch, builtin_type_void_data_ptr,
- &ptr, addr);
+ gdb_assert (sizeof (ptr) == TYPE_LENGTH (ptr_type));
+ gdbarch_address_to_pointer (target_gdbarch, ptr_type, &ptr, addr);
return ptr;
}

@@ -5361,7 +5360,8 @@ procfs_can_use_hw_breakpoint (int type,
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))
+ struct type *ptr_type = builtin_type (target_gdbarch)->builtin_data_ptr;
+ if (sizeof (void *) != TYPE_LENGTH (ptr_type))
return 0;

/* Other tests here??? */