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

On Wednesday 21 October 2009 16:17:08, Michael Snyder wrote:

> > 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...
> 
> We do?  ...
> 
> OK -- how would you suggest doing this sort of test?

In common code, test for target feature or property of
interest to the caller code in question (target_has_execution,
_has_stack, _has_foo), instead of checking if the current
target is target foo or statum foo.

In record.c itself, iff you want to know if precord is
activated, either iterate over the pushed targets
stack looking for &record_ops:

static int
precord_active (void)
{
  foreach (ops, current_target.beneath)
    if (ops == &record_ops)
     return 1;
  return 0;
}

... or, simply keep a global similar to exec.c:using_exec_ops,
and check for that.

(If you want to consider multi-process at some point,
you'll probably move the log-related globals to a
per-inferior structure, and presumably keep a list of
such objects around in record.c.  Then, in record.c, when
checking if recording is activated for a given inferior,
you'd then check if there's an instance of such an object
for the current inferior in that list.)

-- 
Pedro Alves


      reply	other threads:[~2009-10-22 13:08 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
2009-10-21 15:23                   ` Michael Snyder
2009-10-22 13:08                     ` Pedro Alves [this message]

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=200910221408.37498.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