This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [RFA] Expand "info record"


On Tuesday 20 October 2009 23:25:30, Michael Snyder wrote:

> >> +      /* Display instruction number for last instruction in the log.  */
> >> +      printf_filtered (_("Highest recorded instruction number is %llu.\n"), 
> >> +                      record_insn_count ? record_insn_count - 1 : 0);
> > 
> > Why the conditional subtraction?
> 
> Because I don't want it to say "-1".

Okay, that much is obvious, but how can you reach here
with record_insn_count == 0, given that you check if you
have a log at all a bit above?

> > Given this post inc:
> >> +  rec->u.end.insn_num = record_insn_count++;
> 
> No, the post inc implies that the count is actually one greater
> than the last insn that used it.  Yes?

Yes.

> > Could you add a comment to record_insn_num and
> > record_insn_count's definitions explaining what they are and
> > how they're different, if it doesn't become obvious?
> 
> Yep, done, see attached.

Thanks.

May I add that I think it's a shame that "info record"
doesn't distinguish precord not being active from no log yet:

 (gdb) info record
 Process record is not active, or there is no log yet.
 Max logged instructions is 200000.

I played with the patch 5 minutes, and I immediately felt that
this bit not having an else branch was surprising:

     /* If we are not at the end of the log, display where we are.  */
      if (record_list->next != NULL && record_list->type == record_end)
	printf_filtered (_("Current instruction number is %s.\n"),
			 pulongest (record_list->u.end.insn_num));

E.g.:

 (top-gdb) info record
 Lowest recorded instruction number is 14.
 Current instruction number is 17.
 Highest recorded instruction number is 18.
 Log contains 5 instructions.
 Max logged instructions is 5.
 (top-gdb) si

 No more reverse-execution history.
 0x00007ffff7df3e1e in ?? () from /lib64/ld-linux-x86-64.so.2
 (top-gdb) info record
 Lowest recorded instruction number is 14.
 Highest recorded instruction number is 18.
 Log contains 5 instructions.
 Max logged instructions is 5.
 (top-gdb)                     

Can't we explicitly say that we're in recording/live vs replay
mode, or something?

-- 
Pedro Alves


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]