int eh_frame_p);
static CORE_ADDR read_encoded_value (struct comp_unit *unit, gdb_byte encoding,
- int ptr_len, gdb_byte *buf,
+ int ptr_len, const gdb_byte *buf,
unsigned int *bytes_read_ptr,
CORE_ADDR func_base);
\f
CFA_REG_OFFSET,
CFA_EXP
} cfa_how;
- gdb_byte *cfa_exp;
+ const gdb_byte *cfa_exp;
/* Used to implement DW_CFA_remember_state. */
struct dwarf2_frame_state_reg_info *prev;
}
static void
-no_get_frame_base (void *baton, gdb_byte **start, size_t *length)
+no_get_frame_base (void *baton, const gdb_byte **start, size_t *length)
{
internal_error (__FILE__, __LINE__,
_("Support for DW_OP_fbreg is unimplemented"));
_("Support for DW_OP_GNU_push_tls_address is unimplemented"));
}
+/* Helper function for execute_stack_op. */
+
+static void
+no_dwarf_call (struct dwarf_expr_context *ctx, size_t die_offset)
+{
+ internal_error (__FILE__, __LINE__,
+ _("Support for DW_OP_call* is invalid in CFI"));
+}
+
/* Execute the required actions for both the DW_CFA_restore and
DW_CFA_restore_extended instructions. */
static void
}
static CORE_ADDR
-execute_stack_op (gdb_byte *exp, ULONGEST len, int addr_size,
+execute_stack_op (const gdb_byte *exp, ULONGEST len, int addr_size,
struct frame_info *this_frame, CORE_ADDR initial,
int initial_in_stack_memory)
{
ctx->get_frame_base = no_get_frame_base;
ctx->get_frame_cfa = no_get_frame_cfa;
ctx->get_tls_address = no_get_tls_address;
+ ctx->dwarf_call = no_dwarf_call;
dwarf_expr_push (ctx, initial, initial_in_stack_memory);
dwarf_expr_eval (ctx, exp, len);
- result = dwarf_expr_fetch (ctx, 0);
- if (ctx->location == DWARF_VALUE_REGISTER)
- result = read_reg (this_frame, result);
- else if (ctx->location != DWARF_VALUE_MEMORY)
+ if (ctx->location == DWARF_VALUE_MEMORY)
+ result = dwarf_expr_fetch_address (ctx, 0);
+ else if (ctx->location == DWARF_VALUE_REGISTER)
+ result = read_reg (this_frame, dwarf_expr_fetch (ctx, 0));
+ else
{
/* This is actually invalid DWARF, but if we ever do run across
it somehow, we might as well support it. So, instead, report
\f
static void
-execute_cfa_program (struct dwarf2_fde *fde, gdb_byte *insn_ptr,
- gdb_byte *insn_end, struct frame_info *this_frame,
+execute_cfa_program (struct dwarf2_fde *fde, const gdb_byte *insn_ptr,
+ const gdb_byte *insn_end, struct frame_info *this_frame,
struct dwarf2_frame_state *fs)
{
int eh_frame_p = fde->eh_frame_p;
static CORE_ADDR
read_encoded_value (struct comp_unit *unit, gdb_byte encoding,
- int ptr_len, gdb_byte *buf, unsigned int *bytes_read_ptr,
+ int ptr_len, const gdb_byte *buf,
+ unsigned int *bytes_read_ptr,
CORE_ADDR func_base)
{
ptrdiff_t offset;
case DW_EH_PE_uleb128:
{
ULONGEST value;
- gdb_byte *end_buf = buf + (sizeof (value) + 1) * 8 / 7;
+ const gdb_byte *end_buf = buf + (sizeof (value) + 1) * 8 / 7;
*bytes_read_ptr += read_uleb128 (buf, end_buf, &value) - buf;
return base + value;
case DW_EH_PE_sleb128:
{
LONGEST value;
- gdb_byte *end_buf = buf + (sizeof (value) + 1) * 8 / 7;
+ const gdb_byte *end_buf = buf + (sizeof (value) + 1) * 8 / 7;
*bytes_read_ptr += read_sleb128 (buf, end_buf, &value) - buf;
return base + value;