1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

Fix dtrace commit r37631, it is [Feature #2565]

* 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
This commit is contained in:
naruse 2012-11-13 06:13:39 +00:00
parent 8e72bb717a
commit f82d652f35
6 changed files with 58 additions and 40 deletions

View file

@ -1,3 +1,18 @@
Tue Nov 13 12:27:11 2012 NARUSE, Yui <naruse@ruby-lang.org>
* 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 <aaron@tenderlovemaking.com>
Tue Nov 13 12:30:26 2012 NAKAMURA Usaku <usa@ruby-lang.org>
* win32/README.win32: added mention about build directory. currently
@ -28,10 +43,10 @@ Tue Nov 13 06:50:02 2012 Aaron Patterson <aaron@tenderlovemaking.com>
* 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.
@ -59,12 +74,12 @@ Tue Nov 13 06:50:02 2012 Aaron Patterson <aaron@tenderlovemaking.com>
* 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.

View file

@ -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)

View file

@ -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)
@ -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)
@ -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

View file

@ -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

24
tool/gen_dummy_probes.rb Normal file
View file

@ -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

View file

@ -1,24 +0,0 @@
# upper case everything
y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/
# remove the pragma declarations
s/^#PRAGMA.*$//
# replace the provider section with the start of the header file
s/PROVIDER RUBY {/#ifndef _PROBES_H\
#define _PROBES_H/
# finish up the #ifndef sandwich
s/};/#endif \/* _PROBES_H *\//
s/__/_/g
s/([^,)]\{1,\})/(arg0)/
s/([^,)]\{1,\},[^,)]\{1,\})/(arg0, arg1)/
s/([^,)]\{1,\},[^,)]\{1,\},[^,)]\{1,\})/(arg0, arg1, arg2)/
s/([^,)]\{1,\},[^,)]\{1,\},[^,)]\{1,\},[^,)]\{1,\})/(arg0, arg1, arg2, arg3)/
s/([^,)]\{1,\},[^,)]\{1,\},[^,)]\{1,\},[^,)]\{1,\},[^,)]\{1,\})/(arg0, arg1, arg2, arg3, arg4)/
s/[ ]*PROBE[ ]\([^\(]*\)\(([^\)]*)\);/#define RUBY_DTRACE_\1_ENABLED() 0\
#define RUBY_DTRACE_\1\2\ do \{ \} while\(0\)/