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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
|
From cf7235a78e8639514f34956d8d24f19a8a1c4fea Mon Sep 17 00:00:00 2001
From: Remi Collet <fedora@famillecollet.com>
Date: Thu, 3 Jan 2013 15:02:05 +0100
Subject: [PATCH] fix PHP 5.5 build
---
xdebug.c | 4 ++--
xdebug_code_coverage.c | 28 ++++++++++++++--------------
xdebug_compat.c | 8 ++++++--
xdebug_compat.h | 2 +-
xdebug_handler_dbgp.c | 11 ++++++++---
xdebug_var.c | 8 ++++++--
xdebug_var.h | 2 +-
7 files changed, 38 insertions(+), 25 deletions(-)
mode change 100755 => 100644 xdebug_compat.c
mode change 100755 => 100644 xdebug_compat.h
diff --git a/xdebug.c b/xdebug.c
index d8a9d93..facb1dd 100644
--- a/xdebug.c
+++ b/xdebug.c
@@ -491,7 +491,7 @@ static int xdebug_include_or_eval_handler(ZEND_OPCODE_HANDLER_ARGS)
zval tmp_inc_filename;
int is_var;
- inc_filename = xdebug_get_zval(execute_data, opline->XDEBUG_TYPE(op1), &opline->op1, execute_data->Ts, &is_var);
+ inc_filename = xdebug_get_zval(execute_data, opline->XDEBUG_TYPE(op1), &opline->op1, &is_var);
/* If there is no inc_filename, we're just bailing out instead */
if (!inc_filename) {
@@ -1569,7 +1569,7 @@ void xdebug_execute_internal(zend_execute_data *current_execute_data, struct _ze
if (XG(collect_return) && do_return && XG(do_trace) && XG(trace_file) && EG(opline_ptr)) {
cur_opcode = *EG(opline_ptr);
if (cur_opcode) {
- zval *ret = xdebug_zval_ptr(cur_opcode->XDEBUG_TYPE(result), &(cur_opcode->result), current_execute_data->Ts TSRMLS_CC);
+ zval *ret = xdebug_zval_ptr(cur_opcode->XDEBUG_TYPE(result), &(cur_opcode->result), current_execute_data TSRMLS_CC);
if (ret) {
char* t = xdebug_return_trace_stack_retval(fse, ret TSRMLS_CC);
fprintf(XG(trace_file), "%s", t);
diff --git a/xdebug_code_coverage.c b/xdebug_code_coverage.c
index 3593e9f..0e5aa41 100644
--- a/xdebug_code_coverage.c
+++ b/xdebug_code_coverage.c
@@ -110,7 +110,7 @@ static char *xdebug_find_var_name(zend_execute_data *execute_data TSRMLS_DC)
if (is_static) {
xdebug_str_add(&name, xdebug_sprintf("self::"), 1);
} else {
- zval_value = xdebug_get_zval_value(xdebug_get_zval(execute_data, prev_opcode->XDEBUG_TYPE(op1), &prev_opcode->op1, execute_data->Ts, &is_var), 0, options);
+ zval_value = xdebug_get_zval_value(xdebug_get_zval(execute_data, prev_opcode->XDEBUG_TYPE(op1), &prev_opcode->op1, &is_var), 0, options);
xdebug_str_add(&name, xdebug_sprintf("$%s", zval_value), 1);
}
} else if (is_static) { /* todo : see if you can change this and the previous cases around */
@@ -118,19 +118,19 @@ static char *xdebug_find_var_name(zend_execute_data *execute_data TSRMLS_DC)
}
if (cur_opcode->opcode >= ZEND_ASSIGN_ADD && cur_opcode->opcode <= ZEND_ASSIGN_BW_XOR ) {
if (cur_opcode->extended_value == ZEND_ASSIGN_OBJ) {
- zval_value = xdebug_get_zval_value(xdebug_get_zval(execute_data, cur_opcode->XDEBUG_TYPE(op2), &cur_opcode->op2, execute_data->Ts, &is_var), 0, options);
+ zval_value = xdebug_get_zval_value(xdebug_get_zval(execute_data, cur_opcode->XDEBUG_TYPE(op2), &cur_opcode->op2, &is_var), 0, options);
if (cur_opcode->XDEBUG_TYPE(op1) == IS_UNUSED) {
xdebug_str_add(&name, xdebug_sprintf("$this->%s", zval_value), 1);
} else {
xdebug_str_add(&name, xdebug_sprintf("->%s", zval_value), 1);
}
} else if (cur_opcode->extended_value == ZEND_ASSIGN_DIM) {
- zval_value = xdebug_get_zval_value(xdebug_get_zval(execute_data, cur_opcode->XDEBUG_TYPE(op2), &cur_opcode->op2, execute_data->Ts, &is_var), 0, NULL);
+ zval_value = xdebug_get_zval_value(xdebug_get_zval(execute_data, cur_opcode->XDEBUG_TYPE(op2), &cur_opcode->op2, &is_var), 0, NULL);
xdebug_str_add(&name,xdebug_sprintf("[%s]", zval_value), 1);
}
}
if (cur_opcode->opcode >= ZEND_PRE_INC_OBJ && cur_opcode->opcode <= ZEND_POST_DEC_OBJ) {
- zval_value = xdebug_get_zval_value(xdebug_get_zval(execute_data, cur_opcode->XDEBUG_TYPE(op2), &cur_opcode->op2, execute_data->Ts, &is_var), 0, options);
+ zval_value = xdebug_get_zval_value(xdebug_get_zval(execute_data, cur_opcode->XDEBUG_TYPE(op2), &cur_opcode->op2, &is_var), 0, options);
xdebug_str_add(&name, xdebug_sprintf("$this->%s", zval_value), 1);
}
if (zval_value) {
@@ -157,22 +157,22 @@ static char *xdebug_find_var_name(zend_execute_data *execute_data TSRMLS_DC)
xdebug_str_add(&name, xdebug_sprintf("$%s", zend_get_compiled_variable_name(op_array, opcode_ptr->XDEBUG_ZNODE_ELEM(op1, var), &cv_len)), 1);
}
if (opcode_ptr->opcode == ZEND_FETCH_W) {
- zval_value = xdebug_get_zval_value(xdebug_get_zval(execute_data, opcode_ptr->XDEBUG_TYPE(op1), &opcode_ptr->op1, execute_data->Ts, &is_var), 0, options);
+ zval_value = xdebug_get_zval_value(xdebug_get_zval(execute_data, opcode_ptr->XDEBUG_TYPE(op1), &opcode_ptr->op1, &is_var), 0, options);
xdebug_str_add(&name, xdebug_sprintf("%s", zval_value), 1);
}
if (is_static && opcode_ptr->opcode == ZEND_FETCH_RW) {
- zval_value = xdebug_get_zval_value(xdebug_get_zval(execute_data, opcode_ptr->XDEBUG_TYPE(op1), &opcode_ptr->op1, execute_data->Ts, &is_var), 0, options);
+ zval_value = xdebug_get_zval_value(xdebug_get_zval(execute_data, opcode_ptr->XDEBUG_TYPE(op1), &opcode_ptr->op1, &is_var), 0, options);
xdebug_str_add(&name, xdebug_sprintf("%s", zval_value), 1);
}
if (opcode_ptr->opcode == ZEND_FETCH_DIM_W) {
if (opcode_ptr->XDEBUG_TYPE(op2) != IS_VAR) {
- zval_value = xdebug_get_zval_value(xdebug_get_zval(execute_data, opcode_ptr->XDEBUG_TYPE(op2), &opcode_ptr->op2, execute_data->Ts, &is_var), 0, NULL);
+ zval_value = xdebug_get_zval_value(xdebug_get_zval(execute_data, opcode_ptr->XDEBUG_TYPE(op2), &opcode_ptr->op2, &is_var), 0, NULL);
xdebug_str_add(&name, xdebug_sprintf("[%s]", zval_value), 1);
} else {
xdebug_str_add(&name, xdebug_sprintf("[???]") , 1);
}
} else if (opcode_ptr->opcode == ZEND_FETCH_OBJ_W) {
- zval_value = xdebug_get_zval_value(xdebug_get_zval(execute_data, opcode_ptr->XDEBUG_TYPE(op2), &opcode_ptr->op2, execute_data->Ts, &is_var), 0, options);
+ zval_value = xdebug_get_zval_value(xdebug_get_zval(execute_data, opcode_ptr->XDEBUG_TYPE(op2), &opcode_ptr->op2, &is_var), 0, options);
xdebug_str_add(&name, xdebug_sprintf("->%s", zval_value), 1);
}
opcode_ptr = opcode_ptr + 1;
@@ -187,7 +187,7 @@ static char *xdebug_find_var_name(zend_execute_data *execute_data TSRMLS_DC)
if (cur_opcode->XDEBUG_TYPE(op1) == IS_UNUSED) {
xdebug_str_add(&name, "$this", 0);
}
- dimval = xdebug_get_zval(execute_data, cur_opcode->XDEBUG_TYPE(op2), &cur_opcode->op2, execute_data->Ts, &is_var);
+ dimval = xdebug_get_zval(execute_data, cur_opcode->XDEBUG_TYPE(op2), &cur_opcode->op2, &is_var);
xdebug_str_add(&name, xdebug_sprintf("->%s", Z_STRVAL_P(dimval)), 1);
}
@@ -195,7 +195,7 @@ static char *xdebug_find_var_name(zend_execute_data *execute_data TSRMLS_DC)
if (next_opcode->opcode == ZEND_OP_DATA && cur_opcode->XDEBUG_TYPE(op2) == IS_UNUSED) {
xdebug_str_add(&name, "[]", 0);
} else {
- zval_value = xdebug_get_zval_value(xdebug_get_zval(execute_data, opcode_ptr->XDEBUG_TYPE(op2), &opcode_ptr->op2, execute_data->Ts, &is_var), 0, NULL);
+ zval_value = xdebug_get_zval_value(xdebug_get_zval(execute_data, opcode_ptr->XDEBUG_TYPE(op2), &opcode_ptr->op2, &is_var), 0, NULL);
xdebug_str_add(&name, xdebug_sprintf("[%s]", zval_value), 1);
xdfree(zval_value);
}
@@ -242,7 +242,7 @@ static int xdebug_common_assign_dim_handler(char *op, int do_cc, ZEND_OPCODE_HAN
xdfree(full_varname);
full_varname = tmp_varname;
- val = xdebug_get_zval(execute_data, cur_opcode->XDEBUG_TYPE(op1), &cur_opcode->op1, execute_data->Ts, &is_var);
+ val = xdebug_get_zval(execute_data, cur_opcode->XDEBUG_TYPE(op1), &cur_opcode->op1, &is_var);
} else if (cur_opcode->opcode >= ZEND_PRE_INC_OBJ && cur_opcode->opcode <= ZEND_POST_DEC_OBJ) {
char *tmp_varname;
@@ -255,11 +255,11 @@ static int xdebug_common_assign_dim_handler(char *op, int do_cc, ZEND_OPCODE_HAN
xdfree(full_varname);
full_varname = tmp_varname;
- val = xdebug_get_zval(execute_data, cur_opcode->XDEBUG_TYPE(op2), &cur_opcode->op2, execute_data->Ts, &is_var);
+ val = xdebug_get_zval(execute_data, cur_opcode->XDEBUG_TYPE(op2), &cur_opcode->op2, &is_var);
} else if (next_opcode->opcode == ZEND_OP_DATA) {
- val = xdebug_get_zval(execute_data, next_opcode->XDEBUG_TYPE(op1), &next_opcode->op1, execute_data->Ts, &is_var);
+ val = xdebug_get_zval(execute_data, next_opcode->XDEBUG_TYPE(op1), &next_opcode->op1, &is_var);
} else {
- val = xdebug_get_zval(execute_data, cur_opcode->XDEBUG_TYPE(op2), &cur_opcode->op2, execute_data->Ts, &is_var);
+ val = xdebug_get_zval(execute_data, cur_opcode->XDEBUG_TYPE(op2), &cur_opcode->op2, &is_var);
}
fse = XDEBUG_LLIST_VALP(XDEBUG_LLIST_TAIL(XG(stack)));
diff --git a/xdebug_compat.c b/xdebug_compat.c
old mode 100755
new mode 100644
index 615ae0b..e9049b2
--- a/xdebug_compat.c
+++ b/xdebug_compat.c
@@ -64,9 +64,13 @@ void *php_zend_memrchr(const void *s, int c, size_t n)
}
#endif
-#define T(offset) (*(temp_variable *)((char *) Ts + offset))
+#if defined(PHP_VERSION_ID) && PHP_VERSION_ID >= 50500
+#define T(offset) (*EX_TMP_VAR(zdata, offset))
+#else
+#define T(offset) (*(temp_variable *)((char*)zdata->Ts + offset))
+#endif
-zval *xdebug_zval_ptr(int op_type, XDEBUG_ZNODE *node, temp_variable *Ts TSRMLS_DC)
+zval *xdebug_zval_ptr(int op_type, XDEBUG_ZNODE *node, zend_execute_data *zdata TSRMLS_DC)
{
switch (op_type & 0x0F) {
case IS_CONST:
diff --git a/xdebug_compat.h b/xdebug_compat.h
old mode 100755
new mode 100644
index 2e0ba2f..0195cf6
--- a/xdebug_compat.h
+++ b/xdebug_compat.h
@@ -45,7 +45,7 @@
# define XDEBUG_PASS_TWO_DONE op_array->done_pass_two
#endif
-zval *xdebug_zval_ptr(int op_type, XDEBUG_ZNODE *node, temp_variable *Ts TSRMLS_DC);
+zval *xdebug_zval_ptr(int op_type, XDEBUG_ZNODE *node, zend_execute_data *zdata TSRMLS_DC);
#include "ext/standard/base64.h"
#define xdebug_base64_encode php_base64_encode
diff --git a/xdebug_handler_dbgp.c b/xdebug_handler_dbgp.c
index 9f618bc..b3ee14f 100644
--- a/xdebug_handler_dbgp.c
+++ b/xdebug_handler_dbgp.c
@@ -394,15 +394,20 @@ static zval* fetch_zval_from_symbol_table(HashTable *ht, char* name, int name_le
int i = 0;
ulong hash_value = zend_inline_hash_func(element, element_length + 1);
zend_op_array *opa = XG(active_op_array);
- zval ***CVs = XG(active_execute_data)->CVs;
+ zval **CV;
while (i < opa->last_var) {
if (opa->vars[i].hash_value == hash_value &&
opa->vars[i].name_len == element_length &&
strcmp(opa->vars[i].name, element) == 0)
{
- if (CVs[i]) {
- retval_p = *CVs[i];
+#if defined(PHP_VERSION_ID) && PHP_VERSION_ID >= 50500
+ CV = (*EX_CV_NUM(XG(active_execute_data), i));
+#else
+ CV = XG(active_execute_data)->CVs[i];
+#endif
+ if (CV) {
+ retval_p = *CV;
goto cleanup;
}
}
diff --git a/xdebug_var.c b/xdebug_var.c
index f9f0b75..187bd4c 100644
--- a/xdebug_var.c
+++ b/xdebug_var.c
@@ -122,9 +122,13 @@ char* xdebug_error_type(int type)
}
/*************************************************************************************************************************************/
-#define T(offset) (*(temp_variable *)((char *) Ts + offset))
+#if defined(PHP_VERSION_ID) && PHP_VERSION_ID >= 50500
+#define T(offset) (*EX_TMP_VAR(zdata, offset))
+#else
+#define T(offset) (*(temp_variable *)((char*)zdata->Ts + offset))
+#endif
-zval *xdebug_get_zval(zend_execute_data *zdata, int node_type, XDEBUG_ZNODE *node, temp_variable *Ts, int *is_var)
+zval *xdebug_get_zval(zend_execute_data *zdata, int node_type, XDEBUG_ZNODE *node, int *is_var)
{
switch (node_type) {
case IS_CONST:
diff --git a/xdebug_var.h b/xdebug_var.h
index ac69433..91d72fe 100644
--- a/xdebug_var.h
+++ b/xdebug_var.h
@@ -64,7 +64,7 @@
char* xdebug_xmlize(char *string, int len, int *newlen);
char* xdebug_error_type_simple(int type);
char* xdebug_error_type(int type);
-zval *xdebug_get_zval(zend_execute_data *zdata, int node_type, XDEBUG_ZNODE *node, temp_variable *Ts, int *is_var);
+zval *xdebug_get_zval(zend_execute_data *zdata, int node_type, XDEBUG_ZNODE *node, int *is_var);
char* xdebug_get_zval_value(zval *val, int debug_zval, xdebug_var_export_options *options);
char* xdebug_get_zval_value_text_ansi(zval *val, int mode, int debug_zval, xdebug_var_export_options *options TSRMLS_DC);
#define xdebug_get_zval_value_text(v,d,o) xdebug_get_zval_value_text_ansi(v,0,d,o TSRMLS_CC);
--
1.7.10
|