+Wed May 31 21:41:37 2000 Andrew Cagney <cagney@b1.cygnus.com>
+
+ * gdbarch.sh (POINTER_TO_ADDRESS, ADDRESS_TO_POINTER): Change buf
+ to a void pointer. Update initial values.
+ * gdbarch.h, gdbarch.c: Re-generate.
+
+ * findvar.c (address_to_signed_pointer,
+ signed_pointer_to_address): New functions.
+ * inferior.h (signed_pointer_to_address,
+ signed_address_to_pointer): Declare.
+
+ * inferior.h, findvar.c (unsigned_pointer_to_address,
+ address_to_unsigned_pointer): Rename generic_address_to_pointer
+ and generic_pointer_to_address. Update signatures to match
+ gdbarch changes.
+
+ * config/mips/tm-mips.h (POINTER_TO_ADDRESS, ADDRESS_TO_POINTER):
+ Define. MIPS has signed pointers.
+
+ * defs.h, utils.c (host_pointer_to_address,
+ address_to_host_pointer): New functions.
+ * irix5-nat.c (next_link_map_member, first_link_map_member),
+ procfs.c (proc_set_watchpoint, proc_iterate_over_mappings): Use.
+
+ * irix5-nat.c (solib_map_sections, symbol_add_stub): Change
+ function signature to match catch_errors_ftype.
+
+ * TODO: Update. GDB builds using the IRIX native compiler.
+
Sat Jun 3 20:43:59 2000 Andrew Cagney <cagney@b1.cygnus.com>
* defs.h (strsignal, safe_strsignal): Delete declarations.
--
-GDB requires GCC to build under IRIX
-
-IRIX, being more pedantic than GCC reports as errors certain
-assignments that GCC treats as warnings.
-
-This can be worked around by building GDB with the GCC compiler.
-
---
-
The BFD directory requires bug-fixed AUTOMAKE et.al.
AUTOMAKE 1.4 incorrectly set the TEXINPUTS environment variable. It
/* Command to set the processor type. */
extern void mips_set_processor_type_command (char *, int);
+
+
+/* MIPS sign extends addresses */
+#define POINTER_TO_ADDRESS(TYPE,BUF) (signed_pointer_to_address (TYPE, BUF))
+#define ADDRESS_TO_POINTER(TYPE,BUF,ADDR) (address_to_signed_pointer (TYPE, BUF, ADDR))
extern void init_page_info (void);
+extern CORE_ADDR host_pointer_to_address (void *ptr);
+extern void *address_to_host_pointer (CORE_ADDR addr);
+
/* From demangle.c */
extern void set_demangling_style (char *);
/* Given a pointer of type TYPE in target form in BUF, return the
address it represents. */
CORE_ADDR
-generic_pointer_to_address (struct type *type, char *buf)
+unsigned_pointer_to_address (struct type *type, void *buf)
{
return extract_address (buf, TYPE_LENGTH (type));
}
+CORE_ADDR
+signed_pointer_to_address (struct type *type, void *buf)
+{
+ return extract_signed_integer (buf, TYPE_LENGTH (type));
+}
/* Given an address, store it as a pointer of type TYPE in target
format in BUF. */
void
-generic_address_to_pointer (struct type *type, char *buf, CORE_ADDR addr)
+unsigned_address_to_pointer (struct type *type, void *buf, CORE_ADDR addr)
{
store_address (buf, TYPE_LENGTH (type), addr);
}
+void
+address_to_signed_pointer (struct type *type, void *buf, CORE_ADDR addr)
+{
+ store_signed_integer (buf, TYPE_LENGTH (type), addr);
+}
\f
/* Will calling read_var_value or locate_var_value on SYM end
up caring what frame it is being evaluated relative to? SYM must
gdbarch->call_dummy_stack_adjust_p = -1;
gdbarch->coerce_float_to_double = default_coerce_float_to_double;
gdbarch->register_convertible = generic_register_convertible_not;
- gdbarch->pointer_to_address = generic_pointer_to_address;
- gdbarch->address_to_pointer = generic_address_to_pointer;
+ gdbarch->pointer_to_address = unsigned_pointer_to_address;
+ gdbarch->address_to_pointer = unsigned_address_to_pointer;
gdbarch->return_value_on_stack = generic_return_value_on_stack_not;
gdbarch->prologue_frameless_p = generic_prologue_frameless_p;
gdbarch->breakpoint_from_pc = legacy_breakpoint_from_pc;
}
CORE_ADDR
-gdbarch_pointer_to_address (struct gdbarch *gdbarch, struct type *type, char *buf)
+gdbarch_pointer_to_address (struct gdbarch *gdbarch, struct type *type, void *buf)
{
if (gdbarch->pointer_to_address == 0)
internal_error ("gdbarch: gdbarch_pointer_to_address invalid");
}
void
-gdbarch_address_to_pointer (struct gdbarch *gdbarch, struct type *type, char *buf, CORE_ADDR addr)
+gdbarch_address_to_pointer (struct gdbarch *gdbarch, struct type *type, void *buf, CORE_ADDR addr)
{
if (gdbarch->address_to_pointer == 0)
internal_error ("gdbarch: gdbarch_address_to_pointer invalid");
/* Default (function) for non- multi-arch platforms. */
#if (GDB_MULTI_ARCH == 0) && !defined (POINTER_TO_ADDRESS)
-#define POINTER_TO_ADDRESS(type, buf) (generic_pointer_to_address (type, buf))
+#define POINTER_TO_ADDRESS(type, buf) (unsigned_pointer_to_address (type, buf))
#endif
-typedef CORE_ADDR (gdbarch_pointer_to_address_ftype) (struct type *type, char *buf);
-extern CORE_ADDR gdbarch_pointer_to_address (struct gdbarch *gdbarch, struct type *type, char *buf);
+typedef CORE_ADDR (gdbarch_pointer_to_address_ftype) (struct type *type, void *buf);
+extern CORE_ADDR gdbarch_pointer_to_address (struct gdbarch *gdbarch, struct type *type, void *buf);
extern void set_gdbarch_pointer_to_address (struct gdbarch *gdbarch, gdbarch_pointer_to_address_ftype *pointer_to_address);
#if GDB_MULTI_ARCH
#if (GDB_MULTI_ARCH > 1) || !defined (POINTER_TO_ADDRESS)
/* Default (function) for non- multi-arch platforms. */
#if (GDB_MULTI_ARCH == 0) && !defined (ADDRESS_TO_POINTER)
-#define ADDRESS_TO_POINTER(type, buf, addr) (generic_address_to_pointer (type, buf, addr))
+#define ADDRESS_TO_POINTER(type, buf, addr) (unsigned_address_to_pointer (type, buf, addr))
#endif
-typedef void (gdbarch_address_to_pointer_ftype) (struct type *type, char *buf, CORE_ADDR addr);
-extern void gdbarch_address_to_pointer (struct gdbarch *gdbarch, struct type *type, char *buf, CORE_ADDR addr);
+typedef void (gdbarch_address_to_pointer_ftype) (struct type *type, void *buf, CORE_ADDR addr);
+extern void gdbarch_address_to_pointer (struct gdbarch *gdbarch, struct type *type, void *buf, CORE_ADDR addr);
extern void set_gdbarch_address_to_pointer (struct gdbarch *gdbarch, gdbarch_address_to_pointer_ftype *address_to_pointer);
#if GDB_MULTI_ARCH
#if (GDB_MULTI_ARCH > 1) || !defined (ADDRESS_TO_POINTER)
f:2:REGISTER_CONVERT_TO_VIRTUAL:void:register_convert_to_virtual:int regnum, struct type *type, char *from, char *to:regnum, type, from, to:::0::0
f:2:REGISTER_CONVERT_TO_RAW:void:register_convert_to_raw:struct type *type, int regnum, char *from, char *to:type, regnum, from, to:::0::0
#
-f:2:POINTER_TO_ADDRESS:CORE_ADDR:pointer_to_address:struct type *type, char *buf:type, buf:::generic_pointer_to_address::0
-f:2:ADDRESS_TO_POINTER:void:address_to_pointer:struct type *type, char *buf, CORE_ADDR addr:type, buf, addr:::generic_address_to_pointer::0
+f:2:POINTER_TO_ADDRESS:CORE_ADDR:pointer_to_address:struct type *type, void *buf:type, buf:::unsigned_pointer_to_address::0
+f:2:ADDRESS_TO_POINTER:void:address_to_pointer:struct type *type, void *buf, CORE_ADDR addr:type, buf, addr:::unsigned_address_to_pointer::0
#
f:2:RETURN_VALUE_ON_STACK:int:return_value_on_stack:struct type *type:type:::generic_return_value_on_stack_not::0
f:2:EXTRACT_RETURN_VALUE:void:extract_return_value:struct type *type, char *regbuf, char *valbuf:type, regbuf, valbuf::0:0
extern void generic_target_write_fp (CORE_ADDR);
-extern CORE_ADDR generic_pointer_to_address (struct type *type, char *buf);
+extern CORE_ADDR unsigned_pointer_to_address (struct type *type, void *buf);
-extern void generic_address_to_pointer (struct type *type, char *buf,
- CORE_ADDR addr);
+extern void unsigned_address_to_pointer (struct type *type, void *buf,
+ CORE_ADDR addr);
+extern CORE_ADDR signed_pointer_to_address (struct type *type, void *buf);
+extern void address_to_signed_pointer (struct type *type, void *buf,
+ CORE_ADDR addr);
extern void wait_for_inferior (void);
static void info_sharedlibrary_command (char *, int);
-static int symbol_add_stub (char *);
+static int symbol_add_stub (void *);
static struct so_list *find_solib (struct so_list *);
static CORE_ADDR locate_base (void);
-static int solib_map_sections (char *);
+static int solib_map_sections (void *);
/*
*/
static int
-solib_map_sections (arg)
- char *arg;
+solib_map_sections (void *arg)
{
struct so_list *so = (struct so_list *) arg; /* catch_errors bogon */
char *filename;
/* Free the file names, close the file now. */
do_cleanups (old_chain);
+ /* must be non-zero */
return (1);
}
return NULL;
/* Get first list entry. */
- lladdr = (CORE_ADDR) listp;
+ /* The MIPS Sign extends addresses. */
+ lladdr = host_pointer_to_address (listp);
read_memory (lladdr, (char *) &list_old, sizeof (struct obj_list));
/* The first entry in the list is the object file we are debugging,
so skip it. */
- next_lladdr = (CORE_ADDR) list_old.next;
+ next_lladdr = host_pointer_to_address (list_old.next);
#ifdef HANDLE_NEW_OBJ_LIST
if (list_old.data == NEW_OBJ_INFO_MAGIC)
status = target_read_memory (lm->l_lladdr,
(char *) &list_old,
sizeof (struct obj_list));
- next_lladdr = (CORE_ADDR) list_old.next;
+ next_lladdr = host_pointer_to_address (list_old.next);
}
#ifdef HANDLE_NEW_OBJ_LIST
else if (lm->l_variant == OBJ_LIST_32)
new_lm->l_variant = OBJ_LIST_OLD;
new_lm->l_lladdr = lladdr;
- new_lm->l_next = (CORE_ADDR) list_old.next;
+ new_lm->l_next = host_pointer_to_address (list_old.next);
#ifdef HANDLE_NEW_OBJ_LIST
if (list_old.data == NEW_OBJ_INFO_MAGIC)
/* A small stub to get us past the arg-passing pinhole of catch_errors. */
static int
-symbol_add_stub (arg)
- char *arg;
+symbol_add_stub (void *arg)
{
register struct so_list *so = (struct so_list *) arg; /* catch_errs bogon */
CORE_ADDR text_addr = 0;
section_addrs.other[0].addr = text_addr;
so->objfile = symbol_file_add (so->so_name, so->from_tty,
§ion_addrs, 0, 0);
+ /* must be non-zero */
return (1);
}
prwatch_t *pwatch;
pwatch = (prwatch_t *) &arg.watch;
- pwatch->pr_vaddr = addr;
+ pwatch->pr_vaddr = address_to_host_pointer (addr);
pwatch->pr_size = len;
pwatch->pr_wflags = wflags;
#if defined(NEW_PROC_API) && defined (PCWATCH)
not a problem. */
/* Stop looping if the callback returns non-zero. */
- if ((funcstat = (*func) (fd, (CORE_ADDR) map[i].pr_vaddr)) != 0)
+ funcstat = (*func) (fd, host_pointer_to_address (map[i].pr_vaddr));
+ if (funcstat != 0)
break;
}
#endif
#include "language.h"
#include "annotate.h"
+#include "inferior.h" /* for signed_pointer_to_address */
+
#include <readline/readline.h>
#undef XMALLOC
}
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;
+}