Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Pedro Alves <pedro@codesourcery.com>
To: Michael Snyder <msnyder@vmware.com>
Cc: "gdb-patches@sourceware.org" <gdb-patches@sourceware.org>,
	 Hui Zhu <teawater@gmail.com>
Subject: Re: [RFA] Expand "info record"
Date: Wed, 21 Oct 2009 00:22:00 -0000	[thread overview]
Message-ID: <200910210122.06549.pedro@codesourcery.com> (raw)
In-Reply-To: <4ADE38DA.8040803@vmware.com>

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


  reply	other threads:[~2009-10-21  0:22 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-10-12 16:32 Michael Snyder
2009-10-12 17:06 ` Tom Tromey
2009-10-12 17:15   ` Michael Snyder
2009-10-12 18:10     ` Tom Tromey
2009-10-13 11:20       ` Pedro Alves
2009-10-13  6:03 ` Hui Zhu
2009-10-13 17:21   ` Michael Snyder
2009-10-13 18:01     ` Michael Snyder
2009-10-20 19:50       ` Michael Snyder
2009-10-20 20:54         ` Pedro Alves
2009-10-20 22:31           ` Michael Snyder
2009-10-21  0:22             ` Pedro Alves [this message]
2009-10-21  1:38               ` Michael Snyder
2009-10-21  3:09                 ` Hui Zhu
2009-10-21 15:24                   ` Michael Snyder
2009-10-22  2:30                     ` Hui Zhu
2009-10-21 10:54                 ` Pedro Alves
2009-10-21 15:23                   ` Michael Snyder
2009-10-22 13:08                     ` Pedro Alves

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=200910210122.06549.pedro@codesourcery.com \
    --to=pedro@codesourcery.com \
    --cc=gdb-patches@sourceware.org \
    --cc=msnyder@vmware.com \
    --cc=teawater@gmail.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