[PATCH] Trace state variables
Tue Dec 15 13:51:00 GMT 2009
One of our tracepoint enhancements is to add the notion of a "trace
state variable", which is a GDB-defined piece of data managed by the
tracepoint agent on the target; one could think of it as a target-side
convenience variable. You can both read and write from it, so you could
have a tracepoint action that says "collect $foo = $foo + 1" (for the
quick thinkers, yes, there is a no-collect action coming in a future
patch), and then a condition on a different tracepoint that only
triggers when $foo > 1000 . In keeping with their convenience-like
nature, they are introduced with a dollar sign, but you have to declare
them with the tvariable command, and to keep the target side simple,
they are always 64-bit signed integers.
This patch introduces the basic data structures and commands to create,
list, and delete. Pedro's upcoming gdbserver patches will support
tsv's, so you will be able to see how the target side works with them
(not too complicated, they're just indexed by small integers). Since
internalvar handling has changed recently, I've left off the value.c bit
to make "print $foo" work. And for the purists, yes, the tracepoint.c
changes include raw protocol usage, the patch to migrate tracepoint
operations to the target vector is still in the pipeline.
Comments appreciated, I expect to commit in a week or so.
2009-12-15 Stan Shebs <firstname.lastname@example.org>
Add trace state variables.
* ax.h (enum agent_op): Add getv, setv, and tracev.
* ax-gdb.c: Include tracepoint.h.
(gen_expr): Handle BINOP_ASSIGN and OP_INTERNALVAR.
* ax-general.c (ax_tsv): New function.
(aop_map): Add new bytecodes.
* tracepoint.h (struct trace_state_variable): New struct.
(tsv_s): New typedef.
* tracepoint.c (tvariables): New global.
(next_tsv_number): New global.
(create_trace_state_variable): New function.
(find_trace_state_variable): New function.
(delete_trace_state_variable): New function.
(trace_variable_command): New function.
(delete_trace_variable_command): New function.
(tvariables_info): New function.
(trace_start_command): Download tsvs with initial values.
(_initialize_tracepoint): Add new commands.
* gdb.texinfo (Trace State Variables): New section.
(Tracepoint Packets): Describe trace state variable packets.
* agentexpr.texi (Bytecode Descriptions): Describe trace state
* gdb.trace/tsv.exp: New file.
* gdb.base/completion.exp: Update ambiguous info output.
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
More information about the Gdb-patches