]> granicus.if.org Git - php/commitdiff
no estrdup on opline breakpoints
authorkrakjoe <joe.watkins@live.co.uk>
Mon, 11 Nov 2013 15:14:37 +0000 (15:14 +0000)
committerkrakjoe <joe.watkins@live.co.uk>
Mon, 11 Nov 2013 15:14:37 +0000 (15:14 +0000)
phpdbg.c
phpdbg_bp.c
test.php

index 2845add3c017a25645ff7dc9a313073cea3ce37d..351bdc6ba26508178df72bcecf6971b6ff2d1852 100644 (file)
--- a/phpdbg.c
+++ b/phpdbg.c
@@ -65,7 +65,7 @@ static void php_phpdbg_destroy_bp_symbol(void *brake) /* {{{ */
 
 static void php_phpdbg_destroy_bp_opline(void *brake) /* {{{ */
 {
-       efree((char*)((phpdbg_breakline_t*)brake)->name);
+       free((char*)((phpdbg_breakline_t*)brake)->name);
 } /* }}} */
 
 static PHP_RINIT_FUNCTION(phpdbg) /* {{{ */
@@ -94,17 +94,29 @@ static PHP_RSHUTDOWN_FUNCTION(phpdbg) /* {{{ */
     return SUCCESS;
 } /* }}} */
 
-static PHP_FUNCTION(phpdbg_break) /* {{{ */ 
+/* {{{ proto void phpdbg_break(void)
+    instructs phpdbg to insert a breakpoint at the next opcode */ 
+static PHP_FUNCTION(phpdbg_break)
 {
     if (EG(current_execute_data) && EG(active_op_array)) {
-        zend_ulong opline_num = EG(current_execute_data)->opline - EG(active_op_array)->opcodes;
+        zend_ulong opline_num = (EG(current_execute_data)->opline - EG(active_op_array)->opcodes);
         
         phpdbg_set_breakpoint_opline_ex(
             &EG(active_op_array)->opcodes[opline_num+1] TSRMLS_CC);
     }
 } /* }}} */
 
+/* {{{ proto void phpdbg_clear(void)
+    instructs phpdbg to clear breakpoints */
+static PHP_FUNCTION(phpdbg_clear)
+{
+    zend_hash_clean(&PHPDBG_G(bp_files));
+    zend_hash_clean(&PHPDBG_G(bp_symbols));
+    zend_hash_clean(&PHPDBG_G(bp_oplines));
+} /* }}} */
+
 zend_function_entry phpdbg_user_functions[] = {
+    PHP_FE(phpdbg_clear, NULL)
     PHP_FE(phpdbg_break, NULL)
 #ifdef  PHP_FE_END
        PHP_FE_END
index 2bbb12f44bdadef5d6196de7d0df7ae1df5f8c1b..6f615992d0e31388342fd3a4210d2c561e081c66 100644 (file)
@@ -92,7 +92,7 @@ void phpdbg_set_breakpoint_opline(const char *name TSRMLS_DC) /* {{{ */
 
                PHPDBG_G(has_opline_bp) = 1;
         
-        new_break.name = estrdup(name);
+        new_break.name = strdup(name);
                new_break.opline = opline;
                new_break.id = PHPDBG_G(bp_count)++;
         
index 3ac566ce761e7d0dbfbdfa73ec237dcca4207281..938d7d8323df8171137ad1bafaf540521e7445e5 100644 (file)
--- a/test.php
+++ b/test.php
@@ -1,6 +1,10 @@
 <?php
+phpdbg_clear();
+
 function test() {
        echo "Hello World\n";
+       $hidden = "variable";
+       phpdbg_break();
 }
 function test2() {
     echo "Hello World 2\n";