[RFC V2] Systemtap translator support for kernel hardware breakpoints
Prerna Saxena
prerna@linux.vnet.ibm.com
Mon Jan 25 19:00:00 GMT 2010
The previous version of patches courted a very informative discussion on
what we could do with hardware breakpoints using systemtap. I'm
attaching a new set of patches to enable systemtap translator supported
for hardware breakpoints on x86 / x86_64. The basic constructs
intorduced earlier still stand :
probe kernel.data(ADDRESS).write
probe kernel.data(ADDRESS).rw
probe kernel.data(ADDRESS).length(LEN).write
probe kernel.data(ADDRESS).length(LEN).rw
probe kernel.data("SYMBOL_NAME").write
probe kernel.data("SYMBOL_NAME").rw
The patch is based on the mainline kernel. The above constructs do not
depend on dwarf, and hence can be used even on kernels lacking debuginfo.
Patches :
hwbkpt.patch : Code changes for systemtap translator.
hwbkpt-misc.patch : Manpage updates, NEWS, testcase.
Changes from earlier version :
1. The script approximates user-specified lengths to the next largest
request the architecture can support, in case the length is found to be
invalid. An error is reported only if the length is too large for the
architecture to support. (The earlier response was to flag an error and
ignore the probe for all non-supported lengths.)
2. The script translation fails if the number of hardware breakpoint
probes exceeds the number of debug registers for a given architecture.
3. For now, probing of a kernel function's local variables is not
possible. Also, with export of kallsyms_lookup_name(), systemtap
generated module can directly decode symbol address at run-time. IMO,
use of dwarf routines seems an overkill for now.
What remains to be done (TODO):
1. Enabling systemtap hardware breakpoint probes for other architectures
(powerpc/S390, etc) (The kernel hardware breakpoint API for these is not
frozen as yet)
2. New construct : probe kernel.data(ADDRESS).change{}, which gets
triggered each time a write on ADDRESS actually updates its value.
3. Dynamic enabling / disabling a hardware breakpoint handler from a
kprobe context. (This will in turn allow one to set breakpoints on local
variables of kernel functions)
4. Updation of systemtap language reference with the above constructs.(
hwbkpt-misc.patch updates man pages only)
Awaiting feedback,
--
Prerna Saxena
Linux Technology Centre,
IBM Systems and Technology Lab,
Bangalore, India
-------------- next part --------------
A non-text attachment was scrubbed...
Name: hwbkpt.patch
Type: text/x-diff
Size: 18326 bytes
Desc: not available
URL: <http://sourceware.org/pipermail/systemtap/attachments/20100125/51ab791a/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: hwbkpt-misc.patch
Type: text/x-diff
Size: 3349 bytes
Desc: not available
URL: <http://sourceware.org/pipermail/systemtap/attachments/20100125/51ab791a/attachment-0001.bin>
More information about the Systemtap
mailing list