From: Guinevere Larsen <guinevere@redhat.com>
To: gdb-patches@sourceware.org
Cc: Guinevere Larsen <guinevere@redhat.com>
Subject: [PATCH v2 4/6] gdb/record: make record_full_history more c++-like
Date: Thu, 23 Apr 2026 12:26:02 -0300 [thread overview]
Message-ID: <20260423152604.171356-5-guinevere@redhat.com> (raw)
In-Reply-To: <20260423152604.171356-1-guinevere@redhat.com>
Move some functions to being a method of record_full_history, instead of
floating functions.
---
gdb/record-full.c | 25 +++++++++++--------------
1 file changed, 11 insertions(+), 14 deletions(-)
diff --git a/gdb/record-full.c b/gdb/record-full.c
index 6e3907325cd..d0cd8b66174 100644
--- a/gdb/record-full.c
+++ b/gdb/record-full.c
@@ -353,6 +353,10 @@ struct record_full_instruction
uint32_t insn_num;
std::optional<gdb_signal> sigval;
std::vector<record_full_entry> effects;
+
+ /* Execute the full instruction. As a side effect, set
+ record_full_stop_reason. */
+ void exec_insn (regcache *regcache);
};
/* If true, query if PREC cannot record memory
@@ -820,12 +824,9 @@ record_full_gdb_operation_disable_set (void)
static enum target_stop_reason record_full_stop_reason
= TARGET_STOPPED_BY_NO_REASON;
-static inline void
-record_full_exec_insn (struct regcache *regcache,
- struct gdbarch *gdbarch,
- record_full_instruction &insn)
+void record_full_instruction::exec_insn (regcache *regcache)
{
- for (auto &entry : insn.effects)
+ for (auto &entry : effects)
if (entry.execute (regcache))
record_full_stop_reason = TARGET_STOPPED_BY_WATCHPOINT;
}
@@ -1285,9 +1286,7 @@ record_full_wait_1 (struct target_ops *ops,
break;
}
- record_full_exec_insn
- (regcache, gdbarch,
- record_full_list[record_full_next_insn]);
+ record_full_list[record_full_next_insn].exec_insn (regcache);
/* step */
if (record_full_resume_step)
@@ -2477,8 +2476,7 @@ record_full_base_target::save_record (const char *recfilename)
/* Reverse execute to the begin of record list. */
for (int i = record_full_next_insn - 1; i >= 0; i--)
- record_full_exec_insn (regcache, gdbarch,
- record_full_list[i]);
+ record_full_list[i].exec_insn (regcache);
/* Compute the size needed for the extra bfd section. */
save_size = 4; /* magic cookie */
@@ -2550,7 +2548,7 @@ record_full_base_target::save_record (const char *recfilename)
}
/* Execute entry. */
if (i < record_full_next_insn)
- record_full_exec_insn (regcache, gdbarch, record_full_list[i]);
+ record_full_list[i].exec_insn (regcache);
}
unlink_file.keep ();
@@ -2571,17 +2569,16 @@ record_full_goto_insn (size_t target_insn,
scoped_restore restore_operation_disable
= record_full_gdb_operation_disable_set ();
regcache *regcache = get_thread_regcache (inferior_thread ());
- struct gdbarch *gdbarch = regcache->arch ();
/* Assume everything is valid: we will hit the entry,
and we will not hit the end of the recording. */
if (dir == EXEC_REVERSE)
for (int i = record_full_next_insn; i > target_insn; i--)
- record_full_exec_insn (regcache, gdbarch, record_full_list[i - 1]);
+ record_full_list[i-1].exec_insn (regcache);
else
for (int i = record_full_next_insn; i < target_insn; i++)
- record_full_exec_insn (regcache, gdbarch, record_full_list[i]);
+ record_full_list[i].exec_insn (regcache);
}
/* Alias for "target record-full". */
--
2.53.0
next prev parent reply other threads:[~2026-04-23 15:28 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-23 15:25 [PATCH v2 0/6] refactor the internals of record-full Guinevere Larsen
2026-04-23 15:25 ` [PATCH v2 1/6] gdb/record: Refactor record history Guinevere Larsen
2026-04-28 3:28 ` Thiago Jung Bauermann
2026-04-28 19:54 ` Guinevere Larsen
2026-05-06 21:16 ` Schimpe, Christina
2026-05-07 17:38 ` Guinevere Larsen
2026-05-11 15:23 ` Schimpe, Christina
2026-05-12 18:50 ` Guinevere Larsen
2026-05-13 7:54 ` Schimpe, Christina
2026-05-14 15:20 ` Guinevere Larsen
2026-04-23 15:26 ` [PATCH v2 2/6] gdb/record: remove record_full_insn_num Guinevere Larsen
2026-04-23 15:26 ` [PATCH v2 3/6] gdb/record: c++ify internal structures of record-full.c Guinevere Larsen
2026-04-28 3:29 ` Thiago Jung Bauermann
2026-04-23 15:26 ` Guinevere Larsen [this message]
2026-04-28 3:29 ` [PATCH v2 4/6] gdb/record: make record_full_history more c++-like Thiago Jung Bauermann
2026-04-23 15:26 ` [PATCH v2 5/6] gdb/record: extract the PC to record_full_instruction Guinevere Larsen
2026-04-28 3:30 ` Thiago Jung Bauermann
2026-04-23 15:26 ` [PATCH v2 6/6] gdb/record: Define new version of the record-save section Guinevere Larsen
2026-04-23 15:45 ` Eli Zaretskii
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=20260423152604.171356-5-guinevere@redhat.com \
--to=guinevere@redhat.com \
--cc=gdb-patches@sourceware.org \
/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