From: Guinevere Larsen <guinevere@redhat.com>
To: gdb-patches@sourceware.org
Cc: Guinevere Larsen <guinevere@redhat.com>,
Thiago Jung Bauermann <thiago.bauermann@linaro.org>,
Christina Schimpe <christina.schimpe@intel.com>
Subject: [PATCH v5 5/8] gdb/record: make record_full_history more c++-like
Date: Mon, 15 Jun 2026 13:14:57 -0300 [thread overview]
Message-ID: <20260615161500.34181-6-guinevere@redhat.com> (raw)
In-Reply-To: <20260615161500.34181-1-guinevere@redhat.com>
This commit moves the function record_full_exec_insn to be a method of
the record_full_instruction class.
Reviewed-by: Thiago Jung Bauermann <thiago.bauermann@linaro.org>
Reviewed-By: Christina Schimpe <christina.schimpe@intel.com>
---
gdb/record-full.c | 26 ++++++++++++--------------
1 file changed, 12 insertions(+), 14 deletions(-)
diff --git a/gdb/record-full.c b/gdb/record-full.c
index 9a5ec353a4e..54a0251ae19 100644
--- a/gdb/record-full.c
+++ b/gdb/record-full.c
@@ -407,6 +407,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
@@ -871,12 +875,9 @@ static enum target_stop_reason record_full_stop_reason
/* Execute one entry in the log by executing all the effects. */
-static inline void
-record_full_exec_insn (regcache *regcache,
- 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;
}
@@ -1337,9 +1338,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)
@@ -2529,8 +2528,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 */
@@ -2601,8 +2599,9 @@ record_full_base_target::save_record (const char *recfilename)
gdbarch);
}
+ /* 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 ();
@@ -2623,17 +2622,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.54.0
next prev parent reply other threads:[~2026-06-15 16:19 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-15 16:14 [PATCH v5 0/8] refactor the internals of record-full Guinevere Larsen
2026-06-15 16:14 ` [PATCH v5 1/8] gdb/record: Refactor record history Guinevere Larsen
2026-06-15 16:14 ` [PATCH v5 2/8] gdb/record: factor out reading and writing the execution log to corefile Guinevere Larsen
2026-06-15 16:14 ` [PATCH v5 3/8] gdb/record: remove record_full_insn_num Guinevere Larsen
2026-06-15 16:14 ` [PATCH v5 4/8] gdb/record: c++ify internal structures of record-full.c Guinevere Larsen
2026-06-15 16:14 ` Guinevere Larsen [this message]
2026-06-15 16:14 ` [PATCH v5 6/8] gdb/record: extract the PC to record_full_instruction Guinevere Larsen
2026-06-15 16:14 ` [PATCH v5 7/8] gdb/record: Define new version of the record-save section Guinevere Larsen
2026-06-15 16:15 ` [PATCH v5 8/8] gdb/record: rename record_full_list to record_full_log Guinevere Larsen
2026-07-03 13:37 ` [PATCH v5 0/8] refactor the internals of record-full Guinevere Larsen
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=20260615161500.34181-6-guinevere@redhat.com \
--to=guinevere@redhat.com \
--cc=christina.schimpe@intel.com \
--cc=gdb-patches@sourceware.org \
--cc=thiago.bauermann@linaro.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