This is the mail archive of the
systemtap@sourceware.org
mailing list for the systemtap project.
[Bug translator/1133] support .callees probe pattern extension
- From: "jlebon at redhat dot com" <sourceware-bugzilla at sourceware dot org>
- To: systemtap at sourceware dot org
- Date: Fri, 31 Jan 2014 15:23:22 +0000
- Subject: [Bug translator/1133] support .callees probe pattern extension
- Auto-submitted: auto-generated
- References: <bug-1133-6586 at http dot sourceware dot org/bugzilla/>
https://sourceware.org/bugzilla/show_bug.cgi?id=1133
--- Comment #8 from Jonathan Lebon <jlebon at redhat dot com> ---
(In reply to Jonathan Lebon from comment #6)
> I forgot to add also that for now, .callee simply places probes on callees'
> entry points, which means that they will trigger regardless of who the
> caller actually is. The future DW_AT_call_site_pc attribute should allow us
> to painlessly place probe points on the call site itself rather than at
> entry.
>
> As a workaround for now, we could implement a tapset function e.g.
> is_caller("wanted_caller") to do this. Not sure how precise this would be,
> or whether it needs to be built into the probe, or something users would add
> explicitly (maybe we could add a more general
> .function("func").from("parent") form to which .callee would degenerate).
I've implemented this by adding a condition expression to the probe points
created which check if it's the right caller:
$ cd temp
$ cat truecallee.c
// gcc -o truecallee truecallee.c -g -O
__attribute__((noinline))
int foo(int a, int b) {
return a + b;
}
__attribute__((noinline))
int bar(int a, int b) {
return foo(a*b, a-b);
}
int main(int argc, char** argv) {
int a = argc;
a = foo(a, a);
a = bar(a, a);
return a;
}
$ gcc -o truecallee truecallee.c -g -O
$ stap -L 'process("truecallee").function("main").callee("foo")'
process("/home/yyz/jlebon/codebase/systemtap/systemtap/temp/truecallee").function("foo@/home/yyz/jlebon/codebase/systemtap/systemtap/temp/truecallee.c:4")
if ((ustack(1)) == (0x40050b)) $a:int $b:int
$ stap -L 'process("truecallee").function("bar").callee("foo")'
process("/home/yyz/jlebon/codebase/systemtap/systemtap/temp/truecallee").function("foo@/home/yyz/jlebon/codebase/systemtap/systemtap/temp/truecallee.c:4")
if ((ustack(1)) == (0x400502)) $a:int $b:int
$
$ stap -we 'probe process.function("bar").callee("foo") { println("This is the
foo() call from bar(), not main()"); printf("My parent function is: %s\n",
usymname(ustack(1))); exit() }' -c ./truecallee
This is the foo() call from bar(), not main()
My parent function is: bar
$
It seems to work OK for now, but further testing is needed (esp. for inlines
and tail calls).
--
You are receiving this mail because:
You are the assignee for the bug.