diff --git a/Makefile.in b/Makefile.in index a01faae..ff05dae 100644 --- a/Makefile.in +++ b/Makefile.in @@ -297,6 +297,10 @@ enc/unicode/name2ctype.h: enc/unicode/name2ctype.kwd @$(ECHO) preprocessing $< $(Q) $(CPP) $(XCFLAGS) $(CPPFLAGS) $(COUTFLAG)$@ -E $< > $@ +probes.h: + @$(ECHO) translating probes $< + dtrace -o $@ -h -s probes.d + clean-local:: $(Q)$(RM) ext/extinit.c ext/extinit.$(OBJEXT) ext/ripper/y.output -$(Q)$(RM) $(pkgconfig_DATA) diff --git a/array.c b/array.c index 82ae7ef..5c7cc7e 100644 --- a/array.c +++ b/array.c @@ -15,6 +15,7 @@ #include "ruby/util.h" #include "ruby/st.h" #include "ruby/encoding.h" +#include "probes.h" #include "internal.h" #ifndef ARRAY_DEBUG @@ -303,6 +304,10 @@ ary_alloc(VALUE klass) FL_SET_EMBED((VALUE)ary); ARY_SET_EMBED_LEN((VALUE)ary, 0); + if(RUBY_ARRAY_ALLOC_ENABLED()) { + RUBY_ARRAY_ALLOC(rb_sourcefile(), rb_sourceline()); + } + return (VALUE)ary; } diff --git a/gc.c b/gc.c index d5b8dfd..2c0c37f 100644 --- a/gc.c +++ b/gc.c @@ -21,6 +21,7 @@ #include "internal.h" #include "gc.h" #include "constant.h" +#include "probes.h" #include #include #include @@ -1167,6 +1168,8 @@ rb_newobj(void) } } + if(RUBY_OBJECT_ALLOC_ENABLED()) RUBY_OBJECT_ALLOC(); + obj = (VALUE)freelist; freelist = freelist->as.free.next; diff --git a/hash.c b/hash.c index b49aff8..c40d94d 100644 --- a/hash.c +++ b/hash.c @@ -15,6 +15,7 @@ #include "ruby/st.h" #include "ruby/util.h" #include "ruby/encoding.h" +#include "probes.h" #include #ifdef __APPLE__ @@ -221,6 +222,9 @@ hash_alloc(VALUE klass) OBJSETUP(hash, klass, T_HASH); RHASH_IFNONE(hash) = Qnil; + if(RUBY_HASH_ALLOC_ENABLED()) { + RUBY_HASH_ALLOC(rb_sourcefile(), rb_sourceline()); + } return (VALUE)hash; } diff --git a/string.c b/string.c index 9a85f81..a42c3c2 100644 --- a/string.c +++ b/string.c @@ -15,6 +15,7 @@ #include "ruby/re.h" #include "ruby/encoding.h" #include "internal.h" +#include "probes.h" #include #define BEG(no) (regs->beg[(no)]) @@ -377,6 +378,10 @@ str_alloc(VALUE klass) str->as.heap.len = 0; str->as.heap.aux.capa = 0; + if(RUBY_STRING_ALLOC_ENABLED()) { + RUBY_STRING_ALLOC(rb_sourcefile(), rb_sourceline()); + } + return (VALUE)str; } diff --git a/vm_eval.c b/vm_eval.c index 7df7f5f..2fd2b94 100644 --- a/vm_eval.c +++ b/vm_eval.c @@ -11,6 +11,8 @@ **********************************************************************/ +#include "probes.h" + static inline VALUE method_missing(VALUE obj, ID id, int argc, const VALUE *argv, int call_status); static inline VALUE rb_vm_set_finish_env(rb_thread_t * th); static inline VALUE vm_yield_with_cref(rb_thread_t *th, int argc, const VALUE *argv, const NODE *cref); @@ -224,6 +226,14 @@ static inline VALUE rb_call0(VALUE recv, ID mid, int argc, const VALUE *argv, call_type scope, VALUE self) { + if(RUBY_FUNCTION_ENTRY_ENABLED()) { + RUBY_FUNCTION_ENTRY( + rb_obj_classname(recv), + rb_id2name(mid), + argc, + rb_sourcefile(), + rb_sourceline()); + } rb_method_entry_t *me = rb_search_method_entry(recv, mid); rb_thread_t *th = GET_THREAD(); int call_status = rb_method_call_status(th, me, scope, self);