Skip to content

Commit

Permalink
Fix dtrace commit r37631, it is [Feature ruby#2565]
Browse files Browse the repository at this point in the history
* configure.in: disable dtrace because it doesn't work on FreeBSD.

* common.mk (clean-local): rm probes.h.

* common.mk (parse.o): depend $(PROBES_H_INCLUDES).

* common.mk (.d.h): moved from Makefile.in and use BASERUBY.

* tool/gen_dummy_probes.rb: reimplemented with ruby because sed is not
  available on Windows Microsoft VC++ environment.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37636 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
  • Loading branch information
nurse committed Nov 13, 2012
1 parent 8e72bb7 commit f82d652
Show file tree
Hide file tree
Showing 6 changed files with 58 additions and 40 deletions.
23 changes: 19 additions & 4 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,18 @@
Tue Nov 13 12:27:11 2012 NARUSE, Yui <[email protected]>

* configure.in: disable dtrace because it doesn't work on FreeBSD.

* common.mk (clean-local): rm probes.h.

* common.mk (parse.o): depend $(PROBES_H_INCLUDES).

* common.mk (.d.h): moved from Makefile.in and use BASERUBY.

* tool/gen_dummy_probes.rb: reimplemented with ruby because sed is not
available on Windows Microsoft VC++ environment.

Tue Nov 13 06:50:02 2012 Aaron Patterson <[email protected]>

Tue Nov 13 12:30:26 2012 NAKAMURA Usaku <[email protected]>

* win32/README.win32: added mention about build directory. currently
Expand Down Expand Up @@ -28,10 +43,10 @@ Tue Nov 13 06:50:02 2012 Aaron Patterson <[email protected]>

* eval.c (setup_exception): add a probe for when an exception is
raised.

* gc.c: Add DTrace probes for mark begin and end, and sweep begin and
end.

* hash.c (empty_hash_alloc): Add a probe for hash allocation.

* insns.def: Add probes for function entry and return.
Expand Down Expand Up @@ -59,12 +74,12 @@ Tue Nov 13 06:50:02 2012 Aaron Patterson <[email protected]>

* vm_eval.c (vm_call0_cfunc, vm_call0_cfunc_with_frame): add probe on
function entry and return.

* vm_exec.c: expose instruction number to instruction name function.

* vm_insnshelper.c: add function entry and exit probes for cfunc
methods.

* vm_insnhelper.h: vm usage information is always collected, so
uncomment the functions.

Expand Down
10 changes: 0 additions & 10 deletions Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -321,16 +321,6 @@ enc/unicode/name2ctype.h: enc/unicode/name2ctype.kwd
@$(ECHO) preprocessing $<
$(Q) $(CPP) $(warnflags) $(XCFLAGS) $(CPPFLAGS) $(COUTFLAG)$@ -E $< > $@

.d.h:
@$(ECHO) translating probes $<
$(Q)if test -n '$(DTRACE)'; then\
$(DTRACE) -o $@.tmp -h -s $<; \
sed -e 's/RUBY_/RUBY_DTRACE_/g' $@.tmp | sed -e 's/PROBES_H_TMP/PROBES_H/g' >$@; \
rm $@.tmp; \
else \
sed -f $(srcdir)/tool/gen_dummy_probes.sed $< > $@; \
fi

clean-local::
$(Q)$(RM) ext/extinit.c ext/extinit.$(OBJEXT) ext/ripper/y.output \
enc/encinit.c enc/encinit.$(OBJEXT)
Expand Down
14 changes: 12 additions & 2 deletions common.mk
Original file line number Diff line number Diff line change
Expand Up @@ -435,7 +435,7 @@ clean: clean-ext clean-local clean-enc clean-golf clean-rdoc clean-capi clean-ex
clean-local:: PHONY
$(Q)$(RM) $(OBJS) $(MINIOBJS) $(MAINOBJ) $(LIBRUBY_A) $(LIBRUBY_SO) $(LIBRUBY) $(LIBRUBY_ALIASES)
$(Q)$(RM) $(PROGRAM) $(WPROGRAM) miniruby$(EXEEXT) dmyext.$(OBJEXT) $(ARCHFILE) .*.time
$(Q)$(RM) y.tab.c y.output encdb.h transdb.h prelude.c config.log rbconfig.rb $(ruby_pc)
$(Q)$(RM) y.tab.c y.output encdb.h transdb.h prelude.c config.log rbconfig.rb $(ruby_pc) probes.h
clean-ext:: PHONY
clean-golf: PHONY
$(Q)$(RM) $(GORUBY)$(EXEEXT) $(GOLFOBJS)
Expand Down Expand Up @@ -614,6 +614,16 @@ VM_CORE_H_INCLUDES = {$(VPATH)}vm_core.h {$(VPATH)}thread_$(THREAD_MODEL).h \
{$(VPATH)}node.h {$(VPATH)}method.h {$(VPATH)}ruby_atomic.h \
$(ID_H_INCLUDES) $(PROBES_H_INCLUDES)

.d.h:
@$(ECHO) translating probes $<
$(Q)if test -n '$(DTRACE)'; then\
$(DTRACE) -o $@.tmp -h -s $<; \
sed -e 's/RUBY_/RUBY_DTRACE_/g' $@.tmp | sed -e 's/PROBES_H_TMP/PROBES_H/g' >$@; \
$(RM) $@.tmp; \
else \
$(BASERUBY) $(srcdir)/tool/gen_dummy_probes.rb $< > $@; \
fi

addr2line.$(OBJEXT): {$(VPATH)}addr2line.c {$(VPATH)}addr2line.h {$(VPATH)}config.h
array.$(OBJEXT): {$(VPATH)}array.c $(RUBY_H_INCLUDES) {$(VPATH)}util.h \
$(ENCODING_H_INCLUDES) {$(VPATH)}internal.h $(PROBES_H_INCLUDES)
Expand Down Expand Up @@ -688,7 +698,7 @@ parse.$(OBJEXT): {$(VPATH)}parse.c $(RUBY_H_INCLUDES) {$(VPATH)}node.h \
{$(VPATH)}regex.h {$(VPATH)}util.h {$(VPATH)}lex.c \
{$(VPATH)}defs/keywords {$(VPATH)}id.c {$(VPATH)}parse.y \
{$(VPATH)}parse.h {$(VPATH)}vm_opts.h \
{$(VPATH)}internal.h
{$(VPATH)}internal.h $(PROBES_H_INCLUDES)
proc.$(OBJEXT): {$(VPATH)}proc.c {$(VPATH)}eval_intern.h \
$(RUBY_H_INCLUDES) {$(VPATH)}gc.h $(VM_CORE_H_INCLUDES) \
{$(VPATH)}debug.h {$(VPATH)}internal.h {$(VPATH)}iseq.h
Expand Down
3 changes: 3 additions & 0 deletions configure.in
Original file line number Diff line number Diff line change
Expand Up @@ -374,6 +374,9 @@ if test x"${build}" != x"${host}"; then
fi

AC_CHECK_TOOL(DTRACE, dtrace)
AS_CASE(["$target_os"],
[freebsd*], [DTRACE=]
)

AC_PROG_CC
AC_PROG_CXX
Expand Down
24 changes: 24 additions & 0 deletions tool/gen_dummy_probes.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#!/usr/bin/ruby

text = ARGF.read
text.upcase!

# remove the pragma declarations
text.gsub!(/^#PRAGMA.*$/, '')

# replace the provider section with the start of the header file
text.gsub!(/PROVIDER RUBY \{/, "#ifndef\t_PROBES_H\n#define\t_PROBES_H")

# finish up the #ifndef sandwich
text.gsub!(/\};/, "#endif\t/* _PROBES_H */")

text.gsub!(/__/, '_')

text.gsub!(/\([^,)]+\)/, '(arg0)')
text.gsub!(/\([^,)]+,[^,)]+\)/, '(arg0, arg1)')
text.gsub!(/\([^,)]+,[^,)]+,[^,)]+\)/, '(arg0, arg1, arg2)')
text.gsub!(/\([^,)]+,[^,)]+,[^,)]+,[^,)]+\)/, '(arg0, arg1, arg2, arg3)')
text.gsub!(/\([^,)]+,[^,)]+,[^,)]+,[^,)]+,[^,)]+\)/, '(arg0, arg1, arg2, arg3, arg4)')

text.gsub!(/ *PROBE ([^\(]*)(\([^\)]*\));/, "#define RUBY_DTRACE_\\1_ENABLED() 0\n#define RUBY_DTRACE_\\1\\2\ do \{ \} while\(0\)")
print text
24 changes: 0 additions & 24 deletions tool/gen_dummy_probes.sed

This file was deleted.

0 comments on commit f82d652

Please sign in to comment.