aboutsummaryrefslogtreecommitdiff
path: root/gdb/record-btrace.c
diff options
context:
space:
mode:
authorMarkus Metzger <markus.t.metzger@intel.com>2013-04-17 09:39:43 +0200
committerMarkus Metzger <markus.t.metzger@intel.com>2014-01-16 13:05:38 +0100
commit0688d04e19c0e6305c1034eb5e97a66458fd805a (patch)
treebe934314a7c9e9afd80c3488d38eb71c8a25a367 /gdb/record-btrace.c
parent8710b7097e6564969c5e417007a438d8f4ab710e (diff)
downloadbinutils-0688d04e19c0e6305c1034eb5e97a66458fd805a.zip
binutils-0688d04e19c0e6305c1034eb5e97a66458fd805a.tar.gz
binutils-0688d04e19c0e6305c1034eb5e97a66458fd805a.tar.bz2
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.
Diffstat (limited to 'gdb/record-btrace.c')
-rw-r--r--gdb/record-btrace.c38
1 files changed, 28 insertions, 10 deletions
diff --git a/gdb/record-btrace.c b/gdb/record-btrace.c
index c53acec..34aee40 100644
--- a/gdb/record-btrace.c
+++ b/gdb/record-btrace.c
@@ -367,7 +367,7 @@ record_btrace_insn_history_range (ULONGEST from, ULONGEST to, int flags)
if (low != from || high != to)
error (_("Bad range."));
- if (high <= low)
+ if (high < low)
error (_("Bad range."));
btinfo = require_btrace ();
@@ -376,10 +376,17 @@ record_btrace_insn_history_range (ULONGEST from, ULONGEST to, int flags)
if (found == 0)
error (_("Range out of bounds."));
- /* Silently truncate the range, if necessary. */
found = btrace_find_insn_by_number (&end, btinfo, high);
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_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;
context = abs (size);
+ if (context == 0)
+ error (_("Bad record instruction-history-size."));
if (size < 0)
{
@@ -403,12 +412,12 @@ record_btrace_insn_history_from (ULONGEST from, int size, int flags)
if (from < context)
begin = 0;
else
- begin = from - context;
+ begin = from - context + 1;
}
else
{
begin = from;
- end = from + context;
+ end = from + context - 1;
/* Check for wrap-around. */
if (end < begin)
@@ -618,7 +627,7 @@ record_btrace_call_history_range (ULONGEST from, ULONGEST to, int flags)
if (low != from || high != to)
error (_("Bad range."));
- if (high <= low)
+ if (high < low)
error (_("Bad range."));
btinfo = require_btrace ();
@@ -627,10 +636,17 @@ record_btrace_call_history_range (ULONGEST from, ULONGEST to, int flags)
if (found == 0)
error (_("Range out of bounds."));
- /* Silently truncate the range, if necessary. */
found = btrace_find_call_by_number (&end, btinfo, high);
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_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;
context = abs (size);
+ if (context == 0)
+ error (_("Bad record function-call-history-size."));
if (size < 0)
{
@@ -654,12 +672,12 @@ record_btrace_call_history_from (ULONGEST from, int size, int flags)
if (from < context)
begin = 0;
else
- begin = from - context;
+ begin = from - context + 1;
}
else
{
begin = from;
- end = from + context;
+ end = from + context - 1;
/* Check for wrap-around. */
if (end < begin)