Summary: | extend utrace probes with "system-wide" and target-process syntax | ||
---|---|---|---|
Product: | systemtap | Reporter: | Frank Ch. Eigler <fche> |
Component: | translator | Assignee: | David Smith <dsmith> |
Status: | RESOLVED FIXED | ||
Severity: | normal | CC: | drepper.fsp, jkenisto, mhiramat |
Priority: | P2 | ||
Version: | unspecified | ||
Target Milestone: | --- | ||
Host: | Target: | ||
Build: | Last reconfirmed: |
Description
Frank Ch. Eigler
2008-04-22 12:01:28 UTC
*** Bug 5898 has been marked as a duplicate of this bug. *** In addition, probe process("*").{begin,syscall,...} should constitute utrace-based probes on all processes systemwide. For purposes of this, it would be sufficient to have two extensions: - process("*") syntax that maps to the task_finder's unrestricted pathname/pid - target-process syntax that maps to another task_finder option that restricts its monitoring to the target() (stap -c/-x) hierarchy Maybe these two could be the same -- i.e., if someone runs "stap -c/-x", then process("*").foo (or simpler, process.foo) probes would automagically be restricted to the target process hierarchy. Finally, bug #6456 could be a followup to support finer-grained wildcards as in process("/bin/*"). Commit 6cdf288 implements system-wide utrace probes. For reference this is what I was using so that you can do something simple like : stap -e 'probe timer.ms(50) {t = tid(); if (t != 0) { printf("%s:%d.%d 0x%xd %s\n", execname(), pid(), tid(), uaddr(), umap_name(uaddr())); } }' to see where exe/library the system is busy in. # Returns the address in userspace that the current task was at when the # probe occured. function uaddr:long () %{ /* pure */ #include <asm/processor.h> struct pt_regs *uregs; uregs = task_pt_regs(current); THIS->__retvalue = (int64_t) REG_IP(uregs); %} # Returns the name of the map in userspace of the give address in the # current task. XXX - figure out locking issues. function umap_name:string(uaddr:long) %{ /* pure */ #include <linux/mm.h> #include <linux/dcache.h> struct mm_struct *mm; struct vm_area_struct *vma; char *buf = NULL; mm = get_task_mm (current); if (mm) { vma = mm->mmap; while (vma && (uint64_t) vma->vm_start < (uint64_t) THIS->uaddr) vma = vma->vm_next; if (vma && vma->vm_file) { buf = _stp_kmalloc(PATH_MAX); buf = d_path (&(vma->vm_file->f_path), buf, PATH_MAX); } } if (buf) strlcpy(THIS->__retvalue, buf, MAXSTRINGLEN); else strlcpy(THIS->__retvalue, "<unknown>", MAXSTRINGLEN); %} (In reply to comment #5) > For reference [...] Ignore that. I added this to the wrong bug. It was in reference to bug #5951 comment #3. Sorry for the bugzilla spam. I believe commit cec7293 puts the finishing touches on this; could you please review? (In reply to comment #7) > I believe commit cec7293 puts the finishing touches on this; > could you please review? The task_finder.c changes look reasonable, but this new code doesn't work for me. When I run "stap -c /bin/ls ...", _stp_target is 0. (In reply to comment #8) > (In reply to comment #7) > > I believe commit cec7293 puts the finishing touches on this; > > could you please review? > > The task_finder.c changes look reasonable, but this new code doesn't work for > me. When I run "stap -c /bin/ls ...", _stp_target is 0. This works for me now. I'm not sure what the problem was earlier. |