-
Notifications
You must be signed in to change notification settings - Fork 27
/
Copy pathvld_patch.c
76 lines (71 loc) · 2.19 KB
/
vld_patch.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
--- vld.c 2020-01-14 01:12:09.000000000 +0800
+++ vld_modify.c 2020-09-20 12:56:52.982420619 +0800
@@ -299,20 +299,6 @@ static zend_op_array *vld_compile_file(z
op_array = old_compile_file (file_handle, type TSRMLS_CC);
- if (VLD_G(path_dump_file)) {
- fprintf(VLD_G(path_dump_file), "subgraph cluster_file_%p { label=\"file %s\";\n", op_array, op_array->filename ? ZSTRING_VALUE(op_array->filename) : "__main");
- }
- if (op_array) {
- vld_dump_oparray (op_array TSRMLS_CC);
- }
-
- zend_hash_apply_with_arguments (CG(function_table) TSRMLS_CC, (apply_func_args_t) VLD_WRAP_PHP7(vld_dump_fe), 0);
- zend_hash_apply (CG(class_table), (apply_func_t) VLD_WRAP_PHP7(vld_dump_cle) TSRMLS_CC);
-
- if (VLD_G(path_dump_file)) {
- fprintf(VLD_G(path_dump_file), "}\n");
- }
-
return op_array;
}
/* }}} */
@@ -325,21 +311,42 @@ static zend_op_array *vld_compile_string
op_array = old_compile_string (source_string, filename TSRMLS_CC);
- if (op_array) {
- vld_dump_oparray (op_array TSRMLS_CC);
-
- zend_hash_apply_with_arguments (CG(function_table) TSRMLS_CC, (apply_func_args_t) vld_dump_fe_wrapper, 0);
- zend_hash_apply (CG(class_table), (apply_func_t) vld_dump_cle_wrapper TSRMLS_CC);
- }
-
return op_array;
}
/* }}} */
-
+int execute_time=0;
/* {{{
* This function provides a hook for execution */
static void vld_execute_ex(zend_execute_data *execute_data TSRMLS_DC)
{
- // nothing to do
+
+ if (execute_time == 1)
+ {
+ zend_op_array *op_array;
+
+ op_array=&execute_data->func->op_array;
+
+ if (VLD_G(path_dump_file))
+ {
+ fprintf(VLD_G(path_dump_file), "subgraph cluster_file_%p { label=\"file %s\";\n", op_array, op_array->filename ? ZSTRING_VALUE(op_array->filename) : "__main");
+ }
+ if (op_array)
+ {
+ vld_dump_oparray(op_array TSRMLS_CC);
+ }
+
+ zend_hash_apply_with_arguments(CG(function_table) TSRMLS_CC, (apply_func_args_t)VLD_WRAP_PHP7(vld_dump_fe), 0);
+ zend_hash_apply(CG(class_table), (apply_func_t)VLD_WRAP_PHP7(vld_dump_cle) TSRMLS_CC);
+
+ if (VLD_G(path_dump_file))
+ {
+ fprintf(VLD_G(path_dump_file), "}\n");
+ }
+
+ return;
+ }
+
+ execute_time = 1;
+ old_execute_ex(execute_data);
}
/* }}} */