]> granicus.if.org Git - php/commitdiff
resolve all warnings
authorkrakjoe <joe.watkins@live.co.uk>
Mon, 9 Dec 2013 10:15:16 +0000 (10:15 +0000)
committerkrakjoe <joe.watkins@live.co.uk>
Mon, 9 Dec 2013 10:15:16 +0000 (10:15 +0000)
phpdbg.h
phpdbg_bp.c
phpdbg_cmd.c
phpdbg_prompt.c

index 377e1e7757036e9b57a84fb22487220cb0688c2e..7d2b5b5e0c905a0803caa5b3e0d05f8db42738d9 100644 (file)
--- a/phpdbg.h
+++ b/phpdbg.h
 #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
 #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)
 #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
index fe0f8d4e4f4d9e5e9a5211d3880db244b3642807..766761d224c07025df1be69285e8312c7d35ce8a 100644 (file)
@@ -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;
        }
index 677c00621b02da76f87193050c3dabeedf2cd7ea..4d18d471a96a5440a1674914e2df41a082997196 100644 (file)
@@ -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)};
index 90b1f8d44e39d0f27a6b89f0d2b7460689d6fcde..c42b8d1efb1bdd8fda6c9e9fa082ffcf0881037e 100644 (file)
@@ -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)) {