2007-06-13 Markus Deuling <deuling@de.ibm.com>
[deliverable/binutils-gdb.git] / gdb / valops.c
index 51304be70cfc9c3aa967d7d9052ec3382bef42de..35f6558f53ca907f297e846716c88d23ffb584db 100644 (file)
@@ -182,7 +182,8 @@ struct value *
 value_allocate_space_in_inferior (int len)
 {
   struct value *blocklen;
-  struct value *val = find_function_in_inferior (NAME_OF_MALLOC);
+  struct value *val = find_function_in_inferior
+                       (gdbarch_name_of_malloc (current_gdbarch));
 
   blocklen = value_from_longest (builtin_type_int, (LONGEST) len);
   val = call_function_by_hand (val, 1, &blocklen);
@@ -373,23 +374,8 @@ value_cast (struct type *type, struct value *arg2)
     {
       LONGEST longest;
 
-      /* If target compiled by HP aCC.  */
-      if (deprecated_hp_som_som_object_present
-         && code2 == TYPE_CODE_MEMBERPTR)
-       {
-         unsigned int *ptr;
-         struct value *retvalp;
-
-         /* With HP aCC, pointers to data members have a bias.  */
-         retvalp = value_from_longest (type, value_as_long (arg2));
-         /* force evaluation */
-         ptr = (unsigned int *) value_contents (retvalp);
-         *ptr &= ~0x20000000;  /* zap 29th bit to remove bias */
-         return retvalp;
-       }
-
       /* When we cast pointers to integers, we mustn't use
-         POINTER_TO_ADDRESS to find the address the pointer
+         gdbarch_pointer_to_address to find the address the pointer
          represents, as value_as_long would.  GDB should evaluate
          expressions just as the compiler would --- and the compiler
          sees a cast as a simple reinterpretation of the pointer's
@@ -416,7 +402,7 @@ value_cast (struct type *type, struct value *arg2)
         otherwise occur when dealing with a target having two byte
         pointers and four byte addresses.  */
 
-      int addr_bit = TARGET_ADDR_BIT;
+      int addr_bit = gdbarch_addr_bit (current_gdbarch);
 
       LONGEST longest = value_as_long (arg2);
       if (addr_bit < sizeof (LONGEST) * HOST_CHAR_BIT)
@@ -578,7 +564,7 @@ value_assign (struct value *toval, struct value *fromval)
   /* Since modifying a register can trash the frame chain, and modifying memory
      can trash the frame cache, we save the old frame and then restore the new
      frame afterwards.  */
-  old_frame = get_frame_id (deprecated_selected_frame);
+  old_frame = get_frame_id (deprecated_safe_get_selected_frame ());
 
   switch (VALUE_LVAL (toval))
     {
@@ -650,12 +636,14 @@ value_assign (struct value *toval, struct value *fromval)
        if (!frame)
          error (_("Value being assigned to is no longer active."));
        
-       if (CONVERT_REGISTER_P (VALUE_REGNUM (toval), type))
+       if (gdbarch_convert_register_p
+           (current_gdbarch, VALUE_REGNUM (toval), type))
          {
            /* If TOVAL is a special machine register requiring
               conversion of program values to a special raw format.  */
-           VALUE_TO_REGISTER (frame, VALUE_REGNUM (toval),
-                              type, value_contents (fromval));
+           gdbarch_value_to_register (current_gdbarch,
+                                      frame, VALUE_REGNUM (toval),
+                                      type, value_contents (fromval));
          }
        else
          {
@@ -2667,16 +2655,18 @@ value_of_local (const char *name, int complain)
   struct symbol *func, *sym;
   struct block *b;
   struct value * ret;
+  struct frame_info *frame;
 
-  if (deprecated_selected_frame == 0)
+  if (complain)
+    frame = get_selected_frame (_("no frame selected"));
+  else
     {
-      if (complain)
-       error (_("no frame selected"));
-      else
+      frame = deprecated_safe_get_selected_frame ();
+      if (frame == 0)
        return 0;
     }
 
-  func = get_frame_function (deprecated_selected_frame);
+  func = get_frame_function (frame);
   if (!func)
     {
       if (complain)
@@ -2705,7 +2695,7 @@ value_of_local (const char *name, int complain)
        return NULL;
     }
 
-  ret = read_var_value (sym, deprecated_selected_frame);
+  ret = read_var_value (sym, frame);
   if (ret == 0 && complain)
     error (_("`%s' argument unreadable"), name);
   return ret;
This page took 0.024753 seconds and 4 git commands to generate.