gdb: Convert language la_get_symbol_name_matcher field to a method
[deliverable/binutils-gdb.git] / gdb / dwarf2 / loc.c
index e98c67384877a65f9485b378d217d6297744e104..400bb4d16fc7ad7d37bcf03e054d87db96277894 100644 (file)
@@ -673,7 +673,7 @@ public:
 
   struct type *get_base_type (cu_offset die_offset, int size) override
   {
-    struct type *result = dwarf2_get_die_type (die_offset, per_cu);
+    struct type *result = dwarf2_get_die_type (die_offset, per_cu, per_objfile);
     if (result == NULL)
       error (_("Could not find type for DW_OP_const_type"));
     if (size != 0 && TYPE_LENGTH (result) != size)
@@ -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);
   }
@@ -4162,7 +4168,7 @@ disassemble_dwarf_expression (struct ui_file *stream,
 
            data = safe_read_uleb128 (data, end, &ul);
            cu_offset offset = (cu_offset) ul;
-           type = dwarf2_get_die_type (offset, per_cu);
+           type = dwarf2_get_die_type (offset, per_cu, per_objfile);
            fprintf_filtered (stream, "<");
            type_print (type, "", stream, -1);
            fprintf_filtered (stream, " [0x%s]> %d",
@@ -4178,7 +4184,7 @@ disassemble_dwarf_expression (struct ui_file *stream,
 
            data = safe_read_uleb128 (data, end, &ul);
            cu_offset type_die = (cu_offset) ul;
-           type = dwarf2_get_die_type (type_die, per_cu);
+           type = dwarf2_get_die_type (type_die, per_cu, per_objfile);
            fprintf_filtered (stream, "<");
            type_print (type, "", stream, -1);
            fprintf_filtered (stream, " [0x%s]>",
@@ -4202,7 +4208,7 @@ disassemble_dwarf_expression (struct ui_file *stream,
            data = safe_read_uleb128 (data, end, &ul);
            cu_offset type_die = (cu_offset) ul;
 
-           type = dwarf2_get_die_type (type_die, per_cu);
+           type = dwarf2_get_die_type (type_die, per_cu, per_objfile);
            fprintf_filtered (stream, "<");
            type_print (type, "", stream, -1);
            fprintf_filtered (stream, " [0x%s]> [$%s]",
@@ -4225,7 +4231,7 @@ disassemble_dwarf_expression (struct ui_file *stream,
              {
                struct type *type;
 
-               type = dwarf2_get_die_type (type_die, per_cu);
+               type = dwarf2_get_die_type (type_die, per_cu, per_objfile);
                fprintf_filtered (stream, "<");
                type_print (type, "", stream, -1);
                fprintf_filtered (stream, " [0x%s]>",
This page took 0.025196 seconds and 4 git commands to generate.