Add host_pointer_to_address() and address_to_host_pointer(). Add
signed_pointer_to_address() etc. Rename generic_pointer_to_address() to unsigned_pointer_to_address() etc.
This commit is contained in:
parent
0b5454486c
commit
ac2e2ef7e2
12 changed files with 104 additions and 38 deletions
23
gdb/utils.c
23
gdb/utils.c
|
@ -50,6 +50,8 @@
|
|||
#include "language.h"
|
||||
#include "annotate.h"
|
||||
|
||||
#include "inferior.h" /* for signed_pointer_to_address */
|
||||
|
||||
#include <readline/readline.h>
|
||||
|
||||
#undef XMALLOC
|
||||
|
@ -2962,3 +2964,24 @@ phex_nz (ULONGEST l, int sizeof_l)
|
|||
}
|
||||
return str;
|
||||
}
|
||||
|
||||
|
||||
/* 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)
|
||||
{
|
||||
if (sizeof (ptr) != TYPE_LENGTH (builtin_type_ptr))
|
||||
internal_error ("core_addr_to_void_ptr: bad cast");
|
||||
return POINTER_TO_ADDRESS (builtin_type_ptr, &ptr);
|
||||
}
|
||||
|
||||
void *
|
||||
address_to_host_pointer (CORE_ADDR addr)
|
||||
{
|
||||
void *ptr;
|
||||
if (sizeof (ptr) != TYPE_LENGTH (builtin_type_ptr))
|
||||
internal_error ("core_addr_to_void_ptr: bad cast");
|
||||
ADDRESS_TO_POINTER (builtin_type_ptr, &ptr, addr);
|
||||
return ptr;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue