summaryrefslogtreecommitdiff
path: root/gdb/testsuite
diff options
context:
space:
mode:
Diffstat (limited to 'gdb/testsuite')
-rw-r--r--gdb/testsuite/ChangeLog7
-rw-r--r--gdb/testsuite/gdb.trace/collection.c8
-rw-r--r--gdb/testsuite/gdb.trace/collection.exp45
3 files changed, 60 insertions, 0 deletions
diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog
index 1fc2c7c56e0..f59a4cede5a 100644
--- a/gdb/testsuite/ChangeLog
+++ b/gdb/testsuite/ChangeLog
@@ -1,3 +1,10 @@
+2011-02-07 Pedro Alves <pedro@codesourcery.com>
+
+ * gdb.trace/collection.c (global_pieces): New.
+ * gdb.trace/collection.exp (gdb_collect_global_in_pieces_test):
+ New procedure.
+ (gdb_trace_collection_test): Call it.
+
2011-02-04 Sami Wagiaalla <swagiaal@redhat.com>
* gdb.python/py-evthreads.c: New file.
diff --git a/gdb/testsuite/gdb.trace/collection.c b/gdb/testsuite/gdb.trace/collection.c
index 6fb71338a40..4a58170be1a 100644
--- a/gdb/testsuite/gdb.trace/collection.c
+++ b/gdb/testsuite/gdb.trace/collection.c
@@ -27,6 +27,14 @@ test_struct globalstruct;
test_struct *globalp;
int globalarr[16];
+struct global_pieces {
+ unsigned int a;
+ unsigned int b;
+} global_pieces =
+ {
+ 0x12345678, 0x87654321
+ };
+
/*
* Additional globals used in arithmetic tests
*/
diff --git a/gdb/testsuite/gdb.trace/collection.exp b/gdb/testsuite/gdb.trace/collection.exp
index 71ad38c0496..4e0a30d4902 100644
--- a/gdb/testsuite/gdb.trace/collection.exp
+++ b/gdb/testsuite/gdb.trace/collection.exp
@@ -513,6 +513,50 @@ proc gdb_collect_globals_test { } {
"collect globals: cease trace debugging"
}
+# Test that when we've collected all fields of a structure
+# individually, we can print the whole structure in one go.
+proc gdb_collect_global_in_pieces_test { } {
+ global gdb_prompt
+
+ prepare_for_trace_test
+
+ # Find the comment-identified line for setting this tracepoint.
+ set testline 0
+ set msg "collect global in pieces: find tracepoint line"
+ gdb_test_multiple "list globals_test_func, +30" "$msg" {
+ -re "\[\r\n\](\[0-9\]+)\[^\r\n\]+ Set_Tracepoint_Here .*$gdb_prompt" {
+ set testline $expect_out(1,string)
+ pass "$msg"
+ }
+ }
+
+ if {$testline == 0} {
+ return
+ }
+
+ gdb_test "trace $testline" \
+ "Tracepoint \[0-9\]+ at .*" \
+ "collect global in pieces: set tracepoint"
+ gdb_trace_setactions "collect global in pieces: define actions" \
+ "" \
+ "collect global_pieces.a, global_pieces.b" \
+ "^$"
+
+ # Begin the test.
+ run_trace_experiment "global in pieces" globals_test_func
+
+ gdb_test "print /x global_pieces.a" " = 0x12345678" \
+ "collect global in pieces: print piece a"
+ gdb_test "print /x global_pieces.b" " = 0x87654321" \
+ "collect global in pieces: print piece b"
+
+ gdb_test "print /x global_pieces" " = \{a = 0x12345678, b = 0x87654321\}" \
+ "collect global in pieces: print whole object"
+
+ gdb_test "tfind none" "#0 end .*" \
+ "collect global in pieces: cease trace debugging"
+}
+
proc gdb_trace_collection_test {} {
global fpreg
global spreg
@@ -548,6 +592,7 @@ proc gdb_trace_collection_test {} {
gdb_collect_registers_test "\$regs"
gdb_collect_registers_test "\$$fpreg, \$$spreg, \$$pcreg"
gdb_collect_globals_test
+ gdb_collect_global_in_pieces_test
#
# Expression tests: