public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Markus Metzger <markus.t.metzger@intel.com>
To: gdb-patches@sourceware.org
Cc: palves@redhat.com, marc.khouzam@ericsson.com
Subject: [PATCH 1/8] btrace: check if we're replaying when setting the replay position to the end
Date: Wed, 06 Jul 2016 11:57:00 -0000	[thread overview]
Message-ID: <1467806191-4320-2-git-send-email-markus.t.metzger@intel.com> (raw)
In-Reply-To: <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

  parent reply	other threads:[~2016-07-06 11:56 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-07-06 11:56 [PATCH 0/8] record: notify about "record goto" stop Markus Metzger
2016-07-06 11:56 ` [PATCH 4/8] record: signal a record goto stop to front-ends Markus Metzger
2016-07-06 11:56 ` [PATCH 2/8] record: do not allow record goto on a running thread Markus Metzger
2016-07-06 11:57 ` [PATCH 6/8] record-full: signal record-goto stop Markus Metzger
2016-07-06 11:57 ` Markus Metzger [this message]
2016-07-06 11:57 ` [PATCH 7/8] btrace-btrace: " Markus Metzger
2016-07-06 11:57 ` [PATCH 3/8] infrun: export clear_proceed_status_thread Markus Metzger
2016-07-06 11:57 ` [PATCH 5/8] mi, testsuite: add another EXTRA option to mi_expect_stop Markus Metzger
2016-07-06 11:57 ` [PATCH 8/8] btrace: record stop moves to the end of the trace Markus Metzger

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1467806191-4320-2-git-send-email-markus.t.metzger@intel.com \
    --to=markus.t.metzger@intel.com \
    --cc=gdb-patches@sourceware.org \
    --cc=marc.khouzam@ericsson.com \
    --cc=palves@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).