diff options
Diffstat (limited to 'runtime')
-rw-r--r-- | runtime/ChangeLog | 7 | ||||
-rw-r--r-- | runtime/Doxyfile | 2 | ||||
-rw-r--r-- | runtime/probes.c | 48 |
3 files changed, 55 insertions, 2 deletions
diff --git a/runtime/ChangeLog b/runtime/ChangeLog index 1114bb8a..15d5bdd6 100644 --- a/runtime/ChangeLog +++ b/runtime/ChangeLog @@ -1,3 +1,10 @@ +2005-06-27 Martin Hunt <hunt@redhat.com> + + * Doxyfile (PREDEFINED): Added USE_RET_PROBES. + + * probes.c (_stp_register_kretprobes): New function. + (_stp_unregister_kretprobes): New function. + 2005-06-20 Tom Zanussi <zanussi@us.ibm.com> * print.c: Made relayfs _stp_print_flush() use sequence counter. diff --git a/runtime/Doxyfile b/runtime/Doxyfile index fcf4f694..7ab816db 100644 --- a/runtime/Doxyfile +++ b/runtime/Doxyfile @@ -961,7 +961,7 @@ INCLUDE_FILE_PATTERNS = # undefined via #undef or recursively expanded use the := operator # instead of the = operator. -PREDEFINED = __i386__ NEED_INT64_VALS NEED_STRING_VALS NEED_STAT_VALS KEY1_TYPE_INT64 +PREDEFINED = __i386__ NEED_INT64_VALS NEED_STRING_VALS NEED_STAT_VALS KEY1_TYPE_INT64 USE_RET_PROBES # If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then # this tag can be used to specify a list of macro names that should be expanded. diff --git a/runtime/probes.c b/runtime/probes.c index 144445d6..7922c133 100644 --- a/runtime/probes.c +++ b/runtime/probes.c @@ -70,12 +70,26 @@ void _stp_unregister_kprobes (struct kprobe *probes, int num_probes) _stp_log ("All kprobes removed\n"); } + +#ifdef USE_RET_PROBES +/** Unregister a group of return probes. + * @param probes Pointer to an array of struct kretprobe. + * @param num_probes Number of probes in the array. + */ +void _stp_unregister_kretprobes (struct kretprobe *probes, int num_probes) +{ + int i; + for (i = 0; i < num_probes; i++) + unregister_kretprobe(&probes[i]); + _stp_log ("All kretprobes removed\n"); +} +#endif + /** Register a group of kprobes. * @param probes Pointer to an array of struct kprobe. * @param num_probes Number of probes in the array. * @return 0 on success. */ - int _stp_register_kprobes (struct kprobe *probes, int num_probes) { int i, ret ; @@ -102,4 +116,36 @@ out: return ret; } +#ifdef USE_RET_PROBES +/** Register a group of return probes. + * @param probes Pointer to an array of struct kretprobe. + * @param num_probes Number of probes in the array. + * @return 0 on success. + */ +int _stp_register_kretprobes (struct kretprobe *probes, int num_probes) +{ + int i, ret ; + unsigned long addr; + + for (i = 0; i < num_probes; i++) { + addr =_stp_lookup_name((char *)probes[i].kp.addr); + if (addr == 0) { + _stp_log ("ERROR: function %s not found!\n", + (char *)probes[i].kp.addr); + ret = -1; /* FIXME */ + goto out; + } + _stp_log("inserting kretprobe at %s (%p)\n", probes[i].kp.addr, addr); + probes[i].kp.addr = (kprobe_opcode_t *)addr; + ret = register_kretprobe(&probes[i]); + if (ret) + goto out; + } + return 0; +out: + _stp_log ("probe module initialization failed. Exiting...\n"); + _stp_unregister_kretprobes(probes, i); + return ret; +} +#endif #endif /* _PROBES_C */ |