aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Tromey <tromey@redhat.com>2013-05-06 19:46:15 +0000
committerTom Tromey <tromey@redhat.com>2013-05-06 19:46:15 +0000
commit40501e00a1ae6f0dcdd46c01e7137ff7e887c1e1 (patch)
tree989deb032766a735e9ce34ebde5e0f01b5017524
parentb6807d988a28dc2718bae1abba1f28779bc0c3c3 (diff)
downloadgdb-40501e00a1ae6f0dcdd46c01e7137ff7e887c1e1.zip
gdb-40501e00a1ae6f0dcdd46c01e7137ff7e887c1e1.tar.gz
gdb-40501e00a1ae6f0dcdd46c01e7137ff7e887c1e1.tar.bz2
* ada-lang.c (ada_value_primitive_packed_val): Don't
call value_incref. * value.c (set_value_parent): Incref the new parent and decref the old parent. (value_copy, value_primitive_field): Use set_value_parent.
-rw-r--r--gdb/ChangeLog8
-rw-r--r--gdb/ada-lang.c1
-rw-r--r--gdb/value.c12
3 files changed, 15 insertions, 6 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index f3a755d..e520f96 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,13 @@
2013-05-06 Tom Tromey <tromey@redhat.com>
+ * ada-lang.c (ada_value_primitive_packed_val): Don't
+ call value_incref.
+ * value.c (set_value_parent): Incref the new parent and decref
+ the old parent.
+ (value_copy, value_primitive_field): Use set_value_parent.
+
+2013-05-06 Tom Tromey <tromey@redhat.com>
+
* dwarf2loc.c (invalid_synthetic_pointer): Move earlier.
(indirect_pieced_value): Call dwarf2_fetch_constant_bytes
if needed.
diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c
index fdfc0b4..3510750 100644
--- a/gdb/ada-lang.c
+++ b/gdb/ada-lang.c
@@ -2325,7 +2325,6 @@ ada_value_primitive_packed_val (struct value *obj, const gdb_byte *valaddr,
/* Also set the parent value. This is needed when trying to
assign a new value (in inferior memory). */
set_value_parent (v, obj);
- value_incref (obj);
}
else
set_value_bitsize (v, bit_size);
diff --git a/gdb/value.c b/gdb/value.c
index 90bc415..ee3c998 100644
--- a/gdb/value.c
+++ b/gdb/value.c
@@ -811,7 +811,12 @@ value_parent (struct value *value)
void
set_value_parent (struct value *value, struct value *parent)
{
+ struct value *old = value->parent;
+
value->parent = parent;
+ if (parent != NULL)
+ value_incref (parent);
+ value_free (old);
}
gdb_byte *
@@ -1398,9 +1403,7 @@ value_copy (struct value *arg)
}
val->unavailable = VEC_copy (range_s, arg->unavailable);
- val->parent = arg->parent;
- if (val->parent)
- value_incref (val->parent);
+ set_value_parent (val, arg->parent);
if (VALUE_LVAL (val) == lval_computed)
{
const struct lval_funcs *funcs = val->location.computed.funcs;
@@ -2652,8 +2655,7 @@ value_primitive_field (struct value *arg1, int offset,
v->offset = (value_embedded_offset (arg1)
+ offset
+ (bitpos - v->bitpos) / 8);
- v->parent = arg1;
- value_incref (v->parent);
+ set_value_parent (v, arg1);
if (!value_lazy (arg1))
value_fetch_lazy (v);
}