2012-11-18 20:30:10 +04:00
|
|
|
#ifndef RUBY_PROBES_HELPER_H
|
|
|
|
#define RUBY_PROBES_HELPER_H
|
|
|
|
|
|
|
|
#include "ruby/ruby.h"
|
|
|
|
|
2015-10-29 08:32:19 +03:00
|
|
|
struct ruby_dtrace_method_hook_args {
|
|
|
|
const char *classname;
|
|
|
|
const char *methodname;
|
|
|
|
const char *filename;
|
|
|
|
int line_no;
|
|
|
|
volatile VALUE klass;
|
|
|
|
volatile VALUE name;
|
|
|
|
};
|
|
|
|
|
2019-12-04 10:42:30 +03:00
|
|
|
MJIT_SYMBOL_EXPORT_BEGIN
|
2017-11-07 11:19:25 +03:00
|
|
|
NOINLINE(int rb_dtrace_setup(rb_execution_context_t *, VALUE, ID, struct ruby_dtrace_method_hook_args *));
|
2019-12-04 10:42:30 +03:00
|
|
|
MJIT_SYMBOL_EXPORT_END
|
2015-10-29 08:32:19 +03:00
|
|
|
|
2017-11-07 11:19:25 +03:00
|
|
|
#define RUBY_DTRACE_METHOD_HOOK(name, ec, klazz, id) \
|
2012-12-11 07:37:19 +04:00
|
|
|
do { \
|
2015-10-29 08:32:19 +03:00
|
|
|
if (UNLIKELY(RUBY_DTRACE_##name##_ENABLED())) { \
|
|
|
|
struct ruby_dtrace_method_hook_args args; \
|
2017-11-07 11:19:25 +03:00
|
|
|
if (rb_dtrace_setup(ec, klazz, id, &args)) { \
|
2015-10-29 08:32:19 +03:00
|
|
|
RUBY_DTRACE_##name(args.classname, \
|
|
|
|
args.methodname, \
|
|
|
|
args.filename, \
|
|
|
|
args.line_no); \
|
2012-11-18 20:30:10 +04:00
|
|
|
} \
|
|
|
|
} \
|
2012-12-11 07:37:19 +04:00
|
|
|
} while (0)
|
2012-11-18 20:30:10 +04:00
|
|
|
|
2017-11-07 11:19:25 +03:00
|
|
|
#define RUBY_DTRACE_METHOD_ENTRY_HOOK(ec, klass, id) \
|
|
|
|
RUBY_DTRACE_METHOD_HOOK(METHOD_ENTRY, ec, klass, id)
|
2012-12-01 06:13:06 +04:00
|
|
|
|
2017-11-07 11:19:25 +03:00
|
|
|
#define RUBY_DTRACE_METHOD_RETURN_HOOK(ec, klass, id) \
|
|
|
|
RUBY_DTRACE_METHOD_HOOK(METHOD_RETURN, ec, klass, id)
|
2012-12-01 06:13:06 +04:00
|
|
|
|
2017-11-07 11:19:25 +03:00
|
|
|
#define RUBY_DTRACE_CMETHOD_ENTRY_HOOK(ec, klass, id) \
|
|
|
|
RUBY_DTRACE_METHOD_HOOK(CMETHOD_ENTRY, ec, klass, id)
|
2012-12-01 06:13:06 +04:00
|
|
|
|
2017-11-07 11:19:25 +03:00
|
|
|
#define RUBY_DTRACE_CMETHOD_RETURN_HOOK(ec, klass, id) \
|
|
|
|
RUBY_DTRACE_METHOD_HOOK(CMETHOD_RETURN, ec, klass, id)
|
2012-12-01 06:13:06 +04:00
|
|
|
|
2012-11-18 20:30:10 +04:00
|
|
|
#endif /* RUBY_PROBES_HELPER_H */
|