Skip to content

Commit 3e3a7ba

Browse files
committed
stop multiple executions from occuring at once, #5
1 parent da065d6 commit 3e3a7ba

File tree

3 files changed

+20
-6
lines changed

3 files changed

+20
-6
lines changed

phpdbg.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -396,7 +396,7 @@ int main(int argc, char *argv[]) /* {{{ */
396396
zend_try {
397397
phpdbg_interactive(TSRMLS_C);
398398
} zend_catch {
399-
399+
400400
} zend_end_try();
401401
} while(!PHPDBG_G(quitting));
402402

phpdbg_prompt.c

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,11 @@ static PHPDBG_COMMAND(next) /* {{{ */
110110

111111
static PHPDBG_COMMAND(run) /* {{{ */
112112
{
113+
if (EG(in_execution)) {
114+
printf("[Cannot start another execution while on is in progress]\n");
115+
return FAILURE;
116+
}
117+
113118
if (PHPDBG_G(ops) || PHPDBG_G(exec)) {
114119
if (!PHPDBG_G(ops)) {
115120
if (phpdbg_compile(TSRMLS_C) == FAILURE) {
@@ -528,7 +533,9 @@ void phpdbg_execute_ex(zend_execute_data *execute_data TSRMLS_DC) /* {{{ */
528533
if (PHPDBG_G(has_file_bp)
529534
&& phpdbg_find_breakpoint_file(execute_data->op_array TSRMLS_CC) == SUCCESS) {
530535
while (phpdbg_interactive(TSRMLS_C) != PHPDBG_NEXT) {
531-
continue;
536+
if (!PHPDBG_G(quitting)) {
537+
continue;
538+
}
532539
}
533540
}
534541

@@ -540,7 +547,9 @@ void phpdbg_execute_ex(zend_execute_data *execute_data TSRMLS_DC) /* {{{ */
540547
if (phpdbg_find_breakpoint_symbol(
541548
previous->function_state.function TSRMLS_CC) == SUCCESS) {
542549
while (phpdbg_interactive(TSRMLS_C) != PHPDBG_NEXT) {
543-
continue;
550+
if (!PHPDBG_G(quitting)) {
551+
continue;
552+
}
544553
}
545554
}
546555
}
@@ -550,18 +559,22 @@ void phpdbg_execute_ex(zend_execute_data *execute_data TSRMLS_DC) /* {{{ */
550559
if (PHPDBG_G(has_opline_bp)
551560
&& phpdbg_find_breakpoint_opline(execute_data->opline TSRMLS_CC) == SUCCESS) {
552561
while (phpdbg_interactive(TSRMLS_C) != PHPDBG_NEXT) {
553-
continue;
562+
if (!PHPDBG_G(quitting)) {
563+
continue;
564+
}
554565
}
555566
}
556-
567+
557568
PHPDBG_G(vmret) = execute_data->opline->handler(execute_data TSRMLS_CC);
558569

559570
phpdbg_print_opline(
560571
execute_data TSRMLS_CC);
561572

562573
if (PHPDBG_G(stepping)) {
563574
while (phpdbg_interactive(TSRMLS_C) != PHPDBG_NEXT) {
564-
continue;
575+
if (!PHPDBG_G(quitting)) {
576+
continue;
577+
}
565578
}
566579
}
567580

test.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ function test() {
66
$hidden = "variable";
77
phpdbg_break();
88
}
9+
910
function test2() {
1011
echo "Hello World 2\n";
1112
}

0 commit comments

Comments
 (0)