From 3c57fe1f22d54aa2f8857bbabb19b013dc879877 Mon Sep 17 00:00:00 2001 From: Josh Stone Date: Tue, 5 Feb 2013 13:17:16 -0800 Subject: [PATCH] Add kprobe.function.call, and squash nd_syscall.exit.return * tapsets.cxx (register_standard_tapsets): Bind kprobe .call variants. * man/stapprobes.3stap: Document this new possibility. * tapset/linux/nd_syscalls.stp: Use .call to make sure that alias suffixes can't tack a .return on nd_syscall.exit and .exit_group. --- man/stapprobes.3stap | 2 ++ tapset/linux/nd_syscalls.stp | 6 ++++-- tapsets.cxx | 4 ++++ 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/man/stapprobes.3stap b/man/stapprobes.3stap index fd3156a16..19d4c6165 100644 --- a/man/stapprobes.3stap +++ b/man/stapprobes.3stap @@ -596,8 +596,10 @@ of the function. Following constructs are supported : .SAMPLE kprobe.function(FUNCTION) +kprobe.function(FUNCTION).call kprobe.function(FUNCTION).return kprobe.module(NAME).function(FUNCTION) +kprobe.module(NAME).function(FUNCTION).call kprobe.module(NAME).function(FUNCTION).return kprobe.statement.(ADDRESS).absolute .ESAMPLE diff --git a/tapset/linux/nd_syscalls.stp b/tapset/linux/nd_syscalls.stp index 28024ef3e..6cd0dc56d 100644 --- a/tapset/linux/nd_syscalls.stp +++ b/tapset/linux/nd_syscalls.stp @@ -1003,7 +1003,7 @@ probe nd_syscall.compat_execve.return = kprobe.function("compat_do_execve").retu # exit _______________________________________________________ # long sys_exit(int error_code) -probe nd_syscall.exit = kprobe.function("do_exit") +probe nd_syscall.exit = kprobe.function("do_exit").call { name = "exit" // status = $code @@ -1014,11 +1014,12 @@ probe nd_syscall.exit = kprobe.function("do_exit") } # sys_exit() never returns, and is blacklisted for return probes, # so no alias here. See bz6588. +# NB: the explicit .call ensures that alias suffixes can't infer .return # exit_group _________________________________________________ # void sys_exit_group(int error_code) # -probe nd_syscall.exit_group = kprobe.function("sys_exit_group") ? +probe nd_syscall.exit_group = kprobe.function("sys_exit_group").call ? { name = "exit_group" // status = $error_code @@ -1029,6 +1030,7 @@ probe nd_syscall.exit_group = kprobe.function("sys_exit_group") ? } # sys_exit_group() never returns, and is blacklisted for return probes, # so no alias here. See bz6588. +# NB: the explicit .call ensures that alias suffixes can't infer .return # faccessat __________________________________________________ # new function with 2.6.16 diff --git a/tapsets.cxx b/tapsets.cxx index 18b29846c..d17ae2ab5 100644 --- a/tapsets.cxx +++ b/tapsets.cxx @@ -10151,8 +10151,12 @@ register_standard_tapsets(systemtap_session & s) // Kprobe based probe s.pattern_root->bind(TOK_KPROBE)->bind_str(TOK_FUNCTION) ->bind(new kprobe_builder()); + s.pattern_root->bind(TOK_KPROBE)->bind_str(TOK_FUNCTION)->bind(TOK_CALL) + ->bind(new kprobe_builder()); s.pattern_root->bind(TOK_KPROBE)->bind_str(TOK_MODULE) ->bind_str(TOK_FUNCTION)->bind(new kprobe_builder()); + s.pattern_root->bind(TOK_KPROBE)->bind_str(TOK_MODULE) + ->bind_str(TOK_FUNCTION)->bind(TOK_CALL)->bind(new kprobe_builder()); s.pattern_root->bind(TOK_KPROBE)->bind_str(TOK_FUNCTION)->bind(TOK_RETURN) ->bind(new kprobe_builder()); s.pattern_root->bind(TOK_KPROBE)->bind_str(TOK_FUNCTION)->bind(TOK_RETURN) -- 2.43.5