78 error (
_(
"Unsupported address size in DWARF expressions: %d bits"),
85 0,
"<signed DWARF address type>");
142 size_t newlen = ctx->
stack_len + need + 10;
181 error (
_(
"dwarf expression stack underflow"));
191 error (
_(
"Asked for position %d of stack, "
192 "stack only has %d elements on it."),
205 error (
_(
"integral type expected in DWARF expression"));
225 error (
_(
"no unsigned variant found for type, while evaluating "
226 "DWARF expression"));
247 error (
_(
"no signed variant found for type, while evaluating "
248 "DWARF expression"));
291 error (
_(
"Asked for position %d of stack, "
292 "stack only has %d elements on it."),
343 p->
v.
ptr.die.sect_off = ctx->
len;
378 error (
_(
"DWARF expression error: ran off end of buffer reading uleb128 value"));
390 error (
_(
"DWARF expression error: ran off end of buffer reading sleb128 value"));
399 error (
_(
"DWARF expression error: ran off end of buffer reading leb128 value"));
414 if (op_ptr != op_end && *op_ptr != DW_OP_piece && *op_ptr != DW_OP_bit_piece)
415 error (
_(
"DWARF-2 expression error: `%s' operations must be "
416 "used either alone or in conjunction with DW_OP_piece "
417 "or DW_OP_bit_piece."),
449 error (
_(
"Could not find type for DW_OP_GNU_const_type"));
451 error (
_(
"DW_OP_GNU_const_type has different sizes for type and data"));
470 if (*buf >= DW_OP_reg0 && *buf <= DW_OP_reg31)
472 if (buf_end - buf != 1)
474 return *buf - DW_OP_reg0;
477 if (*buf == DW_OP_GNU_regval_type)
487 else if (*buf == DW_OP_regx)
496 if (buf != buf_end || (
int) dwarf_reg != dwarf_reg)
516 if (*buf >= DW_OP_breg0 && *buf <= DW_OP_breg31)
518 dwarf_reg = *buf - DW_OP_breg0;
523 else if (*buf == DW_OP_bregx)
529 if ((
int) dwarf_reg != dwarf_reg)
541 if (*buf == DW_OP_deref)
544 *deref_size_return = -1;
546 else if (*buf == DW_OP_deref_size)
551 *deref_size_return = *buf++;
574 if (*buf != DW_OP_fbreg)
581 *fb_offset_return = fb_offset;
582 if (buf != buf_end || fb_offset != (
LONGEST) *fb_offset_return)
601 if (*buf >= DW_OP_breg0 && *buf <= DW_OP_breg31)
603 dwarf_reg = *buf - DW_OP_breg0;
608 if (*buf != DW_OP_bregx)
623 *sp_offset_return = sp_offset;
624 if (buf != buf_end || sp_offset != (
LONGEST) *sp_offset_return)
651 error (
_(
"DWARF-2 expression error: Loop detected (%d)."),
655 while (op_ptr < op_end)
657 enum dwarf_location_atom op = *op_ptr++;
665 int in_stack_memory = 0;
666 uint64_t uoffset,
reg;
668 struct value *result_val = NULL;
708 result = op - DW_OP_lit0;
720 if (op_ptr >= op_end || *op_ptr != DW_OP_GNU_push_tls_address)
725 case DW_OP_GNU_addr_index:
731 case DW_OP_GNU_const_index:
823 && *op_ptr != DW_OP_piece
824 && *op_ptr != DW_OP_bit_piece
825 && *op_ptr != DW_OP_GNU_uninit)
826 error (
_(
"DWARF-2 expression error: DW_OP_reg operations must be "
827 "used either alone or in conjunction with DW_OP_piece "
828 "or DW_OP_bit_piece."));
830 result = op - DW_OP_reg0;
844 case DW_OP_implicit_value:
849 if (op_ptr + len > op_end)
850 error (
_(
"DW_OP_implicit_value: too few bytes available."));
856 "DW_OP_implicit_value");
860 case DW_OP_stack_value:
865 case DW_OP_GNU_implicit_pointer:
870 error (
_(
"DWARF-2 expression error: DW_OP_GNU_implicit_pointer "
871 "is not allowed in frame context"));
885 "DW_OP_GNU_implicit_pointer");
942 unsigned int before_stack_len;
962 error (
_(
"Not implemented: computing frame "
963 "base using explicit value operator"));
992 error (
_(
"Not enough elements for "
993 "DW_OP_swap. Need 2, have %d."),
1012 error (
_(
"Not enough elements for "
1013 "DW_OP_rot. Need 3, have %d."),
1025 case DW_OP_deref_size:
1026 case DW_OP_GNU_deref_type:
1028 int addr_size = (op == DW_OP_deref ? ctx->
addr_size : *op_ptr++);
1029 gdb_byte *buf = alloca (addr_size);
1035 if (op == DW_OP_GNU_deref_type)
1040 type_die.
cu_off = uoffset;
1044 type = address_type;
1057 byte_order, result);
1067 case DW_OP_plus_uconst:
1087 case DW_OP_plus_uconst:
1117 struct value *first, *second;
1126 error (
_(
"Incompatible types on DWARF stack"));
1133 result_val =
value_binop (first, second, BINOP_BITWISE_AND);
1136 result_val =
value_binop (first, second, BINOP_DIV);
1139 result_val =
value_binop (first, second, BINOP_SUB);
1149 if (orig_type == address_type)
1160 result_val =
value_binop (first, second, BINOP_MOD);
1162 result_val =
value_cast (orig_type, result_val);
1166 result_val =
value_binop (first, second, BINOP_MUL);
1171 result_val =
value_binop (first, second, BINOP_BITWISE_IOR);
1174 result_val =
value_binop (first, second, BINOP_ADD);
1179 result_val =
value_binop (first, second, BINOP_LSH);
1192 result_val =
value_binop (first, second, BINOP_RSH);
1209 result_val =
value_binop (first, second, BINOP_RSH);
1218 result_val =
value_binop (first, second, BINOP_BITWISE_XOR);
1249 _(
"Can't be reached."));
1254 case DW_OP_call_frame_cfa:
1257 in_stack_memory = 1;
1260 case DW_OP_GNU_push_tls_address:
1315 case DW_OP_bit_piece:
1333 case DW_OP_GNU_uninit:
1334 if (op_ptr != op_end)
1335 error (
_(
"DWARF-2 expression error: DW_OP_GNU_uninit must always "
1336 "be the very last op."));
1361 case DW_OP_GNU_entry_value:
1368 if (op_ptr + len > op_end)
1369 error (
_(
"DW_OP_GNU_entry_value: too few bytes available."));
1387 if (deref_size == -1)
1392 kind_u, deref_size);
1396 error (
_(
"DWARF-2 expression error: DW_OP_GNU_entry_value is "
1397 "supported only for single DW_OP_reg* "
1398 "or for DW_OP_breg*(0)+DW_OP_deref*"));
1401 case DW_OP_GNU_parameter_ref:
1415 case DW_OP_GNU_const_type:
1423 type_die.
cu_off = uoffset;
1433 case DW_OP_GNU_regval_type:
1440 type_die.
cu_off = uoffset;
1447 case DW_OP_GNU_convert:
1448 case DW_OP_GNU_reinterpret:
1454 type_die.
cu_off = uoffset;
1456 if (type_die.
cu_off == 0)
1457 type = address_type;
1464 if (op == DW_OP_GNU_convert)
1472 error (
_(
"DW_OP_GNU_reinterpret has wrong size"));
1480 case DW_OP_push_object_address:
1487 error (
_(
"Unhandled dwarf expression opcode 0x%x"), op);
1513 error (
_(
"%s is invalid in this context"),
"DW_OP_fbreg");
1521 error (
_(
"%s is invalid in this context"),
"DW_OP_call_frame_cfa");
1529 error (
_(
"%s is invalid in this context"),
"DW_OP_GNU_implicit_pointer");
1537 error (
_(
"%s is invalid in this context"),
"DW_OP_GNU_push_tls_address");
1545 error (
_(
"%s is invalid in this context"),
"DW_OP_call*");
1553 error (
_(
"Support for typed DWARF is not supported in this context"));
1566 _(
"Support for DW_OP_GNU_entry_value is unimplemented"));
1574 error (
_(
"%s is invalid in this context"),
"DW_OP_GNU_addr_index");
CORE_ADDR gdbarch_integer_to_address(struct gdbarch *gdbarch, struct type *type, const gdb_byte *buf)
void dwarf_expr_push_address(struct dwarf_expr_context *ctx, CORE_ADDR value, int in_stack_memory)
struct value * value_zero(struct type *type, enum lval_type lv)
ULONGEST extract_unsigned_integer(const gdb_byte *, int, enum bfd_endian)
static int base_types_equal_p(struct type *t1, struct type *t2)
static void add_piece(struct dwarf_expr_context *ctx, ULONGEST size, ULONGEST offset)
struct value * value_from_contents_and_address(struct type *type, const gdb_byte *valaddr, CORE_ADDR address)
CORE_ADDR ctx_no_get_frame_pc(void *baton)
static struct type * get_signed_type(struct gdbarch *gdbarch, struct type *type)
struct type * dw_types[3]
struct value * value_from_contents(struct type *type, const gdb_byte *contents)
struct dwarf_expr_piece::@52::@55 ptr
LONGEST value_as_long(struct value *val)
void * gdbarch_data(struct gdbarch *gdbarch, struct gdbarch_data *data)
const struct builtin_type * builtin_type(struct gdbarch *gdbarch)
void internal_error(const char *file, int line, const char *fmt,...)
struct type * builtin_uint8
struct type * ctx_no_get_base_type(struct dwarf_expr_context *ctx, cu_offset die)
struct type * builtin_uint16
CORE_ADDR(* get_addr_index)(void *baton, unsigned int index)
void ctx_no_get_frame_base(void *baton, const gdb_byte **start, size_t *length)
void dwarf_expr_require_composition(const gdb_byte *op_ptr, const gdb_byte *op_end, const char *op_name)
struct type *(* get_base_type)(struct dwarf_expr_context *ctx, cu_offset die)
const gdb_byte * safe_read_uleb128(const gdb_byte *buf, const gdb_byte *buf_end, uint64_t *r)
static const gdb_byte * gdb_skip_leb128(const gdb_byte *buf, const gdb_byte *buf_end)
static void dwarf_expr_pop(struct dwarf_expr_context *ctx)
static void execute_stack_op(struct dwarf_expr_context *, const gdb_byte *, const gdb_byte *)
struct type * builtin_int32
struct value * dwarf_expr_fetch(struct dwarf_expr_context *ctx, int n)
int gdbarch_integer_to_address_p(struct gdbarch *gdbarch)
void store_unsigned_integer(gdb_byte *, int, enum bfd_endian, ULONGEST)
#define GDBARCH_OBSTACK_ZALLOC(GDBARCH, TYPE)
CORE_ADDR ctx_no_get_addr_index(void *baton, unsigned int index)
CORE_ADDR(* get_object_address)(void *baton)
char * op_name(struct expression *exp, enum exp_opcode opcode)
const gdb_byte * safe_skip_leb128(const gdb_byte *buf, const gdb_byte *buf_end)
CORE_ADDR(* get_tls_address)(void *baton, CORE_ADDR offset)
const gdb_byte * value_contents(struct value *value)
struct dwarf_expr_piece::@52::@53 mem
const struct dwarf_expr_context_funcs * funcs
static int dwarf_expr_stack_empty_p(struct dwarf_expr_context *ctx)
void initialize_file_ftype(void)
int gdbarch_sp_regnum(struct gdbarch *gdbarch)
static struct gdbarch_data * dwarf_arch_cookie
const gdb_byte * value_contents_all(struct value *value)
initialize_file_ftype _initialize_dwarf2expr
struct type * builtin_int16
static void dwarf_require_integral(struct type *type)
enum bfd_endian gdbarch_byte_order(struct gdbarch *gdbarch)
struct cleanup * make_cleanup(make_cleanup_ftype *function, void *arg)
static const gdb_byte * gdb_read_uleb128(const gdb_byte *buf, const gdb_byte *buf_end, uint64_t *r)
struct type * builtin_uint32
CORE_ADDR ctx_no_get_tls_address(void *baton, CORE_ADDR offset)
struct dwarf_expr_context * new_dwarf_expr_context(void)
static struct type * dwarf_get_base_type(struct dwarf_expr_context *ctx, cu_offset die, int size)
static void dwarf_expr_grow_stack(struct dwarf_expr_context *ctx, size_t need)
struct value * value_cast(struct type *type, struct value *arg2)
struct dwarf_expr_piece::@52::@54 literal
struct type * arch_integer_type(struct gdbarch *gdbarch, int bit, int unsigned_p, char *name)
int value_equal(struct value *arg1, struct value *arg2)
enum dwarf_value_location location
struct value *(* get_reg_value)(void *baton, struct type *type, int regnum)
struct dwarf_expr_piece * pieces
const gdb_byte * safe_read_sleb128(const gdb_byte *buf, const gdb_byte *buf_end, int64_t *r)
PTR xrealloc(PTR ptr, size_t size)
int gdbarch_dwarf2_reg_to_regnum(struct gdbarch *gdbarch, int dwarf2_regnr)
int dwarf_block_to_dwarf_reg(const gdb_byte *buf, const gdb_byte *buf_end)
static struct type * get_unsigned_type(struct gdbarch *gdbarch, struct type *type)
struct value * value_neg(struct value *arg1)
CORE_ADDR(* get_frame_cfa)(void *baton)
#define TYPE_CODE(thistype)
void(* dwarf_call)(struct dwarf_expr_context *ctx, cu_offset die_offset)
void free_dwarf_expr_context(struct dwarf_expr_context *ctx)
static struct type * dwarf_expr_address_type(struct dwarf_expr_context *ctx)
static void dwarf_expr_push(struct dwarf_expr_context *ctx, struct value *value, int in_stack_memory)
int value_less(struct value *arg1, struct value *arg2)
static void free_dwarf_expr_context_cleanup(void *arg)
struct value * value_complement(struct value *arg1)
static void * dwarf_gdbarch_types_init(struct gdbarch *gdbarch)
CORE_ADDR(* read_addr_from_reg)(void *baton, int regnum)
CORE_ADDR ctx_no_get_frame_cfa(void *baton)
struct value * value_binop(struct value *arg1, struct value *arg2, enum exp_opcode op)
void(* get_frame_base)(void *baton, const gdb_byte **start, size_t *length)
int dwarf_expr_fetch_in_stack_memory(struct dwarf_expr_context *ctx, int n)
enum dwarf_value_location location
void ctx_no_push_dwarf_reg_entry_value(struct dwarf_expr_context *ctx, enum call_site_parameter_kind kind, union call_site_parameter_u kind_u, int deref_size)
unsigned long long ULONGEST
struct dwarf_stack_value * stack
struct type * value_type(const struct value *value)
static const gdb_byte * gdb_read_sleb128(const gdb_byte *buf, const gdb_byte *buf_end, int64_t *r)
struct type * builtin_int64
struct value * value_from_ulongest(struct type *type, ULONGEST num)
union dwarf_expr_piece::@52 v
CORE_ADDR dwarf_expr_fetch_address(struct dwarf_expr_context *ctx, int n)
void(* push_dwarf_reg_entry_value)(struct dwarf_expr_context *ctx, enum call_site_parameter_kind kind, union call_site_parameter_u kind_u, int deref_size)
#define TYPE_LENGTH(thistype)
int dwarf_block_to_dwarf_reg_deref(const gdb_byte *buf, const gdb_byte *buf_end, CORE_ADDR *deref_size_return)
void dwarf_expr_eval(struct dwarf_expr_context *ctx, const gdb_byte *addr, size_t len)
struct type * builtin_uint64
LONGEST extract_signed_integer(const gdb_byte *, int, enum bfd_endian)
struct type * builtin_int8
PTR xcalloc(size_t number, size_t size)
void ctx_no_dwarf_call(struct dwarf_expr_context *ctx, cu_offset die_offset)
int dwarf_block_to_sp_offset(struct gdbarch *gdbarch, const gdb_byte *buf, const gdb_byte *buf_end, CORE_ADDR *sp_offset_return)
void error(const char *fmt,...)
struct gdbarch_data * gdbarch_data_register_post_init(gdbarch_data_post_init_ftype *post_init)
int dwarf_block_to_fb_offset(const gdb_byte *buf, const gdb_byte *buf_end, CORE_ADDR *fb_offset_return)
struct cleanup * make_cleanup_free_dwarf_expr_context(struct dwarf_expr_context *ctx)
struct type * builtin_int
const ULONGEST const LONGEST len
void(* read_mem)(void *baton, gdb_byte *buf, CORE_ADDR addr, size_t length)