зеркало из https://github.com/github/ruby.git
* probes.d: Change function-entry probe to method-entry.
* insns.def: ditto * probes_helper.h: ditto * test/dtrace/test_function_entry.rb: ditto * test/dtrace/test_singleton_function.rb: ditto * vm.c: ditto * vm_eval.c: ditto * vm_insnhelper.c: ditto git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37951 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
Родитель
0fe2051c93
Коммит
4bdd909518
11
ChangeLog
11
ChangeLog
|
@ -1,3 +1,14 @@
|
|||
Thu Nov 29 05:19:25 2012 Aaron Patterson <aaron@tenderlovemaking.com>
|
||||
|
||||
* probes.d: Change function-entry probe to method-entry.
|
||||
* insns.def: ditto
|
||||
* probes_helper.h: ditto
|
||||
* test/dtrace/test_function_entry.rb: ditto
|
||||
* test/dtrace/test_singleton_function.rb: ditto
|
||||
* vm.c: ditto
|
||||
* vm_eval.c: ditto
|
||||
* vm_insnhelper.c: ditto
|
||||
|
||||
Thu Nov 29 04:45:17 2012 Koichi Sasada <ko1@atdot.net>
|
||||
|
||||
* vm_backtrace.c: rename Class name from
|
||||
|
|
|
@ -843,28 +843,28 @@ trace
|
|||
{
|
||||
rb_event_flag_t flag = (rb_event_flag_t)nf;
|
||||
|
||||
if (RUBY_DTRACE_FUNCTION_ENTRY_ENABLED()) {
|
||||
if (RUBY_DTRACE_METHOD_ENTRY_ENABLED()) {
|
||||
if (flag == RUBY_EVENT_CALL || flag == RUBY_EVENT_C_CALL) {
|
||||
VALUE klass;
|
||||
ID called_id;
|
||||
|
||||
rb_thread_method_id_and_class(th, &called_id, &klass);
|
||||
|
||||
RUBY_DTRACE_FUNCTION_ENTRY(
|
||||
RUBY_DTRACE_METHOD_ENTRY(
|
||||
RSTRING_PTR(rb_inspect(klass)),
|
||||
rb_id2name(called_id),
|
||||
rb_sourcefile(),
|
||||
rb_sourceline());
|
||||
}
|
||||
}
|
||||
if (RUBY_DTRACE_FUNCTION_RETURN_ENABLED()) {
|
||||
if (RUBY_DTRACE_METHOD_RETURN_ENABLED()) {
|
||||
if (flag == RUBY_EVENT_RETURN || flag == RUBY_EVENT_C_RETURN) {
|
||||
VALUE klass;
|
||||
ID called_id;
|
||||
|
||||
rb_thread_method_id_and_class(th, &called_id, &klass);
|
||||
|
||||
RUBY_DTRACE_FUNCTION_RETURN(
|
||||
RUBY_DTRACE_METHOD_RETURN(
|
||||
RSTRING_PTR(rb_inspect(klass)),
|
||||
rb_id2name(called_id),
|
||||
rb_sourcefile(),
|
||||
|
|
4
probes.d
4
probes.d
|
@ -1,8 +1,8 @@
|
|||
#include "vm_opts.h"
|
||||
|
||||
provider ruby {
|
||||
probe function__entry(const char *, const char *, const char *, int);
|
||||
probe function__return(const char *, const char *, const char *, int);
|
||||
probe method__entry(const char *, const char *, const char *, int);
|
||||
probe method__return(const char *, const char *, const char *, int);
|
||||
|
||||
probe require__entry(const char *, const char *, int);
|
||||
probe require__return(const char *);
|
||||
|
|
|
@ -4,13 +4,13 @@
|
|||
#include "ruby/ruby.h"
|
||||
#include "probes.h"
|
||||
|
||||
#define RUBY_DTRACE_FUNC_ENTRY_HOOK(klass, id) \
|
||||
if (RUBY_DTRACE_FUNCTION_ENTRY_ENABLED()) { \
|
||||
#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_FUNCTION_ENTRY( \
|
||||
RUBY_DTRACE_METHOD_ENTRY( \
|
||||
classname, \
|
||||
methodname, \
|
||||
filename, \
|
||||
|
@ -18,13 +18,13 @@
|
|||
} \
|
||||
} \
|
||||
|
||||
#define RUBY_DTRACE_FUNC_RETURN_HOOK(klass, id) \
|
||||
if (RUBY_DTRACE_FUNCTION_RETURN_ENABLED()) { \
|
||||
#define RUBY_DTRACE_METHOD_RETURN_HOOK(klass, id) \
|
||||
if (RUBY_DTRACE_METHOD_RETURN_ENABLED()) { \
|
||||
const char * classname = rb_class2name((klass)); \
|
||||
const char * methodname = rb_id2name((id)); \
|
||||
const char * filename = rb_sourcefile(); \
|
||||
if (classname && methodname && filename) { \
|
||||
RUBY_DTRACE_FUNCTION_RETURN( \
|
||||
RUBY_DTRACE_METHOD_RETURN( \
|
||||
classname, \
|
||||
methodname, \
|
||||
filename, \
|
||||
|
|
|
@ -4,7 +4,7 @@ module DTrace
|
|||
class TestFunctionEntry < TestCase
|
||||
def test_function_entry
|
||||
probe = <<-eoprobe
|
||||
ruby$target:::function-entry
|
||||
ruby$target:::method-entry
|
||||
/arg0 && arg1 && arg2/
|
||||
{
|
||||
printf("%s %s %s %d\\n", copyinstr(arg0), copyinstr(arg1), copyinstr(arg2), arg3);
|
||||
|
@ -25,7 +25,7 @@ ruby$target:::function-entry
|
|||
|
||||
def test_function_return
|
||||
probe = <<-eoprobe
|
||||
ruby$target:::function-return
|
||||
ruby$target:::method-return
|
||||
/arg0 && arg1 && arg2/
|
||||
{
|
||||
printf("%s %s %s %d\\n", copyinstr(arg0), copyinstr(arg1), copyinstr(arg2), arg3);
|
||||
|
|
|
@ -4,7 +4,7 @@ module DTrace
|
|||
class TestSingletonFunctionEntry < TestCase
|
||||
def test_entry
|
||||
probe = <<-eoprobe
|
||||
ruby$target:::function-entry
|
||||
ruby$target:::method-entry
|
||||
/strstr(copyinstr(arg0), "Foo") != NULL/
|
||||
{
|
||||
printf("%s %s %s %d\\n", copyinstr(arg0), copyinstr(arg1), copyinstr(arg2), arg3);
|
||||
|
@ -25,7 +25,7 @@ ruby$target:::function-entry
|
|||
|
||||
def test_exit
|
||||
probe = <<-eoprobe
|
||||
ruby$target:::function-return
|
||||
ruby$target:::method-return
|
||||
{
|
||||
printf("%s %s %s %d\\n", copyinstr(arg0), copyinstr(arg1), copyinstr(arg2), arg3);
|
||||
}
|
||||
|
|
2
vm.c
2
vm.c
|
@ -1177,7 +1177,7 @@ vm_exec(rb_thread_t *th)
|
|||
if (UNLIKELY(VM_FRAME_TYPE(th->cfp) == VM_FRAME_MAGIC_CFUNC)) {
|
||||
const rb_method_entry_t *me = th->cfp->me;
|
||||
EXEC_EVENT_HOOK(th, RUBY_EVENT_C_RETURN, th->cfp->self, me->called_id, me->klass, Qnil);
|
||||
RUBY_DTRACE_FUNC_RETURN_HOOK(me->klass, me->called_id);
|
||||
RUBY_DTRACE_METHOD_RETURN_HOOK(me->klass, me->called_id);
|
||||
}
|
||||
th->cfp = RUBY_VM_PREVIOUS_CONTROL_FRAME(th->cfp);
|
||||
}
|
||||
|
|
10
vm_eval.c
10
vm_eval.c
|
@ -55,7 +55,7 @@ vm_call0_cfunc(rb_thread_t* th, rb_call_info_t *ci, const VALUE *argv)
|
|||
{
|
||||
VALUE val;
|
||||
|
||||
RUBY_DTRACE_FUNC_ENTRY_HOOK(ci->defined_class, ci->mid);
|
||||
RUBY_DTRACE_METHOD_ENTRY_HOOK(ci->defined_class, ci->mid);
|
||||
EXEC_EVENT_HOOK(th, RUBY_EVENT_C_CALL, ci->recv, ci->mid, ci->defined_class, Qnil);
|
||||
{
|
||||
rb_control_frame_t *reg_cfp = th->cfp;
|
||||
|
@ -85,7 +85,7 @@ vm_call0_cfunc(rb_thread_t* th, rb_call_info_t *ci, const VALUE *argv)
|
|||
}
|
||||
}
|
||||
EXEC_EVENT_HOOK(th, RUBY_EVENT_C_RETURN, ci->recv, ci->mid, ci->defined_class, val);
|
||||
RUBY_DTRACE_FUNC_RETURN_HOOK(ci->defined_class, ci->mid);
|
||||
RUBY_DTRACE_METHOD_RETURN_HOOK(ci->defined_class, ci->mid);
|
||||
|
||||
return val;
|
||||
}
|
||||
|
@ -103,7 +103,7 @@ vm_call0_cfunc_with_frame(rb_thread_t* th, rb_call_info_t *ci, const VALUE *argv
|
|||
ID mid = ci->mid;
|
||||
rb_block_t *blockptr = ci->blockptr;
|
||||
|
||||
RUBY_DTRACE_FUNC_ENTRY_HOOK(defined_class, mid);
|
||||
RUBY_DTRACE_METHOD_ENTRY_HOOK(defined_class, mid);
|
||||
EXEC_EVENT_HOOK(th, RUBY_EVENT_C_CALL, recv, mid, defined_class, Qnil);
|
||||
{
|
||||
rb_control_frame_t *reg_cfp = th->cfp;
|
||||
|
@ -123,7 +123,7 @@ vm_call0_cfunc_with_frame(rb_thread_t* th, rb_call_info_t *ci, const VALUE *argv
|
|||
vm_pop_frame(th);
|
||||
}
|
||||
EXEC_EVENT_HOOK(th, RUBY_EVENT_C_RETURN, recv, mid, defined_class, val);
|
||||
RUBY_DTRACE_FUNC_RETURN_HOOK(defined_class, mid);
|
||||
RUBY_DTRACE_METHOD_RETURN_HOOK(defined_class, mid);
|
||||
|
||||
return val;
|
||||
}
|
||||
|
@ -1015,7 +1015,7 @@ rb_iterate(VALUE (* it_proc) (VALUE), VALUE data1,
|
|||
if (UNLIKELY(VM_FRAME_TYPE(th->cfp) == VM_FRAME_MAGIC_CFUNC)) {
|
||||
const rb_method_entry_t *me = th->cfp->me;
|
||||
EXEC_EVENT_HOOK(th, RUBY_EVENT_C_RETURN, th->cfp->self, me->called_id, me->klass, Qnil);
|
||||
RUBY_DTRACE_FUNC_RETURN_HOOK(me->klass, me->called_id);
|
||||
RUBY_DTRACE_METHOD_RETURN_HOOK(me->klass, me->called_id);
|
||||
}
|
||||
|
||||
th->cfp = RUBY_VM_PREVIOUS_CONTROL_FRAME(th->cfp);
|
||||
|
|
|
@ -1449,7 +1449,7 @@ vm_call_cfunc_with_frame(rb_thread_t *th, rb_control_frame_t *reg_cfp, rb_call_i
|
|||
rb_block_t *blockptr = ci->blockptr;
|
||||
int argc = ci->argc;
|
||||
|
||||
RUBY_DTRACE_FUNC_ENTRY_HOOK(me->klass, me->called_id);
|
||||
RUBY_DTRACE_METHOD_ENTRY_HOOK(me->klass, me->called_id);
|
||||
EXEC_EVENT_HOOK(th, RUBY_EVENT_C_CALL, recv, me->called_id, me->klass, Qundef);
|
||||
|
||||
vm_push_frame(th, 0, VM_FRAME_MAGIC_CFUNC, recv, defined_class,
|
||||
|
@ -1468,7 +1468,7 @@ vm_call_cfunc_with_frame(rb_thread_t *th, rb_control_frame_t *reg_cfp, rb_call_i
|
|||
vm_pop_frame(th);
|
||||
|
||||
EXEC_EVENT_HOOK(th, RUBY_EVENT_C_RETURN, recv, me->called_id, me->klass, val);
|
||||
RUBY_DTRACE_FUNC_RETURN_HOOK(me->klass, me->called_id);
|
||||
RUBY_DTRACE_METHOD_RETURN_HOOK(me->klass, me->called_id);
|
||||
|
||||
return val;
|
||||
}
|
||||
|
@ -1516,7 +1516,7 @@ vm_call_cfunc(rb_thread_t *th, rb_control_frame_t *reg_cfp, rb_call_info_t *ci)
|
|||
|
||||
if (len >= 0) rb_check_arity(ci->argc, len, len);
|
||||
|
||||
RUBY_DTRACE_FUNC_ENTRY_HOOK(me->klass, me->called_id);
|
||||
RUBY_DTRACE_METHOD_ENTRY_HOOK(me->klass, me->called_id);
|
||||
EXEC_EVENT_HOOK(th, RUBY_EVENT_C_CALL, recv, me->called_id, me->klass, Qnil);
|
||||
|
||||
if (!(ci->me->flag & NOEX_PROTECTED) &&
|
||||
|
@ -1526,7 +1526,7 @@ vm_call_cfunc(rb_thread_t *th, rb_control_frame_t *reg_cfp, rb_call_info_t *ci)
|
|||
val = vm_call_cfunc_latter(th, reg_cfp, ci);
|
||||
|
||||
EXEC_EVENT_HOOK(th, RUBY_EVENT_C_RETURN, recv, me->called_id, me->klass, val);
|
||||
RUBY_DTRACE_FUNC_RETURN_HOOK(me->klass, me->called_id);
|
||||
RUBY_DTRACE_METHOD_RETURN_HOOK(me->klass, me->called_id);
|
||||
|
||||
return val;
|
||||
}
|
||||
|
@ -1575,7 +1575,7 @@ vm_call_bmethod_body(rb_thread_t *th, rb_call_info_t *ci, const VALUE *argv)
|
|||
rb_proc_t *proc;
|
||||
VALUE val;
|
||||
|
||||
RUBY_DTRACE_FUNC_ENTRY_HOOK(ci->me->klass, ci->me->called_id);
|
||||
RUBY_DTRACE_METHOD_ENTRY_HOOK(ci->me->klass, ci->me->called_id);
|
||||
EXEC_EVENT_HOOK(th, RUBY_EVENT_CALL, ci->recv, ci->me->called_id, ci->me->klass, Qnil);
|
||||
|
||||
/* control block frame */
|
||||
|
@ -1584,7 +1584,7 @@ vm_call_bmethod_body(rb_thread_t *th, rb_call_info_t *ci, const VALUE *argv)
|
|||
val = vm_invoke_proc(th, proc, ci->recv, ci->defined_class, ci->argc, argv, ci->blockptr);
|
||||
|
||||
EXEC_EVENT_HOOK(th, RUBY_EVENT_RETURN, ci->recv, ci->me->called_id, ci->me->klass, val);
|
||||
RUBY_DTRACE_FUNC_RETURN_HOOK(ci->me->klass, ci->me->called_id);
|
||||
RUBY_DTRACE_METHOD_RETURN_HOOK(ci->me->klass, ci->me->called_id);
|
||||
|
||||
return val;
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче