Mirror of the gdb mailing list
 help / color / mirror / Atom feed
* trace state variables -- what should be traced?
@ 2014-09-12 19:45 David Taylor
  2014-09-15  4:04 ` Yao Qi
  0 siblings, 1 reply; 4+ messages in thread
From: David Taylor @ 2014-09-12 19:45 UTC (permalink / raw)
  To: gdb

For trace state variables, what should be traced?

If I reference a trace state variable in a tracepoint action, its value
will be collected and placed into the trace frame.

If it's not a trace state variable, but rather just an 'ordinary'
variable, then there is, currently, no ambiguity.  But, for trace state
variables, it can be set with an aop_setv operation.  Which value should
be recorded?

The old value?  Or the new value?

Currently the new value is always recorded and sometimes the old value
is recorded as well.

Since the old value, when it is recorded, is always recorded prior to
recording the new value, the new value overwrites the old value.

The manual doesn't say what happens, but I would argue that the old
value should always be recorded and never the new value.

Thoughts?

Knowing the collection expression and the values of everything in it
allows me to compute the new value.  But, I cannot similarly compute the
old value.  Once it is overwritten it is lost forever.

There are 4 places where aop_tracev is generated, all 4 are in
gdb/ax-gdb.c, function gen_expr.

case BINOP_ASSIGN:

	      ax_tsv (ax, aop_setv, tsv->number);
	      if (ax->tracing)
		ax_tsv (ax, aop_tracev, tsv->number);

case BINOP_ASSIGN_MODIFY:

	      ax_tsv (ax, aop_getv, tsv->number);
	      if (ax->tracing)
		ax_tsv (ax, aop_tracev, tsv->number);

and then a little bit later in that same case:

	      ax_tsv (ax, aop_setv, tsv->number);
	      if (ax->tracing)
		ax_tsv (ax, aop_tracev, tsv->number);

case OP_INTERNALVAR:

	    ax_tsv (ax, aop_getv, tsv->number);
	    if (ax->tracing)
	      ax_tsv (ax, aop_tracev, tsv->number);

If you agree, then the first (BINOP_ASSIGN) should have the setv moved
after the tracev to become:

	      if (ax->tracing)
		ax_tsv (ax, aop_tracev, tsv->number);
	      ax_tsv (ax, aop_setv, tsv->number);

and the third (second one in BINOP_ASSIGN_MODIFY) should have the 

	      if (ax->tracing)
		ax_tsv (ax, aop_tracev, tsv->number);

lines deleted.

Comments?

David


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2014-09-18 13:38 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-09-12 19:45 trace state variables -- what should be traced? David Taylor
2014-09-15  4:04 ` Yao Qi
2014-09-15 14:19   ` David Taylor
2014-09-18 13:38     ` Yao Qi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox