Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: "Schimpe, Christina" <christina.schimpe@intel.com>
To: Guinevere Larsen <guinevere@redhat.com>,
	"gdb-patches@sourceware.org" <gdb-patches@sourceware.org>
Subject: RE: [PATCH v3 4/7] gdb/record: make record_full_history more c++-like
Date: Tue, 26 May 2026 09:04:17 +0000	[thread overview]
Message-ID: <SN7PR11MB7638F32DA4B6DEFA29D38EFFF90B2@SN7PR11MB7638.namprd11.prod.outlook.com> (raw)
In-Reply-To: <20260515163706.3355686-5-guinevere@redhat.com>

> -----Original Message-----
> From: Guinevere Larsen <guinevere@redhat.com>
> Sent: Freitag, 15. Mai 2026 18:37
> To: gdb-patches@sourceware.org
> Cc: Guinevere Larsen <guinevere@redhat.com>
> Subject: [PATCH v3 4/7] gdb/record: make record_full_history more c++-like
> 
> Move some functions to being a method of record_full_history, instead of
> floating functions.

Commit message:

- Shouldn't it be "a method of struct record_full_instruction" (also for the header)?
- it's only one function, so you could simply write the function name instead of "Move some 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
> 24e94eaf5da..8cabd6e9438 100644
> --- a/gdb/record-full.c
> +++ b/gdb/record-full.c
> @@ -388,6 +388,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 @@ -843,12 +847,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 (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;  } @@ -
> 1308,9 +1309,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)
> @@ -2503,8 +2502,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 */
> @@ -2576,7 +2574,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 ();
> @@ -2597,17 +2595,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);

Nit: spaces missing in i-1 => i - i

>    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
> 

With the nits fixed, LGTM.

Reviewed-By: Christina Schimpe <christina.schimpe@intel.com>

Christina

Intel Deutschland GmbH
Registered Address: Dornacher Strasse 1, 85622 Feldkirchen, Germany
Tel: +49 89 991 430, www.intel.de
Managing Directors: Harry Demas, Jeffrey Schneiderman, Yin Chong Sorrell
Chairperson of the Supervisory Board: Nicole Lau
Registered Seat: Munich
Commercial Register: Amtsgericht Muenchen HRB 186928

  parent reply	other threads:[~2026-05-26  9:05 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-15 16:36 [PATCH v3 0/7] refactor the internals of record-full Guinevere Larsen
2026-05-15 16:36 ` [PATCH v3 1/7] gdb/record: Refactor record history Guinevere Larsen
2026-05-26  8:33   ` Schimpe, Christina
2026-05-28 13:20     ` Guinevere Larsen
2026-05-29 13:47       ` Schimpe, Christina
2026-05-15 16:36 ` [PATCH v3 2/7] gdb/record: remove record_full_insn_num Guinevere Larsen
2026-05-26  8:35   ` Schimpe, Christina
2026-05-15 16:37 ` [PATCH v3 3/7] gdb/record: c++ify internal structures of record-full.c Guinevere Larsen
2026-05-26  9:00   ` Schimpe, Christina
2026-05-27 20:13     ` Guinevere Larsen
2026-05-29 12:09       ` Schimpe, Christina
2026-05-29 16:38         ` Guinevere Larsen
2026-05-15 16:37 ` [PATCH v3 4/7] gdb/record: make record_full_history more c++-like Guinevere Larsen
2026-05-16  1:03   ` Thiago Jung Bauermann
2026-05-26  9:04   ` Schimpe, Christina [this message]
2026-05-26 20:07     ` Guinevere Larsen
2026-05-15 16:37 ` [PATCH v3 5/6] gdb/record: Define new version of the record-save section Guinevere Larsen
2026-05-15 16:37 ` [PATCH v3 5/7] gdb/record: extract the PC to record_full_instruction Guinevere Larsen
2026-05-16  1:04   ` Thiago Jung Bauermann
2026-05-29 12:40   ` Schimpe, Christina
2026-06-01 20:24     ` Guinevere Larsen
2026-05-15 16:37 ` [PATCH v3 6/7] gdb/record: Define new version of the record-save section Guinevere Larsen
2026-05-15 16:37 ` [PATCH v3 6/6] gdb/record: rename record_full_list to record_full_log Guinevere Larsen
2026-05-29 12:05   ` Schimpe, Christina
2026-05-15 16:37 ` [PATCH v3 7/7] " Guinevere Larsen
2026-05-16  1:07   ` Thiago Jung Bauermann
2026-05-15 17:45 ` [PATCH v3 0/7] 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=SN7PR11MB7638F32DA4B6DEFA29D38EFFF90B2@SN7PR11MB7638.namprd11.prod.outlook.com \
    --to=christina.schimpe@intel.com \
    --cc=gdb-patches@sourceware.org \
    --cc=guinevere@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