aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--erts/configure.in1
-rw-r--r--lib/Makefile2
-rw-r--r--lib/dtrace/Makefile36
-rw-r--r--lib/dtrace/c_src/Makefile4
-rw-r--r--lib/dtrace/c_src/Makefile.in151
-rw-r--r--lib/dtrace/ebin/.placeholder0
-rw-r--r--lib/dtrace/src/Makefile102
-rw-r--r--lib/dtrace/src/dtrace.app.src27
-rw-r--r--lib/dtrace/src/dtrace.appup.src19
-rw-r--r--lib/dtrace/vsn.mk1
-rw-r--r--lib/runtime_tools/c_src/Makefile.in79
-rw-r--r--lib/runtime_tools/c_src/dtrace_user.d (renamed from lib/dtrace/c_src/dtrace_user.d)0
-rw-r--r--lib/runtime_tools/c_src/dyntrace.c (renamed from lib/dtrace/c_src/dtrace.c)14
-rw-r--r--lib/runtime_tools/examples/dist.d (renamed from lib/dtrace/examples/dist.d)0
-rw-r--r--lib/runtime_tools/examples/dist.systemtap (renamed from lib/dtrace/examples/dist.systemtap)0
-rw-r--r--lib/runtime_tools/examples/driver1.d (renamed from lib/dtrace/examples/driver1.d)0
-rw-r--r--lib/runtime_tools/examples/driver1.systemtap (renamed from lib/dtrace/examples/driver1.systemtap)0
-rw-r--r--lib/runtime_tools/examples/efile_drv.d (renamed from lib/dtrace/examples/efile_drv.d)0
-rw-r--r--lib/runtime_tools/examples/efile_drv.systemtap (renamed from lib/dtrace/examples/efile_drv.systemtap)0
-rw-r--r--lib/runtime_tools/examples/function-calls.d (renamed from lib/dtrace/examples/function-calls.d)0
-rw-r--r--lib/runtime_tools/examples/function-calls.systemtap (renamed from lib/dtrace/examples/function-calls.systemtap)0
-rw-r--r--lib/runtime_tools/examples/garbage-collection.d (renamed from lib/dtrace/examples/garbage-collection.d)0
-rw-r--r--lib/runtime_tools/examples/garbage-collection.systemtap (renamed from lib/dtrace/examples/garbage-collection.systemtap)0
-rw-r--r--lib/runtime_tools/examples/memory1.d (renamed from lib/dtrace/examples/memory1.d)0
-rw-r--r--lib/runtime_tools/examples/memory1.systemtap (renamed from lib/dtrace/examples/memory1.systemtap)0
-rw-r--r--lib/runtime_tools/examples/messages.d (renamed from lib/dtrace/examples/messages.d)0
-rw-r--r--lib/runtime_tools/examples/messages.systemtap (renamed from lib/dtrace/examples/messages.systemtap)0
-rw-r--r--lib/runtime_tools/examples/port1.d (renamed from lib/dtrace/examples/port1.d)0
-rw-r--r--lib/runtime_tools/examples/port1.systemtap (renamed from lib/dtrace/examples/port1.systemtap)0
-rw-r--r--lib/runtime_tools/examples/process-scheduling.d (renamed from lib/dtrace/examples/process-scheduling.d)0
-rw-r--r--lib/runtime_tools/examples/process-scheduling.systemtap (renamed from lib/dtrace/examples/process-scheduling.systemtap)0
-rw-r--r--lib/runtime_tools/examples/spawn-exit.d (renamed from lib/dtrace/examples/spawn-exit.d)0
-rw-r--r--lib/runtime_tools/examples/spawn-exit.systemtap (renamed from lib/dtrace/examples/spawn-exit.systemtap)0
-rw-r--r--lib/runtime_tools/examples/user-probe.d (renamed from lib/dtrace/examples/user-probe.d)0
-rw-r--r--lib/runtime_tools/examples/user-probe.systemtap (renamed from lib/dtrace/examples/user-probe.systemtap)0
-rw-r--r--lib/runtime_tools/src/Makefile10
-rw-r--r--lib/runtime_tools/src/dyntrace.erl (renamed from lib/dtrace/src/dtrace.erl)70
-rw-r--r--lib/runtime_tools/src/runtime_tools.app.src2
38 files changed, 144 insertions, 374 deletions
diff --git a/erts/configure.in b/erts/configure.in
index 15ca2209b7..b94fe86dc7 100644
--- a/erts/configure.in
+++ b/erts/configure.in
@@ -4509,7 +4509,6 @@ dnl
../lib/os_mon/c_src/$host/Makefile:../lib/os_mon/c_src/Makefile.in
dnl ../lib/ssl/c_src/$host/Makefile:../lib/ssl/c_src/Makefile.in
../lib/crypto/c_src/$host/Makefile:../lib/crypto/c_src/Makefile.in
- ../lib/dtrace/c_src/$host/Makefile:../lib/dtrace/c_src/Makefile.in
../lib/orber/c_src/$host/Makefile:../lib/orber/c_src/Makefile.in
../lib/runtime_tools/c_src/$host/Makefile:../lib/runtime_tools/c_src/Makefile.in
../lib/tools/c_src/$host/Makefile:../lib/tools/c_src/Makefile.in
diff --git a/lib/Makefile b/lib/Makefile
index 96ce2d1315..aa4e074830 100644
--- a/lib/Makefile
+++ b/lib/Makefile
@@ -31,7 +31,7 @@ ifdef BUILD_ALL
cosTransactions cosEvent cosTime cosNotification \
cosProperty cosFileTransfer cosEventDomain et megaco webtool \
xmerl edoc eunit ssh inviso typer erl_docgen \
- percept dialyzer dtrace hipe
+ percept dialyzer hipe
EXTRA_FILE := $(wildcard EXTRA-APPLICATIONS)
EXTRA_APPLICATIONS := $(if $(EXTRA_FILE),$(shell cat $(EXTRA_FILE)))
endif
diff --git a/lib/dtrace/Makefile b/lib/dtrace/Makefile
deleted file mode 100644
index 29d463aab1..0000000000
--- a/lib/dtrace/Makefile
+++ /dev/null
@@ -1,36 +0,0 @@
-#
-# %CopyrightBegin%
-#
-# Copyright Ericsson AB 2002-2009. All Rights Reserved.
-#
-# The contents of this file are subject to the Erlang Public License,
-# Version 1.1, (the "License"); you may not use this file except in
-# compliance with the License. You should have received a copy of the
-# Erlang Public License along with this software. If not, it can be
-# retrieved online at http://www.erlang.org/.
-#
-# 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.
-#
-# %CopyrightEnd%
-#
-include $(ERL_TOP)/make/target.mk
-include $(ERL_TOP)/make/$(TARGET)/otp.mk
-
-#
-# Macros
-#
-
-SUB_DIRECTORIES = src c_src
-
-include vsn.mk
-VSN = $(DTRACE_VSN)
-
-SPECIAL_TARGETS =
-
-#
-# Default Subdir Targets
-#
-include $(ERL_TOP)/make/otp_subdir.mk
diff --git a/lib/dtrace/c_src/Makefile b/lib/dtrace/c_src/Makefile
deleted file mode 100644
index a65491d45d..0000000000
--- a/lib/dtrace/c_src/Makefile
+++ /dev/null
@@ -1,4 +0,0 @@
-#
-# Invoke with GNU make
-#
-include $(ERL_TOP)/make/run_make.mk
diff --git a/lib/dtrace/c_src/Makefile.in b/lib/dtrace/c_src/Makefile.in
deleted file mode 100644
index 4d5f59a63d..0000000000
--- a/lib/dtrace/c_src/Makefile.in
+++ /dev/null
@@ -1,151 +0,0 @@
-#
-# %CopyrightBegin%
-#
-# Copyright Scott Lystig Fritchie 2011. All Rights Reserved.
-#
-# The contents of this file are subject to the Erlang Public License,
-# Version 1.1, (the "License"); you may not use this file except in
-# compliance with the License. You should have received a copy of the
-# Erlang Public License along with this software. If not, it can be
-# retrieved online at http://www.erlang.org/.
-#
-# 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.
-#
-# %CopyrightEnd%
-#
-include $(ERL_TOP)/make/target.mk
-include $(ERL_TOP)/make/$(TARGET)/otp.mk
-include $(ERL_TOP)/make/$(TARGET)/otp_ded.mk
-
-# ----------------------------------------------------
-# Items from top-level configure
-# ----------------------------------------------------
-DTRACE_ENABLED=@DTRACE_ENABLED@
-DTRACE_ENABLED_2STEP=@DTRACE_ENABLED_2STEP@
-
-# ----------------------------------------------------
-# Application version
-# ----------------------------------------------------
-include ../vsn.mk
-VSN=$(DTRACE_VSN)
-
-# ----------------------------------------------------
-# The following variables differ between systems.
-# Set by configure.
-# ----------------------------------------------------
-CC = $(DED_CC)
-LD = $(DED_LD)
-SHELL = /bin/sh
-LIBS = $(DED_LIBS)
-LDFLAGS += $(DED_LDFLAGS)
-CFLAGS = $(DED_CFLAGS)
-
-DTRACE_LIBNAME = dtrace
-
-
-INCLUDES = $(DED_INCLUDES)
-
-ifeq ($(TYPE),debug)
-TYPEMARKER = .debug
-TYPE_FLAGS = $(subst -O3,,$(subst -O2,,$(CFLAGS))) -DDEBUG
-else
-ifeq ($(TYPE),valgrind)
-TYPEMARKER = .valgrind
-TYPE_FLAGS = $(subst -O3,,$(subst -O2,,$(CFLAGS))) -DVALGRIND
-else
-TYPEMARKER =
-TYPE_FLAGS = $(CFLAGS)
-endif
-endif
-
-ALL_CFLAGS = $(TYPE_FLAGS) $(INCLUDES) -I$(OBJDIR) \
- -I$(ERL_TOP)/erts/emulator/$(TARGET)
-
-# ----------------------------------------------------
-# Release directory specification
-# ----------------------------------------------------
-RELSYSDIR = $(RELEASE_PATH)/lib/dtrace-$(VSN)
-
-# ----------------------------------------------------
-# Misc Macros
-# ----------------------------------------------------
-before_DTrace_OBJS = $(OBJDIR)/dtrace$(TYPEMARKER).o
-## NIF_MAKEFILE = $(PRIVDIR)/Makefile
-
-# Higher-level makefiles says that we can only compile on UNIX flavors
-NIF_LIB = $(LIBDIR)/dtrace$(TYPEMARKER).@DED_EXT@
-
-ifeq ($(HOST_OS),)
-HOST_OS := $(shell $(ERL_TOP)/erts/autoconf/config.guess)
-endif
-
-# ----------------------------------------------------
-# Targets
-# ----------------------------------------------------
-
-debug opt valgrind: $(OBJDIR) $(LIBDIR) $(NIF_LIB)
-
-ifdef DTRACE_ENABLED
-DTRACE_USER_HEADER=$(OBJDIR)/dtrace_user.h
-$(OBJDIR)/dtrace_user.h: ./dtrace_user.d
- dtrace -h -C $(INCLUDES) \
- -s ./dtrace_user.d \
- -o ./dtrace_user.tmp
- sed -e '/^#define[ ]*ERLANG_[A-Z0-9_]*(.*)/y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/' ./dtrace_user.tmp > $@
- rm ./dtrace_user.tmp
-else
-DTRACE_USER_HEADER=
-endif
-
-DTRACE_OBJS =
-ifdef DTRACE_ENABLED_2STEP
-DTRACE_OBJS += $(OBJDIR)/dtrace_user.o
-$(OBJDIR)/dtrace_user.o: $(before_DTrace_OBJS) $(OBJDIR)/dtrace_user.h
- dtrace -G -C \
- -s ./dtrace_user.d \
- -o $@ $(before_DTrace_OBJS)
-endif
-
-OBJS = $(before_DTrace_OBJS) $(DTRACE_OBJS)
-
-$(OBJDIR):
- -@mkdir -p $(OBJDIR)
-
-$(LIBDIR):
- -@mkdir -p $(LIBDIR)
-
-$(OBJDIR)/%$(TYPEMARKER).o: %.c $(DTRACE_USER_HEADER)
- $(INSTALL_DIR) $(OBJDIR)
- $(CC) -c -o $@ $(ALL_CFLAGS) $<
-
-$(NIF_LIB): $(OBJS)
- $(INSTALL_DIR) $(LIBDIR)
- $(LD) $(LDFLAGS) -o $@ $^ $(LDLIBS)
-
-clean:
- rm -f $(LIBDIR)/dtrace.@DED_EXT@
- rm -f $(LIBDIR)/dtrace.debug.@DED_EXT@
- rm -f $(LIBDIR)/dtrace.valgrind.@DED_EXT@
- rm -f $(OBJDIR)/dtrace.o
- rm -f $(OBJDIR)/dtrace.debug.o
- rm -f $(OBJDIR)/dtrace.valgrind.o
- rm -f core *~
-
-docs:
-
-# ----------------------------------------------------
-# Release Target
-# ----------------------------------------------------
-include $(ERL_TOP)/make/otp_release_targets.mk
-
-release_spec: opt
- $(INSTALL_DIR) $(RELSYSDIR)/priv/obj
- $(INSTALL_DIR) $(RELSYSDIR)/priv/lib
- # $(INSTALL_DATA) $(NIF_MAKEFILE) $(RELSYSDIR)/priv/obj
- $(INSTALL_PROGRAM) $(OBJS) $(RELSYSDIR)/priv/obj
- $(INSTALL_PROGRAM) $(NIF_LIB) $(RELSYSDIR)/priv/lib
-
-release_docs_spec:
diff --git a/lib/dtrace/ebin/.placeholder b/lib/dtrace/ebin/.placeholder
deleted file mode 100644
index e69de29bb2..0000000000
--- a/lib/dtrace/ebin/.placeholder
+++ /dev/null
diff --git a/lib/dtrace/src/Makefile b/lib/dtrace/src/Makefile
deleted file mode 100644
index d613402a63..0000000000
--- a/lib/dtrace/src/Makefile
+++ /dev/null
@@ -1,102 +0,0 @@
-#
-# %CopyrightBegin%
-#
-# Copyright Ericsson AB 2002-2011. All Rights Reserved.
-#
-# The contents of this file are subject to the Erlang Public License,
-# Version 1.1, (the "License"); you may not use this file except in
-# compliance with the License. You should have received a copy of the
-# Erlang Public License along with this software. If not, it can be
-# retrieved online at http://www.erlang.org/.
-#
-# 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.
-#
-# %CopyrightEnd%
-#
-include $(ERL_TOP)/make/target.mk
-include $(ERL_TOP)/make/$(TARGET)/otp.mk
-
-# ----------------------------------------------------
-# Application version
-# ----------------------------------------------------
-include ../vsn.mk
-VSN=$(DTRACE_VSN)
-
-# ----------------------------------------------------
-# Release directory specification
-# ----------------------------------------------------
-RELSYSDIR = $(RELEASE_PATH)/lib/dtrace-$(VSN)
-
-# ----------------------------------------------------
-# Common Macros
-# ----------------------------------------------------
-
-MODULES= \
- dtrace
-
-HRL_FILES= \
-
-INTERNAL_HRL_FILES= \
-
-ERL_FILES= $(MODULES:%=%.erl)
-EXAMPLE_FILES= \
- ../examples/*
-
-TARGET_FILES= $(MODULES:%=$(EBIN)/%.$(EMULATOR)) $(APP_TARGET) $(APPUP_TARGET)
-
-EXECUTABLES= \
-
-APP_FILE= dtrace.app
-
-APP_SRC= $(APP_FILE).src
-APP_TARGET= $(EBIN)/$(APP_FILE)
-
-APPUP_FILE= dtrace.appup
-
-APPUP_SRC= $(APPUP_FILE).src
-APPUP_TARGET= $(EBIN)/$(APPUP_FILE)
-
-# ----------------------------------------------------
-# FLAGS
-# ----------------------------------------------------
-ERL_COMPILE_FLAGS += \
- -I../include \
- -I ../../et/include \
- -I ../../../libraries/et/include
-
-# ----------------------------------------------------
-# Targets
-# ----------------------------------------------------
-
-debug opt: $(TARGET_FILES)
-
-clean:
- rm -f $(TARGET_FILES)
- rm -f errs core *~
-
-$(APP_TARGET): $(APP_SRC) ../vsn.mk
- sed -e 's;%VSN%;$(VSN);' $< > $@
-
-$(APPUP_TARGET): $(APPUP_SRC) ../vsn.mk
- sed -e 's;%VSN%;$(VSN);' $< > $@
-
-docs:
-
-# ----------------------------------------------------
-# Release Target
-# ----------------------------------------------------
-include $(ERL_TOP)/make/otp_release_targets.mk
-
-release_spec: opt
- $(INSTALL_DIR) $(RELSYSDIR)/src
- $(INSTALL_DATA) $(ERL_FILES) $(RELSYSDIR)/src
- # $(INSTALL_DATA) $(INTERNAL_HRL_FILES) $(RELSYSDIR)/src
- $(INSTALL_DIR) $(RELSYSDIR)/examples
- $(INSTALL_DATA) $(EXAMPLE_FILES) $(RELSYSDIR)/examples
- $(INSTALL_DIR) $(RELSYSDIR)/ebin
- $(INSTALL_DATA) $(TARGET_FILES) $(RELSYSDIR)/ebin
-
-release_docs_spec:
diff --git a/lib/dtrace/src/dtrace.app.src b/lib/dtrace/src/dtrace.app.src
deleted file mode 100644
index 764e863559..0000000000
--- a/lib/dtrace/src/dtrace.app.src
+++ /dev/null
@@ -1,27 +0,0 @@
-%%
-%% %CopyrightBegin%
-%%
-%% Copyright Ericsson AB 2002-2009. All Rights Reserved.
-%%
-%% The contents of this file are subject to the Erlang Public License,
-%% Version 1.1, (the "License"); you may not use this file except in
-%% compliance with the License. You should have received a copy of the
-%% Erlang Public License along with this software. If not, it can be
-%% retrieved online at http://www.erlang.org/.
-%%
-%% 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.
-%%
-%% %CopyrightEnd%
-%%
-{application, dtrace,
- [{description, "DTRACE version 1"},
- {vsn, "%VSN%"},
- {modules, [
- dtrace
- ]},
- {registered, []},
- {applications, [kernel, stdlib]},
- {env, []}]}.
diff --git a/lib/dtrace/src/dtrace.appup.src b/lib/dtrace/src/dtrace.appup.src
deleted file mode 100644
index f730a2f8df..0000000000
--- a/lib/dtrace/src/dtrace.appup.src
+++ /dev/null
@@ -1,19 +0,0 @@
-%%
-%% %CopyrightBegin%
-%%
-%% Copyright Ericsson AB 2002-2009. All Rights Reserved.
-%%
-%% The contents of this file are subject to the Erlang Public License,
-%% Version 1.1, (the "License"); you may not use this file except in
-%% compliance with the License. You should have received a copy of the
-%% Erlang Public License along with this software. If not, it can be
-%% retrieved online at http://www.erlang.org/.
-%%
-%% 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.
-%%
-%% %CopyrightEnd%
-%%
-{"%VSN%",[],[]}.
diff --git a/lib/dtrace/vsn.mk b/lib/dtrace/vsn.mk
deleted file mode 100644
index 73bf983c00..0000000000
--- a/lib/dtrace/vsn.mk
+++ /dev/null
@@ -1 +0,0 @@
-DTRACE_VSN = 0.8
diff --git a/lib/runtime_tools/c_src/Makefile.in b/lib/runtime_tools/c_src/Makefile.in
index 3d9a7ed69d..120f9b913f 100644
--- a/lib/runtime_tools/c_src/Makefile.in
+++ b/lib/runtime_tools/c_src/Makefile.in
@@ -21,6 +21,11 @@ include $(ERL_TOP)/make/$(TARGET)/otp.mk
include $(ERL_TOP)/make/$(TARGET)/otp_ded.mk
# ----------------------------------------------------
+# Items from top-level configure
+# ----------------------------------------------------
+DTRACE_ENABLED=@DTRACE_ENABLED@
+DTRACE_ENABLED_2STEP=@DTRACE_ENABLED_2STEP@
+# ----------------------------------------------------
# Application version
# ----------------------------------------------------
include ../vsn.mk
@@ -38,6 +43,8 @@ SHELL = /bin/sh
LIBS = $(DED_LIBS)
LDFLAGS += $(DED_LDFLAGS)
+DTRACE_LIBNAME = dyntrace
+
SYSINCLUDE = $(DED_SYS_INCLUDE)
ifeq ($(findstring vxworks,$(TARGET)),vxworks)
SYSINCLUDE += -I$(ERL_TOP)/erts/etc/vxworks
@@ -45,15 +52,20 @@ endif
TRACE_DRV_INCLUDES = $(SYSINCLUDE)
-ALL_CFLAGS = $(CFLAGS) @DEFS@ $(TYPE_FLAGS) $(TRACE_DRV_INCLUDES)
-
+ALL_CFLAGS = $(CFLAGS) @DEFS@ $(TYPE_FLAGS) $(TRACE_DRV_INCLUDES) \
+ -I$(OBJDIR) -I$(ERL_TOP)/erts/emulator/$(TARGET)
ifeq ($(TYPE),debug)
TYPEMARKER = .debug
-TYPE_FLAGS = -g -DDEBUG @DEBUG_FLAGS@
+TYPE_FLAGS = $(subst -O3,,$(subst -O2,,$(CFLAGS))) -DDEBUG @DEBUG_FLAGS@
+else
+ifeq ($(TYPE),valgrind)
+TYPEMARKER = .valgrind
+TYPE_FLAGS = $(subst -O3,,$(subst -O2,,$(CFLAGS))) -DVALGRIND
else
TYPEMARKER =
-TYPE_FLAGS = -O2
+TYPE_FLAGS = $(CFLAGS)
+endif
endif
ROOTDIR = $(ERL_TOP)/lib
@@ -69,6 +81,16 @@ RELSYSDIR = $(RELEASE_PATH)/lib/runtime_tools-$(VSN)
# ----------------------------------------------------
# Misc Macros
# ----------------------------------------------------
+before_DTrace_OBJS = $(OBJDIR)/dyntrace$(TYPEMARKER).o
+## NIF_MAKEFILE = $(PRIVDIR)/Makefile
+
+# Higher-level makefiles says that we can only compile on UNIX flavors
+NIF_LIB = $(LIBDIR)/dyntrace$(TYPEMARKER).@DED_EXT@
+
+ifeq ($(HOST_OS),)
+HOST_OS := $(shell $(ERL_TOP)/erts/autoconf/config.guess)
+endif
+
TRACE_IP_DRV_OBJS = \
$(OBJDIR)/trace_ip_drv.o
@@ -91,7 +113,44 @@ endif
_create_dirs := $(shell mkdir -p $(OBJDIR) $(LIBDIR))
-debug opt: $(SOLIBS)
+debug opt valgrind: $(SOLIBS) $(OBJDIR) $(LIBDIR) $(NIF_LIB)
+
+ifdef DTRACE_ENABLED
+DTRACE_USER_HEADER=$(OBJDIR)/dtrace_user.h
+$(OBJDIR)/dtrace_user.h: ./dtrace_user.d
+ dtrace -h -C $(INCLUDES) \
+ -s ./dtrace_user.d \
+ -o ./dtrace_user.tmp
+ sed -e '/^#define[ ]*ERLANG_[A-Z0-9_]*(.*)/y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/' ./dtrace_user.tmp > $@
+ rm ./dtrace_user.tmp
+else
+DTRACE_USER_HEADER=
+endif
+
+DTRACE_OBJS =
+ifdef DTRACE_ENABLED_2STEP
+DTRACE_OBJS += $(OBJDIR)/dtrace_user.o
+$(OBJDIR)/dtrace_user.o: $(before_DTrace_OBJS) $(OBJDIR)/dtrace_user.h
+ dtrace -G -C \
+ -s ./dtrace_user.d \
+ -o $@ $(before_DTrace_OBJS)
+endif
+
+DYNTRACE_OBJS = $(before_DTrace_OBJS) $(DTRACE_OBJS)
+
+$(OBJDIR):
+ -@mkdir -p $(OBJDIR)
+
+$(LIBDIR):
+ -@mkdir -p $(LIBDIR)
+
+$(OBJDIR)/dyntrace$(TYPEMARKER).o: dyntrace.c $(DTRACE_USER_HEADER)
+ $(INSTALL_DIR) $(OBJDIR)
+ $(CC) -c -o $@ $(ALL_CFLAGS) $<
+
+$(NIF_LIB): $(DYNTRACE_OBJS)
+ $(INSTALL_DIR) $(LIBDIR)
+ $(LD) $(LDFLAGS) -o $@ $^ $(LDLIBS)
$(OBJDIR)/%.o: %.c
$(CC) -c -o $@ $(ALL_CFLAGS) $<
@@ -118,6 +177,12 @@ $(LIBDIR)/trace_file_drv.eld: $(TRACE_FILE_DRV_OBJS)
clean:
rm -f $(SOLIBS) $(TRACE_IP_DRV_OBJS) $(TRACE_FILE_DRV_OBJS)
+ rm -f $(LIBDIR)/dyntrace.@DED_EXT@
+ rm -f $(LIBDIR)/dyntrace.debug.@DED_EXT@
+ rm -f $(LIBDIR)/dyntrace.valgrind.@DED_EXT@
+ rm -f $(OBJDIR)/dyntrace.o
+ rm -f $(OBJDIR)/dyntrace.debug.o
+ rm -f $(OBJDIR)/dyntrace.valgrind.o
rm -f core *~
docs:
@@ -128,8 +193,10 @@ docs:
include $(ERL_TOP)/make/otp_release_targets.mk
release_spec: opt
+ $(INSTALL_DIR) $(RELSYSDIR)/priv/obj
$(INSTALL_DIR) $(RELSYSDIR)/priv/lib
- $(INSTALL_PROGRAM) $(SOLIBS) $(RELSYSDIR)/priv/lib
+ $(INSTALL_PROGRAM) $(DYNTRACE_OBJS) $(RELSYSDIR)/priv/obj
+ $(INSTALL_PROGRAM) $(NIF_LIB) $(SOLIBS) $(RELSYSDIR)/priv/lib
release_docs_spec:
diff --git a/lib/dtrace/c_src/dtrace_user.d b/lib/runtime_tools/c_src/dtrace_user.d
index 45d3ef3b66..45d3ef3b66 100644
--- a/lib/dtrace/c_src/dtrace_user.d
+++ b/lib/runtime_tools/c_src/dtrace_user.d
diff --git a/lib/dtrace/c_src/dtrace.c b/lib/runtime_tools/c_src/dyntrace.c
index 90bb39a4b8..d94014559d 100644
--- a/lib/dtrace/c_src/dtrace.c
+++ b/lib/runtime_tools/c_src/dyntrace.c
@@ -22,11 +22,15 @@
*/
+
#include "erl_nif.h"
#include "config.h"
#include "sys.h"
#include "dtrace-wrapper.h"
-#ifdef HAVE_DTRACE
+#if defined(USE_DYNAMIC_TRACE) && (defined(USE_DTRACE) || defined(USE_SYSTEMTAP))
+#define HAVE_USE_DTRACE 1
+#endif
+#ifdef HAVE_USE_DTRACE
#include "dtrace_user.h"
#endif
@@ -59,7 +63,7 @@ static ErlNifFunc nif_funcs[] = {
{"user_trace_i4s4", 9, user_trace_i4s4}
};
-ERL_NIF_INIT(dtrace, nif_funcs, load, NULL, NULL, NULL)
+ERL_NIF_INIT(dyntrace, nif_funcs, load, NULL, NULL, NULL)
static ERL_NIF_TERM atom_true;
static ERL_NIF_TERM atom_false;
@@ -82,7 +86,7 @@ static int load(ErlNifEnv* env, void** priv_data, ERL_NIF_TERM load_info)
static ERL_NIF_TERM available(ErlNifEnv* env, int argc, const ERL_NIF_TERM argv[])
{
-#ifdef HAVE_DTRACE
+#ifdef HAVE_USE_DTRACE
return atom_true;
#else
return atom_false;
@@ -91,7 +95,7 @@ static ERL_NIF_TERM available(ErlNifEnv* env, int argc, const ERL_NIF_TERM argv[
static ERL_NIF_TERM user_trace_s1(ErlNifEnv* env, int argc, const ERL_NIF_TERM argv[])
{
-#ifdef HAVE_DTRACE
+#ifdef HAVE_USE_DTRACE
ErlNifBinary message_bin;
DTRACE_CHARBUF(messagebuf, MESSAGE_BUFSIZ + 1);
@@ -130,7 +134,7 @@ get_string_maybe(ErlNifEnv *env,
static ERL_NIF_TERM user_trace_i4s4(ErlNifEnv* env, int argc, const ERL_NIF_TERM argv[])
{
-#ifdef HAVE_DTRACE
+#ifdef HAVE_USE_DTRACE
DTRACE_CHARBUF(procbuf, 32 + 1);
DTRACE_CHARBUF(user_tagbuf, MESSAGE_BUFSIZ + 1);
char *utbuf = NULL;
diff --git a/lib/dtrace/examples/dist.d b/lib/runtime_tools/examples/dist.d
index 550e10d363..550e10d363 100644
--- a/lib/dtrace/examples/dist.d
+++ b/lib/runtime_tools/examples/dist.d
diff --git a/lib/dtrace/examples/dist.systemtap b/lib/runtime_tools/examples/dist.systemtap
index af27b2cab6..af27b2cab6 100644
--- a/lib/dtrace/examples/dist.systemtap
+++ b/lib/runtime_tools/examples/dist.systemtap
diff --git a/lib/dtrace/examples/driver1.d b/lib/runtime_tools/examples/driver1.d
index 9f53ffeb2a..9f53ffeb2a 100644
--- a/lib/dtrace/examples/driver1.d
+++ b/lib/runtime_tools/examples/driver1.d
diff --git a/lib/dtrace/examples/driver1.systemtap b/lib/runtime_tools/examples/driver1.systemtap
index 8b99e465b7..8b99e465b7 100644
--- a/lib/dtrace/examples/driver1.systemtap
+++ b/lib/runtime_tools/examples/driver1.systemtap
diff --git a/lib/dtrace/examples/efile_drv.d b/lib/runtime_tools/examples/efile_drv.d
index 085995ce58..085995ce58 100644
--- a/lib/dtrace/examples/efile_drv.d
+++ b/lib/runtime_tools/examples/efile_drv.d
diff --git a/lib/dtrace/examples/efile_drv.systemtap b/lib/runtime_tools/examples/efile_drv.systemtap
index 5a47b3e22b..5a47b3e22b 100644
--- a/lib/dtrace/examples/efile_drv.systemtap
+++ b/lib/runtime_tools/examples/efile_drv.systemtap
diff --git a/lib/dtrace/examples/function-calls.d b/lib/runtime_tools/examples/function-calls.d
index 238c5211ac..238c5211ac 100644
--- a/lib/dtrace/examples/function-calls.d
+++ b/lib/runtime_tools/examples/function-calls.d
diff --git a/lib/dtrace/examples/function-calls.systemtap b/lib/runtime_tools/examples/function-calls.systemtap
index 8fc4375135..8fc4375135 100644
--- a/lib/dtrace/examples/function-calls.systemtap
+++ b/lib/runtime_tools/examples/function-calls.systemtap
diff --git a/lib/dtrace/examples/garbage-collection.d b/lib/runtime_tools/examples/garbage-collection.d
index f234e7d4db..f234e7d4db 100644
--- a/lib/dtrace/examples/garbage-collection.d
+++ b/lib/runtime_tools/examples/garbage-collection.d
diff --git a/lib/dtrace/examples/garbage-collection.systemtap b/lib/runtime_tools/examples/garbage-collection.systemtap
index 64d69c6fbd..64d69c6fbd 100644
--- a/lib/dtrace/examples/garbage-collection.systemtap
+++ b/lib/runtime_tools/examples/garbage-collection.systemtap
diff --git a/lib/dtrace/examples/memory1.d b/lib/runtime_tools/examples/memory1.d
index c2e16e0779..c2e16e0779 100644
--- a/lib/dtrace/examples/memory1.d
+++ b/lib/runtime_tools/examples/memory1.d
diff --git a/lib/dtrace/examples/memory1.systemtap b/lib/runtime_tools/examples/memory1.systemtap
index 9723f2d02d..9723f2d02d 100644
--- a/lib/dtrace/examples/memory1.systemtap
+++ b/lib/runtime_tools/examples/memory1.systemtap
diff --git a/lib/dtrace/examples/messages.d b/lib/runtime_tools/examples/messages.d
index 6361f3a220..6361f3a220 100644
--- a/lib/dtrace/examples/messages.d
+++ b/lib/runtime_tools/examples/messages.d
diff --git a/lib/dtrace/examples/messages.systemtap b/lib/runtime_tools/examples/messages.systemtap
index ff8f4076b1..ff8f4076b1 100644
--- a/lib/dtrace/examples/messages.systemtap
+++ b/lib/runtime_tools/examples/messages.systemtap
diff --git a/lib/dtrace/examples/port1.d b/lib/runtime_tools/examples/port1.d
index 204abbd3b8..204abbd3b8 100644
--- a/lib/dtrace/examples/port1.d
+++ b/lib/runtime_tools/examples/port1.d
diff --git a/lib/dtrace/examples/port1.systemtap b/lib/runtime_tools/examples/port1.systemtap
index a63d9b670c..a63d9b670c 100644
--- a/lib/dtrace/examples/port1.systemtap
+++ b/lib/runtime_tools/examples/port1.systemtap
diff --git a/lib/dtrace/examples/process-scheduling.d b/lib/runtime_tools/examples/process-scheduling.d
index 79e9cc598c..79e9cc598c 100644
--- a/lib/dtrace/examples/process-scheduling.d
+++ b/lib/runtime_tools/examples/process-scheduling.d
diff --git a/lib/dtrace/examples/process-scheduling.systemtap b/lib/runtime_tools/examples/process-scheduling.systemtap
index c8cee60a07..c8cee60a07 100644
--- a/lib/dtrace/examples/process-scheduling.systemtap
+++ b/lib/runtime_tools/examples/process-scheduling.systemtap
diff --git a/lib/dtrace/examples/spawn-exit.d b/lib/runtime_tools/examples/spawn-exit.d
index 7310f3343d..7310f3343d 100644
--- a/lib/dtrace/examples/spawn-exit.d
+++ b/lib/runtime_tools/examples/spawn-exit.d
diff --git a/lib/dtrace/examples/spawn-exit.systemtap b/lib/runtime_tools/examples/spawn-exit.systemtap
index 5e3be9fc1b..5e3be9fc1b 100644
--- a/lib/dtrace/examples/spawn-exit.systemtap
+++ b/lib/runtime_tools/examples/spawn-exit.systemtap
diff --git a/lib/dtrace/examples/user-probe.d b/lib/runtime_tools/examples/user-probe.d
index 13baff6a32..13baff6a32 100644
--- a/lib/dtrace/examples/user-probe.d
+++ b/lib/runtime_tools/examples/user-probe.d
diff --git a/lib/dtrace/examples/user-probe.systemtap b/lib/runtime_tools/examples/user-probe.systemtap
index 84a45709e8..84a45709e8 100644
--- a/lib/dtrace/examples/user-probe.systemtap
+++ b/lib/runtime_tools/examples/user-probe.systemtap
diff --git a/lib/runtime_tools/src/Makefile b/lib/runtime_tools/src/Makefile
index 946409b262..6dc89bea32 100644
--- a/lib/runtime_tools/src/Makefile
+++ b/lib/runtime_tools/src/Makefile
@@ -45,6 +45,7 @@ MODULES= \
runtime_tools \
runtime_tools_sup \
dbg \
+ dyntrace \
percept_profile \
observer_backend \
ttb_autostart
@@ -64,10 +65,15 @@ APPUP_FILE= runtime_tools.appup
APPUP_SRC= $(APPUP_FILE).src
APPUP_TARGET= $(EBIN)/$(APPUP_FILE)
+EXAMPLE_FILES= \
+ ../examples/*
# ----------------------------------------------------
# FLAGS
# ----------------------------------------------------
-ERL_COMPILE_FLAGS += -I../include
+ERL_COMPILE_FLAGS += \
+ -I../include \
+ -I ../../et/include \
+ -I ../../../libraries/et/include
# ----------------------------------------------------
# Targets
@@ -97,6 +103,8 @@ release_spec: opt
$(INSTALL_DATA) $(ERL_FILES) $(RELSYSDIR)/src
$(INSTALL_DIR) $(RELSYSDIR)/include
$(INSTALL_DATA) $(HRL_FILES) $(RELSYSDIR)/include
+ $(INSTALL_DIR) $(RELSYSDIR)/examples
+ $(INSTALL_DATA) $(EXAMPLE_FILES) $(RELSYSDIR)/examples
$(INSTALL_DIR) $(RELSYSDIR)/ebin
$(INSTALL_DATA) $(TARGET_FILES) $(RELSYSDIR)/ebin
diff --git a/lib/dtrace/src/dtrace.erl b/lib/runtime_tools/src/dyntrace.erl
index 71a1a3480e..20472a2be6 100644
--- a/lib/dtrace/src/dtrace.erl
+++ b/lib/runtime_tools/src/dyntrace.erl
@@ -1,27 +1,28 @@
--module(dtrace).
+-module(dyntrace).
-%%% @doc The DTrace interface module
+%%% @doc The Dynamic tracing interface module
%%%
-%%% This DTrace interface module, with the corresponding NIFs, should
-%%% work on any operating system platform where user-space DTrace
-%%% probes are supported.
+%%% This Dynamic tracing interface module, with the corresponding NIFs, should
+%%% work on any operating system platform where user-space DTrace/Systemtap
+%%% (and in the future LttNG UST) probes are supported.
%%%
-%%% Use the `dtrace:init()' function to load the NIF shared library and
+%%% Use the `dyntrace:init()' function to load the NIF shared library and
%%% to initialize library's private state.
%%%
-%%% It is recommended that you use the `dtrace:p()' function to add
-%%% DTrace probes to your Erlang code. This function can accept up to
+%%% It is recommended that you use the `dyntrace:p()' function to add
+%%% Dynamic trace probes to your Erlang code. This function can accept up to
%%% four integer arguments and four string arguments; the integer
%%% argument(s) must come before any string argument. For example:
%%% ```
-%%% 1> dtrace:put_tag("GGOOOAAALL!!!!!").
+%%% 1> dyntrace:put_utag("GGOOOAAALL!!!!!").
%%% true
-%%% 2> dtrace:init().
+%%% 2> dyntrace:init().
%%% ok
%%%
-%%% % % % Enable the DTrace probe using the 'dtrace' command.
+%%% % % % If using dtrace, enable the Dynamic trace probe using the 'dtrace'
+%%% % % % command.
%%%
-%%% 3> dtrace:p(7, 8, 9, "one", "four").
+%%% 3> dyntrace:p(7, 8, 9, "one", "four").
%%% true
%%% '''
%%%
@@ -35,29 +36,60 @@
%%% then the driver will ignore the user's input and use a default
%%% value of 0 or NULL, respectively.
--export([init/0, available/0,
+-export([available/0,
user_trace_s1/1, % TODO: unify with pid & tag args like user_trace_i4s4
p/0, p/1, p/2, p/3, p/4, p/5, p/6, p/7, p/8]).
-export([put_utag/1, get_utag/0, get_utag_data/0, spread_utag/1, restore_utag/1]).
-export([scaff/0]). % Development only
-export([user_trace_i4s4/9]). % Know what you're doing!
+-on_load(on_load/0).
-type probe_arg() :: integer() | iolist().
-type int_p_arg() :: integer() | iolist() | undef.
+
%% The *_maybe() types use atom() instead of a stricter 'undef'
%% because user_trace_i4s4/9 is exposed to the outside world, and
%% because the driver will allow any atom to be used as a "not
%% present" indication, we'll allow any atom in the types.
+
-type integer_maybe() :: integer() | atom().
-type iolist_maybe() :: iolist() | atom().
--spec init() -> ok | {error, {term(), term()}}.
-
-init() ->
- PrivDir = code:priv_dir(dtrace),
- Lib = filename:join([PrivDir, "lib", "dtrace"]),
- erlang:load_nif(Lib, 0).
+on_load() ->
+ PrivDir = code:priv_dir(runtime_tools),
+ LibName = "dyntrace",
+ Lib = filename:join([PrivDir, "lib", LibName]),
+ Status = case erlang:load_nif(Lib, 0) of
+ ok -> ok;
+ {error, {load_failed, _}}=Error1 ->
+ ArchLibDir =
+ filename:join([PrivDir, "lib",
+ erlang:system_info(system_architecture)]),
+ Candidate =
+ filelib:wildcard(filename:join([ArchLibDir,LibName ++ "*" ])),
+ case Candidate of
+ [] -> Error1;
+ _ ->
+ ArchLib = filename:join([ArchLibDir, LibName]),
+ erlang:load_nif(ArchLib, 0)
+ end;
+ Error1 -> Error1
+ end,
+ case Status of
+ ok -> ok;
+ {error, {E, Str}} ->
+ case erlang:system_info(dynamic_trace) of
+ none ->
+ ok;
+ _ ->
+ error_logger:error_msg("Unable to load dyntrace library. Failed with error:~n
+\"~p, ~s\"~n"
+ "Dynamic tracing is enabled but the driver is not built correctly~n",[
+ E,Str]),
+ Status
+ end
+ end.
%%%
%%% NIF placeholders
diff --git a/lib/runtime_tools/src/runtime_tools.app.src b/lib/runtime_tools/src/runtime_tools.app.src
index 76fd998530..a9d2d68857 100644
--- a/lib/runtime_tools/src/runtime_tools.app.src
+++ b/lib/runtime_tools/src/runtime_tools.app.src
@@ -23,7 +23,7 @@
inviso_rt,inviso_rt_lib,inviso_rt_meta,
inviso_as_lib,inviso_autostart,inviso_autostart_server,
runtime_tools,runtime_tools_sup,erts_alloc_config,
- ttb_autostart]},
+ ttb_autostart,dyntrace]},
{registered, [runtime_tools_sup,inviso_rt,inviso_rt_meta]},
{applications, [kernel, stdlib]},
% {env, [{inviso_autostart_mod,your_own_autostart_module}]},