com php-src: Fixed segfault + ZTS: phpdbg_frame.c phpdbg _frame.h phpdbg_prompt.c
| From: | Bob Weinand | Date: | Fri, 22 Nov 2013 18:16:25 +0000 |
| Subject: | com php-src: Fixed segfault + ZTS: phpdbg_frame.c phpdbg _frame.h phpdbg_prompt.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-74706@lists.php.net to get a copy of this message | ||
Commit: 202c1cee3971279c589f4cd01772bf720bcfc05d
Author: Bob Weinand <bobwei9@hotmail.com> Fri, 22 Nov 2013 19:16:25 +0100
Parents: c46a4136976fe3645e34b18659460dd495bc6088
Branches: PHP-5.6
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=202c1cee3971279c589f4cd01772bf720bcfc05d
Log:
Fixed segfault + ZTS
Changed paths:
M phpdbg_frame.c
M phpdbg_frame.h
M phpdbg_prompt.c
Diff:
diff --git a/phpdbg_frame.c b/phpdbg_frame.c
index aeda9ed...536debf 100644
--- a/phpdbg_frame.c
+++ b/phpdbg_frame.c
@@ -28,7 +28,7 @@ ZEND_EXTERN_MODULE_GLOBALS(phpdbg);
#define PHPDBG_FRAME(v) (PHPDBG_G(frame).v)
#define PHPDBG_EX(v) (EG(current_execute_data)->v)
-void switch_to_frame(int frame) {
+void switch_to_frame(int frame TSRMLS_DC) {
zend_execute_data *execute_data =
PHPDBG_FRAME(num)?PHPDBG_FRAME(execute_data):EG(current_execute_data);
int i = 0;
@@ -52,7 +52,7 @@ void switch_to_frame(int frame) {
return;
}
- restore_frame();
+ restore_frame(TSRMLS_C);
if (frame > 0) {
PHPDBG_FRAME(num) = frame;
@@ -63,6 +63,7 @@ void switch_to_frame(int frame) {
EG(opline_ptr) = &PHPDBG_EX(opline);
EG(active_op_array) = PHPDBG_EX(op_array);
+ PHPDBG_FRAME(execute_data)->original_return_value = EG(return_value_ptr_ptr);
EG(return_value_ptr_ptr) = PHPDBG_EX(original_return_value);
EG(active_symbol_table) = PHPDBG_EX(symbol_table);
EG(This) = PHPDBG_EX(current_this);
@@ -80,7 +81,7 @@ void switch_to_frame(int frame) {
);
}
-void restore_frame() {
+void restore_frame(TSRMLS_D) {
if (PHPDBG_FRAME(num) == 0) {
return;
}
diff --git a/phpdbg_frame.h b/phpdbg_frame.h
index 39efbf1..49cdbcf 100644
--- a/phpdbg_frame.h
+++ b/phpdbg_frame.h
@@ -29,8 +29,8 @@ typedef struct {
zend_execute_data *execute_data;
} phpdbg_frame;
-void switch_to_frame(int frame);
+void switch_to_frame(int frame TSRMLS_DC);
-void restore_frame();
+void restore_frame(TSRMLS_D);
#endif /* PHPDBG_FRAME_H */
diff --git a/phpdbg_prompt.c b/phpdbg_prompt.c
index 27f0b73..a5dca20 100644
--- a/phpdbg_prompt.c
+++ b/phpdbg_prompt.c
@@ -376,7 +376,7 @@ PHPDBG_COMMAND(frame) /* {{{ */
{
switch (param->type) {
case NUMERIC_PARAM:
- switch_to_frame(param->num);
+ switch_to_frame(param->num TSRMLS_CC);
break;
case EMPTY_PARAM:
@@ -1077,7 +1077,11 @@ last:
out:
phpdbg_destroy_input(&input TSRMLS_CC);
-
+
+ if (EG(in_execution)) {
+ restore_frame(TSRMLS_C);
+ }
+
PHPDBG_G(flags) &= ~PHPDBG_IS_INTERACTIVE;
return ret;