5
|
1 |
Index: php-5.2.12/Zend/zend_dtrace.d
|
|
2 |
===================================================================
|
|
3 |
--- php-5.2.12.orig/Zend/zend_dtrace.d Thu Dec 17 18:45:36 2009
|
|
4 |
+++ php-5.2.12/Zend/zend_dtrace.d Thu Dec 17 18:48:23 2009
|
|
5 |
@@ -0,0 +1,39 @@
|
|
6 |
+/*
|
|
7 |
+ +----------------------------------------------------------------------+
|
|
8 |
+ | Zend Engine |
|
|
9 |
+ +----------------------------------------------------------------------+
|
|
10 |
+ | Copyright (c) 1998-2009 Zend Technologies Ltd. (http://www.zend.com) |
|
|
11 |
+ +----------------------------------------------------------------------+
|
|
12 |
+ | This source file is subject to version 2.00 of the Zend license, |
|
|
13 |
+ | that is bundled with this package in the file LICENSE, and is |
|
|
14 |
+ | available through the world-wide-web at the following url: |
|
|
15 |
+ | http://www.zend.com/license/2_00.txt. |
|
|
16 |
+ | If you did not receive a copy of the Zend license and are unable to |
|
|
17 |
+ | obtain it through the world-wide-web, please send a note to |
|
|
18 |
+ | [email protected] so we can mail you a copy immediately. |
|
|
19 |
+ +----------------------------------------------------------------------+
|
|
20 |
+ | Authors: David Soria Parra <[email protected]> |
|
|
21 |
+ +----------------------------------------------------------------------+
|
|
22 |
+*/
|
|
23 |
+
|
|
24 |
+/* $Id: $ */
|
|
25 |
+
|
|
26 |
+provider php {
|
|
27 |
+ probe exception__caught(char *classname);
|
|
28 |
+ probe exception__thrown(char* classname);
|
|
29 |
+ probe request__startup(char* request_file, char* request_uri, char* request_method);
|
|
30 |
+ probe request__shutdown(char* request_file, char* request_uri, char* request_method);
|
|
31 |
+ probe compile__file__entry(char * compile_file, char *compile_file_translated);
|
|
32 |
+ probe compile__file__return(char *compile_file, char *compile_file_translated);
|
|
33 |
+ probe error(char *errormsg, char *request_file, int lineno);
|
|
34 |
+ probe execute__entry(char* request_file, int lineno);
|
|
35 |
+ probe execute__return(char* request_file, int lineno);
|
|
36 |
+ probe function__entry(char* function_name, char* request_file, int lineno, char* classname, char* scope);
|
|
37 |
+ probe function__return(char* function_name, char* request_file, int lineno, char* classname, char* scope);
|
|
38 |
+ probe object__create(char *classname, char* request_file, int lineno);
|
|
39 |
+ probe object__destroy(char *classname, char* request_file, int lineno);
|
|
40 |
+};
|
|
41 |
+
|
|
42 |
+/*#pragma D attributes Private/Private/Unknown provider php module
|
|
43 |
+#pragma D attributes Private/Private/Unknown provider php function
|
|
44 |
+#pragma D attributes Evolving/Evolving/Common provider php provider */
|
|
45 |
Index: php-5.2.12/Zend/zend_dtrace.h
|
|
46 |
===================================================================
|
|
47 |
--- php-5.2.12.orig/Zend/zend_dtrace.h Thu Dec 17 18:45:36 2009
|
|
48 |
+++ php-5.2.12/Zend/zend_dtrace.h Thu Dec 17 18:48:23 2009
|
|
49 |
@@ -0,0 +1,49 @@
|
|
50 |
+/*
|
|
51 |
+ +----------------------------------------------------------------------+
|
|
52 |
+ | Zend Engine |
|
|
53 |
+ +----------------------------------------------------------------------+
|
|
54 |
+ | Copyright (c) 1998-2009 Zend Technologies Ltd. (http://www.zend.com) |
|
|
55 |
+ +----------------------------------------------------------------------+
|
|
56 |
+ | This source file is subject to version 2.00 of the Zend license, |
|
|
57 |
+ | that is bundled with this package in the file LICENSE, and is |
|
|
58 |
+ | available through the world-wide-web at the following url: |
|
|
59 |
+ | http://www.zend.com/license/2_00.txt. |
|
|
60 |
+ | If you did not receive a copy of the Zend license and are unable to |
|
|
61 |
+ | obtain it through the world-wide-web, please send a note to |
|
|
62 |
+ | [email protected] so we can mail you a copy immediately. |
|
|
63 |
+ +----------------------------------------------------------------------+
|
|
64 |
+ | Authors: David Soria Parra <[email protected]> |
|
|
65 |
+ +----------------------------------------------------------------------+
|
|
66 |
+*/
|
|
67 |
+
|
|
68 |
+/* $Id: $ */
|
|
69 |
+
|
|
70 |
+#ifndef _ZEND_DTRACE_H
|
|
71 |
+#define _ZEND_DTRACE_H
|
|
72 |
+
|
|
73 |
+#ifndef ZEND_WIN32
|
|
74 |
+# include <unistd.h>
|
|
75 |
+#endif
|
|
76 |
+
|
|
77 |
+#ifdef __cplusplus
|
|
78 |
+extern "C" {
|
|
79 |
+#endif
|
|
80 |
+
|
|
81 |
+#ifdef HAVE_DTRACE
|
0
|
82 |
+ZEND_API zend_op_array *(*zend_dtrace_compile_file)(zend_file_handle *file_handle, int type TSRMLS_DC);
|
|
83 |
+ZEND_API void (*zend_dtrace_execute)(zend_op_array *op_array TSRMLS_DC);
|
|
84 |
+ZEND_API void (*zend_dtrace_execute_internal)(zend_execute_data *execute_data_ptr, int return_value_used TSRMLS_DC);
|
|
85 |
+
|
5
|
86 |
+ZEND_API zend_op_array *dtrace_compile_file(zend_file_handle *file_handle, int type TSRMLS_DC);
|
|
87 |
+ZEND_API void dtrace_execute(zend_op_array *op_array TSRMLS_DC);
|
|
88 |
+ZEND_API void dtrace_execute_internal(zend_execute_data *execute_data_ptr, int return_value_used TSRMLS_DC);
|
|
89 |
+ZEND_API char *dtrace_get_executed_filename(TSRMLS_D);
|
|
90 |
+#include <zend_dtrace_gen.h>
|
|
91 |
+
|
|
92 |
+#endif /* HAVE_DTRACE */
|
|
93 |
+
|
|
94 |
+#ifdef __cplusplus
|
|
95 |
+}
|
|
96 |
+#endif
|
|
97 |
+
|
|
98 |
+#endif /* _ZEND_DTRACE_H */
|
|
99 |
Index: php-5.2.12/Zend/zend_dtrace.c
|
|
100 |
===================================================================
|
|
101 |
--- php-5.2.12.orig/Zend/zend_dtrace.c Thu Dec 17 18:45:36 2009
|
|
102 |
+++ php-5.2.12/Zend/zend_dtrace.c Thu Dec 17 18:48:23 2009
|
|
103 |
@@ -0,0 +1,107 @@
|
|
104 |
+/*
|
|
105 |
+ +----------------------------------------------------------------------+
|
|
106 |
+ | Zend Engine |
|
|
107 |
+ +----------------------------------------------------------------------+
|
|
108 |
+ | Copyright (c) 1998-2009 Zend Technologies Ltd. (http://www.zend.com) |
|
|
109 |
+ +----------------------------------------------------------------------+
|
|
110 |
+ | This source file is subject to version 2.00 of the Zend license, |
|
|
111 |
+ | that is bundled with this package in the file LICENSE, and is |
|
|
112 |
+ | available through the world-wide-web at the following url: |
|
|
113 |
+ | http://www.zend.com/license/2_00.txt. |
|
|
114 |
+ | If you did not receive a copy of the Zend license and are unable to |
|
|
115 |
+ | obtain it through the world-wide-web, please send a note to |
|
|
116 |
+ | [email protected] so we can mail you a copy immediately. |
|
|
117 |
+ +----------------------------------------------------------------------+
|
|
118 |
+ | Authors: David Soria Parra <[email protected]> |
|
|
119 |
+ +----------------------------------------------------------------------+
|
|
120 |
+*/
|
|
121 |
+
|
|
122 |
+/* $Id: $ */
|
|
123 |
+
|
|
124 |
+#include "zend.h"
|
|
125 |
+#include "zend_API.h"
|
|
126 |
+#include "zend_dtrace.h"
|
|
127 |
+
|
|
128 |
+#ifdef HAVE_DTRACE
|
|
129 |
+/* PHP DTrace probes {{{ */
|
|
130 |
+ZEND_API char *dtrace_get_executed_filename(TSRMLS_D)
|
|
131 |
+{
|
|
132 |
+ if (EG(current_execute_data) && EG(current_execute_data)->op_array) {
|
|
133 |
+ return EG(current_execute_data)->op_array->filename;
|
|
134 |
+ } else {
|
|
135 |
+ return zend_get_executed_filename(TSRMLS_C);
|
|
136 |
+ }
|
|
137 |
+}
|
|
138 |
+
|
0
|
139 |
+ZEND_API zend_op_array *dtrace_compile_file(zend_file_handle *file_handle, int type TSRMLS_DC)
|
|
140 |
+{
|
|
141 |
+ zend_op_array *res;
|
|
142 |
+ DTRACE_COMPILE_FILE_ENTRY(file_handle->opened_path, file_handle->filename);
|
|
143 |
+ res = compile_file(file_handle, type TSRMLS_CC);
|
|
144 |
+ DTRACE_COMPILE_FILE_RETURN(file_handle->opened_path, file_handle->filename);
|
|
145 |
+
|
|
146 |
+ return res;
|
|
147 |
+}
|
|
148 |
+
|
5
|
149 |
+/* We wrap the execute function to have fire the execute-entry/return and function-entry/return probes */
|
0
|
150 |
+ZEND_API void dtrace_execute(zend_op_array *op_array TSRMLS_DC)
|
|
151 |
+{
|
|
152 |
+ int lineno;
|
|
153 |
+ char *scope, *filename, *funcname, *classname;
|
|
154 |
+ scope = filename = funcname = classname = NULL;
|
5
|
155 |
+
|
|
156 |
+ /* we need filename and lineno for both execute and function probes */
|
0
|
157 |
+ if (DTRACE_EXECUTE_ENTRY_ENABLED() || DTRACE_EXECUTE_RETURN_ENABLED()) {
|
5
|
158 |
+ filename = dtrace_get_executed_filename(TSRMLS_C);
|
0
|
159 |
+ lineno = zend_get_executed_lineno(TSRMLS_C);
|
|
160 |
+ }
|
5
|
161 |
+
|
0
|
162 |
+ if (DTRACE_FUNCTION_ENTRY_ENABLED() || DTRACE_FUNCTION_RETURN_ENABLED()) {
|
5
|
163 |
+ filename = dtrace_get_executed_filename(TSRMLS_C);
|
0
|
164 |
+ classname = get_active_class_name(&scope TSRMLS_CC);
|
|
165 |
+ funcname = get_active_function_name(TSRMLS_C);
|
|
166 |
+ lineno = zend_get_executed_lineno(TSRMLS_C);
|
|
167 |
+ }
|
5
|
168 |
+
|
|
169 |
+ if (DTRACE_EXECUTE_ENTRY_ENABLED()) {
|
|
170 |
+ DTRACE_EXECUTE_ENTRY(filename, lineno);
|
|
171 |
+ }
|
|
172 |
+
|
|
173 |
+ if (DTRACE_FUNCTION_ENTRY_ENABLED() && funcname != NULL) {
|
0
|
174 |
+ DTRACE_FUNCTION_ENTRY(funcname, filename, lineno, classname, scope);
|
|
175 |
+ }
|
|
176 |
+
|
|
177 |
+ execute(op_array TSRMLS_CC);
|
|
178 |
+
|
5
|
179 |
+ if (DTRACE_FUNCTION_RETURN_ENABLED() && funcname != NULL) {
|
|
180 |
+ DTRACE_FUNCTION_RETURN(funcname, filename, lineno, classname, scope);
|
|
181 |
+ }
|
0
|
182 |
+
|
5
|
183 |
+ if (DTRACE_EXECUTE_RETURN_ENABLED()) {
|
|
184 |
+ DTRACE_EXECUTE_RETURN(filename, lineno);
|
0
|
185 |
+ }
|
|
186 |
+}
|
|
187 |
+
|
|
188 |
+ZEND_API void dtrace_execute_internal(zend_execute_data *execute_data_ptr, int return_value_used TSRMLS_DC)
|
|
189 |
+{
|
|
190 |
+ int lineno;
|
|
191 |
+ char *filename;
|
|
192 |
+ if (DTRACE_EXECUTE_ENTRY_ENABLED() || DTRACE_EXECUTE_RETURN_ENABLED()) {
|
5
|
193 |
+ filename = dtrace_get_executed_filename(TSRMLS_C);
|
0
|
194 |
+ lineno = zend_get_executed_lineno(TSRMLS_C);
|
|
195 |
+ }
|
|
196 |
+
|
5
|
197 |
+ if (DTRACE_EXECUTE_ENTRY_ENABLED()) {
|
|
198 |
+ DTRACE_EXECUTE_ENTRY(filename, lineno);
|
|
199 |
+ }
|
0
|
200 |
+
|
5
|
201 |
+ execute_internal(execute_data_ptr, return_value_used TSRMLS_CC);
|
0
|
202 |
+
|
5
|
203 |
+ if (DTRACE_EXECUTE_RETURN_ENABLED()) {
|
|
204 |
+ DTRACE_EXECUTE_RETURN(filename, lineno);
|
|
205 |
+ }
|
0
|
206 |
+}
|
|
207 |
+
|
5
|
208 |
+/* }}} */
|
|
209 |
+#endif /* HAVE_DTRACE */
|
0
|
210 |
+
|
5
|
211 |
Index: php-5.2.9/Zend/zend_dtrace_gen.php
|
|
212 |
===================================================================
|
|
213 |
--- php-5.2.9.orig/Zend/zend_dtrace_gen.php Thu Apr 02 22:18:32 2009 +0200
|
|
214 |
+++ php-5.2.9/Zend/zend_dtrace_gen.php Thu Apr 02 22:18:32 2009 +0200
|
0
|
215 |
@@ -0,0 +1,32 @@
|
|
216 |
+<?php
|
|
217 |
+/*
|
|
218 |
+ +----------------------------------------------------------------------+
|
|
219 |
+ | Zend Engine |
|
|
220 |
+ +----------------------------------------------------------------------+
|
|
221 |
+ | Copyright (c) 1998-2009 Zend Technologies Ltd. (http://www.zend.com) |
|
|
222 |
+ +----------------------------------------------------------------------+
|
|
223 |
+ | This source file is subject to version 2.00 of the Zend license, |
|
|
224 |
+ | that is bundled with this package in the file LICENSE, and is |
|
|
225 |
+ | available through the world-wide-web at the following url: |
|
|
226 |
+ | http://www.zend.com/license/2_00.txt. |
|
|
227 |
+ | If you did not receive a copy of the Zend license and are unable to |
|
|
228 |
+ | obtain it through the world-wide-web, please send a note to |
|
|
229 |
+ | [email protected] so we can mail you a copy immediately. |
|
|
230 |
+ +----------------------------------------------------------------------+
|
|
231 |
+ | Authors: David Soria Parra <[email protected]> |
|
|
232 |
+ +----------------------------------------------------------------------+
|
|
233 |
+
|
|
234 |
+ $Id:$
|
|
235 |
+*/
|
|
236 |
+
|
|
237 |
+echo "regenerating zend_dtrace.h\n";
|
|
238 |
+system('dtrace -h -s zend_dtrace.d');
|
|
239 |
+
|
|
240 |
+echo "renaming probe definitions\n";
|
|
241 |
+$content = file_get_contents('zend_dtrace.h');
|
5
|
242 |
+$content = str_replace('#define PHP_', '#define DTRACE_', $content);
|
0
|
243 |
+$content = str_replace('PHP_STABILITY', 'DTRACE_STABILITY', $content);
|
|
244 |
+$content = str_replace('PHP_TYPEDEFS', 'DTRACE_TYPEDEFS', $content);
|
|
245 |
+$content = str_replace('#if _DTRACE_VERSION', '#if _DTRACE_VERSION && HAVE_SYS_SDT_H', $content);
|
|
246 |
+file_put_contents('zend_dtrace.h', $content);
|
|
247 |
+
|
5
|
248 |
Index: php-5.2.11/Zend/zend.c
|
|
249 |
===================================================================
|
|
250 |
--- php-5.2.11.orig/Zend/zend.c 2009-11-02 02:59:10.971196190 +0100
|
|
251 |
+++ php-5.2.11/Zend/zend.c 2009-11-02 02:59:56.087087949 +0100
|
|
252 |
@@ -28,6 +28,7 @@
|
|
253 |
#include "zend_exceptions.h"
|
|
254 |
#include "zend_builtin_functions.h"
|
|
255 |
#include "zend_ini.h"
|
|
256 |
+#include "zend_dtrace.h"
|
|
257 |
|
|
258 |
#ifdef ZTS
|
|
259 |
# define GLOBAL_FUNCTION_TABLE global_function_table
|
|
260 |
@@ -603,10 +604,17 @@
|
|
261 |
zend_vspprintf = utility_functions->vspprintf_function;
|
|
262 |
zend_getenv = utility_functions->getenv_function;
|
|
263 |
|
|
264 |
+#if HAVE_DTRACE
|
|
265 |
+/* build with dtrace support */
|
|
266 |
+ zend_compile_file = dtrace_compile_file;
|
|
267 |
+ zend_execute = dtrace_execute;
|
|
268 |
+ zend_execute_internal = dtrace_execute_internal;
|
|
269 |
+#else
|
|
270 |
zend_compile_file = compile_file;
|
|
271 |
- zend_compile_string = compile_string;
|
|
272 |
zend_execute = execute;
|
|
273 |
zend_execute_internal = NULL;
|
|
274 |
+#endif /* HAVE_SYS_SDT_H */
|
|
275 |
+ zend_compile_string = compile_string;
|
|
276 |
zend_throw_exception_hook = NULL;
|
|
277 |
|
|
278 |
zend_init_opcodes_handlers();
|
|
279 |
@@ -961,6 +970,15 @@
|
|
280 |
|
|
281 |
va_start(args, format);
|
|
282 |
|
|
283 |
+#ifdef HAVE_DTRACE
|
|
284 |
+ if(DTRACE_ERROR_ENABLED()) {
|
|
285 |
+ char *dtrace_error_buffer;
|
|
286 |
+ zend_vspprintf(&dtrace_error_buffer, 0, format, args);
|
|
287 |
+ DTRACE_ERROR(dtrace_error_buffer, error_filename, error_lineno);
|
|
288 |
+ efree(dtrace_error_buffer);
|
|
289 |
+ }
|
|
290 |
+#endif /* HAVE_DTRACE */
|
|
291 |
+
|
|
292 |
/* if we don't have a user defined error handler */
|
|
293 |
if (!EG(user_error_handler)
|
|
294 |
|| !(EG(user_error_handler_error_reporting) & type)) {
|
|
295 |
Index: php-5.2.12/Zend/zend_API.c
|
|
296 |
===================================================================
|
|
297 |
--- php-5.2.12.orig/Zend/zend_API.c.NEW2 Sat Sep 5 12:01:06 2009
|
|
298 |
+++ php-5.2.12/Zend/zend_API.c Thu Dec 17 18:48:23 2009
|
|
299 |
@@ -25,11 +25,16 @@
|
|
300 |
#include "zend_API.h"
|
|
301 |
#include "zend_modules.h"
|
|
302 |
#include "zend_constants.h"
|
|
303 |
+#include "zend_dtrace.h"
|
|
304 |
|
|
305 |
#ifdef HAVE_STDARG_H
|
|
306 |
#include <stdarg.h>
|
|
307 |
#endif
|
|
308 |
|
|
309 |
+#ifdef HAVE_DTRACE
|
|
310 |
+extern char* dtrace_get_executed_filename(TSRMLS_D);
|
|
311 |
+#endif
|
|
312 |
+
|
|
313 |
/* these variables are true statics/globals, and have to be mutex'ed on every access */
|
|
314 |
static int module_count=0;
|
|
315 |
ZEND_API HashTable module_registry;
|
|
316 |
@@ -942,6 +947,17 @@
|
|
317 |
zend_error(E_ERROR, "Cannot instantiate %s %s", what, class_type->name);
|
|
318 |
}
|
|
319 |
|
|
320 |
+#ifdef HAVE_DTRACE
|
|
321 |
+ if (DTRACE_OBJECT_CREATE_ENABLED()) {
|
|
322 |
+ char *filename;
|
|
323 |
+ int lineno;
|
|
324 |
+
|
|
325 |
+ filename = dtrace_get_executed_filename(TSRMLS_C);
|
|
326 |
+ lineno = zend_get_executed_lineno(TSRMLS_C);
|
|
327 |
+ DTRACE_OBJECT_CREATE(class_type->name, filename, lineno);
|
|
328 |
+ }
|
|
329 |
+#endif /* HAVE_DTRACE */
|
|
330 |
+
|
|
331 |
zend_update_class_constants(class_type TSRMLS_CC);
|
|
332 |
|
|
333 |
Z_TYPE_P(arg) = IS_OBJECT;
|
|
334 |
Index: php-5.2.12/Zend/zend_objects.c
|
|
335 |
===================================================================
|
|
336 |
--- php-5.2.12.orig/Zend/zend_objects.c Mon Oct 12 10:09:11 2009
|
|
337 |
+++ php-5.2.12/Zend/zend_objects.c Thu Dec 17 18:48:23 2009
|
|
338 |
@@ -25,6 +25,7 @@
|
|
339 |
#include "zend_API.h"
|
|
340 |
#include "zend_interfaces.h"
|
|
341 |
#include "zend_exceptions.h"
|
|
342 |
+#include "zend_dtrace.h"
|
|
343 |
|
|
344 |
ZEND_API void zend_object_std_init(zend_object *object, zend_class_entry *ce TSRMLS_DC)
|
|
345 |
{
|
|
346 |
@@ -51,6 +52,16 @@
|
|
347 |
{
|
|
348 |
zend_function *destructor = object ? object->ce->destructor : NULL;
|
|
349 |
|
|
350 |
+#ifdef HAVE_DTRACE
|
|
351 |
+ if (DTRACE_OBJECT_DESTROY_ENABLED()) {
|
|
352 |
+ char *filename;
|
|
353 |
+ int lineno;
|
|
354 |
+
|
|
355 |
+ filename = dtrace_get_executed_filename(TSRMLS_C);
|
|
356 |
+ lineno = zend_get_executed_lineno(TSRMLS_C);
|
|
357 |
+ DTRACE_OBJECT_DESTROY(object->ce->name, filename, lineno);
|
|
358 |
+ }
|
|
359 |
+#endif /* HAVE_DTRACE */
|
|
360 |
if (destructor) {
|
|
361 |
zval *obj;
|
|
362 |
zval *old_exception;
|
|
363 |
Index: php-5.2.11/Zend/zend_exceptions.c
|
|
364 |
===================================================================
|
|
365 |
--- php-5.2.11.orig/Zend/zend_exceptions.c 2009-11-02 02:59:10.970676604 +0100
|
|
366 |
+++ php-5.2.11/Zend/zend_exceptions.c 2009-11-02 02:59:56.084156777 +0100
|
0
|
367 |
@@ -26,6 +26,7 @@
|
|
368 |
#include "zend_builtin_functions.h"
|
|
369 |
#include "zend_interfaces.h"
|
|
370 |
#include "zend_exceptions.h"
|
|
371 |
+#include "zend_dtrace.h"
|
|
372 |
|
|
373 |
zend_class_entry *default_exception_ce;
|
|
374 |
zend_class_entry *error_exception_ce;
|
5
|
375 |
@@ -34,6 +35,15 @@
|
0
|
376 |
|
|
377 |
void zend_throw_exception_internal(zval *exception TSRMLS_DC) /* {{{ */
|
|
378 |
{
|
5
|
379 |
+#ifdef HAVE_DTRACE
|
0
|
380 |
+ if (DTRACE_EXCEPTION_THROWN_ENABLED()) {
|
5
|
381 |
+ char *classname;
|
0
|
382 |
+ int name_len;
|
5
|
383 |
+ zend_get_object_classname(exception, &classname, &name_len TSRMLS_CC);
|
|
384 |
+ DTRACE_EXCEPTION_THROWN(classname);
|
0
|
385 |
+ }
|
5
|
386 |
+#endif /* HAVE_DTRACE */
|
0
|
387 |
+
|
|
388 |
if (exception != NULL) {
|
|
389 |
if (EG(exception)) {
|
|
390 |
/* FIXME: bail out? */
|
5
|
391 |
Index: php-5.2.11/Zend/zend_execute.c
|
|
392 |
===================================================================
|
|
393 |
--- php-5.2.11.orig/Zend/zend_execute.c 2009-11-02 02:59:10.971029046 +0100
|
|
394 |
+++ php-5.2.11/Zend/zend_execute.c 2009-11-02 02:59:56.084688879 +0100
|
0
|
395 |
@@ -35,6 +35,7 @@
|
|
396 |
#include "zend_exceptions.h"
|
|
397 |
#include "zend_interfaces.h"
|
|
398 |
#include "zend_vm.h"
|
|
399 |
+#include "zend_dtrace.h"
|
|
400 |
|
|
401 |
/* Virtual current working directory support */
|
|
402 |
#include "tsrm_virtual_cwd.h"
|
5
|
403 |
Index: php-5.2.11/Zend/zend_vm_def.h
|
|
404 |
===================================================================
|
198
|
405 |
--- php-5.2.17/Zend/zend_vm_def.h.ORIG Mon Jul 5 02:08:35 2010
|
|
406 |
+++ php-5.2.17/Zend/zend_vm_def.h Mon Jan 31 13:46:32 2011
|
|
407 |
@@ -2249,6 +2249,11 @@
|
0
|
408 |
ZEND_VM_CONTINUE(); /* CHECK_ME */
|
|
409 |
}
|
|
410 |
ce = Z_OBJCE_P(EG(exception));
|
|
411 |
+
|
5
|
412 |
+#ifdef HAVE_DTRACE
|
|
413 |
+ DTRACE_EXCEPTION_CAUGHT(ce->name);
|
|
414 |
+#endif /* HAVE_DTRACE */
|
|
415 |
+
|
|
416 |
if (ce != EX_T(opline->op1.u.var).class_entry) {
|
|
417 |
if (!instanceof_function(ce, EX_T(opline->op1.u.var).class_entry TSRMLS_CC)) {
|
|
418 |
if (opline->op1.u.EA.type) {
|
|
419 |
Index: php-5.2.11/Zend/zend_vm_execute.h
|
|
420 |
===================================================================
|
|
421 |
--- php-5.2.11.orig/Zend/zend_vm_execute.h 2009-11-02 02:59:10.970794327 +0100
|
|
422 |
+++ php-5.2.11/Zend/zend_vm_execute.h 2009-11-02 02:59:56.095206861 +0100
|
|
423 |
@@ -333,6 +333,11 @@
|
|
424 |
ZEND_VM_CONTINUE(); /* CHECK_ME */
|
|
425 |
}
|
|
426 |
ce = Z_OBJCE_P(EG(exception));
|
|
427 |
+
|
|
428 |
+#ifdef HAVE_DTRACE
|
|
429 |
+ DTRACE_EXCEPTION_CAUGHT(ce->name);
|
|
430 |
+#endif /* HAVE_DTRACE */
|
0
|
431 |
+
|
|
432 |
if (ce != EX_T(opline->op1.u.var).class_entry) {
|
|
433 |
if (!instanceof_function(ce, EX_T(opline->op1.u.var).class_entry TSRMLS_CC)) {
|
|
434 |
if (opline->op1.u.EA.type) {
|
5
|
435 |
Index: php-5.2.11/main/main.c
|
|
436 |
===================================================================
|
|
437 |
--- php-5.2.11.orig/main/main.c 2009-11-02 02:59:10.970427110 +0100
|
|
438 |
+++ php-5.2.11/main/main.c 2009-11-02 02:59:56.083717631 +0100
|
|
439 |
@@ -81,6 +81,7 @@
|
|
440 |
#include "zend_indent.h"
|
|
441 |
#include "zend_extensions.h"
|
|
442 |
#include "zend_ini.h"
|
|
443 |
+#include "zend_dtrace.h"
|
|
444 |
|
|
445 |
#include "php_content_types.h"
|
|
446 |
#include "php_ticks.h"
|
|
447 |
@@ -1260,6 +1261,10 @@
|
|
448 |
{
|
|
449 |
int retval = SUCCESS;
|
|
450 |
|
|
451 |
+#ifdef HAVE_DTRACE
|
|
452 |
+ DTRACE_REQUEST_STARTUP(SAFE_FILENAME(SG(request_info).path_translated), SAFE_FILENAME(SG(request_info).request_uri), SAFE_FILENAME(SG(request_info).request_method));
|
|
453 |
+#endif /* HAVE_DTRACE */
|
0
|
454 |
+
|
5
|
455 |
#ifdef PHP_WIN32
|
|
456 |
PG(com_initialized) = 0;
|
|
457 |
#endif
|
|
458 |
@@ -1534,6 +1539,10 @@
|
|
459 |
PG(com_initialized) = 0;
|
|
460 |
}
|
|
461 |
#endif
|
0
|
462 |
+
|
5
|
463 |
+#ifdef HAVE_DTRACE
|
|
464 |
+ DTRACE_REQUEST_SHUTDOWN(SAFE_FILENAME(SG(request_info).path_translated), SAFE_FILENAME(SG(request_info).request_uri), SAFE_FILENAME(SG(request_info).request_method));
|
|
465 |
+#endif /* HAVE_DTRACE */
|
|
466 |
}
|
|
467 |
/* }}} */
|
|
468 |
|
|
469 |
Index: php-5.2.11/main/php_config.h.in
|
|
470 |
===================================================================
|
198
|
471 |
--- php-5.2.17/main/php_config.h.in.ORIG Thu Jan 6 15:04:47 2011
|
|
472 |
+++ php-5.2.17/main/php_config.h.in Mon Jan 31 13:46:34 2011
|
|
473 |
@@ -725,6 +725,9 @@
|
5
|
474 |
/* Define if you have the <sys/resource.h> header file. */
|
|
475 |
#undef HAVE_SYS_RESOURCE_H
|
|
476 |
|
|
477 |
+/* Define to 1 if you have the <sys/sdt.h> header file. */
|
|
478 |
+#undef HAVE_SYS_SDT_H
|
|
479 |
+
|
|
480 |
/* Define if you have the <sys/select.h> header file. */
|
|
481 |
#undef HAVE_SYS_SELECT_H
|
|
482 |
|
|
483 |
Index: php-5.2.12/acinclude.m4
|
|
484 |
===================================================================
|
198
|
485 |
--- php-5.2.17/acinclude.m4.ORIG Wed May 5 14:55:44 2010
|
|
486 |
+++ php-5.2.17/acinclude.m4 Mon Jan 31 13:46:34 2011
|
|
487 |
@@ -2877,3 +2877,56 @@
|
0
|
488 |
fi
|
|
489 |
])
|
|
490 |
|
|
491 |
+dnl
|
|
492 |
+dnl Generate dtrace targets
|
|
493 |
+dnl
|
|
494 |
+AC_DEFUN([PHP_GENERATE_DTRACE],[
|
|
495 |
+ old_IFS=[$]IFS
|
|
496 |
+ IFS=.
|
|
497 |
+ set $ac_src
|
|
498 |
+ IFS=$old_IFS
|
|
499 |
+ build_target=$2
|
|
500 |
+ PHP_GLOBAL_OBJS="[$]PHP_GLOBAL_OBJS $1.o"
|
|
501 |
+ for src in $PHP_DTRACE_OBJS; do
|
|
502 |
+ case [$]build_target in
|
|
503 |
+ *)
|
5
|
504 |
+ obj="$obj `dirname $src`/.libs/`basename $src | sed 's,\.lo$,.o,'` " ;;
|
0
|
505 |
+ esac
|
|
506 |
+ done
|
|
507 |
+
|
|
508 |
+ cat >>Makefile.objects<<EOF
|
|
509 |
+$1.o: \$(PHP_DTRACE_OBJS)
|
|
510 |
+ dtrace -G -o $1.o -s $1 $obj
|
|
511 |
+EOF
|
|
512 |
+
|
|
513 |
+])
|
|
514 |
+
|
|
515 |
+dnl
|
|
516 |
+dnl Link given source files with dtrace
|
|
517 |
+dnl PHP_ADD_DTRACE(providerdesc, sources, module)
|
|
518 |
+dnl
|
|
519 |
+AC_DEFUN([PHP_ADD_DTRACE],[
|
|
520 |
+ case "$3" in
|
5
|
521 |
+ ""[)] unset ac_bdir;;
|
|
522 |
+ /*[)] ac_bdir=$ac_srcdir;;
|
|
523 |
+ *[)] extdir=PHP_EXT_DIR($3); ac_bdir="$extdir/";;
|
0
|
524 |
+ esac
|
|
525 |
+ old_IFS=[$]IFS
|
|
526 |
+ for ac_src in $2; do
|
|
527 |
+ IFS=.
|
|
528 |
+ set $ac_src
|
|
529 |
+ ac_obj=[$]1
|
|
530 |
+ IFS=$old_IFS
|
|
531 |
+
|
|
532 |
+ PHP_DTRACE_OBJS="[$]PHP_DTRACE_OBJS [$]ac_bdir[$]ac_obj.lo"
|
|
533 |
+ done;
|
|
534 |
+])
|
5
|
535 |
+
|
|
536 |
+dnl
|
|
537 |
+dnl Generate platform specific dtrace header
|
|
538 |
+dnl
|
|
539 |
+AC_DEFUN([PHP_INIT_DTRACE], [
|
|
540 |
+ dtrace -h -C -s $1 -o $2
|
|
541 |
+ $SED -ibak 's,PHP_,DTRACE_,g' $2
|
|
542 |
+])
|
|
543 |
+
|
198
|
544 |
|
5
|
545 |
Index: php-5.2.12/configure.in
|
|
546 |
===================================================================
|
198
|
547 |
--- php-5.2.17/configure.in.ORIG Thu Jan 6 15:01:19 2011
|
|
548 |
+++ php-5.2.17/configure.in Mon Jan 31 13:46:34 2011
|
|
549 |
@@ -881,6 +881,23 @@
|
0
|
550 |
AC_DEFINE(HAVE_IPV6, 1, [Whether to enable IPv6 support])
|
|
551 |
fi
|
|
552 |
|
|
553 |
+dnl ## DTRACE CHECHKS
|
|
554 |
+dnl ## this needs to be done before SAPI configureation
|
5
|
555 |
+PHP_ARG_ENABLE(dtrace, whether to enable DTrace support,
|
0
|
556 |
+[ --enable-dtrace Enable DTrace support], no, no)
|
|
557 |
+
|
|
558 |
+dnl ## DTRACE CHECHKS
|
|
559 |
+dnl ## this needs to be done before SAPI configureation
|
|
560 |
+if test "$PHP_DTRACE" = "yes"; then
|
|
561 |
+ AC_CHECK_HEADERS([sys/sdt.h],
|
|
562 |
+ [PHP_ADD_DTRACE([Zend/zend_dtrace.d], [main/main.c, Zend/zend_API.c \
|
5
|
563 |
+ Zend/zend_execute.c Zend/zend_exceptions.c Zend/zend_objects.c \
|
|
564 |
+ Zend/zend_dtrace.c Zend/zend.c])
|
|
565 |
+ AC_DEFINE(HAVE_DTRACE, 1, [Whether to enable DTrace support])
|
|
566 |
+ PHP_INIT_DTRACE([Zend/zend_dtrace.d], [Zend/zend_dtrace_gen.h])],
|
0
|
567 |
+ [])
|
|
568 |
+fi
|
|
569 |
+
|
|
570 |
AC_MSG_CHECKING([how big to make fd sets])
|
|
571 |
PHP_ARG_ENABLE(fd-setsize,,
|
|
572 |
[ --enable-fd-setsize Set size of descriptor sets], no, no)
|
198
|
573 |
@@ -1211,6 +1228,7 @@
|
0
|
574 |
PHP_SUBST(PHP_CLI_TARGET)
|
|
575 |
PHP_SUBST(PHP_SAPI_OBJS)
|
|
576 |
PHP_SUBST(PHP_CLI_OBJS)
|
|
577 |
+PHP_SUBST(PHP_DTRACE_OBJS)
|
|
578 |
PHP_SUBST(PHP_GLOBAL_OBJS)
|
|
579 |
|
|
580 |
PHP_SUBST(PHP_MODULES)
|
198
|
581 |
@@ -1400,7 +1418,7 @@
|
5
|
582 |
PHP_ADD_SOURCES(Zend, \
|
|
583 |
zend_language_parser.c zend_language_scanner.c \
|
|
584 |
zend_ini_parser.c zend_ini_scanner.c \
|
|
585 |
- zend_alloc.c zend_compile.c zend_constants.c zend_dynamic_array.c \
|
|
586 |
+ zend_alloc.c zend_compile.c zend_constants.c zend_dynamic_array.c zend_dtrace.c \
|
|
587 |
zend_execute_API.c zend_highlight.c zend_llist.c \
|
|
588 |
zend_opcode.c zend_operators.c zend_ptr_stack.c zend_stack.c \
|
|
589 |
zend_variables.c zend.c zend_API.c zend_extensions.c zend_hash.c \
|
198
|
590 |
@@ -1432,6 +1450,13 @@
|
0
|
591 |
PHP_ADD_MAKEFILE_FRAGMENT($abs_srcdir/Makefile.frag,$abs_srcdir/Zend,Zend)
|
|
592 |
PHP_ADD_MAKEFILE_FRAGMENT($abs_srcdir/Zend/Makefile.frag,$abs_srcdir/Zend,Zend)
|
|
593 |
|
|
594 |
+if test "$PHP_DTRACE" = "yes"; then
|
|
595 |
+ case $host_alias in
|
|
596 |
+ *solaris*)
|
|
597 |
+ PHP_GENERATE_DTRACE([Zend/zend_dtrace.d],$php_build_target);;
|
|
598 |
+ esac
|
|
599 |
+fi
|
|
600 |
+
|
|
601 |
PHP_GEN_BUILD_DIRS
|
|
602 |
PHP_GEN_GLOBAL_MAKEFILE
|