This is the mail archive of the gdb-patches@sources.redhat.com mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

[patch] s/value_as_pointer/value_as_address/


Hello,

The attached patch renames the function value_as_pointer() to
value_as_address().  This is to make the function name consistent with
both its semantics and its documentation.  The good old days when you
could assume pointer == address have long gone.

I should note that there is a recripical function value_from_pointer().
For the moment I'm leaving that be.  That function converts the
address into a `struct value' containing a target pointer rather than a
`struct value' containing the full value of the address.  I suspect GDB
needs both but that is another story. [:-)]

Assuming no one raises a problem with this over the next few days I'll
commit it to the trunk.

enjoy,
Andrew



Index: ChangeLog
2001-09-21  Andrew Cagney  <ac131313@redhat.com>

	* value.h (value_as_address): Rename value_as_pointer.
	* eval.c, findvar.c, gnu-v2-abi.c, gnu-v3-abi.c, jv-lang.c,
	jv-valprint.c, printcmd.c, stack.c, top.c, valarith.c, valops.c,
	values.c: Update.

2001-09-21  Andrew Cagney  <ac131313@redhat.com>

	* gdbint.texinfo (Target Architecture Definition): Function
	value_as_pointer renamed to value_as_address.

Index: eval.c
===================================================================
RCS file: /cvs/src/src/gdb/eval.c,v
retrieving revision 1.13
diff -p -r1.13 eval.c
*** eval.c	2001/04/27 00:19:09	1.13
--- eval.c	2001/09/22 02:53:27
*************** parse_and_eval_address (char *exp)
*** 80,86 ****
    register struct cleanup *old_chain =
    make_cleanup (free_current_contents, &expr);
  
!   addr = value_as_pointer (evaluate_expression (expr));
    do_cleanups (old_chain);
    return addr;
  }
--- 80,86 ----
    register struct cleanup *old_chain =
    make_cleanup (free_current_contents, &expr);
  
!   addr = value_as_address (evaluate_expression (expr));
    do_cleanups (old_chain);
    return addr;
  }
*************** parse_and_eval_address_1 (char **expptr)
*** 96,102 ****
    register struct cleanup *old_chain =
    make_cleanup (free_current_contents, &expr);
  
!   addr = value_as_pointer (evaluate_expression (expr));
    do_cleanups (old_chain);
    return addr;
  }
--- 96,102 ----
    register struct cleanup *old_chain =
    make_cleanup (free_current_contents, &expr);
  
!   addr = value_as_address (evaluate_expression (expr));
    do_cleanups (old_chain);
    return addr;
  }
*************** evaluate_subexp_standard (struct type *e
*** 1676,1682 ****
  	return value_zero (exp->elts[pc + 1].type, lval_memory);
        else
  	return value_at_lazy (exp->elts[pc + 1].type,
! 			      value_as_pointer (arg1),
  			      NULL);
  
      case UNOP_PREINCREMENT:
--- 1676,1682 ----
  	return value_zero (exp->elts[pc + 1].type, lval_memory);
        else
  	return value_at_lazy (exp->elts[pc + 1].type,
! 			      value_as_address (arg1),
  			      NULL);
  
      case UNOP_PREINCREMENT:
Index: findvar.c
===================================================================
RCS file: /cvs/src/src/gdb/findvar.c,v
retrieving revision 1.22
diff -p -r1.22 findvar.c
*** findvar.c	2001/08/01 18:39:23	1.22
--- findvar.c	2001/09/22 02:53:28
*************** addresses have not been bound by the dyn
*** 522,528 ****
  				      SYMBOL_BASEREG (var), frame);
  	if (regval == NULL)
  	  error ("Value of base register not available.");
! 	addr = value_as_pointer (regval);
  	addr += SYMBOL_VALUE (var);
  	break;
        }
--- 522,528 ----
  				      SYMBOL_BASEREG (var), frame);
  	if (regval == NULL)
  	  error ("Value of base register not available.");
! 	addr = value_as_address (regval);
  	addr += SYMBOL_VALUE (var);
  	break;
        }
*************** addresses have not been bound by the dyn
*** 560,566 ****
  	    if (regval == NULL)
  	      error ("Value of register variable not available.");
  
! 	    addr = value_as_pointer (regval);
  	    VALUE_LVAL (v) = lval_memory;
  	  }
  	else
--- 560,566 ----
  	    if (regval == NULL)
  	      error ("Value of register variable not available.");
  
! 	    addr = value_as_address (regval);
  	    VALUE_LVAL (v) = lval_memory;
  	  }
  	else
Index: gnu-v2-abi.c
===================================================================
RCS file: /cvs/src/src/gdb/gnu-v2-abi.c,v
retrieving revision 1.3
diff -p -r1.3 gnu-v2-abi.c
*** gnu-v2-abi.c	2001/05/25 17:09:48	1.3
--- gnu-v2-abi.c	2001/09/22 02:53:28
*************** gnuv2_value_rtti_type (value_ptr v, int 
*** 251,262 ****
                                            TYPE_VPTR_FIELDNO (known_type));
        tempval=value_field (v, TYPE_VPTR_FIELDNO(known_type));
        VALUE_ADDRESS(tempval) += bitpos / 8;
!       vtbl=value_as_pointer (tempval);
        using_enclosing=1;
      }
    else
      {
!       vtbl=value_as_pointer(value_field(v,TYPE_VPTR_FIELDNO(known_type)));
        using_enclosing=0;
      }
  
--- 251,262 ----
                                            TYPE_VPTR_FIELDNO (known_type));
        tempval=value_field (v, TYPE_VPTR_FIELDNO(known_type));
        VALUE_ADDRESS(tempval) += bitpos / 8;
!       vtbl=value_as_address (tempval);
        using_enclosing=1;
      }
    else
      {
!       vtbl=value_as_address(value_field(v,TYPE_VPTR_FIELDNO(known_type)));
        using_enclosing=0;
      }
  
Index: gnu-v3-abi.c
===================================================================
RCS file: /cvs/src/src/gdb/gnu-v3-abi.c,v
retrieving revision 1.3
diff -p -r1.3 gnu-v3-abi.c
*** gnu-v3-abi.c	2001/06/07 14:51:20	1.3
--- gnu-v3-abi.c	2001/09/22 02:53:28
*************** gnuv3_rtti_type (struct value *value,
*** 209,215 ****
    /* Fetch VALUE's virtual table pointer, and tweak it to point at
       an instance of our imaginary gdb_gnu_v3_abi_vtable structure.   */
    vtable_address
!     = value_as_pointer (value_field (value, TYPE_VPTR_FIELDNO (value_type)));
    vtable = value_at_lazy (vtable_type,
                            vtable_address - vtable_address_point_offset (),
                            VALUE_BFD_SECTION (value));
--- 209,215 ----
    /* Fetch VALUE's virtual table pointer, and tweak it to point at
       an instance of our imaginary gdb_gnu_v3_abi_vtable structure.   */
    vtable_address
!     = value_as_address (value_field (value, TYPE_VPTR_FIELDNO (value_type)));
    vtable = value_at_lazy (vtable_type,
                            vtable_address - vtable_address_point_offset (),
                            VALUE_BFD_SECTION (value));
*************** gnuv3_virtual_fn_field (struct value **v
*** 311,317 ****
    /* Now value is an object of the appropriate base type.  Fetch its
       virtual table.  */
    vtable_address
!     = value_as_pointer (value_field (value, TYPE_VPTR_FIELDNO (vfn_base)));
    vtable = value_at_lazy (vtable_type,
                            vtable_address - vtable_address_point_offset (),
                            VALUE_BFD_SECTION (value));
--- 311,317 ----
    /* Now value is an object of the appropriate base type.  Fetch its
       virtual table.  */
    vtable_address
!     = value_as_address (value_field (value, TYPE_VPTR_FIELDNO (vfn_base)));
    vtable = value_at_lazy (vtable_type,
                            vtable_address - vtable_address_point_offset (),
                            VALUE_BFD_SECTION (value));
Index: jv-lang.c
===================================================================
RCS file: /cvs/src/src/gdb/jv-lang.c,v
retrieving revision 1.7
diff -p -r1.7 jv-lang.c
*** jv-lang.c	2001/03/23 22:48:44	1.7
--- jv-lang.c	2001/09/22 02:53:28
*************** java_class_from_object (value_ptr obj_va
*** 232,238 ****
    if (TYPE_CODE (VALUE_TYPE (obj_val)) == TYPE_CODE_PTR
        && TYPE_LENGTH (TYPE_TARGET_TYPE (VALUE_TYPE (obj_val))) == 0)
      obj_val = value_at (get_java_object_type (),
! 			value_as_pointer (obj_val), NULL);
  
    vtable_val = value_struct_elt (&obj_val, NULL, "vtable", NULL, "structure");
    return value_struct_elt (&vtable_val, NULL, "class", NULL, "structure");
--- 232,238 ----
    if (TYPE_CODE (VALUE_TYPE (obj_val)) == TYPE_CODE_PTR
        && TYPE_LENGTH (TYPE_TARGET_TYPE (VALUE_TYPE (obj_val))) == 0)
      obj_val = value_at (get_java_object_type (),
! 			value_as_address (obj_val), NULL);
  
    vtable_val = value_struct_elt (&obj_val, NULL, "vtable", NULL, "structure");
    return value_struct_elt (&vtable_val, NULL, "class", NULL, "structure");
*************** static int
*** 243,249 ****
  java_class_is_primitive (value_ptr clas)
  {
    value_ptr vtable = value_struct_elt (&clas, NULL, "vtable", NULL, "struct");
!   CORE_ADDR i = value_as_pointer (vtable);
    return (int) (i & 0x7fffffff) == (int) 0x7fffffff;
  }
  
--- 243,249 ----
  java_class_is_primitive (value_ptr clas)
  {
    value_ptr vtable = value_struct_elt (&clas, NULL, "vtable", NULL, "struct");
!   CORE_ADDR i = value_as_address (vtable);
    return (int) (i & 0x7fffffff) == (int) 0x7fffffff;
  }
  
*************** evaluate_subexp_java (struct type *expec
*** 911,917 ****
  
  	  if (noside == EVAL_AVOID_SIDE_EFFECTS)
  	    return value_zero (el_type, VALUE_LVAL (arg1));
! 	  address = value_as_pointer (arg1);
  	  address += JAVA_OBJECT_SIZE;
  	  read_memory (address, buf4, 4);
  	  length = (long) extract_signed_integer (buf4, 4);
--- 911,917 ----
  
  	  if (noside == EVAL_AVOID_SIDE_EFFECTS)
  	    return value_zero (el_type, VALUE_LVAL (arg1));
! 	  address = value_as_address (arg1);
  	  address += JAVA_OBJECT_SIZE;
  	  read_memory (address, buf4, 4);
  	  length = (long) extract_signed_integer (buf4, 4);
Index: jv-valprint.c
===================================================================
RCS file: /cvs/src/src/gdb/jv-valprint.c,v
retrieving revision 1.7
diff -p -r1.7 jv-valprint.c
*** jv-valprint.c	2001/03/23 22:48:44	1.7
--- jv-valprint.c	2001/09/22 02:53:28
*************** java_value_print (value_ptr val, struct 
*** 202,208 ****
        && strcmp (TYPE_NAME (TYPE_TARGET_TYPE (type)), "java.lang.String") == 0
        && (format == 0 || format == 's')
        && address != 0
!       && value_as_pointer (val) != 0)
      {
        value_ptr data_val;
        CORE_ADDR data;
--- 202,208 ----
        && strcmp (TYPE_NAME (TYPE_TARGET_TYPE (type)), "java.lang.String") == 0
        && (format == 0 || format == 's')
        && address != 0
!       && value_as_address (val) != 0)
      {
        value_ptr data_val;
        CORE_ADDR data;
*************** java_value_print (value_ptr val, struct 
*** 215,227 ****
        mark = value_mark ();	/* Remember start of new values */
  
        data_val = value_struct_elt (&val, NULL, "data", NULL, NULL);
!       data = value_as_pointer (data_val);
  
        boffset_val = value_struct_elt (&val, NULL, "boffset", NULL, NULL);
!       boffset = value_as_pointer (boffset_val);
  
        count_val = value_struct_elt (&val, NULL, "count", NULL, NULL);
!       count = value_as_pointer (count_val);
  
        value_free_to_mark (mark);	/* Release unnecessary values */
  
--- 215,227 ----
        mark = value_mark ();	/* Remember start of new values */
  
        data_val = value_struct_elt (&val, NULL, "data", NULL, NULL);
!       data = value_as_address (data_val);
  
        boffset_val = value_struct_elt (&val, NULL, "boffset", NULL, NULL);
!       boffset = value_as_address (boffset_val);
  
        count_val = value_struct_elt (&val, NULL, "count", NULL, NULL);
!       count = value_as_address (count_val);
  
        value_free_to_mark (mark);	/* Release unnecessary values */
  
Index: printcmd.c
===================================================================
RCS file: /cvs/src/src/gdb/printcmd.c,v
retrieving revision 1.27
diff -p -r1.27 printcmd.c
*** printcmd.c	2001/09/12 04:18:08	1.27
--- printcmd.c	2001/09/22 02:53:29
*************** x_command (char *exp, int from_tty)
*** 1348,1354 ****
  	   && VALUE_LVAL (val) == lval_memory)
  	next_address = VALUE_ADDRESS (val);
        else
! 	next_address = value_as_pointer (val);
        if (VALUE_BFD_SECTION (val))
  	next_section = VALUE_BFD_SECTION (val);
        do_cleanups (old_chain);
--- 1348,1354 ----
  	   && VALUE_LVAL (val) == lval_memory)
  	next_address = VALUE_ADDRESS (val);
        else
! 	next_address = value_as_address (val);
        if (VALUE_BFD_SECTION (val))
  	next_section = VALUE_BFD_SECTION (val);
        do_cleanups (old_chain);
*************** do_one_display (struct display *d)
*** 1586,1592 ****
  	printf_filtered ("  ");
  
        val = evaluate_expression (d->exp);
!       addr = value_as_pointer (val);
        if (d->format.format == 'i')
  	addr = ADDR_BITS_REMOVE (addr);
  
--- 1586,1592 ----
  	printf_filtered ("  ");
  
        val = evaluate_expression (d->exp);
!       addr = value_as_address (val);
        if (d->format.format == 'i')
  	addr = ADDR_BITS_REMOVE (addr);
  
*************** printf_command (char *arg, int from_tty)
*** 2248,2254 ****
  	      char *str;
  	      CORE_ADDR tem;
  	      int j;
! 	      tem = value_as_pointer (val_args[i]);
  
  	      /* This is a %s argument.  Find the length of the string.  */
  	      for (j = 0;; j++)
--- 2248,2254 ----
  	      char *str;
  	      CORE_ADDR tem;
  	      int j;
! 	      tem = value_as_address (val_args[i]);
  
  	      /* This is a %s argument.  Find the length of the string.  */
  	      for (j = 0;; j++)
Index: stack.c
===================================================================
RCS file: /cvs/src/src/gdb/stack.c,v
retrieving revision 1.22
diff -p -r1.22 stack.c
*** stack.c	2001/07/14 18:59:07	1.22
--- stack.c	2001/09/22 02:53:29
*************** parse_frame_specification (char *frame_e
*** 701,707 ****
  	    tmp_cleanup = make_cleanup (xfree, addr_string);
  
  	    /* NOTE: we call parse_and_eval and then both
! 	       value_as_long and value_as_pointer rather than calling
  	       parse_and_eval_long and parse_and_eval_address because
  	       of the issue of potential side effects from evaluating
  	       the expression.  */
--- 701,707 ----
  	    tmp_cleanup = make_cleanup (xfree, addr_string);
  
  	    /* NOTE: we call parse_and_eval and then both
! 	       value_as_long and value_as_address rather than calling
  	       parse_and_eval_long and parse_and_eval_address because
  	       of the issue of potential side effects from evaluating
  	       the expression.  */
*************** parse_frame_specification (char *frame_e
*** 709,715 ****
  	    if (numargs == 0)
  	      level = value_as_long (vp);
  
! 	    args[numargs++] = value_as_pointer (vp);
  	    do_cleanups (tmp_cleanup);
  	  }
  
--- 709,715 ----
  	    if (numargs == 0)
  	      level = value_as_long (vp);
  
! 	    args[numargs++] = value_as_address (vp);
  	    do_cleanups (tmp_cleanup);
  	  }
  
Index: top.c
===================================================================
RCS file: /cvs/src/src/gdb/top.c,v
retrieving revision 1.45
diff -p -r1.45 top.c
*** top.c	2001/09/07 21:33:08	1.45
--- top.c	2001/09/22 02:53:30
*************** get_prompt_1 (void *data)
*** 1436,1442 ****
  		  break;
  		case TYPE_CODE_PTR:
  		  elt_type = check_typedef (TYPE_TARGET_TYPE (arg_type));
! 		  addrval = value_as_pointer (arg_val);
  
  		  if (TYPE_LENGTH (elt_type) == 1 &&
  		      TYPE_CODE (elt_type) == TYPE_CODE_INT &&
--- 1436,1442 ----
  		  break;
  		case TYPE_CODE_PTR:
  		  elt_type = check_typedef (TYPE_TARGET_TYPE (arg_type));
! 		  addrval = value_as_address (arg_val);
  
  		  if (TYPE_LENGTH (elt_type) == 1 &&
  		      TYPE_CODE (elt_type) == TYPE_CODE_INT &&
Index: valarith.c
===================================================================
RCS file: /cvs/src/src/gdb/valarith.c,v
retrieving revision 1.8
diff -p -r1.8 valarith.c
*** valarith.c	2001/08/01 18:39:23	1.8
--- valarith.c	2001/09/22 02:53:31
*************** value_add (value_ptr arg1, value_ptr arg
*** 80,86 ****
        if (len == 0)
  	len = 1;		/* For (void *) */
        retval = value_from_pointer (valptrtype,
! 				   value_as_pointer (valptr)
  				   + (len * value_as_long (valint)));
        VALUE_BFD_SECTION (retval) = VALUE_BFD_SECTION (valptr);
        return retval;
--- 80,86 ----
        if (len == 0)
  	len = 1;		/* For (void *) */
        retval = value_from_pointer (valptrtype,
! 				   value_as_address (valptr)
  				   + (len * value_as_long (valint)));
        VALUE_BFD_SECTION (retval) = VALUE_BFD_SECTION (valptr);
        return retval;
*************** value_sub (value_ptr arg1, value_ptr arg
*** 105,111 ****
  	  /* pointer - integer.  */
  	  LONGEST sz = TYPE_LENGTH (check_typedef (TYPE_TARGET_TYPE (type1)));
  	  return value_from_pointer (VALUE_TYPE (arg1),
! 				     (value_as_pointer (arg1)
  				      - (sz * value_as_long (arg2))));
  	}
        else if (TYPE_CODE (type2) == TYPE_CODE_PTR
--- 105,111 ----
  	  /* pointer - integer.  */
  	  LONGEST sz = TYPE_LENGTH (check_typedef (TYPE_TARGET_TYPE (type1)));
  	  return value_from_pointer (VALUE_TYPE (arg1),
! 				     (value_as_address (arg1)
  				      - (sz * value_as_long (arg2))));
  	}
        else if (TYPE_CODE (type2) == TYPE_CODE_PTR
*************** value_equal (register value_ptr arg1, re
*** 1200,1208 ****
    /* FIXME: Need to promote to either CORE_ADDR or LONGEST, whichever
       is bigger.  */
    else if (code1 == TYPE_CODE_PTR && (code2 == TYPE_CODE_INT || code2 == TYPE_CODE_BOOL))
!     return value_as_pointer (arg1) == (CORE_ADDR) value_as_long (arg2);
    else if (code2 == TYPE_CODE_PTR && (code1 == TYPE_CODE_INT || code1 == TYPE_CODE_BOOL))
!     return (CORE_ADDR) value_as_long (arg1) == value_as_pointer (arg2);
  
    else if (code1 == code2
  	   && ((len = (int) TYPE_LENGTH (type1))
--- 1200,1208 ----
    /* FIXME: Need to promote to either CORE_ADDR or LONGEST, whichever
       is bigger.  */
    else if (code1 == TYPE_CODE_PTR && (code2 == TYPE_CODE_INT || code2 == TYPE_CODE_BOOL))
!     return value_as_address (arg1) == (CORE_ADDR) value_as_long (arg2);
    else if (code2 == TYPE_CODE_PTR && (code1 == TYPE_CODE_INT || code1 == TYPE_CODE_BOOL))
!     return (CORE_ADDR) value_as_long (arg1) == value_as_address (arg2);
  
    else if (code1 == code2
  	   && ((len = (int) TYPE_LENGTH (type1))
*************** value_less (register value_ptr arg1, reg
*** 1254,1267 ****
  	   && (code2 == TYPE_CODE_FLT || code2 == TYPE_CODE_INT || code2 == TYPE_CODE_BOOL))
      return value_as_double (arg1) < value_as_double (arg2);
    else if (code1 == TYPE_CODE_PTR && code2 == TYPE_CODE_PTR)
!     return value_as_pointer (arg1) < value_as_pointer (arg2);
  
    /* FIXME: Need to promote to either CORE_ADDR or LONGEST, whichever
       is bigger.  */
    else if (code1 == TYPE_CODE_PTR && (code2 == TYPE_CODE_INT || code2 == TYPE_CODE_BOOL))
!     return value_as_pointer (arg1) < (CORE_ADDR) value_as_long (arg2);
    else if (code2 == TYPE_CODE_PTR && (code1 == TYPE_CODE_INT || code1 == TYPE_CODE_BOOL))
!     return (CORE_ADDR) value_as_long (arg1) < value_as_pointer (arg2);
    else if (code1 == TYPE_CODE_STRING && code2 == TYPE_CODE_STRING)
      return value_strcmp (arg1, arg2) < 0;
    else
--- 1254,1267 ----
  	   && (code2 == TYPE_CODE_FLT || code2 == TYPE_CODE_INT || code2 == TYPE_CODE_BOOL))
      return value_as_double (arg1) < value_as_double (arg2);
    else if (code1 == TYPE_CODE_PTR && code2 == TYPE_CODE_PTR)
!     return value_as_address (arg1) < value_as_address (arg2);
  
    /* FIXME: Need to promote to either CORE_ADDR or LONGEST, whichever
       is bigger.  */
    else if (code1 == TYPE_CODE_PTR && (code2 == TYPE_CODE_INT || code2 == TYPE_CODE_BOOL))
!     return value_as_address (arg1) < (CORE_ADDR) value_as_long (arg2);
    else if (code2 == TYPE_CODE_PTR && (code1 == TYPE_CODE_INT || code1 == TYPE_CODE_BOOL))
!     return (CORE_ADDR) value_as_long (arg1) < value_as_address (arg2);
    else if (code1 == TYPE_CODE_STRING && code2 == TYPE_CODE_STRING)
      return value_strcmp (arg1, arg2) < 0;
    else
Index: valops.c
===================================================================
RCS file: /cvs/src/src/gdb/valops.c,v
retrieving revision 1.38
diff -p -r1.38 valops.c
*** valops.c	2001/07/10 21:24:48	1.38
--- valops.c	2001/09/22 02:53:32
*************** value_ind (value_ptr arg1)
*** 970,976 ****
        enc_type = TYPE_TARGET_TYPE (enc_type);
        /* Retrieve the enclosing object pointed to */
        arg2 = value_at_lazy (enc_type,
! 		   value_as_pointer (arg1) - VALUE_POINTED_TO_OFFSET (arg1),
  			    VALUE_BFD_SECTION (arg1));
        /* Re-adjust type */
        VALUE_TYPE (arg2) = TYPE_TARGET_TYPE (base_type);
--- 970,976 ----
        enc_type = TYPE_TARGET_TYPE (enc_type);
        /* Retrieve the enclosing object pointed to */
        arg2 = value_at_lazy (enc_type,
! 		   value_as_address (arg1) - VALUE_POINTED_TO_OFFSET (arg1),
  			    VALUE_BFD_SECTION (arg1));
        /* Re-adjust type */
        VALUE_TYPE (arg2) = TYPE_TARGET_TYPE (base_type);
*************** find_function_addr (value_ptr function, 
*** 1221,1227 ****
      }
    else if (code == TYPE_CODE_PTR)
      {
!       funaddr = value_as_pointer (function);
        ftype = check_typedef (TYPE_TARGET_TYPE (ftype));
        if (TYPE_CODE (ftype) == TYPE_CODE_FUNC
  	  || TYPE_CODE (ftype) == TYPE_CODE_METHOD)
--- 1221,1227 ----
      }
    else if (code == TYPE_CODE_PTR)
      {
!       funaddr = value_as_address (function);
        ftype = check_typedef (TYPE_TARGET_TYPE (ftype));
        if (TYPE_CODE (ftype) == TYPE_CODE_FUNC
  	  || TYPE_CODE (ftype) == TYPE_CODE_METHOD)
*************** find_function_addr (value_ptr function, 
*** 1237,1243 ****
        /* Handle the case of functions lacking debugging info.
           Their values are characters since their addresses are char */
        if (TYPE_LENGTH (ftype) == 1)
! 	funaddr = value_as_pointer (value_addr (function));
        else
  	/* Handle integer used as address of a function.  */
  	funaddr = (CORE_ADDR) value_as_long (function);
--- 1237,1243 ----
        /* Handle the case of functions lacking debugging info.
           Their values are characters since their addresses are char */
        if (TYPE_LENGTH (ftype) == 1)
! 	funaddr = value_as_address (value_addr (function));
        else
  	/* Handle integer used as address of a function.  */
  	funaddr = (CORE_ADDR) value_as_long (function);
Index: value.h
===================================================================
RCS file: /cvs/src/src/gdb/value.h,v
retrieving revision 1.21
diff -p -r1.21 value.h
*** value.h	2001/08/01 18:39:24	1.21
--- value.h	2001/09/22 02:53:32
*************** extern LONGEST value_as_long (value_ptr 
*** 289,295 ****
  
  extern DOUBLEST value_as_double (value_ptr val);
  
! extern CORE_ADDR value_as_pointer (value_ptr val);
  
  extern LONGEST unpack_long (struct type *type, char *valaddr);
  
--- 289,295 ----
  
  extern DOUBLEST value_as_double (value_ptr val);
  
! extern CORE_ADDR value_as_address (value_ptr val);
  
  extern LONGEST unpack_long (struct type *type, char *valaddr);
  
Index: values.c
===================================================================
RCS file: /cvs/src/src/gdb/values.c,v
retrieving revision 1.22
diff -p -r1.22 values.c
*** values.c	2001/08/01 18:39:24	1.22
--- values.c	2001/09/22 02:53:32
*************** value_as_double (register value_ptr val)
*** 561,567 ****
     Note that val's type may not actually be a pointer; value_as_long
     handles all the cases.  */
  CORE_ADDR
! value_as_pointer (value_ptr val)
  {
    /* Assume a CORE_ADDR can fit in a LONGEST (for now).  Not sure
       whether we want this to be true eventually.  */
--- 561,567 ----
     Note that val's type may not actually be a pointer; value_as_long
     handles all the cases.  */
  CORE_ADDR
! value_as_address (value_ptr val)
  {
    /* Assume a CORE_ADDR can fit in a LONGEST (for now).  Not sure
       whether we want this to be true eventually.  */
*************** unpack_double (struct type *type, char *
*** 709,715 ****
     host byte order.
  
     If you want functions and arrays to be coerced to pointers, and
!    references to be dereferenced, call value_as_pointer() instead.
  
     C++: It is assumed that the front-end has taken care of
     all matters concerning pointers to members.  A pointer
--- 709,715 ----
     host byte order.
  
     If you want functions and arrays to be coerced to pointers, and
!    references to be dereferenced, call value_as_address() instead.
  
     C++: It is assumed that the front-end has taken care of
     all matters concerning pointers to members.  A pointer
*************** value_headof (value_ptr in_arg, struct t
*** 979,985 ****
    /* Turn vtable into typeinfo function */
    VALUE_OFFSET(vtbl)+=4;
  
!   msymbol = lookup_minimal_symbol_by_pc ( value_as_pointer(value_ind(vtbl)) );
    if (msymbol == NULL
        || (demangled_name = SYMBOL_NAME (msymbol)) == NULL)
        {
--- 979,985 ----
    /* Turn vtable into typeinfo function */
    VALUE_OFFSET(vtbl)+=4;
  
!   msymbol = lookup_minimal_symbol_by_pc ( value_as_address(value_ind(vtbl)) );
    if (msymbol == NULL
        || (demangled_name = SYMBOL_NAME (msymbol)) == NULL)
        {
Index: doc/gdbint.texinfo
===================================================================
RCS file: /cvs/src/src/gdb/doc/gdbint.texinfo,v
retrieving revision 1.39
diff -p -r1.39 gdbint.texinfo
*** gdbint.texinfo	2001/09/08 10:53:45	1.39
--- gdbint.texinfo	2001/09/22 02:53:34
*************** If @var{type} is not a pointer or refere
*** 2441,2447 ****
  will signal an internal error.
  @end deftypefun
  
! @deftypefun CORE_ADDR value_as_pointer (value_ptr @var{val})
  Assuming that @var{val} is a pointer, return the address it represents,
  as appropriate for the current architecture.
  
--- 2441,2447 ----
  will signal an internal error.
  @end deftypefun
  
! @deftypefun CORE_ADDR value_as_address (value_ptr @var{val})
  Assuming that @var{val} is a pointer, return the address it represents,
  as appropriate for the current architecture.
  

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]