This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
[PATCH 1/8] btrace: check if we're replaying when setting the replay position to the end
- From: Markus Metzger <markus dot t dot metzger at intel dot com>
- To: gdb-patches at sourceware dot org
- Cc: palves at redhat dot com, marc dot khouzam at ericsson dot com
- Date: Wed, 6 Jul 2016 13:56:24 +0200
- Subject: [PATCH 1/8] btrace: check if we're replaying when setting the replay position to the end
- Authentication-results: sourceware.org; auth=none
- References: <1467806191-4320-1-git-send-email-markus.t.metzger@intel.com>
When setting the replay position to the end there is nothing to do if we are
not replaying. Check that and return immediately.
This avoids printing the current location if we're already at the end.
2016-07-06 Markus Metzger <markus.t.metzger@intel.com>
gdb/
* record-btrace.c (record_btrace_set_replay): Check if replaying.
testsuite/
* gdb.btrace/record_goto.exp: Test "record goto end" twice.
---
gdb/record-btrace.c | 7 ++++++-
gdb/testsuite/gdb.btrace/record_goto.exp | 3 +++
2 files changed, 9 insertions(+), 1 deletion(-)
diff --git a/gdb/record-btrace.c b/gdb/record-btrace.c
index 24594a9..80d9f04 100644
--- a/gdb/record-btrace.c
+++ b/gdb/record-btrace.c
@@ -2704,7 +2704,12 @@ record_btrace_set_replay (struct thread_info *tp,
btinfo = &tp->btrace;
if (it == NULL || it->function == NULL)
- record_btrace_stop_replaying (tp);
+ {
+ if (!btrace_is_replaying (tp))
+ return;
+
+ record_btrace_stop_replaying (tp);
+ }
else
{
if (btinfo->replay == NULL)
diff --git a/gdb/testsuite/gdb.btrace/record_goto.exp b/gdb/testsuite/gdb.btrace/record_goto.exp
index 50b259a..45df261 100644
--- a/gdb/testsuite/gdb.btrace/record_goto.exp
+++ b/gdb/testsuite/gdb.btrace/record_goto.exp
@@ -160,6 +160,9 @@ gdb_test "record instruction-history -" [multi_line \
# check that we can go to the end of the trace
gdb_test "record goto end" ".*main \\(\\) at record_goto.c:50.*"
+# check that we don't repeat the current location if we go to the end again
+gdb_test_no_output "record goto end" "goto end again"
+
# check that we're filling up the context correctly
gdb_test "record function-call-history /ci" [multi_line \
"14\t fun2\tinst 35,36" \
--
1.8.3.1