This is the mail archive of the
systemtap@sourceware.org
mailing list for the systemtap project.
Re: user instruction tracing patch?
- From: Roland McGrath <roland at redhat dot com>
- To: fche at redhat dot com (Frank Ch. Eigler)
- Cc: dcnltc at us dot ibm dot com, systemtap at sourceware dot org
- Date: Wed, 14 Nov 2007 13:59:40 -0800 (PST)
- Subject: Re: user instruction tracing patch?
- References: <4739E5C2.80206@us.ibm.com> <y0mzlxg4iw2.fsf@ton.toronto.redhat.com>
> Since utrace will provide the pt_regs structure, the probe handler
> bodies will be able to call e.g. backtrace(), probefunc(), and really
> should have some structured access to the registers (a new tapset
> function like register:long ("name") ?)
In general to access all registers you can't always use pt_regs directly;
the details vary by machine. You can get many of them on the common
machines (x86, ppc). A simple embedded-C tapset approach for each machine
is certainly an easy place to start. For full generality, you'll need to
use the formal utrace_regset interfaces instead. The elfutils libraries
have full information on mapping register names and DWARF numbers to the
formats these interfaces expose, though they could use more sugar. There
is a variety of ways you could use that info in the translator to expose
register access to the script language.
> probe process(PID).itrace if (condition) { }
So this is special syntax constrained to just testing a script variable?
Or it's any complex expression reducible to only reading global script
variables? Or what exactly?
I like this syntax when it's just a general thing for skipping out probe
hits. (In fact, you can call it awk and say it's really just a
one-statement probe body since {...} is just a statement.)
But when its real use is to cause acts that change the value of evaluating
the condition to hook into immediately changing the state of low-level
tracing features that produce the probe hits, then I want to know exactly
what the language semantics guarantees about the timely control of that state.
> probe process(PID).function("NAME") { condition = 1 }
> probe process(PID).function("NAME").return { condition = 0 }
For likely answers to my first question, doesn't seem much different from
an explicit enable/disable command, just more obscure when reading the script.
If the variable is not otherwise used, wouldn't that compile to the same as:
probe process(PID).function("NAME") { enable process(PID).itrace; }
probe process(PID).function("NAME").return { disable process(PID).itrace; }
or whatever syntax explicit enable/disable has?
Thanks,
Roland