aboutsummaryrefslogtreecommitdiff
path: root/gdb/testsuite
diff options
context:
space:
mode:
authorPedro Alves <palves@redhat.com>2011-02-14 11:30:37 +0000
committerPedro Alves <palves@redhat.com>2011-02-14 11:30:37 +0000
commit39d37385568d667a2f5fab7e10adda5813a54467 (patch)
tree4d9623ad33dc78fd0a5036ef9a97eaaa28bdc914 /gdb/testsuite
parent06d72e16c409574a7facc283ef1fcd7c5fd5fa05 (diff)
downloadgdb-39d37385568d667a2f5fab7e10adda5813a54467.zip
gdb-39d37385568d667a2f5fab7e10adda5813a54467.tar.gz
gdb-39d37385568d667a2f5fab7e10adda5813a54467.tar.bz2
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.
Diffstat (limited to 'gdb/testsuite')
-rw-r--r--gdb/testsuite/ChangeLog10
-rw-r--r--gdb/testsuite/gdb.trace/unavailable.cc11
-rw-r--r--gdb/testsuite/gdb.trace/unavailable.exp25
3 files changed, 46 insertions, 0 deletions
diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog
index d5ea01a..95ad195 100644
--- a/gdb/testsuite/ChangeLog
+++ b/gdb/testsuite/ChangeLog
@@ -1,5 +1,15 @@
2011-02-14 Pedro Alves <pedro@codesourcery.com>
+ * 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 <pedro@codesourcery.com>
+
* gdb.trace/unavailable.cc, gdb.trace/unavailable.exp: New files.
2011-02-13 Jan Kratochvil <jan.kratochvil@redhat.com>
diff --git a/gdb/testsuite/gdb.trace/unavailable.cc b/gdb/testsuite/gdb.trace/unavailable.cc
index 23c709b..d25837d 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 f77d96e..00fb332 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 \$__" " = <unavailable>" "last examined value was <unavailable>"
+ # This tests that building the array does not require accessing
+ # g_int's contents.
+ gdb_test "print { 1, g_int, 3 }" \
+ " = \\{1, <unavailable>, 3\\}" \
+ "build array from unavailable value"
+
+ # Note, depends on previous test.
+ gdb_test "print \$\[1\]" \
+ " = <unavailable>" \
+ "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 = <unavailable>\\}"
+ gdb_test "print \$.member" " = <unavailable>"
+
+ # Cast to baseclass, checking the unavailable-ness is propagated.
+ gdb_test "print (small_struct) g_smallstruct_b" " = \\{member = <unavailable>\\}"
+
+ # Same cast, but starting from a non-lazy, value.
+ gdb_test "print g_smallstruct_b" " = \\{<small_struct> = \\{member = <unavailable>\\}, <No data fields>\\}"
+ gdb_test "print (small_struct) \$" " = \\{member = <unavailable>\\}"
+
gdb_test "tfind none" \
"#0 end .*" \
"cease trace debugging"