From: Dmitry Stogov Date: Fri, 18 Nov 2016 09:23:10 +0000 (+0300) Subject: Introduced zend.enable_dtrace INI directive to enable/disable PHP call tracing X-Git-Tag: php-7.1.0~3^2~14 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=01239b0effbc1839aca6d03cdd4c3a0c1a509798;p=php Introduced zend.enable_dtrace INI directive to enable/disable PHP call tracing --- diff --git a/NEWS b/NEWS index 94826541fd..a96d1c61ac 100644 --- 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) diff --git a/Zend/zend.c b/Zend/zend.c index 12801c8b70..8d221e82aa 100644 --- a/Zend/zend.c +++ b/Zend/zend.c @@ -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 } /* }}} */ diff --git a/Zend/zend_globals.h b/Zend/zend_globals.h index fbbf503c41..4609c26374 100644 --- a/Zend/zend_globals.h +++ b/Zend/zend_globals.h @@ -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 */