diff --git a/Makefile.in b/Makefile.in index 603cbb83dab..ab3aaa372ec 100644 --- a/Makefile.in +++ b/Makefile.in @@ -58,6 +58,7 @@ TIERS += base tier_base_dirs = \ config \ build \ + probes \ $(NULL) include $(topsrcdir)/$(MOZ_BUILD_APP)/build.mk diff --git a/allmakefiles.sh b/allmakefiles.sh index e9b4696a1f5..a75072e829a 100755 --- a/allmakefiles.sh +++ b/allmakefiles.sh @@ -63,6 +63,7 @@ config/Makefile config/autoconf.mk config/mkdepend/Makefile config/doxygen.cfg +probes/Makefile extensions/Makefile " diff --git a/config/autoconf.mk.in b/config/autoconf.mk.in index b6d268201bb..2d24fb6129c 100644 --- a/config/autoconf.mk.in +++ b/config/autoconf.mk.in @@ -589,6 +589,7 @@ GCC_VERSION = @GCC_VERSION@ XCODEBUILD_VERSION= @XCODEBUILD_VERSION@ HAS_XCODE_2_1 = @HAS_XCODE_2_1@ UNIVERSAL_BINARY= @UNIVERSAL_BINARY@ +HAVE_DTRACE= @HAVE_DTRACE@ VISIBILITY_FLAGS = @VISIBILITY_FLAGS@ WRAP_SYSTEM_INCLUDES = @WRAP_SYSTEM_INCLUDES@ diff --git a/config/rules.mk b/config/rules.mk index 69513989e7c..97fc3106f8a 100644 --- a/config/rules.mk +++ b/config/rules.mk @@ -981,6 +981,12 @@ endif SUB_LOBJS = $(shell for lib in $(SHARED_LIBRARY_LIBS); do $(AR_LIST) $${lib} $(CLEANUP1); done;) endif endif +ifdef MOZILLA_PROBE_LIBS +PROBE_LOBJS = $(shell for lib in $(MOZILLA_PROBE_LIBS); do $(AR_LIST) $${lib} $(CLEANUP1); done;) +endif +ifdef DTRACE_PROBE_OBJ +EXTRA_DEPS += $(DTRACE_PROBE_OBJ) +endif $(LIBRARY): $(OBJS) $(LOBJS) $(SHARED_LIBRARY_LIBS) $(EXTRA_DEPS) Makefile Makefile.in rm -f $@ @@ -1070,7 +1076,26 @@ ifdef SHARED_LIBRARY_LIBS @for lib in $(SHARED_LIBRARY_LIBS); do $(AR_EXTRACT) $${lib}; $(CLEANUP2); done endif # SHARED_LIBRARY_LIBS endif # NO_LD_ARCHIVE_FLAGS - $(MKSHLIB) $(SHLIB_LDSTARTFILE) $(OBJS) $(LOBJS) $(SUB_SHLOBJS) $(RESFILE) $(LDFLAGS) $(EXTRA_DSO_LDOPTS) $(OS_LIBS) $(EXTRA_LIBS) $(DEF_FILE) $(SHLIB_LDENDFILE) +ifdef NEED_DTRACE_PROBE_OBJ + @rm -f $(PROBE_LOBJS) + @for lib in $(MOZILLA_PROBE_LIBS); do $(AR_EXTRACT) $${lib}; $(CLEANUP2); done + dtrace -G -C -32 -s $(MOZILLA_DTRACE_SRC) -o $(NEED_DTRACE_PROBE_OBJ) $(PROBE_LOBJS) + @for lib in $(MOZILLA_PROBE_LIBS); do \ + ofiles=`$(AR_LIST) $${lib}`; \ + $(AR_DELETE) $${lib} $$ofiles; \ + done + $(MKSHLIB) $(SHLIB_LDSTARTFILE) $(OBJS) $(LOBJS) $(SUB_SHLOBJS) $(NEED_DTRACE_PROBE_OBJ) $(PROBE_LOBJS) $(RESFILE) $(LDFLAGS) $(EXTRA_DSO_LDOPTS) $(OS_LIBS) $(EXTRA_LIBS) $(DEF_FILE) $(SHLIB_LDENDFILE) + @rm -f $(PROBE_LOBJS) + @rm -f $(NEED_DTRACE_PROBE_OBJ) + @for lib in $(MOZILLA_PROBE_LIBS); do \ + if [ -L $${lib} ]; then rm -f `readlink $${lib}`; fi; \ + done + @rm -f $(MOZILLA_PROBE_LIBS) + +else + $(MKSHLIB) $(SHLIB_LDSTARTFILE) $(OBJS) $(DTRACE_PROBE_OBJ) $(LOBJS) $(SUB_SHLOBJS) $(RESFILE) $(LDFLAGS) $(EXTRA_DSO_LDOPTS) $(OS_LIBS) $(EXTRA_LIBS) $(DEF_FILE) $(SHLIB_LDENDFILE) +endif # NEED_DTRACE_PROBE_OBJ + ifeq (_WINNT,$(GNU_CC)_$(OS_ARCH)) ifdef MSMANIFEST_TOOL ifdef EMBED_MANIFEST_AT diff --git a/configure.in b/configure.in index 5c52f670869..0e44f0ceff3 100644 --- a/configure.in +++ b/configure.in @@ -2807,6 +2807,19 @@ AC_CHECK_HEADER(new, [NEW_H=new]) AC_DEFINE_UNQUOTED(NEW_H, <$NEW_H>) AC_LANG_C +AC_ARG_ENABLE(dtrace, + build with dtrace support if available (default=no), + [enable_dtrace="yes"],) +if test "x$enable_dtrace" = "xyes"; then + AC_CHECK_HEADER(sys/sdt.h, HAVE_DTRACE=1) + if test -n "$HAVE_DTRACE"; then + AC_DEFINE(INCLUDE_MOZILLA_DTRACE) + else + AC_MSG_ERROR([dtrace enabled but sys/std.h not found]); + fi +fi +AC_SUBST(HAVE_DTRACE) + case $target in *-aix4.3*|*-aix5*) ;; diff --git a/probes/Makefile.in b/probes/Makefile.in new file mode 100644 index 00000000000..5836b401a73 --- /dev/null +++ b/probes/Makefile.in @@ -0,0 +1,55 @@ +# ***** BEGIN LICENSE BLOCK ***** +# Version: MPL 1.1/GPL 2.0/LGPL 2.1 +# +# The contents of this file are subject to the Mozilla Public License Version +# 1.1 (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# http://www.mozilla.org/MPL/ +# +# Software distributed under the License is distributed on an "AS IS" basis, +# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License +# for the specific language governing rights and limitations under the +# License. +# +# The Original Code is mozilla.org code. +# +# The Initial Developer of the Original Code is +# Mozilla Corporation. +# Portions created by the Initial Developer are Copyright (C) 2007 +# the Initial Developer. All Rights Reserved. +# +# Contributor(s): +# +# Alternatively, the contents of this file may be used under the terms of +# either the GNU General Public License Version 2 or later (the "GPL"), or +# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), +# in which case the provisions of the GPL or the LGPL are applicable instead +# of those above. If you wish to allow use of your version of this file only +# under the terms of either the GPL or the LGPL, and not to allow others to +# use your version of this file under the terms of the MPL, indicate your +# decision by deleting the provisions above and replace them with the notice +# and other provisions required by the GPL or the LGPL. If you do not delete +# the provisions above, a recipient may use your version of this file under +# the terms of any one of the MPL, the GPL or the LGPL. +# +# ***** END LICENSE BLOCK ***** + +DEPTH = .. +topsrcdir = @top_srcdir@ +srcdir = @srcdir@ +VPATH = @srcdir@ + +include $(DEPTH)/config/autoconf.mk + +ifdef HAVE_DTRACE +export:: $(DIST)/include/mozilla-trace.h + +# Replace _DTRACE_VERSION with INCLUDE_MOZILLA_DTRACE +$(DIST)/include/mozilla-trace.h: mozilla-trace.d Makefile + dtrace -h -s $(srcdir)/mozilla-trace.d -o mozilla-trace.h.tmp + sed -e 's/if _DTRACE_VERSION/ifdef INCLUDE_MOZILLA_DTRACE/' \ + mozilla-trace.h.tmp > $(DIST)/include/mozilla-trace.h + rm mozilla-trace.h.tmp +endif + +include $(topsrcdir)/config/rules.mk diff --git a/probes/mozilla-trace.d b/probes/mozilla-trace.d new file mode 100644 index 00000000000..bd3613436b3 --- /dev/null +++ b/probes/mozilla-trace.d @@ -0,0 +1,48 @@ +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* ***** BEGIN LICENSE BLOCK ***** + * Version: MPL 1.1/GPL 2.0/LGPL 2.1 + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * Copyright (C) 2007 Sun Microsystems, Inc. All Rights Reserved. + * + * Alternatively, the contents of this file may be used under the terms of + * either the GNU General Public License Version 2 or later (the "GPL"), or + * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), + * in which case the provisions of the GPL or the LGPL are applicable instead + * of those above. If you wish to allow use of your version of this file only + * under the terms of either the GPL or the LGPL, and not to allow others to + * use your version of this file under the terms of the MPL, indicate your + * decision by deleting the provisions above and replace them with the notice + * and other provisions required by the GPL or the LGPL. If you do not delete + * the provisions above, a recipient may use your version of this file under + * the terms of any one of the MPL, the GPL or the LGPL. + * + * ***** END LICENSE BLOCK ***** */ +/* + * mozilla provider probes: + * Data types defined in the generated file mozilla-trace.h + * + * TBD + */ + +provider mozilla { + /* Probe definitions go here */ +}; + +/* +#pragma D attributes Unstable/Unstable/Common provider mozilla provider +#pragma D attributes Private/Private/Unknown provider mozilla module +#pragma D attributes Private/Private/Unknown provider mozilla function +#pragma D attributes Unstable/Unstable/Common provider mozilla name +#pragma D attributes Unstable/Unstable/Common provider mozilla args +*/ +