* 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.
This commit is contained in:
parent
045dd51fd8
commit
8ddb196517
|
@ -1,3 +1,8 @@
|
||||||
|
2013-03-13 Yao Qi <yao@codesourcery.com>
|
||||||
|
|
||||||
|
* tracepoint.c (tfile_get_trace_state_variable_value): Look for
|
||||||
|
the last matched 'V' blcok in trace frame.
|
||||||
|
|
||||||
2013-03-12 Joel Brobecker <brobecker@adacore.com>
|
2013-03-12 Joel Brobecker <brobecker@adacore.com>
|
||||||
|
|
||||||
* NEWS: Create a new section for the next release branch.
|
* NEWS: Create a new section for the next release branch.
|
||||||
|
|
|
@ -1,3 +1,8 @@
|
||||||
|
2013-03-13 Yao Qi <yao@codesourcery.com>
|
||||||
|
|
||||||
|
* tracepoint.c (traceframe_read_tsv): Look for the last matched
|
||||||
|
'V' block in trace frame.
|
||||||
|
|
||||||
2013-03-11 Markus Metzger <markus.t.metzger@intel.com>
|
2013-03-11 Markus Metzger <markus.t.metzger@intel.com>
|
||||||
|
|
||||||
* target.h (struct target_ops): Add btrace ops.
|
* target.h (struct target_ops): Add btrace ops.
|
||||||
|
|
|
@ -5257,6 +5257,7 @@ traceframe_read_tsv (int tsvnum, LONGEST *val)
|
||||||
unsigned char *database, *dataptr;
|
unsigned char *database, *dataptr;
|
||||||
unsigned int datasize;
|
unsigned int datasize;
|
||||||
int vnum;
|
int vnum;
|
||||||
|
int found = 0;
|
||||||
|
|
||||||
trace_debug ("traceframe_read_tsv");
|
trace_debug ("traceframe_read_tsv");
|
||||||
|
|
||||||
|
@ -5279,7 +5280,8 @@ traceframe_read_tsv (int tsvnum, LONGEST *val)
|
||||||
datasize = tframe->data_size;
|
datasize = tframe->data_size;
|
||||||
database = dataptr = &tframe->data[0];
|
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,
|
while ((dataptr = traceframe_find_block_type (dataptr,
|
||||||
datasize
|
datasize
|
||||||
- (dataptr - database),
|
- (dataptr - database),
|
||||||
|
@ -5294,16 +5296,17 @@ traceframe_read_tsv (int tsvnum, LONGEST *val)
|
||||||
if (tsvnum == vnum)
|
if (tsvnum == vnum)
|
||||||
{
|
{
|
||||||
memcpy (val, dataptr, sizeof (*val));
|
memcpy (val, dataptr, sizeof (*val));
|
||||||
return 0;
|
found = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Skip over this block. */
|
/* Skip over this block. */
|
||||||
dataptr += sizeof (LONGEST);
|
dataptr += sizeof (LONGEST);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!found)
|
||||||
trace_debug ("traceframe %d has no data for variable %d",
|
trace_debug ("traceframe %d has no data for variable %d",
|
||||||
tfnum, tsvnum);
|
tfnum, tsvnum);
|
||||||
return 1;
|
return !found;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Read a requested block of static tracepoint data from a trace
|
/* Read a requested block of static tracepoint data from a trace
|
||||||
|
|
|
@ -1,3 +1,10 @@
|
||||||
|
2013-03-13 Yao Qi <yao@codesourcery.com>
|
||||||
|
|
||||||
|
* 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.
|
||||||
|
|
||||||
2013-03-13 Yao Qi <yao@codesourcery.com>
|
2013-03-13 Yao Qi <yao@codesourcery.com>
|
||||||
|
|
||||||
* gdb.trace/tsv.exp: Remove code unrelated to testing TSV.
|
* gdb.trace/tsv.exp: Remove code unrelated to testing TSV.
|
||||||
|
|
|
@ -142,7 +142,36 @@ gdb_test "print \$tvar5" " = 16" \
|
||||||
|
|
||||||
gdb_test_no_output "tstop" ""
|
gdb_test_no_output "tstop" ""
|
||||||
|
|
||||||
|
# Save trace frames to tfile.
|
||||||
|
set tracefile [standard_output_file ${testfile}]
|
||||||
|
gdb_test "tsave ${tracefile}.tf" \
|
||||||
|
"Trace data saved to file '${tracefile}.tf'.*" \
|
||||||
|
"save tfile trace file"
|
||||||
|
|
||||||
|
proc check_tsv { data_source } {
|
||||||
|
with_test_prefix "${data_source}" {
|
||||||
|
gdb_test "tfind 0"
|
||||||
gdb_test "print \$tvar5" " = 16" \
|
gdb_test "print \$tvar5" " = 16" \
|
||||||
"Print a trace state variable after run"
|
"Print a trace state variable"
|
||||||
|
gdb_test "tfind" \
|
||||||
|
"Target failed to find requested trace frame.*"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
# Check the tsv from the live inferior.
|
||||||
|
check_tsv "live"
|
||||||
|
|
||||||
|
# Change target to tfile.
|
||||||
|
set test "change to tfile target"
|
||||||
|
gdb_test_multiple "target tfile ${tracefile}.tf" "$test" {
|
||||||
|
-re "A program is being debugged already. Kill it. .y or n. " {
|
||||||
|
send_gdb "y\n"
|
||||||
|
exp_continue
|
||||||
|
}
|
||||||
|
-re "$gdb_prompt $" {
|
||||||
|
pass "$test"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
# Check the tsv from tfile.
|
||||||
|
check_tsv "tfile"
|
||||||
|
|
|
@ -4655,7 +4655,12 @@ static int
|
||||||
tfile_get_trace_state_variable_value (int tsvnum, LONGEST *val)
|
tfile_get_trace_state_variable_value (int tsvnum, LONGEST *val)
|
||||||
{
|
{
|
||||||
int pos;
|
int pos;
|
||||||
|
int found = 0;
|
||||||
|
|
||||||
|
/* Iterate over blocks in current frame and find the last 'V'
|
||||||
|
block in which tsv number is TSVNUM. In one trace frame, there
|
||||||
|
may be multiple 'V' blocks created for a given trace variable,
|
||||||
|
and the last matched 'V' block contains the updated value. */
|
||||||
pos = 0;
|
pos = 0;
|
||||||
while ((pos = traceframe_find_block_type ('V', pos)) >= 0)
|
while ((pos = traceframe_find_block_type ('V', pos)) >= 0)
|
||||||
{
|
{
|
||||||
|
@ -4671,13 +4676,12 @@ tfile_get_trace_state_variable_value (int tsvnum, LONGEST *val)
|
||||||
*val = extract_signed_integer ((gdb_byte *) val, 8,
|
*val = extract_signed_integer ((gdb_byte *) val, 8,
|
||||||
gdbarch_byte_order
|
gdbarch_byte_order
|
||||||
(target_gdbarch ()));
|
(target_gdbarch ()));
|
||||||
return 1;
|
found = 1;
|
||||||
}
|
}
|
||||||
pos += (4 + 8);
|
pos += (4 + 8);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Didn't find anything. */
|
return found;
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
|
|
Loading…
Reference in New Issue