From: krakjoe Date: Mon, 9 Dec 2013 10:15:16 +0000 (+0000) Subject: resolve all warnings X-Git-Tag: php-5.6.0alpha1~110^2~21 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=af979393fcb50250b797b1c717fb034c61155fae;p=php resolve all warnings --- diff --git a/phpdbg.h b/phpdbg.h index 377e1e7757..7d2b5b5e0c 100644 --- a/phpdbg.h +++ b/phpdbg.h @@ -105,8 +105,7 @@ #define PHPDBG_HAS_OPCODE_BP (1<<6) #define PHPDBG_HAS_FUNCTION_OPLINE_BP (1<<7) #define PHPDBG_HAS_METHOD_OPLINE_BP (1<<8) -#define PHPDBG_HAS_FILE_OPLINE_BP (1<<9) -#define PHPDBG_BP_MASK (PHPDBG_HAS_FILE_BP|PHPDBG_HAS_SYM_BP|PHPDBG_HAS_METHOD_BP|PHPDBG_HAS_OPLINE_BP|PHPDBG_HAS_COND_BP|PHPDBG_HAS_OPCODE_BP|PHPDBG_HAS_FUNCTION_OPLINE_BP|PHPDBG_HAS_METHOD_OPLINE_BP|PHPDBG_HAS_FILE_OPLINE_BP) +#define PHPDBG_HAS_FILE_OPLINE_BP (1<<9) /* }}} */ /* END: DO NOT CHANGE DO NOT CHANGE DO NOT CHANGE @@ -124,7 +123,6 @@ #define PHPDBG_IN_UNTIL (1<<17) #define PHPDBG_IN_FINISH (1<<18) #define PHPDBG_IN_LEAVE (1<<19) -#define PHPDBG_SEEK_MASK (PHPDBG_IN_UNTIL|PHPDBG_IN_FINISH|PHPDBG_IN_LEAVE) #define PHPDBG_IS_REGISTERED (1<<20) #define PHPDBG_IS_STEPONEVAL (1<<21) @@ -135,6 +133,10 @@ #define PHPDBG_IS_REMOTE (1<<26) #define PHPDBG_IS_DISCONNECTED (1<<27) +#define PHPDBG_SEEK_MASK (PHPDBG_IN_UNTIL|PHPDBG_IN_FINISH|PHPDBG_IN_LEAVE) +#define PHPDBG_BP_RESOLVE_MASK (PHPDBG_HAS_FUNCTION_OPLINE_BP|PHPDBG_HAS_METHOD_OPLINE_BP|PHPDBG_HAS_FILE_OPLINE_BP) +#define PHPDBG_BP_MASK (PHPDBG_HAS_FILE_BP|PHPDBG_HAS_SYM_BP|PHPDBG_HAS_METHOD_BP|PHPDBG_HAS_OPLINE_BP|PHPDBG_HAS_COND_BP|PHPDBG_HAS_OPCODE_BP|PHPDBG_HAS_FUNCTION_OPLINE_BP|PHPDBG_HAS_METHOD_OPLINE_BP|PHPDBG_HAS_FILE_OPLINE_BP) + #ifndef _WIN32 # define PHPDBG_DEFAULT_FLAGS (PHPDBG_IS_QUIET|PHPDBG_IS_COLOURED|PHPDBG_IS_BP_ENABLED) #else diff --git a/phpdbg_bp.c b/phpdbg_bp.c index fe0f8d4e4f..766761d224 100644 --- a/phpdbg_bp.c +++ b/phpdbg_bp.c @@ -536,8 +536,8 @@ PHPDBG_API void phpdbg_set_breakpoint_method_opline(const char *class, const cha if (zend_hash_index_exists(method_table, opline)) { phpdbg_notice("Breakpoint already exists for %s::%s#%ld", new_break.class_name, new_break.func_name, opline); - efree(new_break.func_name); - efree(new_break.class_name); + efree((char*)new_break.func_name); + efree((char*)new_break.class_name); PHPDBG_G(bp_count)--; return; } @@ -586,7 +586,7 @@ PHPDBG_API void phpdbg_set_breakpoint_function_opline(const char *function, zend if (zend_hash_index_exists(func_table, opline)) { phpdbg_notice("Breakpoint already exists for %s#%ld", new_break.func_name, opline); - efree(new_break.func_name); + efree((char*)new_break.func_name); PHPDBG_G(bp_count)--; return; } @@ -635,7 +635,7 @@ PHPDBG_API void phpdbg_set_breakpoint_file_opline(const char *file, zend_ulong o if (zend_hash_index_exists(file_table, opline)) { phpdbg_notice("Breakpoint already exists for %s:%ld", new_break.class_name, opline); - efree(new_break.class_name); + efree((char*)new_break.class_name); PHPDBG_G(bp_count)--; return; } diff --git a/phpdbg_cmd.c b/phpdbg_cmd.c index 677c00621b..4d18d471a9 100644 --- a/phpdbg_cmd.c +++ b/phpdbg_cmd.c @@ -170,10 +170,31 @@ PHPDBG_API char* phpdbg_param_tostring(const phpdbg_param_t *param, char **point break; case FILE_PARAM: + if (param->num) { + asprintf(pointer, + "%s:%lu#%lu", + param->file.name, + param->file.line, + param->num); + } else { + asprintf(pointer, + "%s:%lu", + param->file.name, + param->file.line); + } + break; + + case NUMERIC_FUNCTION_PARAM: + asprintf(pointer, + "%s#%lu", param->str, param->num); + break; + + case NUMERIC_METHOD_PARAM: asprintf(pointer, - "%s:%lu", - param->file.name, - param->file.line); + "%s::%s#%lu", + param->method.class, + param->method.name, + param->num); break; default: @@ -208,6 +229,20 @@ PHPDBG_API void phpdbg_copy_param(const phpdbg_param_t* src, phpdbg_param_t* des case FILE_PARAM: dest->file.name = estrdup(src->file.name); dest->file.line = src->file.line; + if (src->num) + dest->num = src->num; + break; + + case NUMERIC_FUNCTION_PARAM: + dest->str = estrndup(src->str, src->len); + dest->num = src->num; + dest->len = src->len; + break; + + case NUMERIC_METHOD_PARAM: + dest->method.class = estrdup(src->method.class); + dest->method.name = estrdup(src->method.name); + dest->num = src->num; break; case EMPTY_PARAM: { /* do nothing */ } break; @@ -231,6 +266,8 @@ PHPDBG_API zend_ulong phpdbg_hash_param(const phpdbg_param_t *param TSRMLS_DC) / case FILE_PARAM: hash += zend_inline_hash_func(param->file.name, strlen(param->file.name)); hash += param->file.line; + if (param->num) + hash += param->num; break; case ADDR_PARAM: @@ -241,6 +278,18 @@ PHPDBG_API zend_ulong phpdbg_hash_param(const phpdbg_param_t *param TSRMLS_DC) / hash += param->num; break; + case NUMERIC_FUNCTION_PARAM: + hash += zend_inline_hash_func(param->str, param->len); + hash += param->num; + break; + + case NUMERIC_METHOD_PARAM: + hash += zend_inline_hash_func(param->method.class, strlen(param->method.class)); + hash += zend_inline_hash_func(param->method.name, strlen(param->method.name)); + if (param->num) + hash+= param->num; + break; + case EMPTY_PARAM: { /* do nothing */ } break; } @@ -252,6 +301,13 @@ PHPDBG_API zend_bool phpdbg_match_param(const phpdbg_param_t *l, const phpdbg_pa if (l && r) { if (l->type == r->type) { switch (l->type) { + + case NUMERIC_FUNCTION_PARAM: + if (l->num != r->num) { + break; + } + /* break intentionally omitted */ + case STR_PARAM: return (l->len == r->len) && (memcmp(l->str, r->str, l->len) == SUCCESS); @@ -268,12 +324,20 @@ PHPDBG_API zend_bool phpdbg_match_param(const phpdbg_param_t *l, const phpdbg_pa strlen(l->file.name), strlen(r->file.name)}; if (lengths[0] == lengths[1]) { - return (memcmp( - l->file.name, r->file.name, lengths[0]) == SUCCESS); + if ((!l->num && !r->num) || (l->num == r->num)) { + return (memcmp( + l->file.name, r->file.name, lengths[0]) == SUCCESS); + } } } } break; + case NUMERIC_METHOD_PARAM: + if (l->num != r->num) { + break; + } + /* break intentionally omitted */ + case METHOD_PARAM: { size_t lengths[2] = { strlen(l->method.class), strlen(r->method.class)}; diff --git a/phpdbg_prompt.c b/phpdbg_prompt.c index 90b1f8d44e..c42b8d1efb 100644 --- a/phpdbg_prompt.c +++ b/phpdbg_prompt.c @@ -1183,8 +1183,11 @@ zend_vm_enter: #endif while (1) { - /* resolve nth opline breakpoints */ - phpdbg_resolve_op_array_breaks(EG(active_op_array) TSRMLS_CC); + + if ((PHPDBG_G(flags) & PHPDBG_BP_RESOLVE_MASK)) { + /* resolve nth opline breakpoints */ + phpdbg_resolve_op_array_breaks(EG(active_op_array) TSRMLS_CC); + } #ifdef ZEND_WIN32 if (EG(timed_out)) {