Re: [PATCH] Print trace state variables

Tom Tromey
2010-12-14T16:13:56Z

>>>>> "Joel" == Joel Brobecker <brobecker@adacore.com> writes:

Joel> I think a cleaner way of doing this would be to create a new OP_ enum
Joel> for tracepoint variables. We'd then add handling for it in
Joel> write_dollar_variable, as well as in the expression evaluator.

FWIW, I mildly prefer the current approach. Using a new OP_ means that
the variable is fixed at expression-parse time; but there doesn't seem
to be a compelling need to make this limitation. In fact, it seems like
it could be confusing... breakpoint conditions entered at different
times would refer to different variables (some hidden!), or re-parsing
an expression might resolve the variable differently.

Joel> Another potential issue to consider is precedence: If the user had
Joel> already defined an internal variable called "VAR", and then creates
Joel> a tracepoint variable with the same name, which one should we print
Joel> when he write "$VAR"? With your proposal, the tracepoint variable
Joel> hides the internal variable, right?

The docs say:

Trace state variables share the same
namespace as other "$" variables, which means that you cannot have
trace state variables with names like `$23' or `$pc', nor can you have
a trace state variable and a convenience variable with the same name.

Maybe this could be enforced? Or is that not possible?

Tom