aboutsummaryrefslogtreecommitdiff
path: root/gdb/testsuite/gdb.trace
diff options
context:
space:
mode:
authorStan Shebs <shebs@codesourcery.com>2010-04-05 21:57:18 +0000
committerStan Shebs <shebs@codesourcery.com>2010-04-05 21:57:18 +0000
commitfce3c1f0f17879e1c60d1acb277a232f37255aab (patch)
treebf0a2376c01eb3a26327873a9e6645f47a559452 /gdb/testsuite/gdb.trace
parent9cdcc3e8b3ed0291e48a9783f4db6fb52cacd936 (diff)
downloadgdb-fce3c1f0f17879e1c60d1acb277a232f37255aab.zip
gdb-fce3c1f0f17879e1c60d1acb277a232f37255aab.tar.gz
gdb-fce3c1f0f17879e1c60d1acb277a232f37255aab.tar.bz2
2010-04-05 Stan Shebs <stan@codesourcery.com>
* tracepoint.c: Include gdbcore.h. (tfile_xfer_partial): Return partial results, also try reading from executable. (tfile_has_all_memory): New function. (init_tfile_ops): Use it. * gdb.trace/tfile.c: Add a variable split across two blocks, and a constant global. * gdb.trace/tfile.exp: Try to print them.
Diffstat (limited to 'gdb/testsuite/gdb.trace')
-rw-r--r--gdb/testsuite/gdb.trace/tfile.c38
-rw-r--r--gdb/testsuite/gdb.trace/tfile.exp7
2 files changed, 34 insertions, 11 deletions
diff --git a/gdb/testsuite/gdb.trace/tfile.c b/gdb/testsuite/gdb.trace/tfile.c
index 4deba06..e9c1831 100644
--- a/gdb/testsuite/gdb.trace/tfile.c
+++ b/gdb/testsuite/gdb.trace/tfile.c
@@ -15,6 +15,10 @@ char *tfsizeptr;
int testglob = 31415;
+int testglob2 = 271828;
+
+const int constglob = 10000;
+
int
start_trace_file (char *filename)
{
@@ -40,12 +44,30 @@ finish_trace_file (int fd)
close (fd);
}
+
+void
+add_memory_block (char *addr, int size)
+{
+ short short_x;
+ long long ll_x;
+
+ *((char *) trptr) = 'M';
+ trptr += 1;
+ ll_x = (long) addr;
+ memcpy (trptr, &ll_x, sizeof (long long));
+ trptr += sizeof (long long);
+ short_x = size;
+ memcpy (trptr, &short_x, 2);
+ trptr += 2;
+ memcpy (trptr, addr, size);
+ trptr += size;
+}
+
void
write_basic_trace_file (void)
{
int fd, int_x;
short short_x;
- long long ll_x;
fd = start_trace_file ("basic.tf");
@@ -82,16 +104,10 @@ write_basic_trace_file (void)
trptr += 2;
tfsizeptr = trptr;
trptr += 4;
- *((char *) trptr) = 'M';
- trptr += 1;
- ll_x = (long) &testglob;
- memcpy (trptr, &ll_x, sizeof (long long));
- trptr += sizeof (long long);
- short_x = sizeof (testglob);
- memcpy (trptr, &short_x, 2);
- trptr += 2;
- memcpy (trptr, &testglob, sizeof (testglob));
- trptr += sizeof (testglob);
+ add_memory_block (&testglob, sizeof (testglob));
+ /* Divide a variable between two separate memory blocks. */
+ add_memory_block (&testglob2, 1);
+ add_memory_block (((char*) &testglob2) + 1, sizeof (testglob2) - 1);
/* Go back and patch in the frame size. */
int_x = trptr - tfsizeptr - sizeof (int);
memcpy (tfsizeptr, &int_x, 4);
diff --git a/gdb/testsuite/gdb.trace/tfile.exp b/gdb/testsuite/gdb.trace/tfile.exp
index a0a73ee..2140a45 100644
--- a/gdb/testsuite/gdb.trace/tfile.exp
+++ b/gdb/testsuite/gdb.trace/tfile.exp
@@ -74,8 +74,15 @@ gdb_test "tfind 0" \
\#0 write_basic_trace_file ().*" \
"tfind 0 on trace file"
+# Note that there is no tracepoint collecting these globals, we
+# just happen to know they are covered by the trace frame.
+
gdb_test "print testglob" " = 31415" "print testglob on trace file"
+gdb_test "print testglob2" " = 271828" "print testglob2 on trace file"
+
+gdb_test "print constglob" " = 10000" "print constglob on trace file"
+
gdb_test "tfind" "Target failed to find requested trace frame." \
"tfind does not find a second frame in trace file"