(dwarf_expr_frame_base_1): Likewise.
(read_pieced_value): Update.
(needs_frame_frame_base): Constify.
(dwarf2_tracepoint_var_loc): Likewise.
(dwarf2_tracepoint_var_access): Likewise.
(locexpr_describe_location_piece): Likewise.
(locexpr_describe_location_1): Likewise.
* dwarf2expr.h (struct dwarf_expr_context) <get_frame_base>:
Constify.
(data): Now const.
(struct dwarf_expr_piece) <v.literal.data>: Likewise.
(dwarf_expr_eval, read_uleb128, read_sleb128)
(dwarf2_read_address): Update.
* dwarf2expr.c (dwarf_expr_eval): Constify.
(read_uleb128): Likewise.
(read_sleb128): Likewise.
(dwarf2_read_address): Likewise.
(require_composition): Likewise.
(execute_stack_op): Likewise.
* dwarf2-frame.h (struct dwarf2_frame_state_reg) <loc.exp>: Now a
"const gdb_byte *".
* dwarf2-frame.c (struct dwarf2_frame_state_reg_info) <cfa_exp>:
Now const.
(no_get_frame_base): Constify.
(execute_stack_op): Likewise.
(execute_cfa_program): Likewise.
(read_encoded_value): Likewise.
+2010-05-25 Tom Tromey <tromey@redhat.com>
+
+ * dwarf2loc.c (dwarf_expr_frame_base): Constify.
+ (dwarf_expr_frame_base_1): Likewise.
+ (read_pieced_value): Update.
+ (needs_frame_frame_base): Constify.
+ (dwarf2_tracepoint_var_loc): Likewise.
+ (dwarf2_tracepoint_var_access): Likewise.
+ (locexpr_describe_location_piece): Likewise.
+ (locexpr_describe_location_1): Likewise.
+ * dwarf2expr.h (struct dwarf_expr_context) <get_frame_base>:
+ Constify.
+ (data): Now const.
+ (struct dwarf_expr_piece) <v.literal.data>: Likewise.
+ (dwarf_expr_eval, read_uleb128, read_sleb128)
+ (dwarf2_read_address): Update.
+ * dwarf2expr.c (dwarf_expr_eval): Constify.
+ (read_uleb128): Likewise.
+ (read_sleb128): Likewise.
+ (dwarf2_read_address): Likewise.
+ (require_composition): Likewise.
+ (execute_stack_op): Likewise.
+ * dwarf2-frame.h (struct dwarf2_frame_state_reg) <loc.exp>: Now a
+ "const gdb_byte *".
+ * dwarf2-frame.c (struct dwarf2_frame_state_reg_info) <cfa_exp>:
+ Now const.
+ (no_get_frame_base): Constify.
+ (execute_stack_op): Likewise.
+ (execute_cfa_program): Likewise.
+ (read_encoded_value): Likewise.
+
2010-05-25 Doug Evans <dje@google.com>
* ser-pipe.c (pipe_open): Ignore SIGINTs in child.
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"));
}
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)
{
\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;
union {
LONGEST offset;
ULONGEST reg;
- unsigned char *exp;
+ const gdb_byte *exp;
struct value *(*fn) (struct frame_info *this_frame, void **this_cache,
int regnum);
} loc;
/* Local prototypes. */
static void execute_stack_op (struct dwarf_expr_context *,
- gdb_byte *, gdb_byte *);
+ const gdb_byte *, const gdb_byte *);
static struct type *unsigned_address_type (struct gdbarch *, int);
/* Create a new context for the expression evaluator. */
CTX. */
void
-dwarf_expr_eval (struct dwarf_expr_context *ctx, gdb_byte *addr, size_t len)
+dwarf_expr_eval (struct dwarf_expr_context *ctx, const gdb_byte *addr,
+ size_t len)
{
int old_recursion_depth = ctx->recursion_depth;
by R, and return the new value of BUF. Verify that it doesn't extend
past BUF_END. */
-gdb_byte *
-read_uleb128 (gdb_byte *buf, gdb_byte *buf_end, ULONGEST * r)
+const gdb_byte *
+read_uleb128 (const gdb_byte *buf, const gdb_byte *buf_end, ULONGEST * r)
{
unsigned shift = 0;
ULONGEST result = 0;
by R, and return the new value of BUF. Verify that it doesn't extend
past BUF_END. */
-gdb_byte *
-read_sleb128 (gdb_byte *buf, gdb_byte *buf_end, LONGEST * r)
+const gdb_byte *
+read_sleb128 (const gdb_byte *buf, const gdb_byte *buf_end, LONGEST * r)
{
unsigned shift = 0;
LONGEST result = 0;
doesn't extend past BUF_END. */
CORE_ADDR
-dwarf2_read_address (struct gdbarch *gdbarch, gdb_byte *buf,
- gdb_byte *buf_end, int addr_size)
+dwarf2_read_address (struct gdbarch *gdbarch, const gdb_byte *buf,
+ const gdb_byte *buf_end, int addr_size)
{
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
expression, or that it is followed by a composition operator. */
static void
-require_composition (gdb_byte *op_ptr, gdb_byte *op_end, const char *op_name)
+require_composition (const gdb_byte *op_ptr, const gdb_byte *op_end,
+ const char *op_name)
{
/* It seems like DW_OP_GNU_uninit should be handled here. However,
it doesn't seem to make sense for DW_OP_*_value, and it was not
static void
execute_stack_op (struct dwarf_expr_context *ctx,
- gdb_byte *op_ptr, gdb_byte *op_end)
+ const gdb_byte *op_ptr, const gdb_byte *op_end)
{
enum bfd_endian byte_order = gdbarch_byte_order (ctx->gdbarch);
break;
case DW_OP_fbreg:
{
- gdb_byte *datastart;
+ const gdb_byte *datastart;
size_t datalen;
unsigned int before_stack_len;
/* Return the location expression for the frame base attribute, in
START and LENGTH. The result must be live until the current
expression evaluation is complete. */
- void (*get_frame_base) (void *baton, gdb_byte **start, size_t *length);
+ void (*get_frame_base) (void *baton, const gdb_byte **start, size_t *length);
/* Return the CFA for the frame. */
CORE_ADDR (*get_frame_cfa) (void *baton);
/* For VALUE_LITERAL, a the current literal value's length and
data. */
ULONGEST len;
- gdb_byte *data;
+ const gdb_byte *data;
/* Initialization status of variable: Non-zero if variable has been
initialized; zero otherwise. */
{
/* A pointer to the data making up this piece, for literal
pieces. */
- gdb_byte *data;
+ const gdb_byte *data;
/* The length of the available data. */
ULONGEST length;
} literal;
void dwarf_expr_push (struct dwarf_expr_context *ctx, CORE_ADDR value,
int in_stack_memory);
void dwarf_expr_pop (struct dwarf_expr_context *ctx);
-void dwarf_expr_eval (struct dwarf_expr_context *ctx, unsigned char *addr,
+void dwarf_expr_eval (struct dwarf_expr_context *ctx, const gdb_byte *addr,
size_t len);
CORE_ADDR dwarf_expr_fetch (struct dwarf_expr_context *ctx, int n);
int dwarf_expr_fetch_in_stack_memory (struct dwarf_expr_context *ctx, int n);
-gdb_byte *read_uleb128 (gdb_byte *buf, gdb_byte *buf_end, ULONGEST * r);
-gdb_byte *read_sleb128 (gdb_byte *buf, gdb_byte *buf_end, LONGEST * r);
-CORE_ADDR dwarf2_read_address (struct gdbarch *gdbarch, gdb_byte *buf,
- gdb_byte *buf_end, int addr_size);
+const gdb_byte *read_uleb128 (const gdb_byte *buf, const gdb_byte *buf_end,
+ ULONGEST * r);
+const gdb_byte *read_sleb128 (const gdb_byte *buf, const gdb_byte *buf_end,
+ LONGEST * r);
+CORE_ADDR dwarf2_read_address (struct gdbarch *gdbarch, const gdb_byte *buf,
+ const gdb_byte *buf_end, int addr_size);
#endif /* dwarf2expr.h */
static void
dwarf_expr_frame_base_1 (struct symbol *framefunc, CORE_ADDR pc,
- gdb_byte **start, size_t *length);
+ const gdb_byte **start, size_t *length);
/* A helper function for dealing with location lists. Given a
symbol baton (BATON) and a pc value (PC), find the appropriate
describing the frame base. Return a pointer to it in START and
its length in LENGTH. */
static void
-dwarf_expr_frame_base (void *baton, gdb_byte **start, size_t * length)
+dwarf_expr_frame_base (void *baton, const gdb_byte **start, size_t * length)
{
/* FIXME: cagney/2003-03-26: This code should be using
get_frame_base_address(), and then implement a dwarf2 specific
static void
dwarf_expr_frame_base_1 (struct symbol *framefunc, CORE_ADDR pc,
- gdb_byte **start, size_t *length)
+ const gdb_byte **start, size_t *length)
{
if (SYMBOL_LOCATION_BATON (framefunc) == NULL)
*start = NULL;
struct dwarf_expr_piece *p = &c->pieces[i];
size_t this_size, this_size_bits;
long dest_offset_bits, source_offset_bits, source_offset;
- gdb_byte *intermediate_buffer;
+ const gdb_byte *intermediate_buffer;
/* Compute size, source, and destination offsets for copying, in
bits. */
/* Frame-relative accesses do require a frame. */
static void
-needs_frame_frame_base (void *baton, gdb_byte **start, size_t * length)
+needs_frame_frame_base (void *baton, const gdb_byte **start, size_t * length)
{
static gdb_byte lit0 = DW_OP_lit0;
struct needs_frame_baton *nf_baton = baton;
LONGEST offset;
};
-static gdb_byte *
+static const gdb_byte *
dwarf2_tracepoint_var_loc (struct symbol *symbol,
struct agent_expr *ax,
struct axs_var_loc *loc,
struct gdbarch *gdbarch,
- gdb_byte *data, gdb_byte *end)
+ const gdb_byte *data, const gdb_byte *end)
{
if (data[0] >= DW_OP_reg0 && data[0] <= DW_OP_reg31)
{
struct symbol *framefunc;
int frame_reg = 0;
LONGEST frame_offset;
- gdb_byte *base_data;
+ const gdb_byte *base_data;
size_t base_size;
LONGEST base_offset = 0;
if (base_data[0] >= DW_OP_breg0 && base_data[0] <= DW_OP_breg31)
{
- gdb_byte *buf_end;
-
+ const gdb_byte *buf_end;
+
frame_reg = base_data[0] - DW_OP_breg0;
buf_end = read_sleb128 (base_data + 1,
base_data + base_size, &base_offset);
static void
dwarf2_tracepoint_var_ref (struct symbol *symbol, struct gdbarch *gdbarch,
struct agent_expr *ax, struct axs_value *value,
- gdb_byte *data, int size)
+ const gdb_byte *data, int size)
{
- gdb_byte *end = data + size;
+ const gdb_byte *end = data + size;
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
/* In practice, a variable is not going to be spread across
dozens of registers or memory locations. If someone comes up
/* Describe a single piece of a location, returning an updated
position in the bytecode sequence. */
-static gdb_byte *
+static const gdb_byte *
locexpr_describe_location_piece (struct symbol *symbol, struct ui_file *stream,
CORE_ADDR addr, struct objfile *objfile,
- gdb_byte *data, int size, unsigned int addr_size)
+ const gdb_byte *data, int size,
+ unsigned int addr_size)
{
struct gdbarch *gdbarch = get_objfile_arch (objfile);
int regno;
struct symbol *framefunc;
int frame_reg = 0;
LONGEST frame_offset;
- gdb_byte *base_data;
+ const gdb_byte *base_data;
size_t base_size;
LONGEST base_offset = 0;
if (base_data[0] >= DW_OP_breg0 && base_data[0] <= DW_OP_breg31)
{
- gdb_byte *buf_end;
+ const gdb_byte *buf_end;
frame_reg = base_data[0] - DW_OP_breg0;
buf_end = read_sleb128 (base_data + 1,
static void
locexpr_describe_location_1 (struct symbol *symbol, CORE_ADDR addr,
- struct ui_file *stream, gdb_byte *data, int size,
+ struct ui_file *stream,
+ const gdb_byte *data, int size,
struct objfile *objfile, unsigned int addr_size)
{
- gdb_byte *end = data + size;
+ const gdb_byte *end = data + size;
int piece_done = 0, first_piece = 1, bad = 0;
/* A multi-piece description consists of multiple sequences of bytes