aboutsummaryrefslogtreecommitdiff
path: root/gdb
diff options
context:
space:
mode:
authorTom Tromey <tromey@redhat.com>2010-05-25 16:41:46 +0000
committerTom Tromey <tromey@redhat.com>2010-05-25 16:41:46 +0000
commit0d45f56e4700225d5789b60da9ea3f082bb5e23d (patch)
tree1af7b8f88e4f8e21d13990d34d4d359a679b7fc8 /gdb
parente34838f0f74e1fdb249bcdd822136c98375e4f4b (diff)
downloadgdb-0d45f56e4700225d5789b60da9ea3f082bb5e23d.zip
gdb-0d45f56e4700225d5789b60da9ea3f082bb5e23d.tar.gz
gdb-0d45f56e4700225d5789b60da9ea3f082bb5e23d.tar.bz2
* 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.
Diffstat (limited to 'gdb')
-rw-r--r--gdb/ChangeLog31
-rw-r--r--gdb/dwarf2-frame.c19
-rw-r--r--gdb/dwarf2-frame.h2
-rw-r--r--gdb/dwarf2expr.c24
-rw-r--r--gdb/dwarf2expr.h18
-rw-r--r--gdb/dwarf2loc.c38
6 files changed, 85 insertions, 47 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 8690bc6..ac78a60 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,34 @@
+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.
diff --git a/gdb/dwarf2-frame.c b/gdb/dwarf2-frame.c
index 0dec2b6..2ac95b0 100644
--- a/gdb/dwarf2-frame.c
+++ b/gdb/dwarf2-frame.c
@@ -156,7 +156,7 @@ static int dwarf2_frame_adjust_regnum (struct gdbarch *gdbarch, int regnum,
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);
@@ -179,7 +179,7 @@ struct dwarf2_frame_state
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;
@@ -306,7 +306,7 @@ read_mem (void *baton, gdb_byte *buf, CORE_ADDR addr, size_t len)
}
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"));
@@ -359,7 +359,7 @@ register %s (#%d) at %s"),
}
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)
{
@@ -400,8 +400,8 @@ execute_stack_op (gdb_byte *exp, ULONGEST len, int addr_size,
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;
@@ -1411,7 +1411,8 @@ encoding_for_size (unsigned int size)
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;
@@ -1468,7 +1469,7 @@ read_encoded_value (struct comp_unit *unit, gdb_byte encoding,
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;
@@ -1485,7 +1486,7 @@ read_encoded_value (struct comp_unit *unit, gdb_byte encoding,
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;
diff --git a/gdb/dwarf2-frame.h b/gdb/dwarf2-frame.h
index d2b34f0..2496f05 100644
--- a/gdb/dwarf2-frame.h
+++ b/gdb/dwarf2-frame.h
@@ -72,7 +72,7 @@ struct dwarf2_frame_state_reg
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;
diff --git a/gdb/dwarf2expr.c b/gdb/dwarf2expr.c
index 723293b..c145cf4 100644
--- a/gdb/dwarf2expr.c
+++ b/gdb/dwarf2expr.c
@@ -32,7 +32,7 @@
/* 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. */
@@ -193,7 +193,8 @@ add_piece (struct dwarf_expr_context *ctx, ULONGEST size, ULONGEST offset)
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;
@@ -208,8 +209,8 @@ dwarf_expr_eval (struct dwarf_expr_context *ctx, gdb_byte *addr, size_t len)
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;
@@ -234,8 +235,8 @@ read_uleb128 (gdb_byte *buf, gdb_byte *buf_end, ULONGEST * r)
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;
@@ -263,8 +264,8 @@ read_sleb128 (gdb_byte *buf, gdb_byte *buf_end, LONGEST * r)
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);
@@ -334,7 +335,8 @@ signed_address_type (struct gdbarch *gdbarch, int addr_size)
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
@@ -351,7 +353,7 @@ require_composition (gdb_byte *op_ptr, gdb_byte *op_end, const char *op_name)
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);
@@ -583,7 +585,7 @@ execute_stack_op (struct dwarf_expr_context *ctx,
break;
case DW_OP_fbreg:
{
- gdb_byte *datastart;
+ const gdb_byte *datastart;
size_t datalen;
unsigned int before_stack_len;
diff --git a/gdb/dwarf2expr.h b/gdb/dwarf2expr.h
index 487d4f7..a0f4554 100644
--- a/gdb/dwarf2expr.h
+++ b/gdb/dwarf2expr.h
@@ -88,7 +88,7 @@ struct dwarf_expr_context
/* 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);
@@ -121,7 +121,7 @@ struct dwarf_expr_context
/* 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. */
@@ -175,7 +175,7 @@ struct dwarf_expr_piece
{
/* 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;
@@ -195,15 +195,17 @@ struct cleanup *
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 */
diff --git a/gdb/dwarf2loc.c b/gdb/dwarf2loc.c
index 41b67fb..481501b 100644
--- a/gdb/dwarf2loc.c
+++ b/gdb/dwarf2loc.c
@@ -44,7 +44,7 @@
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
@@ -153,7 +153,7 @@ dwarf_expr_read_mem (void *baton, gdb_byte *buf, CORE_ADDR addr, size_t len)
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
@@ -178,7 +178,7 @@ dwarf_expr_frame_base (void *baton, gdb_byte **start, size_t * length)
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;
@@ -463,7 +463,7 @@ read_pieced_value (struct value *v)
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. */
@@ -917,7 +917,7 @@ needs_frame_read_mem (void *baton, gdb_byte *buf, CORE_ADDR addr, size_t len)
/* 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;
@@ -1017,12 +1017,12 @@ struct axs_var_loc
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)
{
@@ -1044,7 +1044,7 @@ dwarf2_tracepoint_var_loc (struct symbol *symbol,
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;
@@ -1063,8 +1063,8 @@ dwarf2_tracepoint_var_loc (struct symbol *symbol,
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);
@@ -1143,9 +1143,9 @@ dwarf2_tracepoint_var_access (struct agent_expr *ax,
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
@@ -1285,10 +1285,11 @@ locexpr_read_needs_frame (struct symbol *symbol)
/* 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;
@@ -1315,7 +1316,7 @@ locexpr_describe_location_piece (struct symbol *symbol, struct ui_file *stream,
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;
@@ -1335,7 +1336,7 @@ locexpr_describe_location_piece (struct symbol *symbol, struct ui_file *stream,
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,
@@ -1422,10 +1423,11 @@ locexpr_describe_location_piece (struct symbol *symbol, struct ui_file *stream,
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