This is the mail archive of the
systemtap@sourceware.org
mailing list for the systemtap project.
Re: [RFC][PATCH 2/4] kprobe-based symbol resolution for stap-translator
- From: Prerna Saxena <prerna at linux dot vnet dot ibm dot com>
- To: systemtap at sourceware dot org
- Date: Fri, 13 Mar 2009 16:15:27 +0530
- Subject: Re: [RFC][PATCH 2/4] kprobe-based symbol resolution for stap-translator
- References: <49BA38DB.1080604@linux.vnet.ibm.com>
Prerna Saxena wrote:
Hi,
Here's a set of patches which enable the stap-translator to utilize
kprobes for resolving function addresses.
( Similar to James Bottomley's patch sent out last july )
In place of resolving probe points in semantic pass (Pass 2 ) by
consulting vmlinux/debuginfo, this approach defers symbol resolution
to the generated kprobes module. The kprobes module is passed the name
of the function to be probed, which gets resolved against the kernel
symbol tables to insert probes.
This construct can be invoked using a new switch "--ksym" .
In its present form, it is capable of probing function entry & returns
(non-inlines). It does /*not*/ support :
* a wildcard - based search for module/function names
* probing select/all functions in a given source file
* probing inline functions.
* statement probes
Known issues :
1. Apparently systemtap modules pick up build-id from the debuginfo
files. Since debuginfo lookup is completely bypassed here, the
generated stap modules fail a consistency check later owing to
incorrect build id. For now, patch 4 comments out this check and the
stap modules run fine, but I'd appreciate some pointers on how to set
it right. :-)
2. An incorrect indentation parameter passed to the translated output
in pass 3 causes stap to abort due to assert failure. Patch 4 corrects
this as well.
Patches :
1. kallsym_patch_1 , kallsym_patch_2 : introduce changes to session.h
/ main.cxx for the new switch "--ksym"
2. kallsym_patch_3 : changes to tapsets.cxx.
3. kallsym_patch_4 : workarounds for known problems.
I'm working on fine-tuning its capabilities.....looking fwd to
suggestions... :-)
--
Prerna Saxena
Linux Technology Centre,
IBM Systems and Technology Lab,
Bangalore, India
Index: git-02-mar/main.cxx
===================================================================
--- git-02-mar.orig/main.cxx
+++ git-02-mar/main.cxx
@@ -131,6 +131,7 @@ usage (systemtap_session& s, int exitcod
<< " --kelf make do with symbol table from vmlinux" << endl
<< " --kmap[=FILE]" << endl
<< " make do with symbol table from nm listing" << endl
+ << " --ksym defer symbol resolution to kprobes " <<endl
#endif
// Formerly present --ignore-{vmlinux,dwarf} options are for testsuite use
// only, and don't belong in the eyesight of a plain user.
@@ -428,6 +429,7 @@ main (int argc, char * const argv [])
#define LONG_OPT_IGNORE_VMLINUX 3
#define LONG_OPT_IGNORE_DWARF 4
#define LONG_OPT_VERBOSE_PASS 5
+#define LONG_OPT_KALLSYMS 6
// NB: also see find_hash(), usage(), switch stmt below, stap.1 man page
static struct option long_options[] = {
{ "kelf", 0, &long_opt, LONG_OPT_KELF },
@@ -435,6 +437,7 @@ main (int argc, char * const argv [])
{ "ignore-vmlinux", 0, &long_opt, LONG_OPT_IGNORE_VMLINUX },
{ "ignore-dwarf", 0, &long_opt, LONG_OPT_IGNORE_DWARF },
{ "vp", 1, &long_opt, LONG_OPT_VERBOSE_PASS },
+ { "ksym", 0, &long_opt, LONG_OPT_KALLSYMS },
{ NULL, 0, NULL, 0 }
};
int grc = getopt_long (argc, argv, "hVMvtp:I:e:o:R:r:m:kgPc:x:D:bs:uqwl:d:L:F",
@@ -675,6 +678,9 @@ main (int argc, char * const argv [])
case LONG_OPT_IGNORE_DWARF:
s.ignore_dwarf = true;
break;
+ case LONG_OPT_KALLSYMS:
+ s.consult_kallsym = true;
+ break;
case LONG_OPT_VERBOSE_PASS:
{
bool ok = true;