com php-src: no estrdup on opline breakpoints: phpdbg.c phpdbg_bp.c test.php
| From: | Bob Weinand | Date: | Mon, 11 Nov 2013 15:14:37 +0000 |
| Subject: | com php-src: no estrdup on opline breakpoints: phpdbg.c phpdbg_bp.c test.php | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-75128@lists.php.net to get a copy of this message | ||
Commit: da065d6fb2ad54450daf8f1b50d2934c6880a546
Author: krakjoe <joe.watkins@live.co.uk> Mon, 11 Nov 2013 15:14:37 +0000
Parents: 632c89b65aea9315b218ba766f092131d54f690b
Branches: PHP-5.6
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=da065d6fb2ad54450daf8f1b50d2934c6880a546
Log:
no estrdup on opline breakpoints
Changed paths:
M phpdbg.c
M phpdbg_bp.c
M test.php
Diff:
diff --git a/phpdbg.c b/phpdbg.c
index 2845add..351bdc6 100644
--- 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
diff --git a/phpdbg_bp.c b/phpdbg_bp.c
index 2bbb12f..6f61599 100644
--- a/phpdbg_bp.c
+++ b/phpdbg_bp.c
@@ -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)++;
diff --git a/test.php b/test.php
index 3ac566c..938d7d8 100644
--- 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";