]> granicus.if.org Git - php/commitdiff
backtrace
authorkrakjoe <joe.watkins@live.co.uk>
Sun, 10 Nov 2013 15:16:45 +0000 (15:16 +0000)
committerkrakjoe <joe.watkins@live.co.uk>
Sun, 10 Nov 2013 15:16:45 +0000 (15:16 +0000)
phpdbg_prompt.c

index f61f8d408f9e4c2088781c7d918ad6c4c8f30e83..3be2753ce9c5511c0a8b7841fafb1cef2aeeefe1 100644 (file)
@@ -136,6 +136,21 @@ static PHPDBG_COMMAND(eval) { /* {{{ */
     return SUCCESS;
 } /* }}} */
 
+static PHPDBG_COMMAND(back) { /* {{{ */
+    if (EG(in_execution)) {
+        const zend_execute_data *current = EG(current_execute_data);
+        if (current) {
+            do {
+                printf("%d\n", current->opline->opcode);
+            } while ((current = current->prev_execute_data));
+        }
+        return SUCCESS;
+    } else {
+        printf("Not executing !\n");
+        return FAILURE;
+    }
+} /* }}} */
+
 static PHPDBG_COMMAND(print) { /* {{{ */
   if (!expr_len) {
     printf("Showing Execution Context Information:\n");
@@ -213,6 +228,7 @@ static const phpdbg_command_t phpdbg_prompt_commands[] = {
        PHPDBG_COMMAND_D(eval,      "evaluate some code"),
        PHPDBG_COMMAND_D(print,     "print something"),
        PHPDBG_COMMAND_D(break,     "set breakpoint"),
+       PHPDBG_COMMAND_D(back,      "show backtrace"),
        PHPDBG_COMMAND_D(help,      "show help menu"),
        PHPDBG_COMMAND_D(quit,      "exit phpdbg"),
        {NULL, 0, 0}
@@ -267,9 +283,8 @@ int phpdbg_interactive(int argc, char **argv TSRMLS_DC) /* {{{ */
 
 void phpdbg_execute_ex(zend_execute_data *execute_data TSRMLS_DC)
 {
-       zend_bool original_in_execution;
+       zend_bool original_in_execution = EG(in_execution);
 
-       original_in_execution = EG(in_execution);
        EG(in_execution) = 1;
 
        if (0) {