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 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


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