From 478446b665acb80411b0c7dee417962e88848842 Mon Sep 17 00:00:00 2001 From: Felipe Pena Date: Sun, 17 Nov 2013 14:10:43 -0200 Subject: [PATCH] - Added macro for trailling command --- phpdbg.h | 2 ++ phpdbg_break.h | 2 +- phpdbg_info.h | 2 +- phpdbg_list.h | 8 ++++---- phpdbg_print.h | 10 +++++----- phpdbg_prompt.c | 18 +++++++++--------- test.php | 1 - 7 files changed, 22 insertions(+), 21 deletions(-) diff --git a/phpdbg.h b/phpdbg.h index 625d0af087..eb1aed5f43 100644 --- a/phpdbg.h +++ b/phpdbg.h @@ -139,6 +139,8 @@ struct _phpdbg_command_t { const phpdbg_command_t *subs; /* Sub Commands */ }; +#define PHPDBG_END_COMAND {NULL, 0, NULL, 0, '\0', NULL, NULL} + ZEND_BEGIN_MODULE_GLOBALS(phpdbg) HashTable bp[PHPDBG_BREAK_TABLES]; /* break points */ char *exec; /* file to execute */ diff --git a/phpdbg_break.h b/phpdbg_break.h index 13addb0cdf..c5d5a5a80f 100644 --- a/phpdbg_break.h +++ b/phpdbg_break.h @@ -52,7 +52,7 @@ static const phpdbg_command_t phpdbg_break_commands[] = { PHPDBG_BREAK_EX_D(on, "specify breakpoint by expression", 'o'), PHPDBG_BREAK_EX_D(lineno, "specify breakpoint by line of currently executing file", 'l'), PHPDBG_BREAK_EX_D(func, "specify breakpoint by global function name", 'f'), - {NULL, 0, 0} + PHPDBG_END_COMAND }; #endif /* PHPDBG_BREAK_H */ diff --git a/phpdbg_info.h b/phpdbg_info.h index eb8ebcd086..1e967b0739 100644 --- a/phpdbg_info.h +++ b/phpdbg_info.h @@ -40,7 +40,7 @@ PHPDBG_INFO(files); static const phpdbg_command_t phpdbg_info_commands[] = { PHPDBG_INFO_EX_D(files, "lists included files", 'f'), - {NULL, 0, 0} + PHPDBG_END_COMAND }; #endif /* PHPDBG_INFO_H */ diff --git a/phpdbg_list.h b/phpdbg_list.h index 7d06d84e5d..e186bd3d9f 100644 --- a/phpdbg_list.h +++ b/phpdbg_list.h @@ -46,11 +46,11 @@ void phpdbg_list_function(const zend_function* TSRMLS_DC); void phpdbg_list_file(const char*, long, long, int TSRMLS_DC); static const phpdbg_command_t phpdbg_list_commands[] = { - PHPDBG_LIST_EX_D(lines, "lists the specified lines", 'l'), - PHPDBG_LIST_EX_D(class, "lists the specified class", 'c'), - PHPDBG_LIST_EX_D(method, "lists the specified method", 'm'), + PHPDBG_LIST_EX_D(lines, "lists the specified lines", 'l'), + PHPDBG_LIST_EX_D(class, "lists the specified class", 'c'), + PHPDBG_LIST_EX_D(method, "lists the specified method", 'm'), PHPDBG_LIST_EX_D(func, "lists the specified function", 'f'), - {NULL, 0, 0} + PHPDBG_END_COMAND }; #endif /* PHPDBG_LIST_H */ diff --git a/phpdbg_print.h b/phpdbg_print.h index dc6a13338c..40acfe1b6f 100644 --- a/phpdbg_print.h +++ b/phpdbg_print.h @@ -44,12 +44,12 @@ PHPDBG_PRINT(func); * Commands */ static const phpdbg_command_t phpdbg_print_commands[] = { - PHPDBG_PRINT_D(exec, "print execution context instructions", 'e'), - PHPDBG_PRINT_D(opline, "print the current opline information", 'o'), - PHPDBG_PRINT_D(class, "print out the instructions in the specified class", 'c'), - PHPDBG_PRINT_D(method, "print out the instructions in the specified method", 'm'), + PHPDBG_PRINT_D(exec, "print execution context instructions", 'e'), + PHPDBG_PRINT_D(opline, "print the current opline information", 'o'), + PHPDBG_PRINT_D(class, "print out the instructions in the specified class", 'c'), + PHPDBG_PRINT_D(method, "print out the instructions in the specified method", 'm'), PHPDBG_PRINT_D(func, "print out the instructions in the specified function", 'f'), - {0, 0, 0, 0} + PHPDBG_END_COMAND }; #endif /* PHPDBG_PRINT_H */ diff --git a/phpdbg_prompt.c b/phpdbg_prompt.c index f4f4a03581..94ea220019 100644 --- a/phpdbg_prompt.c +++ b/phpdbg_prompt.c @@ -77,7 +77,7 @@ static const phpdbg_command_t phpdbg_prompt_commands[] = { PHPDBG_COMMAND_EX_D(aliases, "show alias list", 'a'), PHPDBG_COMMAND_EX_D(oplog, "sets oplog output", 'O'), PHPDBG_COMMAND_EX_D(quit, "exit phpdbg", 'q'), - {NULL, 0, 0} + PHPDBG_END_COMAND }; /* }}} */ ZEND_EXTERN_MODULE_GLOBALS(phpdbg); @@ -845,7 +845,7 @@ int phpdbg_interactive(TSRMLS_D) /* {{{ */ phpdbg_error("Failed to execute %s!", cmd); } break; - + case PHPDBG_LEAVE: case PHPDBG_FINISH: case PHPDBG_UNTIL: @@ -1055,7 +1055,7 @@ zend_vm_enter: /* skip possible breakpoints */ goto next; } - + /* run to next line */ if (last_step == PHPDBG_UNTIL && last_file == execute_data->op_array->filename @@ -1063,7 +1063,7 @@ zend_vm_enter: /* skip possible breakpoints */ goto next; } - + /* run to finish */ if (last_step == PHPDBG_FINISH) { if (execute_data->opline < last_op) { @@ -1074,7 +1074,7 @@ zend_vm_enter: last_op = NULL; } } - + /* break for leave */ if (last_step == PHPDBG_LEAVE) { if (execute_data->opline == last_op) { @@ -1093,7 +1093,7 @@ zend_vm_enter: /* not while in conditionals */ phpdbg_print_opline( execute_data, 0 TSRMLS_CC); - + /* conditions cannot be executed by eval()'d code */ if (!(PHPDBG_G(flags) & PHPDBG_IN_EVAL) && (PHPDBG_G(flags) & PHPDBG_HAS_COND_BP) @@ -1136,17 +1136,17 @@ zend_vm_enter: next: last_lineno = execute_data->opline->lineno; last_file = execute_data->op_array->filename; - + switch (last_step) { case PHPDBG_FINISH: if (!last_op) { last_op = &execute_data->op_array->opcodes[execute_data->op_array->last-1]; } break; - + case PHPDBG_LEAVE: if (!last_op) { - last_op = &execute_data->op_array->opcodes[execute_data->op_array->last-2]; + last_op = &execute_data->op_array->opcodes[execute_data->op_array->last-2]; } break; } diff --git a/test.php b/test.php index 02c58b50da..fab577b67e 100644 --- a/test.php +++ b/test.php @@ -1,5 +1,4 @@