diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 6cbfdf8355..a127078b79 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,8 @@ +2011-02-14 Pedro Alves + + * valops.c (value_repeat): Use read_value_memory instead of + read_memory. + 2011-02-14 Pedro Alves * value.h (value_contents_copy, value_contents_copy_raw): Declare. diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog index 95ad1951c0..a9a19c9cad 100644 --- a/gdb/testsuite/ChangeLog +++ b/gdb/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2011-02-14 Pedro Alves + + * gdb.trace/unavailable.exp (gdb_collect_globals_test): Test that + value repeat handles unavailableness. + 2011-02-14 Pedro Alves * gdb.trace/unavailable.exp (gdb_collect_globals_test): Add new diff --git a/gdb/testsuite/gdb.trace/unavailable.exp b/gdb/testsuite/gdb.trace/unavailable.exp index 00fb332e43..18e1043175 100644 --- a/gdb/testsuite/gdb.trace/unavailable.exp +++ b/gdb/testsuite/gdb.trace/unavailable.exp @@ -155,6 +155,9 @@ proc gdb_collect_globals_test { } { gdb_test_no_output "set print repeat 10" + # Check that value repeat handles unavailable-ness. + gdb_test "print *tarray@3" " = \\{\\{a = 0, b = \\}, \\{a = 0, b = \\}, \\{a = , b = \\}\\}" + # Static fields gdb_test "print struct_b.static_struct_a" \ diff --git a/gdb/valops.c b/gdb/valops.c index 1c37fae46a..1f25a32720 100644 --- a/gdb/valops.c +++ b/gdb/valops.c @@ -1456,12 +1456,13 @@ value_repeat (struct value *arg1, int count) val = allocate_repeat_value (value_enclosing_type (arg1), count); - read_memory (value_address (arg1), - value_contents_all_raw (val), - TYPE_LENGTH (value_enclosing_type (val))); VALUE_LVAL (val) = lval_memory; set_value_address (val, value_address (arg1)); + read_value_memory (val, 0, value_stack (val), value_address (val), + value_contents_all_raw (val), + TYPE_LENGTH (value_enclosing_type (val))); + return val; }