gas: remove use of PTR
[binutils-gdb.git] / gdb / valops.c
index e091c445e7948599bdf8c3689302949c4d0cf6ce..27e84d9f6b32581da9ca79a946d6e91e035b21ee 100644 (file)
@@ -103,9 +103,9 @@ show_overload_resolution (struct ui_file *file, int from_tty,
                          struct cmd_list_element *c, 
                          const char *value)
 {
-  fprintf_filtered (file, _("Overload resolution in evaluating "
-                           "C++ functions is %s.\n"),
-                   value);
+  gdb_printf (file, _("Overload resolution in evaluating "
+                     "C++ functions is %s.\n"),
+             value);
 }
 
 /* Find the address of function name NAME in the inferior.  If OBJF_P
@@ -120,14 +120,14 @@ find_function_in_inferior (const char *name, struct objfile **objf_p)
   sym = lookup_symbol (name, 0, VAR_DOMAIN, 0);
   if (sym.symbol != NULL)
     {
-      if (SYMBOL_CLASS (sym.symbol) != LOC_BLOCK)
+      if (sym.symbol->aclass () != LOC_BLOCK)
        {
          error (_("\"%s\" exists in this program but is not a function."),
                 name);
        }
 
       if (objf_p)
-       *objf_p = symbol_objfile (sym.symbol);
+       *objf_p = sym.symbol->objfile ();
 
       return value_of_variable (sym.symbol, sym.block);
     }
@@ -146,7 +146,7 @@ find_function_in_inferior (const char *name, struct objfile **objf_p)
          type = lookup_pointer_type (builtin_type (gdbarch)->builtin_char);
          type = lookup_function_type (type);
          type = lookup_pointer_type (type);
-         maddr = BMSYMBOL_VALUE_ADDRESS (msymbol);
+         maddr = msymbol.value_address ();
 
          if (objf_p)
            *objf_p = objfile;
@@ -274,7 +274,7 @@ value_cast_structs (struct type *type, struct value *v2)
       if (v)
        {
          /* Downcasting is possible (t1 is superclass of v2).  */
-         CORE_ADDR addr2 = value_address (v2);
+         CORE_ADDR addr2 = value_address (v2) + value_embedded_offset (v2);
 
          addr2 -= value_address (v) + value_embedded_offset (v);
          return value_at (type, addr2);
@@ -1387,7 +1387,7 @@ value_of_variable (struct symbol *var, const struct block *b)
 struct value *
 address_of_variable (struct symbol *var, const struct block *b)
 {
-  struct type *type = SYMBOL_TYPE (var);
+  struct type *type = var->type ();
   struct value *val;
 
   /* Evaluate it first; if the result is a memory address, we're fine.
@@ -2374,6 +2374,15 @@ value_struct_elt (struct value **argp,
       if (v)
        return v;
 
+      if (current_language->la_language == language_fortran)
+       {
+         /* If it is not a field it is the type name of an inherited
+         structure.  */
+         v = search_struct_field (name, *argp, t, 1);
+         if (v)
+           return v;
+       }
+
       /* C++: If it was not found as a data field, then try to
         return it as a pointer to a method.  */
       v = search_struct_method (name, argp, args, 0,
@@ -2833,7 +2842,7 @@ find_overload_match (gdb::array_view<value *> args,
             the function part.  Do not try this for non-functions (e.g.
             function pointers).  */
          if (qualified_name
-             && (check_typedef (SYMBOL_TYPE (fsym))->code ()
+             && (check_typedef (fsym->type ())->code ()
                  == TYPE_CODE_FUNC))
            {
              temp_func = cp_func_name (qualified_name);
@@ -3187,14 +3196,14 @@ find_oload_champ (gdb::array_view<value *> args,
              static_offset = oload_method_static_p (methods, ix);
            }
          else
-           nparms = SYMBOL_TYPE (functions[ix])->num_fields ();
+           nparms = functions[ix]->type ()->num_fields ();
 
          parm_types.reserve (nparms);
          for (jj = 0; jj < nparms; jj++)
            {
              type *t = (methods != NULL
                         ? (TYPE_FN_FIELD_ARGS (methods, ix)[jj].type ())
-                        : SYMBOL_TYPE (functions[ix])->field (jj).type ());
+                        : functions[ix]->type ()->field (jj).type ());
              parm_types.push_back (t);
            }
        }
@@ -3207,28 +3216,28 @@ find_oload_champ (gdb::array_view<value *> args,
       if (overload_debug)
        {
          if (methods != NULL)
-           fprintf_filtered (gdb_stderr,
-                             "Overloaded method instance %s, # of parms %d\n",
-                             methods[ix].physname, (int) parm_types.size ());
+           gdb_printf (gdb_stderr,
+                       "Overloaded method instance %s, # of parms %d\n",
+                       methods[ix].physname, (int) parm_types.size ());
          else if (xmethods != NULL)
-           fprintf_filtered (gdb_stderr,
-                             "Xmethod worker, # of parms %d\n",
-                             (int) parm_types.size ());
+           gdb_printf (gdb_stderr,
+                       "Xmethod worker, # of parms %d\n",
+                       (int) parm_types.size ());
          else
-           fprintf_filtered (gdb_stderr,
-                             "Overloaded function instance "
-                             "%s # of parms %d\n",
-                             functions[ix]->demangled_name (),
-                             (int) parm_types.size ());
+           gdb_printf (gdb_stderr,
+                       "Overloaded function instance "
+                       "%s # of parms %d\n",
+                       functions[ix]->demangled_name (),
+                       (int) parm_types.size ());
 
-         fprintf_filtered (gdb_stderr,
-                           "...Badness of length : {%d, %d}\n",
-                           bv[0].rank, bv[0].subrank);
+         gdb_printf (gdb_stderr,
+                     "...Badness of length : {%d, %d}\n",
+                     bv[0].rank, bv[0].subrank);
 
          for (jj = 1; jj < bv.size (); jj++)
-           fprintf_filtered (gdb_stderr,
-                             "...Badness of arg %d : {%d, %d}\n",
-                             jj, bv[jj].rank, bv[jj].subrank);
+           gdb_printf (gdb_stderr,
+                       "...Badness of arg %d : {%d, %d}\n",
+                       jj, bv[jj].rank, bv[jj].subrank);
        }
 
       if (oload_champ_bv->empty ())
@@ -3256,9 +3265,9 @@ find_oload_champ (gdb::array_view<value *> args,
            break;
          }
       if (overload_debug)
-       fprintf_filtered (gdb_stderr, "Overload resolution "
-                         "champion is %d, ambiguous? %d\n",
-                         oload_champ, oload_ambiguous);
+       gdb_printf (gdb_stderr, "Overload resolution "
+                   "champion is %d, ambiguous? %d\n",
+                   oload_champ, oload_ambiguous);
     }
 
   return oload_champ;
@@ -3779,8 +3788,8 @@ value_maybe_namespace_elt (const struct type *curtype,
   if (sym.symbol == NULL)
     return NULL;
   else if ((noside == EVAL_AVOID_SIDE_EFFECTS)
-          && (SYMBOL_CLASS (sym.symbol) == LOC_TYPEDEF))
-    result = allocate_value (SYMBOL_TYPE (sym.symbol));
+          && (sym.symbol->aclass () == LOC_TYPEDEF))
+    result = allocate_value (sym.symbol->type ());
   else
     result = value_of_variable (sym.symbol, sym.block);