mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
9709448474
* probes_helper.h: look up klass and method if none are provided. * eval.c: update macro usage. * vm_eval.c: ditto. * vm_insnhelper.c: ditto. * test/dtrace/test_function_entry.rb: test for change. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38001 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
43 lines
1.1 KiB
C
43 lines
1.1 KiB
C
#ifndef RUBY_PROBES_HELPER_H
|
|
#define RUBY_PROBES_HELPER_H
|
|
|
|
#include "ruby/ruby.h"
|
|
#include "probes.h"
|
|
|
|
#define RUBY_DTRACE_METHOD_ENTRY_HOOK(klass, id) \
|
|
if (RUBY_DTRACE_METHOD_ENTRY_ENABLED()) { \
|
|
const char * classname = rb_class2name((klass)); \
|
|
const char * methodname = rb_id2name((id)); \
|
|
const char * filename = rb_sourcefile(); \
|
|
if (classname && methodname && filename) { \
|
|
RUBY_DTRACE_METHOD_ENTRY( \
|
|
classname, \
|
|
methodname, \
|
|
filename, \
|
|
rb_sourceline()); \
|
|
} \
|
|
} \
|
|
|
|
#define RUBY_DTRACE_METHOD_RETURN_HOOK(th, klass, id) \
|
|
if (RUBY_DTRACE_METHOD_RETURN_ENABLED()) { \
|
|
VALUE _klass = (klass); \
|
|
VALUE _id = (id); \
|
|
const char * classname; \
|
|
const char * methodname; \
|
|
const char * filename; \
|
|
if (!_klass) { \
|
|
rb_thread_method_id_and_class((th), &_id, &_klass); \
|
|
} \
|
|
classname = rb_class2name(_klass); \
|
|
methodname = rb_id2name(_id); \
|
|
filename = rb_sourcefile(); \
|
|
if (classname && methodname && filename) { \
|
|
RUBY_DTRACE_METHOD_RETURN( \
|
|
classname, \
|
|
methodname, \
|
|
filename, \
|
|
rb_sourceline()); \
|
|
} \
|
|
} \
|
|
|
|
#endif /* RUBY_PROBES_HELPER_H */
|