From 39d37385568d667a2f5fab7e10adda5813a54467 Mon Sep 17 00:00:00 2001 From: Pedro Alves Date: Mon, 14 Feb 2011 11:30:37 +0000 Subject: gdb/ * value.h (value_contents_copy, value_contents_copy_raw): Declare. * value.c (value_contents_copy_raw, value_contents_copy): New functions. (value_primitive_field): Use value_contents_copy_raw instead of memcpy. * valops.c (value_fetch_lazy): Use value_contents_copy instead of memcpy. (value_array, value_slice): Ditto. * valarith.c (value_subscripted_rvalue): Use value_contents_copy_raw instead of memcpy. gdb/testsuite/ * gdb.trace/unavailable.exp (gdb_collect_globals_test): Add new tests for building arrays from unavailable values, subscripting non-memory rvalue unvailable arrays, and accessing fields or baseclasses of non-lazy unavailable values, * gdb.trace/unavailable.cc (small_struct, small_struct_b): New struct types. (g_smallstruct, g_smallstruct_b): New globals. --- gdb/testsuite/ChangeLog | 10 ++++++++++ gdb/testsuite/gdb.trace/unavailable.cc | 11 +++++++++++ gdb/testsuite/gdb.trace/unavailable.exp | 25 +++++++++++++++++++++++++ 3 files changed, 46 insertions(+) (limited to 'gdb/testsuite') diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog index d5ea01a27d8..95ad1951c09 100644 --- a/gdb/testsuite/ChangeLog +++ b/gdb/testsuite/ChangeLog @@ -1,3 +1,13 @@ +2011-02-14 Pedro Alves + + * gdb.trace/unavailable.exp (gdb_collect_globals_test): Add new + tests for building arrays from unavailable values, subscripting + non-memory rvalue unvailable arrays, and accessing fields or + baseclasses of non-lazy unavailable values, + * gdb.trace/unavailable.cc (small_struct, small_struct_b): New + struct types. + (g_smallstruct, g_smallstruct_b): New globals. + 2011-02-14 Pedro Alves * gdb.trace/unavailable.cc, gdb.trace/unavailable.exp: New files. diff --git a/gdb/testsuite/gdb.trace/unavailable.cc b/gdb/testsuite/gdb.trace/unavailable.cc index 23c709b030c..d25837df217 100644 --- a/gdb/testsuite/gdb.trace/unavailable.cc +++ b/gdb/testsuite/gdb.trace/unavailable.cc @@ -30,6 +30,15 @@ typedef struct TEST_STRUCT { double memberd; } test_struct; +struct small_struct +{ + int member; +}; + +struct small_struct_b : public small_struct +{ +}; + typedef int test_array [4]; /* Global variables to be collected. */ @@ -41,6 +50,8 @@ double globald; test_struct globalstruct; test_struct *globalp; int globalarr[16]; +small_struct g_smallstruct; +small_struct_b g_smallstruct_b; /* Strings. */ diff --git a/gdb/testsuite/gdb.trace/unavailable.exp b/gdb/testsuite/gdb.trace/unavailable.exp index f77d96e0c7c..00fb332e43b 100644 --- a/gdb/testsuite/gdb.trace/unavailable.exp +++ b/gdb/testsuite/gdb.trace/unavailable.exp @@ -214,6 +214,31 @@ proc gdb_collect_globals_test { } { gdb_test "p \$__" " = " "last examined value was " + # This tests that building the array does not require accessing + # g_int's contents. + gdb_test "print { 1, g_int, 3 }" \ + " = \\{1, , 3\\}" \ + "build array from unavailable value" + + # Note, depends on previous test. + gdb_test "print \$\[1\]" \ + " = " \ + "subscript a non-memory rvalue array, accessing an unvailable element" + + # Access a field of a non-lazy value, making sure the + # unavailable-ness is propagated. History values are easy + # non-lazy values, so use those. The first test just sets up for + # the second. + gdb_test "print g_smallstruct" " = \\{member = \\}" + gdb_test "print \$.member" " = " + + # Cast to baseclass, checking the unavailable-ness is propagated. + gdb_test "print (small_struct) g_smallstruct_b" " = \\{member = \\}" + + # Same cast, but starting from a non-lazy, value. + gdb_test "print g_smallstruct_b" " = \\{ = \\{member = \\}, \\}" + gdb_test "print (small_struct) \$" " = \\{member = \\}" + gdb_test "tfind none" \ "#0 end .*" \ "cease trace debugging" -- cgit v1.2.1