[rfc] Re: host_pointer_to_address() === (CORE_ADDR) (void*) (val)

Andrew Cagney ac131313@cygnus.com
Thu Jun 1 04:07:00 GMT 2000


Andrew Cagney wrote:
> 
> Hello,
> 
> If you look through code like procfs.c, you will find casts like:
> 
>       /* Stop looping if the callback returns non-zero.  */
>       if ((funcstat = (*func) (fd, (CORE_ADDR) map->pr_vaddr)) != 0)
> 
> The problem is with ``(CORE_ADDR) map->pr_vaddr''.  ``map->pr_vaddr'' is
> a ``void *'' (32bits) and ``CORE_ADDR'' is a ``long long'' (64bits).
> Some (one? mips/n32) targets assume that addresses sign-extended while
> others assume zero extension.  The consequence is that the above code is
> potentially dangerous.  GCC complains with a warning while some native
> compilers refuse to accept it at all :-/

Hello,

Attached is the corresponding patch.  It does the following:

	o	Adds the functions.

			host_pointer_to_address()

		and

			address_to_host_pointer()

		that do the relevant conversions

	o	because I was having trouble passing ``CORE_ADDR''
		to the underlying POINTER_TO_ADDRESS, I've
		changed that so it takes a void* instead of a char*
		for the buffer.

		JimB?

	o	For the MIPS, I've added definitions of POINTER_TO_ADDRESS
		using the new functions:

			signed_pointer_to_address()
			address_to_signed_pointer()

	o	as a knee jerk reaction to these names, I renamed:

			generic_pointer_to_address() et al.
		   to	unsigned_pointer_to_address()

		Jimb?

The only remaining thing for me to consider is for the conversion
functions to validate that the address they are passing is correctly
extended vis:

	addr in [0xffffffff80000000 .. 0x000000007fffffff]
	(i think)

Thing is, right now if I did this I know the MIPS would collaps in a
heap - it is defining ADDR_BITS_REMOVE() which makes a mess of
everything :-(

Fixing that is next.

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

Index: defs.h
===================================================================
RCS file: /cvs/src/src/gdb/defs.h,v
retrieving revision 1.21
diff -p -r1.21 defs.h
*** defs.h	2000/05/23 14:48:13	1.21
--- defs.h	2000/06/01 10:54:25
*************** extern void mfree (PTR, PTR);
*** 374,379 ****
--- 374,382 ----
  
  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 *);
Index: findvar.c
===================================================================
RCS file: /cvs/src/src/gdb/findvar.c,v
retrieving revision 1.12
diff -p -r1.12 findvar.c
*** findvar.c	2000/05/28 01:12:27	1.12
--- findvar.c	2000/06/01 10:54:31
*************** write_fp (val)
*** 1210,1229 ****
  /* 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)
  {
    return extract_address (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)
  {
    store_address (buf, TYPE_LENGTH (type), addr);
  }
  
  
  /* Will calling read_var_value or locate_var_value on SYM end
     up caring what frame it is being evaluated relative to?  SYM must
--- 1210,1239 ----
  /* Given a pointer of type TYPE in target form in BUF, return the
     address it represents.  */
  CORE_ADDR
! 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
! 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);
+ }
  
  /* Will calling read_var_value or locate_var_value on SYM end
     up caring what frame it is being evaluated relative to?  SYM must
Index: gdbarch.c
===================================================================
RCS file: /cvs/src/src/gdb/gdbarch.c,v
retrieving revision 1.23
diff -p -r1.23 gdbarch.c
*** gdbarch.c	2000/05/15 06:27:16	1.23
--- gdbarch.c	2000/06/01 10:54:36
*************** gdbarch_alloc (const struct gdbarch_info
*** 376,383 ****
    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->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;
--- 376,383 ----
    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 = 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;
*************** set_gdbarch_register_convert_to_raw (str
*** 2106,2112 ****
  }
  
  CORE_ADDR
! gdbarch_pointer_to_address (struct gdbarch *gdbarch, struct type *type, char *buf)
  {
    if (gdbarch->pointer_to_address == 0)
      internal_error ("gdbarch: gdbarch_pointer_to_address invalid");
--- 2106,2112 ----
  }
  
  CORE_ADDR
! 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");
*************** set_gdbarch_pointer_to_address (struct g
*** 2123,2129 ****
  }
  
  void
! gdbarch_address_to_pointer (struct gdbarch *gdbarch, struct type *type, char *buf, CORE_ADDR addr)
  {
    if (gdbarch->address_to_pointer == 0)
      internal_error ("gdbarch: gdbarch_address_to_pointer invalid");
--- 2123,2129 ----
  }
  
  void
! 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");
Index: gdbarch.h
===================================================================
RCS file: /cvs/src/src/gdb/gdbarch.h,v
retrieving revision 1.18
diff -p -r1.18 gdbarch.h
*** gdbarch.h	2000/05/15 06:27:16	1.18
--- gdbarch.h	2000/06/01 10:54:38
*************** extern void set_gdbarch_register_convert
*** 592,602 ****
  
  /* 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))
  #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);
  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)
--- 592,602 ----
  
  /* Default (function) for non- multi-arch platforms. */
  #if (GDB_MULTI_ARCH == 0) && !defined (POINTER_TO_ADDRESS)
! #define POINTER_TO_ADDRESS(type, buf) (unsigned_pointer_to_address (type, buf))
  #endif
  
! 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)
*************** extern void set_gdbarch_pointer_to_addre
*** 606,616 ****
  
  /* 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))
  #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);
  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)
--- 606,616 ----
  
  /* Default (function) for non- multi-arch platforms. */
  #if (GDB_MULTI_ARCH == 0) && !defined (ADDRESS_TO_POINTER)
! #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, 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)
Index: gdbarch.sh
===================================================================
RCS file: /cvs/src/src/gdb/gdbarch.sh,v
retrieving revision 1.23
diff -p -r1.23 gdbarch.sh
*** gdbarch.sh	2000/05/30 01:29:26	1.23
--- gdbarch.sh	2000/06/01 10:54:41
*************** f:1:REGISTER_CONVERTIBLE:int:register_co
*** 314,321 ****
  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: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
--- 314,321 ----
  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, 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
Index: inferior.h
===================================================================
RCS file: /cvs/src/src/gdb/inferior.h,v
retrieving revision 1.6
diff -p -r1.6 inferior.h
*** inferior.h	2000/05/28 01:12:27	1.6
--- inferior.h	2000/06/01 10:54:43
*************** extern void write_fp (CORE_ADDR);
*** 160,169 ****
  
  extern void generic_target_write_fp (CORE_ADDR);
  
! extern CORE_ADDR generic_pointer_to_address (struct type *type, char *buf);
  
! extern void generic_address_to_pointer (struct type *type, char *buf,
! 					CORE_ADDR addr);
  
  extern void wait_for_inferior (void);
  
--- 160,172 ----
  
  extern void generic_target_write_fp (CORE_ADDR);
  
! extern CORE_ADDR unsigned_pointer_to_address (struct type *type, void *buf);
  
! 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);
  
Index: irix5-nat.c
===================================================================
RCS file: /cvs/src/src/gdb/irix5-nat.c,v
retrieving revision 1.5
diff -p -r1.5 irix5-nat.c
*** irix5-nat.c	2000/05/28 01:12:28	1.5
--- irix5-nat.c	2000/06/01 10:54:45
*************** static int disable_break (void);
*** 352,358 ****
  
  static void info_sharedlibrary_command (char *, int);
  
! static int symbol_add_stub (char *);
  
  static struct so_list *find_solib (struct so_list *);
  
--- 352,358 ----
  
  static void info_sharedlibrary_command (char *, int);
  
! static int symbol_add_stub (void *);
  
  static struct so_list *find_solib (struct so_list *);
  
*************** static void xfer_link_map_member (struct
*** 364,370 ****
  
  static CORE_ADDR locate_base (void);
  
! static int solib_map_sections (char *);
  
  /*
  
--- 364,370 ----
  
  static CORE_ADDR locate_base (void);
  
! static int solib_map_sections (void *);
  
  /*
  
*************** static int solib_map_sections (char *);
*** 394,401 ****
   */
  
  static int
! solib_map_sections (arg)
!      char *arg;
  {
    struct so_list *so = (struct so_list *) arg;	/* catch_errors bogon */
    char *filename;
--- 394,400 ----
   */
  
  static int
! solib_map_sections (void *arg)
  {
    struct so_list *so = (struct so_list *) arg;	/* catch_errors bogon */
    char *filename;
*************** solib_map_sections (arg)
*** 460,465 ****
--- 459,465 ----
    /* Free the file names, close the file now.  */
    do_cleanups (old_chain);
  
+   /* must be non-zero */
    return (1);
  }
  
*************** first_link_map_member ()
*** 564,575 ****
      return NULL;
  
    /* Get first list entry.  */
!   lladdr = (CORE_ADDR) 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;
  
  #ifdef HANDLE_NEW_OBJ_LIST
    if (list_old.data == NEW_OBJ_INFO_MAGIC)
--- 564,576 ----
      return NULL;
  
    /* Get first list entry.  */
!   /* The MIPS Sign extends addresses. */
!   lladdr = host_pointer_to_core_addr (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 = host_pointer_to_core_addr (list_old.next);
  
  #ifdef HANDLE_NEW_OBJ_LIST
    if (list_old.data == NEW_OBJ_INFO_MAGIC)
*************** next_link_map_member (so_list_ptr)
*** 629,635 ****
  	  status = target_read_memory (lm->l_lladdr,
  				       (char *) &list_old,
  				       sizeof (struct obj_list));
! 	  next_lladdr = (CORE_ADDR) list_old.next;
  	}
  #ifdef HANDLE_NEW_OBJ_LIST
        else if (lm->l_variant == OBJ_LIST_32)
--- 630,636 ----
  	  status = target_read_memory (lm->l_lladdr,
  				       (char *) &list_old,
  				       sizeof (struct obj_list));
! 	  next_lladdr = host_pointer_to_core_addr (list_old.next);
  	}
  #ifdef HANDLE_NEW_OBJ_LIST
        else if (lm->l_variant == OBJ_LIST_32)
*************** xfer_link_map_member (so_list_ptr, lm)
*** 682,688 ****
  
    new_lm->l_variant = OBJ_LIST_OLD;
    new_lm->l_lladdr = lladdr;
!   new_lm->l_next = (CORE_ADDR) list_old.next;
  
  #ifdef HANDLE_NEW_OBJ_LIST
    if (list_old.data == NEW_OBJ_INFO_MAGIC)
--- 683,689 ----
  
    new_lm->l_variant = OBJ_LIST_OLD;
    new_lm->l_lladdr = lladdr;
!   new_lm->l_next = host_pointer_to_core_addr (list_old.next);
  
  #ifdef HANDLE_NEW_OBJ_LIST
    if (list_old.data == NEW_OBJ_INFO_MAGIC)
*************** find_solib (so_list_ptr)
*** 818,825 ****
  /* A small stub to get us past the arg-passing pinhole of catch_errors.  */
  
  static int
! symbol_add_stub (arg)
!      char *arg;
  {
    register struct so_list *so = (struct so_list *) arg;		/* catch_errs bogon */
    CORE_ADDR text_addr = 0;
--- 819,825 ----
  /* A small stub to get us past the arg-passing pinhole of catch_errors.  */
  
  static int
! symbol_add_stub (void *arg)
  {
    register struct so_list *so = (struct so_list *) arg;		/* catch_errs bogon */
    CORE_ADDR text_addr = 0;
*************** symbol_add_stub (arg)
*** 848,853 ****
--- 848,854 ----
    section_addrs.other[0].addr = text_addr;
    so->objfile = symbol_file_add (so->so_name, so->from_tty,
  				 &section_addrs, 0, 0);
+   /* must be non-zero */
    return (1);
  }
  
Index: procfs.c
===================================================================
RCS file: /cvs/src/src/gdb/procfs.c,v
retrieving revision 1.15
diff -p -r1.15 procfs.c
*** procfs.c	2000/05/28 01:12:29	1.15
--- procfs.c	2000/06/01 10:55:01
*************** proc_set_watchpoint (pi, addr, len, wfla
*** 2562,2568 ****
    prwatch_t *pwatch;
  
    pwatch            = (prwatch_t *) &arg.watch;
!   pwatch->pr_vaddr  = addr;
    pwatch->pr_size   = len;
    pwatch->pr_wflags = wflags;
  #if defined(NEW_PROC_API) && defined (PCWATCH)
--- 2562,2568 ----
    prwatch_t *pwatch;
  
    pwatch            = (prwatch_t *) &arg.watch;
!   pwatch->pr_vaddr  = address_to_host_pointer (addr);
    pwatch->pr_size   = len;
    pwatch->pr_wflags = wflags;
  #if defined(NEW_PROC_API) && defined (PCWATCH)
*************** proc_iterate_over_mappings (func)
*** 2683,2689 ****
  	 not a problem.  */
  
        /* Stop looping if the callback returns non-zero.  */
!       if ((funcstat = (*func) (fd, (CORE_ADDR) map[i].pr_vaddr)) != 0)
  	break;
      }
  #endif
--- 2683,2690 ----
  	 not a problem.  */
  
        /* Stop looping if the callback returns non-zero.  */
!       funcstat = (*func) (fd, host_pointer_to_address (map[i].pr_vaddr));
!       if (funcstat != 0)
  	break;
      }
  #endif
Index: utils.c
===================================================================
RCS file: /cvs/src/src/gdb/utils.c,v
retrieving revision 1.14
diff -p -r1.14 utils.c
*** utils.c	2000/05/28 01:12:33	1.14
--- utils.c	2000/06/01 10:55:15
***************
*** 50,55 ****
--- 50,57 ----
  #include "language.h"
  #include "annotate.h"
  
+ #include "inferior.h" /* for signed_pointer_to_address */
+ 
  #include <readline/readline.h>
  
  #undef XMALLOC
*************** phex_nz (ULONGEST l, int sizeof_l)
*** 2981,2984 ****
--- 2983,3007 ----
        break;
      }
    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;
  }
Index: config/mips/tm-mips.h
===================================================================
RCS file: /cvs/src/src/gdb/config/mips/tm-mips.h,v
retrieving revision 1.6
diff -p -r1.6 tm-mips.h
*** tm-mips.h	2000/05/28 01:12:36	1.6
--- tm-mips.h	2000/06/01 10:55:23
*************** typedef unsigned long t_inst;	/* Integer
*** 587,589 ****
--- 587,594 ----
  
  /* 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))


More information about the Gdb-patches mailing list