aboutsummaryrefslogtreecommitdiff
path: root/gdb/testsuite/gdb.trace
diff options
context:
space:
mode:
authorPedro Alves <palves@redhat.com>2011-02-07 12:14:14 +0000
committerPedro Alves <palves@redhat.com>2011-02-07 12:14:14 +0000
commit764880b7edb584d2e037474a40fd06f17e6c5fd5 (patch)
tree7347307cef1e7362e7a86b6ecb786384be4e643a /gdb/testsuite/gdb.trace
parent32a96f364b9e54a5f42d8367ef770efead63cd50 (diff)
downloadgdb-764880b7edb584d2e037474a40fd06f17e6c5fd5.zip
gdb-764880b7edb584d2e037474a40fd06f17e6c5fd5.tar.gz
gdb-764880b7edb584d2e037474a40fd06f17e6c5fd5.tar.bz2
gdb/server/
* server.c (gdb_read_memory): Change return semantics to allow partial transfers. (handle_search_memory_1): Adjust. (process_serial_event) <'m' packet>: Handle partial transfers. * tracepoint.c (traceframe_read_mem): Handle partial transfers. gdb/testsuite/ * 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.
Diffstat (limited to 'gdb/testsuite/gdb.trace')
-rw-r--r--gdb/testsuite/gdb.trace/collection.c8
-rw-r--r--gdb/testsuite/gdb.trace/collection.exp45
2 files changed, 53 insertions, 0 deletions
diff --git a/gdb/testsuite/gdb.trace/collection.c b/gdb/testsuite/gdb.trace/collection.c
index 6fb7133..4a58170 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 71ad38c..4e0a30d 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: