This is the mail archive of the gdb@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]

trace state variables -- what should be traced?


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


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