Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Guinevere Larsen <guinevere@redhat.com>
To: "Schimpe, Christina" <christina.schimpe@intel.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 17:07:55 -0300	[thread overview]
Message-ID: <4e25ebb2-c992-4183-9ef5-97f63760ca87@redhat.com> (raw)
In-Reply-To: <SN7PR11MB7638F32DA4B6DEFA29D38EFFF90B2@SN7PR11MB7638.namprd11.prod.outlook.com>

On 5/26/26 6:04 AM, Schimpe, Christina wrote:
>> -----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>
Fixed all the nits! thanks for the review!
>
> 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
>

-- 
Cheers,
Guinevere Larsen
It/she


  reply	other threads:[~2026-05-26 20:08 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
2026-05-26 20:07     ` Guinevere Larsen [this message]
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=4e25ebb2-c992-4183-9ef5-97f63760ca87@redhat.com \
    --to=guinevere@redhat.com \
    --cc=christina.schimpe@intel.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