From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 23597 invoked by alias); 31 Jan 2014 15:23:28 -0000 Mailing-List: contact systemtap-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Post: List-Help: , Sender: systemtap-owner@sourceware.org Received: (qmail 23535 invoked by uid 48); 31 Jan 2014 15:23:24 -0000 From: "jlebon at redhat dot com" To: systemtap@sourceware.org Subject: [Bug translator/1133] support .callees probe pattern extension Date: Fri, 31 Jan 2014 15:23:00 -0000 X-Bugzilla-Reason: AssignedTo X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: systemtap X-Bugzilla-Component: translator X-Bugzilla-Version: unspecified X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: jlebon at redhat dot com X-Bugzilla-Status: ASSIGNED X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: systemtap at sourceware dot org X-Bugzilla-Target-Milestone: week X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-Bugzilla-URL: http://sourceware.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-SW-Source: 2014-q1/txt/msg00073.txt.bz2 https://sourceware.org/bugzilla/show_bug.cgi?id=1133 --- Comment #8 from Jonathan Lebon --- (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.