gdb: remove FIELD_TYPE macro
[deliverable/binutils-gdb.git] / gdb / dwarf2 / loc.c
index 7953361adeed0b5a9c633417f6c60efe0a83c439..400bb4d16fc7ad7d37bcf03e054d87db96277894 100644 (file)
@@ -726,24 +726,30 @@ public:
     data_src = deref_size == -1 ? parameter->value : parameter->data_value;
     size = deref_size == -1 ? parameter->value_size : parameter->data_value_size;
 
-    gdb_assert (this->per_objfile == caller_per_objfile);
-
     /* DEREF_SIZE size is not verified here.  */
     if (data_src == NULL)
       throw_error (NO_ENTRY_VALUE_ERROR,
                   _("Cannot resolve DW_AT_call_data_value"));
 
+    /* We are about to evaluate an expression in the context of the caller
+       of the current frame.  This evaluation context may be different from
+       the current (callee's) context), so temporarily set the caller's context.
+
+       It is possible for the caller to be from a different objfile from the
+       callee if the call is made through a function pointer.  */
     scoped_restore save_frame = make_scoped_restore (&this->frame,
                                                     caller_frame);
     scoped_restore save_per_cu = make_scoped_restore (&this->per_cu,
                                                      caller_per_cu);
     scoped_restore save_obj_addr = make_scoped_restore (&this->obj_address,
                                                        (CORE_ADDR) 0);
+    scoped_restore save_per_objfile = make_scoped_restore (&this->per_objfile,
+                                                          caller_per_objfile);
 
     scoped_restore save_arch = make_scoped_restore (&this->gdbarch);
     this->gdbarch = this->per_objfile->objfile->arch ();
     scoped_restore save_addr_size = make_scoped_restore (&this->addr_size);
-    this->addr_size = per_cu->addr_size ();
+    this->addr_size = this->per_cu->addr_size ();
 
     this->eval (data_src, size);
   }
This page took 0.025506 seconds and 4 git commands to generate.