Mirror of the gdb mailing list
 help / color / mirror / Atom feed
From: David Taylor <dtaylor@emc.com>
To: gdb@sourceware.org
Subject: trace state variables -- what should be traced?
Date: Fri, 12 Sep 2014 19:45:00 -0000	[thread overview]
Message-ID: <32355.1410551103@usendtaylorx2l> (raw)

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


             reply	other threads:[~2014-09-12 19:45 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-09-12 19:45 David Taylor [this message]
2014-09-15  4:04 ` Yao Qi
2014-09-15 14:19   ` David Taylor
2014-09-18 13:38     ` Yao Qi

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=32355.1410551103@usendtaylorx2l \
    --to=dtaylor@emc.com \
    --cc=gdb@sourceware.org \
    /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