Introduce assign_operation
[deliverable/binutils-gdb.git] / gdb / parse.c
index b3cd91d2730c9e595cd7c148320d12e26ef006e1..884a00862ece650d99cb28f8e0eb6bd81c51ec0d 100644 (file)
@@ -416,7 +416,7 @@ find_minsym_type_and_address (minimal_symbol *msymbol,
                              CORE_ADDR *address_p)
 {
   bound_minimal_symbol bound_msym = {msymbol, objfile};
-  struct obj_section *section = MSYMBOL_OBJ_SECTION (objfile, msymbol);
+  struct obj_section *section = msymbol->obj_section (objfile);
   enum minimal_symbol_type type = MSYMBOL_TYPE (msymbol);
 
   bool is_tls = (section != NULL
@@ -650,6 +650,32 @@ handle_register:
   return;
 }
 
+/* See parser-defs.h.  */
+
+void
+write_exp_symbol_reference (struct parser_state *pstate, const char *name,
+                           struct block_symbol sym)
+{
+  if (sym.symbol != nullptr)
+    {
+      if (symbol_read_needs_frame (sym.symbol))
+       pstate->block_tracker->update (sym);
+      write_exp_elt_opcode (pstate, OP_VAR_VALUE);
+      write_exp_elt_block (pstate, sym.block);
+      write_exp_elt_sym (pstate, sym.symbol);
+      write_exp_elt_opcode (pstate, OP_VAR_VALUE);
+    }
+  else
+    {
+      struct bound_minimal_symbol msymbol = lookup_bound_minimal_symbol (name);
+      if (msymbol.minsym != NULL)
+       write_exp_msymbol (pstate, msymbol);
+      else if (!have_full_symbols () && !have_partial_symbols ())
+       error (_("No symbol table is loaded.  Use the \"file\" command."));
+      else
+       error (_("No symbol \"%s\" in current context."), name);
+    }
+}
 
 const char *
 find_template_name_end (const char *p)
@@ -1320,7 +1346,7 @@ operator_check_standard (struct expression *exp, int pos,
        for (arg = 0; arg < nargs; arg++)
          {
            struct type *inst_type = elts[pos + 3 + arg].type;
-           struct objfile *inst_objfile = TYPE_OBJFILE (inst_type);
+           struct objfile *inst_objfile = inst_type->objfile_owner ();
 
            if (inst_objfile && (*objfile_func) (inst_objfile, data))
              return 1;
@@ -1333,8 +1359,7 @@ operator_check_standard (struct expression *exp, int pos,
        const struct block *const block = elts[pos + 1].block;
        const struct symbol *const symbol = elts[pos + 2].symbol;
 
-       /* Check objfile where the variable itself is placed.
-          SYMBOL_OBJ_SECTION (symbol) may be NULL.  */
+       /* Check objfile where the variable itself is placed.  */
        if ((*objfile_func) (symbol_objfile (symbol), data))
          return 1;
 
@@ -1351,9 +1376,10 @@ operator_check_standard (struct expression *exp, int pos,
 
   /* Invoke callbacks for TYPE and OBJFILE if they were set as non-NULL.  */
 
-  if (type && TYPE_OBJFILE (type)
-      && (*objfile_func) (TYPE_OBJFILE (type), data))
+  if (type != nullptr && type->objfile_owner () != nullptr
+      && objfile_func (type->objfile_owner (), data))
     return 1;
+
   if (objfile && (*objfile_func) (objfile, data))
     return 1;
 
This page took 0.024747 seconds and 4 git commands to generate.