discussion about registering task_finder in user space probing

Wenji Huang wenji.huang@oracle.com
Tue Mar 24 10:42:00 GMT 2009


Hi,

I found our task_finder embedded in each stap_uprob_spec even it is 
same. That will cause many times registering similar task_finder. For 
example,

$stap -p4 -vve 'probe 
process("/home/wjhuang/Download/git-1.5.6/git*").function("xmalloc"){}'

The generated C code is like,
[snip]
static struct stap_uprobe_spec {
   struct stap_task_finder_target finder;
   unsigned long address;
   const char *pathname;
   const char *pp;
   void (*ph) (struct context*);
   unsigned return_p:1;
} stap_uprobe_specs [] = {
   { .finder = { .pathname="/home/wjhuang/Download/git-1.5.6/git", }, 
.address=(unsigned long)0x804b180ULL, 
.pp="process(\"/home/wjhuang/Download/git-1.5.6/git\").function(\"xmalloc@/home/wjhuang/Download/git-1.5.6/git-compat-util.h:256\")", 
.ph=&probe_1383, },
   { .finder = { .pathname="/home/wjhuang/Download/git-1.5.6/git", }, 
.address=(unsigned long)0x804b9cfULL, 
.pp="process(\"/home/wjhuang/Download/git-1.5.6/git\").function(\"xmalloc@/home/wjhuang/Download/git-1.5.6/git-compat-util.h:256\")", 
.ph=&probe_1383, },
   { .finder = { .pathname="/home/wjhuang/Download/git-1.5.6/git", }, 
.address=(unsigned long)0x804c05cULL, 
.pp="process(\"/home/wjhuang/Download/git-1.5.6/git\").function(\"xmalloc@/home/wjhuang/Download/git-1.5.6/git-compat-util.h:256\")", 
.ph=&probe_1383, },
   { .finder = { .pathname="/home/wjhuang/Download/git-1.5.6/git", }, 
.address=(unsigned long)0x804c3b0ULL, 
.pp="process(\"/home/wjhuang/Download/git-1.5.6/git\").function(\"xmalloc\")", 
.ph=&probe_1383, },
[snip]
   for (i=0; i<220; i++) {
     struct stap_uprobe_spec *sups = & stap_uprobe_specs[i];
     probe_point = sups->pp;
     if (sups->finder.pathname) sups->finder.callback = & 
stap_uprobe_process_found;
     else if (sups->pathname) sups->finder.vm_callback = & 
stap_uprobe_vmchange_found;
     rc = stap_register_task_finder_target (& sups->finder);
     if (rc) break;
   }
[snip]

So we will have 220 times registering similar task_finder. I think
the probe point is irrelevant to task_finder. Can we just keep only one 
and invoke callbacks to register all the stap_uprobes[i] once interested 
process found?

Regards,
Wenji



More information about the Systemtap mailing list