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 10:54:00 -0000	[thread overview]
Message-ID: <200910211154.06992.pedro@codesourcery.com> (raw)
In-Reply-To: <4ADE647D.10607@vmware.com>

On Wednesday 21 October 2009 02:31:41, Michael Snyder wrote:
> Pedro Alves wrote:
> > 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?
> 
> Maybe not -- but I'm a belt-and-suspenders guy.
> I don't believe in not checking for something just because
> it "can't happen".  What if somebody changed the check above?

That's why we comment non-obvious code, or add
gdb_asserts (could be overkill), or warnings.  The worse that can
happen if somebody changes the check above, is the new bug is
quickly exposed because gdb starting printing '(ULONGEST) -1'.
Masking a buglet like that is wrong, IMO.

> Yeah, you've convinced me.  Thanks for the prodding,
> and please see new revision.  I'll make that conditional
> go away too.   ;-)

Thanks.  I could nit some more, but the all the info seems
there.  ;-)  I'm fine with the patch.  

I don't see "info record" mentioned in the docs.  Only:
 @kindex info record insn-number
 @item info record insn-number
 Show the current number of recorded instructions.

Was there a corresponding documentation patch?

FTR, it still pains me when I see this:
> +  if (current_target.to_stratum == record_stratum)
> +    {

especially more so now that we have a stratum higher
than record_statum...

-- 
Pedro Alves


  parent reply	other threads:[~2009-10-21 10:54 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
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 [this message]
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=200910211154.06992.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