+/* Given context CTX, section offset SECT_OFF, and compilation unit
+ data PER_CU, execute the "variable value" operation on the DIE
+ found at SECT_OFF. */
+
+static struct value *
+sect_variable_value (struct dwarf_expr_context *ctx, sect_offset sect_off,
+ struct dwarf2_per_cu_data *per_cu)
+{
+ struct type *die_type = dwarf2_fetch_die_type_sect_off (sect_off, per_cu);
+
+ if (die_type == NULL)
+ error (_("Bad DW_OP_GNU_variable_value DIE."));
+
+ /* Note: Things still work when the following test is removed. This
+ test and error is here to conform to the proposed specification. */
+ if (TYPE_CODE (die_type) != TYPE_CODE_INT
+ && TYPE_CODE (die_type) != TYPE_CODE_PTR)
+ error (_("Type of DW_OP_GNU_variable_value DIE must be an integer or pointer."));
+
+ struct type *type = lookup_pointer_type (die_type);
+ struct frame_info *frame = get_selected_frame (_("No frame selected."));
+ return indirect_synthetic_pointer (sect_off, 0, per_cu, frame, type, true);
+}
+