Ruby: probes_helper.h Source File

Ruby 3.4.7p58 (2025-10-08 revision 7a5688e2a27668e48f8d6ff4af5b2208b98a2f5e)

probes_helper.h
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
15NOINLINE(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) \
18do { \
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 */
ruby.h
ruby_dtrace_method_hook_args
Definition probes_helper.h:6
ID
uintptr_t ID
Type that represents a Ruby identifier such as a variable name.
Definition value.h:52
VALUE
uintptr_t VALUE
Type that represents a Ruby object.
Definition value.h:40