[binutils-gdb] btrace: update record_btrace_stop_replaying_at_end
Markus Metzger
mmetzger@sourceware.org
Mon Nov 3 06:40:35 GMT 2025
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=0b6e72d4c138e9af09201560c2056658e8b0499e
commit 0b6e72d4c138e9af09201560c2056658e8b0499e
Author: Markus Metzger <markus.t.metzger@intel.com>
Date: Mon Aug 11 14:17:17 2025 +0000
btrace: update record_btrace_stop_replaying_at_end
In record_btrace_stop_replaying_at_end, we know that we are at the end of
the execution history, so PC must match the current PC if we're not
replaying.
We're not changing any other registers during btrace replay, so we should
be fine leaving the regcache.
But we need to reinit the frame cache, since current frames used the
btrace unwinder.
The main motivation for this, however, is that future patches extend stop
replaying in ways that is not relevant to stop replaying at the end.
Diff:
---
gdb/record-btrace.c | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/gdb/record-btrace.c b/gdb/record-btrace.c
index 80d22a9b4b6..1af9f49ec60 100644
--- a/gdb/record-btrace.c
+++ b/gdb/record-btrace.c
@@ -2166,9 +2166,14 @@ record_btrace_stop_replaying_at_end (struct thread_info *tp)
return;
btrace_insn_end (&end, btinfo);
+ if (btrace_insn_cmp (replay, &end) != 0)
+ return;
- if (btrace_insn_cmp (replay, &end) == 0)
- record_btrace_stop_replaying (tp);
+ xfree (replay);
+ btinfo->replay = nullptr;
+
+ /* Discard any frames from the btrace unwinder. */
+ reinit_frame_cache ();
}
/* The resume method of target record-btrace. */
More information about the Gdb-cvs
mailing list