This is the mail archive of the systemtap@sources.redhat.com mailing list for the systemtap 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]

Re: corrected: tapset/script information template


Frank Ch. Eigler wrote:
Hi -

wcohen wrote:


[...]  I was thinking there are very specific places that one would
want to start tracing and that it would be controlled by some
probes, for example turning on the dynamic call graph when entering
a "function of interest" and turning it off when exiting the same
function.


By "turning it on/off" do you mean causing kernel- or hardware-level
configuration changes to occur during the execution of probe handlers?
That is, do you imagine the assignment of such variable to expand to
kernel API calls that turn on and off debug/counter hardware?

Hardware-level configuration changes. Much of the debug hardware state (debug registers 0-4, 5, and 6) is stored in the context information. However, the particular register that controls the tracking of changes of control flow is not stored in the process context.


I was thinking that instrumentation would be assisted by the debug
hardware rather than the performance monitoring hardware. [...]  The
debug also looks a bit easier to use: fewer bits to twiddle and
easier to find the from/to address. [...]


Is there a standard kernel API for management/abstraction of x86 debug
hardware?  Can you outline the additional logic required to extract
this raw data and turn it into actual call/return trace events?

gdb uses the ptrace mechanism to access the currently supported debugging hardware. The currently supported debug information is tracked on a per process basis. Changes that would be required for tracking call returns in gdb would be:


-save/restore the additional debug registers
-put defines in /usr/include/asm/debugreg.h for registers
-allow ptrace to access the additional debug registers
-trap handler for debug hardware to identify instruction:
	-call
	-return
	-branch
-something to log the trap occuring:
	-filtering to mask out branches (or calls or returns)
	record pid
	type of instruction, call, return, or branch
	from address
	to address

Roland has mentioned revising the ptrace interface. I am not sure how this would fit into that.


-Will



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