]> granicus.if.org Git - php/commitdiff
Introduced zend.enable_dtrace INI directive to enable/disable PHP call tracing
authorDmitry Stogov <dmitry@zend.com>
Fri, 18 Nov 2016 09:23:10 +0000 (12:23 +0300)
committerDmitry Stogov <dmitry@zend.com>
Fri, 18 Nov 2016 09:23:10 +0000 (12:23 +0300)
NEWS
Zend/zend.c
Zend/zend_globals.h

diff --git a/NEWS b/NEWS
index 94826541fd71d1324fc9baa13cbf8e1a0f886ea6..a96d1c61acbf6dce95aa933cf2d2dce5f7724bda 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -8,6 +8,10 @@ PHP                                                                        NEWS
 - Date:
   . Fixed bug #69587 (DateInterval properties and isset). (jhdxr)
 
+- DTrace
+  . Introduced zend.enable_dtrace INI directive to enable/disable PHP
+    call tracing. It's disabled by default. (Dmitry)
+
 - Mbstring:
   . Fixed bug #73532 (Null pointer dereference in mb_eregi). (Laruence)
 
index 12801c8b70a322efca3f43ca53ea3a9e8dc05698..8d221e82aa526fbb933591e5142714f0b2973ddf 100644 (file)
@@ -134,6 +134,9 @@ ZEND_INI_BEGIN()
        STD_ZEND_INI_BOOLEAN("zend.multibyte", "0", ZEND_INI_PERDIR, OnUpdateBool, multibyte,      zend_compiler_globals, compiler_globals)
        ZEND_INI_ENTRY("zend.script_encoding",                  NULL,           ZEND_INI_ALL,           OnUpdateScriptEncoding)
        STD_ZEND_INI_BOOLEAN("zend.detect_unicode",                     "1",    ZEND_INI_ALL,           OnUpdateBool, detect_unicode, zend_compiler_globals, compiler_globals)
+#if HAVE_DTRACE
+       STD_ZEND_INI_BOOLEAN("zend.enable_dtrace",                      "0",    ZEND_INI_SYSTEM,        OnUpdateBool, dtrace_enable,  zend_executor_globals, executor_globals)
+#endif
 #ifdef ZEND_SIGNALS
        STD_ZEND_INI_BOOLEAN("zend.signal_check", "0", ZEND_INI_SYSTEM, OnUpdateBool, check, zend_signal_globals_t, zend_signal_globals)
 #endif
@@ -691,16 +694,9 @@ int zend_startup(zend_utility_functions *utility_functions, char **extensions) /
 
        zend_interrupt_function = NULL;
 
-#if HAVE_DTRACE
-/* build with dtrace support */
-       zend_compile_file = dtrace_compile_file;
-       zend_execute_ex = dtrace_execute_ex;
-       zend_execute_internal = dtrace_execute_internal;
-#else
        zend_compile_file = compile_file;
        zend_execute_ex = execute_ex;
        zend_execute_internal = NULL;
-#endif /* HAVE_SYS_SDT_H */
        zend_compile_string = compile_string;
        zend_throw_exception_hook = NULL;
 
@@ -826,6 +822,14 @@ void zend_post_startup(void) /* {{{ */
 #else
        virtual_cwd_deactivate();
 #endif
+#if HAVE_DTRACE
+       /* build with dtrace support */
+       if (EG(dtrace_enable)) {
+               zend_compile_file = dtrace_compile_file;
+               zend_execute_ex = dtrace_execute_ex;
+               zend_execute_internal = dtrace_execute_internal;
+       }
+#endif
 }
 /* }}} */
 
index fbbf503c4125494c82fce74d90e0ae2c46296ac1..4609c2637471be3f0ae56c9f4c395e19fb5a9cf6 100644 (file)
@@ -217,6 +217,10 @@ struct _zend_executor_globals {
        zend_bool active;
        zend_bool valid_symbol_table;
 
+#if HAVE_DTRACE
+       zend_bool dtrace_enable;
+#endif
+
        zend_long assertions;
 
        uint32_t           ht_iterators_count;     /* number of allocatd slots */