]>
sourceware.org Git - systemtap.git/blob - runtime/probes.c
19539044d1fc379b4f8a8ae2429616512906df11
2 * Functions for Registering and Unregistering Probes
3 * Copyright (C) 2005 Red Hat Inc.
5 * This file is part of systemtap, and is free software. You can
6 * redistribute it and/or modify it under the terms of the GNU General
7 * Public License (GPL); either version 2, or (at your option) any
15 * @brief Functions to assist loading and unloading groups of probes.
18 /** Unregister a group of jprobes.
19 * @param probes Pointer to an array of struct jprobe.
20 * @param num_probes Number of probes in the array.
23 void _stp_unregister_jprobes (struct jprobe
*probes
, int num_probes
)
26 for (i
= 0; i
< num_probes
; i
++)
27 unregister_jprobe(&probes
[i
]);
28 dbug("All jprobes removed\n");
31 /** Register a group of jprobes.
32 * @param probes Pointer to an array of struct jprobe.
33 * @param num_probes Number of probes in the array.
34 * @return 0 on success.
37 int _stp_register_jprobes (struct jprobe
*probes
, int num_probes
)
42 for (i
= 0; i
< num_probes
; i
++) {
43 addr
=kallsyms_lookup_name((char *)probes
[i
].kp
.addr
);
45 _stp_warn("function %s not found!\n", (char *)probes
[i
].kp
.addr
);
49 dbug("inserting jprobe at %s (%p)\n", probes
[i
].kp
.addr
, addr
);
50 probes
[i
].kp
.addr
= (kprobe_opcode_t
*)addr
;
51 ret
= register_jprobe(&probes
[i
]);
57 _stp_warn("probe module initialization failed. Exiting...\n");
58 _stp_unregister_jprobes(probes
, i
);
62 /** Unregister a group of kprobes.
63 * @param probes Pointer to an array of struct kprobe.
64 * @param num_probes Number of probes in the array.
67 void _stp_unregister_kprobes (struct kprobe
*probes
, int num_probes
)
70 for (i
= 0; i
< num_probes
; i
++)
71 unregister_kprobe(&probes
[i
]);
72 dbug("All kprobes removed\n");
77 /** Unregister a group of return probes.
78 * @param probes Pointer to an array of struct kretprobe.
79 * @param num_probes Number of probes in the array.
81 void _stp_unregister_kretprobes (struct kretprobe
*probes
, int num_probes
)
84 for (i
= 0; i
< num_probes
; i
++)
85 unregister_kretprobe(&probes
[i
]);
86 dbug("All return probes removed\n");
90 /** Register a group of kprobes.
91 * @param probes Pointer to an array of struct kprobe.
92 * @param num_probes Number of probes in the array.
93 * @return 0 on success.
95 int _stp_register_kprobes (struct kprobe
*probes
, int num_probes
)
100 for (i
= 0; i
< num_probes
; i
++) {
101 addr
= kallsyms_lookup_name((char *)probes
[i
].addr
);
103 _stp_warn("function %s not found!\n", (char *)probes
[i
].addr
);
107 dbug("inserting kprobe at %s (%p)\n", probes
[i
].addr
, addr
);
108 probes
[i
].addr
= (kprobe_opcode_t
*)addr
;
109 ret
= register_kprobe(&probes
[i
]);
115 _stp_warn("probe module initialization failed. Exiting...\n");
116 _stp_unregister_kprobes(probes
, i
);
120 #ifdef USE_RET_PROBES
121 /** Register a group of return probes.
122 * @param probes Pointer to an array of struct kretprobe.
123 * @param num_probes Number of probes in the array.
124 * @return 0 on success.
126 int _stp_register_kretprobes (struct kretprobe
*probes
, int num_probes
)
131 for (i
= 0; i
< num_probes
; i
++) {
132 addr
= kallsyms_lookup_name((char *)probes
[i
].kp
.addr
);
134 _stp_warn("function %s not found!\n",
135 (char *)probes
[i
].kp
.addr
);
136 ret
= -1; /* FIXME */
139 dbug("inserting kretprobe at %s (%p)\n", probes
[i
].kp
.addr
, addr
);
140 probes
[i
].kp
.addr
= (kprobe_opcode_t
*)addr
;
141 ret
= register_kretprobe(&probes
[i
]);
147 _stp_warn("probe module initialization failed. Exiting...\n");
148 _stp_unregister_kretprobes(probes
, i
);
152 #endif /* _PROBES_C */
This page took 0.044701 seconds and 4 git commands to generate.