This is the mail archive of the
gdb-patches@sources.redhat.com
mailing list for the GDB project.
[commit] Add set_value_offset
- From: Andrew Cagney <cagney at gnu dot org>
- To: gdb-patches at sources dot redhat dot com
- Date: Mon, 07 Feb 2005 21:29:54 -0500
- Subject: [commit] Add set_value_offset
fyi,
Andrew
2005-02-07 Andrew Cagney <cagney@gnu.org>
* value.h (set_value_offset): Declare.
* value.c (set_value_offset): Declare.
* gnu-v2-abi.c, jv-valprint.c, valarith.c, valops.c: Update.
* findvar.c: Update.
Index: findvar.c
===================================================================
RCS file: /cvs/src/src/gdb/findvar.c,v
retrieving revision 1.86
diff -p -u -r1.86 findvar.c
--- findvar.c 7 Feb 2005 15:04:42 -0000 1.86
+++ findvar.c 8 Feb 2005 02:24:23 -0000
@@ -710,9 +710,9 @@ value_from_register (struct type *type,
if (TARGET_BYTE_ORDER == BFD_ENDIAN_BIG
&& len < register_size (current_gdbarch, regnum))
/* Big-endian, and we want less than full size. */
- v->offset = register_size (current_gdbarch, regnum) - len;
+ set_value_offset (v, register_size (current_gdbarch, regnum) - len);
else
- v->offset = 0;
+ set_value_offset (v, 0);
memcpy (value_contents_raw (v), value_bytes + value_offset (v), len);
}
return v;
Index: gnu-v2-abi.c
===================================================================
RCS file: /cvs/src/src/gdb/gnu-v2-abi.c,v
retrieving revision 1.20
diff -p -u -r1.20 gnu-v2-abi.c
--- gnu-v2-abi.c 7 Feb 2005 23:51:03 -0000 1.20
+++ gnu-v2-abi.c 8 Feb 2005 02:24:23 -0000
@@ -162,7 +162,7 @@ gnuv2_virtual_fn_field (struct value **a
if (TYPE_CODE (entry_type) == TYPE_CODE_STRUCT)
{
/* Move the `this' pointer according to the virtual function table. */
- arg1->offset += value_as_long (value_field (entry, 0));
+ set_value_offset (arg1, value_offset (arg1) + value_as_long (value_field (entry, 0)));
if (!value_lazy (arg1))
{
Index: jv-valprint.c
===================================================================
RCS file: /cvs/src/src/gdb/jv-valprint.c,v
retrieving revision 1.22
diff -p -u -r1.22 jv-valprint.c
--- jv-valprint.c 7 Feb 2005 15:04:43 -0000 1.22
+++ jv-valprint.c 8 Feb 2005 02:24:23 -0000
@@ -163,15 +163,15 @@ java_value_print (struct value *val, str
else
{
set_value_lazy (v, 1);
- v->offset = 0;
+ set_value_offset (v, 0);
}
- next_v->offset = value_offset (v);
+ set_value_offset (next_v, value_offset (v));
for (reps = 1; i + reps < length; reps++)
{
set_value_lazy (next_v, 1);
- next_v->offset += TYPE_LENGTH (el_type);
+ set_value_offset (next_v, value_offset (next_v) + TYPE_LENGTH (el_type));
if (memcmp (value_contents (v), value_contents (next_v),
TYPE_LENGTH (el_type)) != 0)
break;
Index: valarith.c
===================================================================
RCS file: /cvs/src/src/gdb/valarith.c,v
retrieving revision 1.35
diff -p -u -r1.35 valarith.c
--- valarith.c 7 Feb 2005 15:04:43 -0000 1.35
+++ valarith.c 8 Feb 2005 02:24:23 -0000
@@ -240,7 +240,7 @@ value_subscript (struct value *array, st
VALUE_LVAL (v) = lval_internalvar_component;
VALUE_ADDRESS (v) = VALUE_ADDRESS (array);
VALUE_FRAME_ID (v) = VALUE_FRAME_ID (array);
- v->offset = offset + value_offset (array);
+ set_value_offset (v, offset + value_offset (array));
return v;
}
@@ -281,7 +281,7 @@ value_subscripted_rvalue (struct value *
VALUE_ADDRESS (v) = VALUE_ADDRESS (array);
VALUE_REGNUM (v) = VALUE_REGNUM (array);
VALUE_FRAME_ID (v) = VALUE_FRAME_ID (array);
- v->offset = value_offset (array) + elt_offs;
+ set_value_offset (v, value_offset (array) + elt_offs);
return v;
}
Index: valops.c
===================================================================
RCS file: /cvs/src/src/gdb/valops.c,v
retrieving revision 1.150
diff -p -u -r1.150 valops.c
--- valops.c 8 Feb 2005 00:25:31 -0000 1.150
+++ valops.c 8 Feb 2005 02:24:24 -0000
@@ -1309,7 +1309,7 @@ search_struct_field (char *name, struct
VALUE_LVAL (v2) = VALUE_LVAL (arg1);
VALUE_ADDRESS (v2) = VALUE_ADDRESS (arg1);
VALUE_FRAME_ID (v2) = VALUE_FRAME_ID (arg1);
- v2->offset = value_offset (arg1) + boffset;
+ set_value_offset (v2, value_offset (arg1) + boffset);
if (value_lazy (arg1))
set_value_lazy (v2, 1);
else
@@ -2775,7 +2775,7 @@ value_slice (struct value *array, int lo
VALUE_LVAL (slice) = VALUE_LVAL (array);
VALUE_ADDRESS (slice) = VALUE_ADDRESS (array);
VALUE_FRAME_ID (slice) = VALUE_FRAME_ID (array);
- slice->offset = value_offset (array) + offset;
+ set_value_offset (slice, value_offset (array) + offset);
}
return slice;
}
Index: value.c
===================================================================
RCS file: /cvs/src/src/gdb/value.c,v
retrieving revision 1.20
diff -p -u -r1.20 value.c
--- value.c 8 Feb 2005 01:59:38 -0000 1.20
+++ value.c 8 Feb 2005 02:24:25 -0000
@@ -145,6 +145,11 @@ value_offset (struct value *value)
{
return value->offset;
}
+void
+set_value_offset (struct value *value, int offset)
+{
+ value->offset = offset;
+}
int
value_bitpos (struct value *value)
Index: value.h
===================================================================
RCS file: /cvs/src/src/gdb/value.h,v
retrieving revision 1.78
diff -p -u -r1.78 value.h
--- value.h 8 Feb 2005 01:59:38 -0000 1.78
+++ value.h 8 Feb 2005 02:24:25 -0000
@@ -172,7 +172,6 @@ struct value
them. */
};
-
/* Values are stored in a chain, so that they can be deleted easily
over calls to the inferior. Values assigned to internal variables
or put into the value history are taken off this list. */
@@ -186,7 +185,9 @@ extern void deprecated_set_value_type (s
struct type *type);
extern int value_bitsize (struct value *);
extern int value_bitpos (struct value *);
+
extern int value_offset (struct value *);
+extern void set_value_offset (struct value *, int offset);
/* The comment from "struct value" reads: ``Is it modifiable? Only
relevant if lval != not_lval.''. Shouldn't the value instead be