From 1299786347b97dea0b9109ebaee7881940d49c0a Mon Sep 17 00:00:00 2001 From: Remi Collet Date: Thu, 3 Jan 2013 15:18:22 +0100 Subject: php-pecl-xdebug: fix PHP 5.5 build, see https://github.com/xdebug/xdebug/pull/51 --- php-pecl-xdebug.spec | 11 +- xdebug-build.patch | 324 +++++++++++++++++++++++++++++++++++++-------------- 2 files changed, 245 insertions(+), 90 deletions(-) diff --git a/php-pecl-xdebug.spec b/php-pecl-xdebug.spec index 182194e..d0865a6 100644 --- a/php-pecl-xdebug.spec +++ b/php-pecl-xdebug.spec @@ -14,6 +14,10 @@ Source0: xdebug_2_2.tar.gz %else Source0: http://pecl.php.net/get/%{pecl_name}-%{version}%{?prever}.tgz %endif + +# https://github.com/xdebug/xdebug/pull/51 +Patch0: xdebug-build.patch + # The Xdebug License, version 1.01 # (Based on "The PHP License", version 3.0) License: PHP @@ -21,9 +25,10 @@ Group: Development/Languages URL: http://xdebug.org/ BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) -BuildRequires: php-pear >= 1:1.4.9-1.2 -BuildRequires: php-devel >= 5.1.0 +BuildRequires: php-pear +BuildRequires: php-devel BuildRequires: libedit-devel +BuildRequires: libtool Requires(post): %{__pecl} Requires(postun): %{__pecl} @@ -75,6 +80,7 @@ mv xdebug-xdebug_2_2 %{pecl_name}-%{version}%{?prever} %endif cd %{pecl_name}-%{version}%{?prever} +%patch0 -p1 -b .build # https://bugs.php.net/60330 sed -i -e '/AC_PREREQ/s/2.60/2.59/' debugclient/configure.in @@ -193,6 +199,7 @@ rm -rf %{buildroot} %changelog * Thu Jan 3 2013 Remi Collet - 2.2.2-0.3.gite1b9127 - new snapshot +- add patch, see https://github.com/xdebug/xdebug/pull/51 * Fri Nov 30 2012 Remi Collet - 2.2.2-0.2.gite773b090fc - rebuild with new php 5.5 snaphost with zend_execute_ex diff --git a/xdebug-build.patch b/xdebug-build.patch index e9a7d01..b381e0c 100644 --- a/xdebug-build.patch +++ b/xdebug-build.patch @@ -1,97 +1,245 @@ ---- xdebug.c.old 2012-11-30 13:22:26.000000000 +0100 -+++ xdebug.c 2012-11-30 13:27:34.000000000 +0100 -@@ -65,16 +65,17 @@ - zend_op_array* (*old_compile_file)(zend_file_handle* file_handle, int type TSRMLS_DC); - zend_op_array* xdebug_compile_file(zend_file_handle*, int TSRMLS_DC); +From cf7235a78e8639514f34956d8d24f19a8a1c4fea Mon Sep 17 00:00:00 2001 +From: Remi Collet +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; --#if PHP_VERSION_ID < 50500 -+#if PHP_VERSION_ID < 50600 - void (*xdebug_old_execute)(zend_op_array *op_array TSRMLS_DC); - void xdebug_execute(zend_op_array *op_array TSRMLS_DC); -- --void (*xdebug_old_execute_internal)(zend_execute_data *current_execute_data, int return_value_used TSRMLS_DC); --void xdebug_execute_internal(zend_execute_data *current_execute_data, int return_value_used TSRMLS_DC); - #else - void (*xdebug_old_execute_ex)(zend_execute_data *execute_data TSRMLS_DC); - void xdebug_execute_ex(zend_execute_data *execute_data TSRMLS_DC); -- -+#endif -+#if PHP_VERSION_ID < 50500 -+void (*xdebug_old_execute_internal)(zend_execute_data *current_execute_data, int return_value_used TSRMLS_DC); -+void xdebug_execute_internal(zend_execute_data *current_execute_data, int return_value_used TSRMLS_DC); -+#else - void (*xdebug_old_execute_internal)(zend_execute_data *current_execute_data, struct _zend_fcall_info *fci, int return_value_used TSRMLS_DC); - void xdebug_execute_internal(zend_execute_data *current_execute_data, struct _zend_fcall_info *fci, int return_value_used TSRMLS_DC); - #endif -@@ -569,7 +570,7 @@ - old_compile_file = zend_compile_file; - zend_compile_file = xdebug_compile_file; +- 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; --#if PHP_VERSION_ID < 50500 -+#if PHP_VERSION_ID < 50600 - xdebug_old_execute = zend_execute; - zend_execute = xdebug_execute; - #else -@@ -713,7 +714,7 @@ +@@ -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; - /* Reset compile, execute and error callbacks */ - zend_compile_file = old_compile_file; --#if PHP_VERSION_ID < 50500 -+#if PHP_VERSION_ID < 50600 - zend_execute = xdebug_old_execute; - #else - zend_execute_ex = xdebug_old_execute_ex; -@@ -1233,7 +1234,7 @@ - return 1; +- 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 --#if PHP_VERSION_ID < 50500 -+#if PHP_VERSION_ID < 50600 - void xdebug_execute(zend_op_array *op_array TSRMLS_DC) +-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) { - zend_execute_data *edata = EG(current_execute_data); -@@ -1254,7 +1255,7 @@ + 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 - /* If we're evaluating for the debugger's eval capability, just bail out */ - if (op_array && op_array->filename && strcmp("xdebug://debug-eval", op_array->filename) == 0) { --#if PHP_VERSION_ID < 50500 -+#if PHP_VERSION_ID < 50600 - xdebug_old_execute(op_array TSRMLS_CC); - #else - xdebug_old_execute_ex(execute_data TSRMLS_CC); -@@ -1265,7 +1266,7 @@ - /* if we're in a ZEND_EXT_STMT, we ignore this function call as it's likely - that it's just being called to check for breakpoints with conditions */ - if (edata && edata->opline && edata->opline->opcode == ZEND_EXT_STMT) { --#if PHP_VERSION_ID < 50500 -+#if PHP_VERSION_ID < 50600 - xdebug_old_execute(op_array TSRMLS_CC); - #else - xdebug_old_execute_ex(execute_data TSRMLS_CC); -@@ -1379,7 +1380,7 @@ - xdebug_trace_function_begin(fse, function_nr TSRMLS_CC); +-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); - fse->symbol_table = EG(active_symbol_table); --#if PHP_VERSION_ID < 50500 -+#if PHP_VERSION_ID < 50600 - fse->execute_data = EG(current_execute_data); - #else - fse->execute_data = EG(current_execute_data)->prev_execute_data; -@@ -1429,7 +1430,7 @@ - clear = 1; - } + #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; --#if PHP_VERSION_ID < 50500 -+#if PHP_VERSION_ID < 50600 - xdebug_old_execute(op_array TSRMLS_CC); - #else - xdebug_old_execute_ex(execute_data TSRMLS_CC); -@@ -1445,7 +1446,7 @@ - if (XG(collect_return) && do_return && XG(do_trace) && XG(trace_file)) { - if (EG(return_value_ptr_ptr) && *EG(return_value_ptr_ptr)) { - char *t; --#if PHP_VERSION_ID >= 50500 -+#if PHP_VERSION_ID >= 50600 - if (op_array->fn_flags & ZEND_ACC_GENERATOR) { - t = xdebug_return_trace_stack_generator_retval(fse, (zend_generator *) EG(return_value_ptr_ptr) TSRMLS_CC); - } else { + 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 + -- cgit