Ruby 2.7.0p0(2019-12-25revision647ee6f091eafcce70ffb75ddf7e121e192ab217)

probes_helper.h
Go to the documentation of this file.
1 #ifndef RUBY_PROBES_HELPER_H
2 #define RUBY_PROBES_HELPER_H
3
4 #include "ruby/ruby.h"
5
6 struct ruby_dtrace_method_hook_args {
7 const char *classname;
8 const char *methodname;
9 const char *filename;
10 int line_no;
11 volatile VALUE klass;
12 volatile VALUE name;
13 };
14
15 NOINLINE(int rb_dtrace_setup(rb_execution_context_t *, VALUE, ID, struct ruby_dtrace_method_hook_args *));
16
17 #define RUBY_DTRACE_METHOD_HOOK(name, ec, klazz, id) \
18 do { \
19 if (UNLIKELY(RUBY_DTRACE_##name##_ENABLED())) { \
20 struct ruby_dtrace_method_hook_args args; \
21 if (rb_dtrace_setup(ec, klazz, id, &args)) { \
22 RUBY_DTRACE_##name(args.classname, \
23 args.methodname, \
24 args.filename, \
25 args.line_no); \
26 } \
27 } \
28 } while (0)
29
30 #define RUBY_DTRACE_METHOD_ENTRY_HOOK(ec, klass, id) \
31 RUBY_DTRACE_METHOD_HOOK(METHOD_ENTRY, ec, klass, id)
32
33 #define RUBY_DTRACE_METHOD_RETURN_HOOK(ec, klass, id) \
34 RUBY_DTRACE_METHOD_HOOK(METHOD_RETURN, ec, klass, id)
35
36 #define RUBY_DTRACE_CMETHOD_ENTRY_HOOK(ec, klass, id) \
37 RUBY_DTRACE_METHOD_HOOK(CMETHOD_ENTRY, ec, klass, id)
38
39 #define RUBY_DTRACE_CMETHOD_RETURN_HOOK(ec, klass, id) \
40 RUBY_DTRACE_METHOD_HOOK(CMETHOD_RETURN, ec, klass, id)
41
42 #endif /* RUBY_PROBES_HELPER_H */
ID
unsigned long ID
Definition: ruby.h:103
VALUE
unsigned long VALUE
Definition: ruby.h:102
ruby_dtrace_method_hook_args::name
volatile VALUE name
Definition: probes_helper.h:12
NOINLINE
NOINLINE(int rb_dtrace_setup(rb_execution_context_t *, VALUE, ID, struct ruby_dtrace_method_hook_args *))
rb_dtrace_setup
MJIT_FUNC_EXPORTED int rb_dtrace_setup(rb_execution_context_t *ec, VALUE klass, ID id, struct ruby_dtrace_method_hook_args *args)
Definition: vm.c:392
ruby_dtrace_method_hook_args::klass
volatile VALUE klass
Definition: probes_helper.h:11
ruby.h
ruby_dtrace_method_hook_args::methodname
const char * methodname
Definition: probes_helper.h:8
ruby_dtrace_method_hook_args::filename
const char * filename
Definition: probes_helper.h:9
ruby_dtrace_method_hook_args::line_no
int line_no
Definition: probes_helper.h:10
ruby_dtrace_method_hook_args
Definition: probes_helper.h:6
ruby_dtrace_method_hook_args::classname
const char * classname
Definition: probes_helper.h:7
rb_execution_context_struct
Definition: vm_core.h:843