#include "gdbtypes.h"
#include "value.h"
#include "gdbcore.h"
-#include "elf/dwarf2.h"
+#include "dwarf2.h"
#include "dwarf2expr.h"
#include "gdb_assert.h"
xfree (ctx);
}
+/* Helper for make_cleanup_free_dwarf_expr_context. */
+
+static void
+free_dwarf_expr_context_cleanup (void *arg)
+{
+ free_dwarf_expr_context (arg);
+}
+
+/* Return a cleanup that calls free_dwarf_expr_context. */
+
+struct cleanup *
+make_cleanup_free_dwarf_expr_context (struct dwarf_expr_context *ctx)
+{
+ return make_cleanup (free_dwarf_expr_context_cleanup, ctx);
+}
+
/* Expand the memory allocated to CTX's stack to contain at least
NEED more elements than are currently used. */
dwarf2_read_address (struct gdbarch *gdbarch, gdb_byte *buf,
gdb_byte *buf_end, int addr_size)
{
+ enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
CORE_ADDR result;
if (buf_end - buf < addr_size)
return gdbarch_integer_to_address
(gdbarch, unsigned_address_type (gdbarch, addr_size), buf);
- return extract_unsigned_integer (buf, addr_size);
+ return extract_unsigned_integer (buf, addr_size, byte_order);
}
/* Return the type of an address of size ADDR_SIZE,
execute_stack_op (struct dwarf_expr_context *ctx,
gdb_byte *op_ptr, gdb_byte *op_end)
{
+ enum bfd_endian byte_order = gdbarch_byte_order (ctx->gdbarch);
+
ctx->in_reg = 0;
ctx->initialized = 1; /* Default is initialized. */
break;
case DW_OP_const1u:
- result = extract_unsigned_integer (op_ptr, 1);
+ result = extract_unsigned_integer (op_ptr, 1, byte_order);
op_ptr += 1;
break;
case DW_OP_const1s:
- result = extract_signed_integer (op_ptr, 1);
+ result = extract_signed_integer (op_ptr, 1, byte_order);
op_ptr += 1;
break;
case DW_OP_const2u:
- result = extract_unsigned_integer (op_ptr, 2);
+ result = extract_unsigned_integer (op_ptr, 2, byte_order);
op_ptr += 2;
break;
case DW_OP_const2s:
- result = extract_signed_integer (op_ptr, 2);
+ result = extract_signed_integer (op_ptr, 2, byte_order);
op_ptr += 2;
break;
case DW_OP_const4u:
- result = extract_unsigned_integer (op_ptr, 4);
+ result = extract_unsigned_integer (op_ptr, 4, byte_order);
op_ptr += 4;
break;
case DW_OP_const4s:
- result = extract_signed_integer (op_ptr, 4);
+ result = extract_signed_integer (op_ptr, 4, byte_order);
op_ptr += 4;
break;
case DW_OP_const8u:
- result = extract_unsigned_integer (op_ptr, 8);
+ result = extract_unsigned_integer (op_ptr, 8, byte_order);
op_ptr += 8;
break;
case DW_OP_const8s:
- result = extract_signed_integer (op_ptr, 8);
+ result = extract_signed_integer (op_ptr, 8, byte_order);
op_ptr += 8;
break;
case DW_OP_constu:
}
break;
+ case DW_OP_call_frame_cfa:
+ result = (ctx->get_frame_cfa) (ctx->baton);
+ break;
+
case DW_OP_GNU_push_tls_address:
/* Variable is at a constant offset in the thread-local
storage block into the objfile for the current thread and
break;
case DW_OP_skip:
- offset = extract_signed_integer (op_ptr, 2);
+ offset = extract_signed_integer (op_ptr, 2, byte_order);
op_ptr += 2;
op_ptr += offset;
goto no_push;
case DW_OP_bra:
- offset = extract_signed_integer (op_ptr, 2);
+ offset = extract_signed_integer (op_ptr, 2, byte_order);
op_ptr += 2;
if (dwarf_expr_fetch (ctx, 0) != 0)
op_ptr += offset;