diff options
author | Yao Qi <yao@codesourcery.com> | 2013-03-13 03:40:27 +0000 |
---|---|---|
committer | Yao Qi <yao@codesourcery.com> | 2013-03-13 03:40:27 +0000 |
commit | 8ddb196517f30b5e304663e428f345daf030230b (patch) | |
tree | c7d0996f2f0192f644f105aa7c6e111b50060c27 /gdb/gdbserver/tracepoint.c | |
parent | 045dd51fd8dd7ae16b74d5154156b2d984d021b9 (diff) | |
download | gdb-8ddb196517f30b5e304663e428f345daf030230b.zip gdb-8ddb196517f30b5e304663e428f345daf030230b.tar.gz gdb-8ddb196517f30b5e304663e428f345daf030230b.tar.bz2 |
* tracepoint.c (tfile_get_trace_state_variable_value): Look for
the last matched 'V' blcok in trace frame.
gdb/gdbserver:
* tracepoint.c (traceframe_read_tsv): Look for the last matched
'V' block in trace frame.
gdb/testsuite:
* gdb.trace/tsv.exp (check_tsv): New.
(top level): Save a tfile on current trace session. Call
check_tsv on live target. Load the tfile with target tfile
and call check_tsv again.
Diffstat (limited to 'gdb/gdbserver/tracepoint.c')
-rw-r--r-- | gdb/gdbserver/tracepoint.c | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/gdb/gdbserver/tracepoint.c b/gdb/gdbserver/tracepoint.c index dcc2e78..bea6202 100644 --- a/gdb/gdbserver/tracepoint.c +++ b/gdb/gdbserver/tracepoint.c @@ -5257,6 +5257,7 @@ traceframe_read_tsv (int tsvnum, LONGEST *val) unsigned char *database, *dataptr; unsigned int datasize; int vnum; + int found = 0; trace_debug ("traceframe_read_tsv"); @@ -5279,7 +5280,8 @@ traceframe_read_tsv (int tsvnum, LONGEST *val) datasize = tframe->data_size; database = dataptr = &tframe->data[0]; - /* Iterate through a traceframe's blocks, looking for the tsv. */ + /* Iterate through a traceframe's blocks, looking for the last + matched tsv. */ while ((dataptr = traceframe_find_block_type (dataptr, datasize - (dataptr - database), @@ -5294,16 +5296,17 @@ traceframe_read_tsv (int tsvnum, LONGEST *val) if (tsvnum == vnum) { memcpy (val, dataptr, sizeof (*val)); - return 0; + found = 1; } /* Skip over this block. */ dataptr += sizeof (LONGEST); } - trace_debug ("traceframe %d has no data for variable %d", - tfnum, tsvnum); - return 1; + if (!found) + trace_debug ("traceframe %d has no data for variable %d", + tfnum, tsvnum); + return !found; } /* Read a requested block of static tracepoint data from a trace |