Skip to content
This repository has been archived by the owner on Oct 3, 2020. It is now read-only.

Commit

Permalink
Landing basic framework for dtrace support (bug 388564). Patch by joh…
Browse files Browse the repository at this point in the history
…n.rice@sun.com and padraig.obriain@sun.com. r+a=ted.mielczarek@gmail.com, sr=sayrer@gmail.com
  • Loading branch information
jst@mozilla.org committed Oct 10, 2007
1 parent 929d3ee commit d49aba1
Show file tree
Hide file tree
Showing 7 changed files with 145 additions and 1 deletion.
1 change: 1 addition & 0 deletions Makefile.in
Expand Up @@ -58,6 +58,7 @@ TIERS += base
tier_base_dirs = \
config \
build \
probes \
$(NULL)

include $(topsrcdir)/$(MOZ_BUILD_APP)/build.mk
Expand Down
1 change: 1 addition & 0 deletions allmakefiles.sh
Expand Up @@ -63,6 +63,7 @@ config/Makefile
config/autoconf.mk
config/mkdepend/Makefile
config/doxygen.cfg
probes/Makefile
extensions/Makefile
"

Expand Down
1 change: 1 addition & 0 deletions config/autoconf.mk.in
Expand Up @@ -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@
Expand Down
27 changes: 26 additions & 1 deletion config/rules.mk
Expand Up @@ -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 $@
Expand Down Expand Up @@ -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
Expand Down
13 changes: 13 additions & 0 deletions configure.in
Expand Up @@ -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*)
;;
Expand Down
55 changes: 55 additions & 0 deletions 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
48 changes: 48 additions & 0 deletions 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
*/

0 comments on commit d49aba1

Please sign in to comment.