record-btrace: make ranges include begin and end
The "record function-call-history" and "record instruction-history" commands accept a range "begin, end". End is not included in both cases. Include it. 2014-01-16 Markus Metzger <markus.t.metzger@intel.com> * record-btrace.c (record_btrace_insn_history_range): Include end. (record_btrace_insn_history_from): Adjust range. (record_btrace_call_history_range): Include end. (record_btrace_call_history_from): Adjust range. * NEWS: Announce changes. testsuite/ * gdb.btrace/function_call_history.exp: Update tests. * gdb.btrace/instruction_history.exp: Update tests. doc/ * gdb.texinfo (Process Record and Replay): Update documentation.
This commit is contained in:
parent
8710b7097e
commit
0688d04e19
9 changed files with 62 additions and 20 deletions
|
@ -1,3 +1,13 @@
|
||||||
|
2014-01-16 Markus Metzger <markus.t.metzger@intel.com>
|
||||||
|
|
||||||
|
* record-btrace.c (record_btrace_insn_history_range): Include
|
||||||
|
end.
|
||||||
|
(record_btrace_insn_history_from): Adjust range.
|
||||||
|
(record_btrace_call_history_range): Include
|
||||||
|
end.
|
||||||
|
(record_btrace_call_history_from): Adjust range.
|
||||||
|
* NEWS: Announce changes.
|
||||||
|
|
||||||
2014-01-16 Markus Metzger <markus.t.metzger@intel.com>
|
2014-01-16 Markus Metzger <markus.t.metzger@intel.com>
|
||||||
|
|
||||||
* record.h (enum record_print_flag)
|
* record.h (enum record_print_flag)
|
||||||
|
|
3
gdb/NEWS
3
gdb/NEWS
|
@ -15,6 +15,9 @@
|
||||||
Both ranges are now printed as '<from>, <to>' to allow copy&paste to the
|
Both ranges are now printed as '<from>, <to>' to allow copy&paste to the
|
||||||
"record instruction-history" and "list" commands.
|
"record instruction-history" and "list" commands.
|
||||||
|
|
||||||
|
* The ranges given as arguments to the 'record function-call-history' and
|
||||||
|
'record instruction-history' commands are now inclusive.
|
||||||
|
|
||||||
*** Changes in GDB 7.7
|
*** Changes in GDB 7.7
|
||||||
|
|
||||||
* Improved support for process record-replay and reverse debugging on
|
* Improved support for process record-replay and reverse debugging on
|
||||||
|
|
|
@ -1,3 +1,7 @@
|
||||||
|
2014-01-16 Markus Metzger <markus.t.metzger@intel.com>
|
||||||
|
|
||||||
|
* gdb.texinfo (Process Record and Replay): Update documentation.
|
||||||
|
|
||||||
2014-01-16 Markus Metzger <markus.t.metzger@intel.com>
|
2014-01-16 Markus Metzger <markus.t.metzger@intel.com>
|
||||||
|
|
||||||
* gdb.texinfo (Process Record and Replay): Document new /c
|
* gdb.texinfo (Process Record and Replay): Document new /c
|
||||||
|
|
|
@ -6465,7 +6465,7 @@ Disassembles ten more instructions before the last disassembly.
|
||||||
@item record instruction-history @var{begin} @var{end}
|
@item record instruction-history @var{begin} @var{end}
|
||||||
Disassembles instructions beginning with instruction number
|
Disassembles instructions beginning with instruction number
|
||||||
@var{begin} until instruction number @var{end}. The instruction
|
@var{begin} until instruction number @var{end}. The instruction
|
||||||
number @var{end} is not included.
|
number @var{end} is included.
|
||||||
@end table
|
@end table
|
||||||
|
|
||||||
This command may not be available for all recording methods.
|
This command may not be available for all recording methods.
|
||||||
|
@ -6536,8 +6536,7 @@ Prints ten more functions before the last ten-line print.
|
||||||
|
|
||||||
@item record function-call-history @var{begin} @var{end}
|
@item record function-call-history @var{begin} @var{end}
|
||||||
Prints functions beginning with function number @var{begin} until
|
Prints functions beginning with function number @var{begin} until
|
||||||
function number @var{end}. The function number @var{end} is not
|
function number @var{end}. The function number @var{end} is included.
|
||||||
included.
|
|
||||||
@end table
|
@end table
|
||||||
|
|
||||||
This command may not be available for all recording methods.
|
This command may not be available for all recording methods.
|
||||||
|
|
|
@ -367,7 +367,7 @@ record_btrace_insn_history_range (ULONGEST from, ULONGEST to, int flags)
|
||||||
if (low != from || high != to)
|
if (low != from || high != to)
|
||||||
error (_("Bad range."));
|
error (_("Bad range."));
|
||||||
|
|
||||||
if (high <= low)
|
if (high < low)
|
||||||
error (_("Bad range."));
|
error (_("Bad range."));
|
||||||
|
|
||||||
btinfo = require_btrace ();
|
btinfo = require_btrace ();
|
||||||
|
@ -376,10 +376,17 @@ record_btrace_insn_history_range (ULONGEST from, ULONGEST to, int flags)
|
||||||
if (found == 0)
|
if (found == 0)
|
||||||
error (_("Range out of bounds."));
|
error (_("Range out of bounds."));
|
||||||
|
|
||||||
/* Silently truncate the range, if necessary. */
|
|
||||||
found = btrace_find_insn_by_number (&end, btinfo, high);
|
found = btrace_find_insn_by_number (&end, btinfo, high);
|
||||||
if (found == 0)
|
if (found == 0)
|
||||||
btrace_insn_end (&end, btinfo);
|
{
|
||||||
|
/* Silently truncate the range. */
|
||||||
|
btrace_insn_end (&end, btinfo);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/* We want both begin and end to be inclusive. */
|
||||||
|
btrace_insn_next (&end, 1);
|
||||||
|
}
|
||||||
|
|
||||||
btrace_insn_history (uiout, &begin, &end, flags);
|
btrace_insn_history (uiout, &begin, &end, flags);
|
||||||
btrace_set_insn_history (btinfo, &begin, &end);
|
btrace_set_insn_history (btinfo, &begin, &end);
|
||||||
|
@ -395,6 +402,8 @@ record_btrace_insn_history_from (ULONGEST from, int size, int flags)
|
||||||
ULONGEST begin, end, context;
|
ULONGEST begin, end, context;
|
||||||
|
|
||||||
context = abs (size);
|
context = abs (size);
|
||||||
|
if (context == 0)
|
||||||
|
error (_("Bad record instruction-history-size."));
|
||||||
|
|
||||||
if (size < 0)
|
if (size < 0)
|
||||||
{
|
{
|
||||||
|
@ -403,12 +412,12 @@ record_btrace_insn_history_from (ULONGEST from, int size, int flags)
|
||||||
if (from < context)
|
if (from < context)
|
||||||
begin = 0;
|
begin = 0;
|
||||||
else
|
else
|
||||||
begin = from - context;
|
begin = from - context + 1;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
begin = from;
|
begin = from;
|
||||||
end = from + context;
|
end = from + context - 1;
|
||||||
|
|
||||||
/* Check for wrap-around. */
|
/* Check for wrap-around. */
|
||||||
if (end < begin)
|
if (end < begin)
|
||||||
|
@ -618,7 +627,7 @@ record_btrace_call_history_range (ULONGEST from, ULONGEST to, int flags)
|
||||||
if (low != from || high != to)
|
if (low != from || high != to)
|
||||||
error (_("Bad range."));
|
error (_("Bad range."));
|
||||||
|
|
||||||
if (high <= low)
|
if (high < low)
|
||||||
error (_("Bad range."));
|
error (_("Bad range."));
|
||||||
|
|
||||||
btinfo = require_btrace ();
|
btinfo = require_btrace ();
|
||||||
|
@ -627,10 +636,17 @@ record_btrace_call_history_range (ULONGEST from, ULONGEST to, int flags)
|
||||||
if (found == 0)
|
if (found == 0)
|
||||||
error (_("Range out of bounds."));
|
error (_("Range out of bounds."));
|
||||||
|
|
||||||
/* Silently truncate the range, if necessary. */
|
|
||||||
found = btrace_find_call_by_number (&end, btinfo, high);
|
found = btrace_find_call_by_number (&end, btinfo, high);
|
||||||
if (found == 0)
|
if (found == 0)
|
||||||
btrace_call_end (&end, btinfo);
|
{
|
||||||
|
/* Silently truncate the range. */
|
||||||
|
btrace_call_end (&end, btinfo);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/* We want both begin and end to be inclusive. */
|
||||||
|
btrace_call_next (&end, 1);
|
||||||
|
}
|
||||||
|
|
||||||
btrace_call_history (uiout, btinfo, &begin, &end, flags);
|
btrace_call_history (uiout, btinfo, &begin, &end, flags);
|
||||||
btrace_set_call_history (btinfo, &begin, &end);
|
btrace_set_call_history (btinfo, &begin, &end);
|
||||||
|
@ -646,6 +662,8 @@ record_btrace_call_history_from (ULONGEST from, int size, int flags)
|
||||||
ULONGEST begin, end, context;
|
ULONGEST begin, end, context;
|
||||||
|
|
||||||
context = abs (size);
|
context = abs (size);
|
||||||
|
if (context == 0)
|
||||||
|
error (_("Bad record function-call-history-size."));
|
||||||
|
|
||||||
if (size < 0)
|
if (size < 0)
|
||||||
{
|
{
|
||||||
|
@ -654,12 +672,12 @@ record_btrace_call_history_from (ULONGEST from, int size, int flags)
|
||||||
if (from < context)
|
if (from < context)
|
||||||
begin = 0;
|
begin = 0;
|
||||||
else
|
else
|
||||||
begin = from - context;
|
begin = from - context + 1;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
begin = from;
|
begin = from;
|
||||||
end = from + context;
|
end = from + context - 1;
|
||||||
|
|
||||||
/* Check for wrap-around. */
|
/* Check for wrap-around. */
|
||||||
if (end < begin)
|
if (end < begin)
|
||||||
|
|
|
@ -878,7 +878,7 @@ struct target_ops
|
||||||
void (*to_insn_history_from) (ULONGEST from, int size, int flags);
|
void (*to_insn_history_from) (ULONGEST from, int size, int flags);
|
||||||
|
|
||||||
/* Disassemble a section of the recorded execution trace from instruction
|
/* Disassemble a section of the recorded execution trace from instruction
|
||||||
BEGIN (inclusive) to instruction END (exclusive). */
|
BEGIN (inclusive) to instruction END (inclusive). */
|
||||||
void (*to_insn_history_range) (ULONGEST begin, ULONGEST end, int flags);
|
void (*to_insn_history_range) (ULONGEST begin, ULONGEST end, int flags);
|
||||||
|
|
||||||
/* Print a function trace of the recorded execution trace.
|
/* Print a function trace of the recorded execution trace.
|
||||||
|
@ -893,7 +893,7 @@ struct target_ops
|
||||||
void (*to_call_history_from) (ULONGEST begin, int size, int flags);
|
void (*to_call_history_from) (ULONGEST begin, int size, int flags);
|
||||||
|
|
||||||
/* Print a function trace of an execution trace section from function BEGIN
|
/* Print a function trace of an execution trace section from function BEGIN
|
||||||
(inclusive) to function END (exclusive). */
|
(inclusive) to function END (inclusive). */
|
||||||
void (*to_call_history_range) (ULONGEST begin, ULONGEST end, int flags);
|
void (*to_call_history_range) (ULONGEST begin, ULONGEST end, int flags);
|
||||||
|
|
||||||
/* Nonzero if TARGET_OBJECT_LIBRARIES_SVR4 may be read with a
|
/* Nonzero if TARGET_OBJECT_LIBRARIES_SVR4 may be read with a
|
||||||
|
|
|
@ -1,3 +1,8 @@
|
||||||
|
2014-01-16 Markus Metzger <markus.t.metzger@intel.com>
|
||||||
|
|
||||||
|
* gdb.btrace/function_call_history.exp: Update tests.
|
||||||
|
* gdb.btrace/instruction_history.exp: Update tests.
|
||||||
|
|
||||||
2014-01-16 Markus Metzger <markus.t.metzger@intel.com>
|
2014-01-16 Markus Metzger <markus.t.metzger@intel.com>
|
||||||
|
|
||||||
* gdb.btrace/function_call_history.exp: Fix expected field
|
* gdb.btrace/function_call_history.exp: Fix expected field
|
||||||
|
|
|
@ -183,9 +183,10 @@ set expected_range [join [list \
|
||||||
"10\tinc"] "\r\n"]
|
"10\tinc"] "\r\n"]
|
||||||
|
|
||||||
# show functions in instruction range
|
# show functions in instruction range
|
||||||
gdb_test "record function-call-history 4,11" $expected_range
|
gdb_test "record function-call-history 4,10" $expected_range
|
||||||
gdb_test "record function-call-history 4,+7" $expected_range
|
gdb_test "record function-call-history 4,+7" $expected_range
|
||||||
gdb_test "record function-call-history 11,-7" $expected_range
|
gdb_test "record function-call-history 10,-7" $expected_range
|
||||||
|
gdb_test "record function-call-history 4,4" "4\tinc\r"
|
||||||
|
|
||||||
# set bp after fib recursion and continue
|
# set bp after fib recursion and continue
|
||||||
set bp_location [gdb_get_line_number "bp.2" $testfile.c]
|
set bp_location [gdb_get_line_number "bp.2" $testfile.c]
|
||||||
|
|
|
@ -65,7 +65,7 @@ if { $traced != 6 } {
|
||||||
}
|
}
|
||||||
|
|
||||||
# test that we see the expected instructions
|
# test that we see the expected instructions
|
||||||
gdb_test "record instruction-history 2,7" [join [list \
|
gdb_test "record instruction-history 2,6" [join [list \
|
||||||
"2\t 0x\[0-9a-f\]+ <loop\\+\[0-9\]+>:\tje 0x\[0-9a-f\]+ <loop\\+\[0-9\]+>" \
|
"2\t 0x\[0-9a-f\]+ <loop\\+\[0-9\]+>:\tje 0x\[0-9a-f\]+ <loop\\+\[0-9\]+>" \
|
||||||
"3\t 0x\[0-9a-f\]+ <loop\\+\[0-9\]+>:\tdec %eax" \
|
"3\t 0x\[0-9a-f\]+ <loop\\+\[0-9\]+>:\tdec %eax" \
|
||||||
"4\t 0x\[0-9a-f\]+ <loop\\+\[0-9\]+>:\tjmp 0x\[0-9a-f\]+ <loop\\+\[0-9\]+>" \
|
"4\t 0x\[0-9a-f\]+ <loop\\+\[0-9\]+>:\tjmp 0x\[0-9a-f\]+ <loop\\+\[0-9\]+>" \
|
||||||
|
@ -81,7 +81,7 @@ gdb_test "record instruction-history /f 2,+5" [join [list \
|
||||||
"6\t 0x\[0-9a-f\]+ <\\+\[0-9\]+>:\tje 0x\[0-9a-f\]+ <loop\\+\[0-9\]+>\r" \
|
"6\t 0x\[0-9a-f\]+ <\\+\[0-9\]+>:\tje 0x\[0-9a-f\]+ <loop\\+\[0-9\]+>\r" \
|
||||||
] "\r\n"]
|
] "\r\n"]
|
||||||
|
|
||||||
gdb_test "record instruction-history /p 7,-5" [join [list \
|
gdb_test "record instruction-history /p 6,-5" [join [list \
|
||||||
"2\t0x\[0-9a-f\]+ <loop\\+\[0-9\]+>:\tje 0x\[0-9a-f\]+ <loop\\+\[0-9\]+>" \
|
"2\t0x\[0-9a-f\]+ <loop\\+\[0-9\]+>:\tje 0x\[0-9a-f\]+ <loop\\+\[0-9\]+>" \
|
||||||
"3\t0x\[0-9a-f\]+ <loop\\+\[0-9\]+>:\tdec %eax" \
|
"3\t0x\[0-9a-f\]+ <loop\\+\[0-9\]+>:\tdec %eax" \
|
||||||
"4\t0x\[0-9a-f\]+ <loop\\+\[0-9\]+>:\tjmp 0x\[0-9a-f\]+ <loop\\+\[0-9\]+>" \
|
"4\t0x\[0-9a-f\]+ <loop\\+\[0-9\]+>:\tjmp 0x\[0-9a-f\]+ <loop\\+\[0-9\]+>" \
|
||||||
|
@ -89,7 +89,7 @@ gdb_test "record instruction-history /p 7,-5" [join [list \
|
||||||
"6\t0x\[0-9a-f\]+ <loop\\+\[0-9\]+>:\tje 0x\[0-9a-f\]+ <loop\\+\[0-9\]+>\r" \
|
"6\t0x\[0-9a-f\]+ <loop\\+\[0-9\]+>:\tje 0x\[0-9a-f\]+ <loop\\+\[0-9\]+>\r" \
|
||||||
] "\r\n"]
|
] "\r\n"]
|
||||||
|
|
||||||
gdb_test "record instruction-history /pf 2,7" [join [list \
|
gdb_test "record instruction-history /pf 2,6" [join [list \
|
||||||
"2\t0x\[0-9a-f\]+ <\\+\[0-9\]+>:\tje 0x\[0-9a-f\]+ <loop\\+\[0-9\]+>" \
|
"2\t0x\[0-9a-f\]+ <\\+\[0-9\]+>:\tje 0x\[0-9a-f\]+ <loop\\+\[0-9\]+>" \
|
||||||
"3\t0x\[0-9a-f\]+ <\\+\[0-9\]+>:\tdec %eax" \
|
"3\t0x\[0-9a-f\]+ <\\+\[0-9\]+>:\tdec %eax" \
|
||||||
"4\t0x\[0-9a-f\]+ <\\+\[0-9\]+>:\tjmp 0x\[0-9a-f\]+ <loop\\+\[0-9\]+>" \
|
"4\t0x\[0-9a-f\]+ <\\+\[0-9\]+>:\tjmp 0x\[0-9a-f\]+ <loop\\+\[0-9\]+>" \
|
||||||
|
@ -97,6 +97,8 @@ gdb_test "record instruction-history /pf 2,7" [join [list \
|
||||||
"6\t0x\[0-9a-f\]+ <\\+\[0-9\]+>:\tje 0x\[0-9a-f\]+ <loop\\+\[0-9\]+>\r" \
|
"6\t0x\[0-9a-f\]+ <\\+\[0-9\]+>:\tje 0x\[0-9a-f\]+ <loop\\+\[0-9\]+>\r" \
|
||||||
] "\r\n"]
|
] "\r\n"]
|
||||||
|
|
||||||
|
gdb_test "record instruction-history 2,2" "2\t 0x\[0-9a-f\]+ <loop\\+\[0-9\]+>:\tje 0x\[0-9a-f\]+ <loop\\+\[0-9\]+>\r"
|
||||||
|
|
||||||
# the following tests are checking the iterators
|
# the following tests are checking the iterators
|
||||||
# to avoid lots of regexps, we just check the number of lines that
|
# to avoid lots of regexps, we just check the number of lines that
|
||||||
# were printed during command execution.
|
# were printed during command execution.
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue