This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
FYI: more constification
- From: Tom Tromey <tromey at redhat dot com>
- To: gdb-patches at sourceware dot org
- Date: Wed, 26 May 2010 09:20:52 -0600
- Subject: FYI: more constification
- Reply-to: tromey at redhat dot com
I'm checking this in.
While working on yet another DWARF patch, I noticed a couple more places
that were missing a "const". This patch adds them.
Tom
2010-05-26 Tom Tromey <tromey@redhat.com>
* dwarf2loc.h (struct dwarf2_locexpr_baton) <data>: Now const.
(struct dwarf2_loclist_baton) <data>: Likewise.
* dwarf2loc.c (find_location_expression): Constify return type.
(dwarf2_evaluate_loc_desc): Make 'data' argument const.
(dwarf2_loc_desc_needs_frame): Likewise.
(loclist_read_variable): Constify.
(loclist_describe_location): Likewise.
(loclist_tracepoint_var_ref): Likewise.
Index: dwarf2loc.c
===================================================================
RCS file: /cvs/src/src/gdb/dwarf2loc.c,v
retrieving revision 1.82
diff -u -r1.82 dwarf2loc.c
--- dwarf2loc.c 25 May 2010 16:41:46 -0000 1.82
+++ dwarf2loc.c 26 May 2010 15:19:21 -0000
@@ -54,12 +54,12 @@
For now, only return the first matching location expression; there
can be more than one in the list. */
-static gdb_byte *
+static const gdb_byte *
find_location_expression (struct dwarf2_loclist_baton *baton,
size_t *locexpr_length, CORE_ADDR pc)
{
CORE_ADDR low, high;
- gdb_byte *loc_ptr, *buf_end;
+ const gdb_byte *loc_ptr, *buf_end;
int length;
struct objfile *objfile = dwarf2_per_cu_objfile (baton->per_cu);
struct gdbarch *gdbarch = get_objfile_arch (objfile);
@@ -773,7 +773,7 @@
static struct value *
dwarf2_evaluate_loc_desc (struct type *type, struct frame_info *frame,
- gdb_byte *data, unsigned short size,
+ const gdb_byte *data, unsigned short size,
struct dwarf2_per_cu_data *per_cu)
{
struct value *retval;
@@ -953,7 +953,7 @@
requires a frame to evaluate. */
static int
-dwarf2_loc_desc_needs_frame (gdb_byte *data, unsigned short size,
+dwarf2_loc_desc_needs_frame (const gdb_byte *data, unsigned short size,
struct dwarf2_per_cu_data *per_cu)
{
struct needs_frame_baton baton;
@@ -1515,7 +1515,7 @@
{
struct dwarf2_loclist_baton *dlbaton = SYMBOL_LOCATION_BATON (symbol);
struct value *val;
- gdb_byte *data;
+ const gdb_byte *data;
size_t size;
data = find_location_expression (dlbaton, &size,
@@ -1557,7 +1557,7 @@
{
struct dwarf2_loclist_baton *dlbaton = SYMBOL_LOCATION_BATON (symbol);
CORE_ADDR low, high;
- gdb_byte *loc_ptr, *buf_end;
+ const gdb_byte *loc_ptr, *buf_end;
int length, first = 1;
struct objfile *objfile = dwarf2_per_cu_objfile (dlbaton->per_cu);
struct gdbarch *gdbarch = get_objfile_arch (objfile);
@@ -1639,7 +1639,7 @@
struct agent_expr *ax, struct axs_value *value)
{
struct dwarf2_loclist_baton *dlbaton = SYMBOL_LOCATION_BATON (symbol);
- gdb_byte *data;
+ const gdb_byte *data;
size_t size;
data = find_location_expression (dlbaton, &size, ax->scope);
Index: dwarf2loc.h
===================================================================
RCS file: /cvs/src/src/gdb/dwarf2loc.h,v
retrieving revision 1.14
diff -u -r1.14 dwarf2loc.h
--- dwarf2loc.h 1 Jan 2010 07:31:30 -0000 1.14
+++ dwarf2loc.h 26 May 2010 15:19:21 -0000
@@ -43,7 +43,7 @@
struct dwarf2_locexpr_baton
{
/* Pointer to the start of the location expression. */
- gdb_byte *data;
+ const gdb_byte *data;
/* Length of the location expression. */
unsigned long size;
@@ -60,7 +60,7 @@
CORE_ADDR base_address;
/* Pointer to the start of the location list. */
- gdb_byte *data;
+ const gdb_byte *data;
/* Length of the location list. */
unsigned long size;