#include "dwarf2.h"
#include "dwarf2/expr.h"
#include "dwarf2/loc.h"
+#include "dwarf2/read.h"
#include "gdbsupport/underlying.h"
#include "gdbarch.h"
/* Create a new context for the expression evaluator. */
-dwarf_expr_context::dwarf_expr_context ()
+dwarf_expr_context::dwarf_expr_context (dwarf2_per_objfile *per_objfile)
: gdbarch (NULL),
addr_size (0),
ref_addr_size (0),
- offset (0),
recursion_depth (0),
max_recursion_depth (0x100),
location (DWARF_VALUE_MEMORY),
len (0),
data (NULL),
- initialized (0)
+ initialized (0),
+ per_objfile (per_objfile)
{
}
static void
dwarf_require_integral (struct type *type)
{
- if (TYPE_CODE (type) != TYPE_CODE_INT
- && TYPE_CODE (type) != TYPE_CODE_CHAR
- && TYPE_CODE (type) != TYPE_CODE_BOOL)
+ if (type->code () != TYPE_CODE_INT
+ && type->code () != TYPE_CODE_CHAR
+ && type->code () != TYPE_CODE_BOOL)
error (_("integral type expected in DWARF expression"));
}
static int
base_types_equal_p (struct type *t1, struct type *t2)
{
- if (TYPE_CODE (t1) != TYPE_CODE (t2))
+ if (t1->code () != t2->code ())
return 0;
if (TYPE_UNSIGNED (t1) != TYPE_UNSIGNED (t2))
return 0;
index, not an address. We don't support things like
branching between the address and the TLS op. */
if (op_ptr >= op_end || *op_ptr != DW_OP_GNU_push_tls_address)
- result += this->offset;
+ result += this->per_objfile->objfile->text_section_offset ();
result_val = value_from_ulongest (address_type, result);
break;
case DW_OP_GNU_addr_index:
op_ptr = safe_read_uleb128 (op_ptr, op_end, &uoffset);
result = this->get_addr_index (uoffset);
- result += this->offset;
+ result += this->per_objfile->objfile->text_section_offset ();
result_val = value_from_ulongest (address_type, result);
break;
case DW_OP_GNU_const_index: