Ruby  3.4.0dev (2024-12-06 revision 892c46283a5ea4179500d951c9d4866c0051f27b)
probes_helper.h (892c46283a5ea4179500d951c9d4866c0051f27b)
1 #ifndef RUBY_PROBES_HELPER_H
2 #define RUBY_PROBES_HELPER_H
3 
4 #include "ruby/ruby.h"
5 
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 */
uintptr_t ID
Type that represents a Ruby identifier such as a variable name.
Definition: value.h:52
uintptr_t VALUE
Type that represents a Ruby object.
Definition: value.h:40