aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gdb/ChangeLog8
-rw-r--r--gdb/tui/tui-regs.c7
-rw-r--r--gdb/value.c4
-rw-r--r--gdb/value.h7
4 files changed, 22 insertions, 4 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 13b7057..faaaf50 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,11 @@
+2013-06-28 Pedro Alves <palves@redhat.com>
+
+ PR tui/14880
+ * tui/tui-regs.c (tui_get_register): Fetch value contents before
+ checking if they're available.
+ * value.c (value_available_contents_eq): Change comment.
+ * value.h (value_available_contents_eq): Expand comment.
+
2013-06-27 Tom Tromey <tromey@redhat.com>
* target.c (find_run_target): Remove.
diff --git a/gdb/tui/tui-regs.c b/gdb/tui/tui-regs.c
index 7f64a2b..975173a 100644
--- a/gdb/tui/tui-regs.c
+++ b/gdb/tui/tui-regs.c
@@ -732,6 +732,13 @@ tui_get_register (struct frame_info *frame,
struct gdbarch *gdbarch = get_frame_arch (frame);
int size = register_size (gdbarch, regnum);
+ /* We only know whether a value chunk is available if we've
+ tried to read it. */
+ if (value_lazy (data->value))
+ value_fetch_lazy (data->value);
+ if (value_lazy (old_val))
+ value_fetch_lazy (old_val);
+
if (value_optimized_out (data->value) != value_optimized_out (old_val)
|| !value_available_contents_eq (data->value, 0,
old_val, 0, size))
diff --git a/gdb/value.c b/gdb/value.c
index ee3c998..fae8b98 100644
--- a/gdb/value.c
+++ b/gdb/value.c
@@ -543,9 +543,7 @@ value_available_contents_eq (const struct value *val1, int offset1,
{
int idx1 = 0, idx2 = 0;
- /* This routine is used by printing routines, where we should
- already have read the value. Note that we only know whether a
- value chunk is available if we've tried to read it. */
+ /* See function description in value.h. */
gdb_assert (!val1->lazy && !val2->lazy);
while (length > 0)
diff --git a/gdb/value.h b/gdb/value.h
index 4e839d3..8a66aa4 100644
--- a/gdb/value.h
+++ b/gdb/value.h
@@ -463,7 +463,12 @@ extern void mark_value_bytes_unavailable (struct value *value,
value_available_contents_eq(val, 4, val, 12, 2) => 1
value_available_contents_eq(val, 4, val, 12, 4) => 0
value_available_contents_eq(val, 3, val, 4, 4) => 0
-*/
+
+ We only know whether a value chunk is available if we've tried to
+ read it. As this routine is used by printing routines, which may
+ be printing values in the value history, long after the inferior is
+ gone, it works with const values. Therefore, this routine must not
+ be called with lazy values. */
extern int value_available_contents_eq (const struct value *val1, int offset1,
const struct value *val2, int offset2,