From: krakjoe Date: Wed, 13 Nov 2013 21:15:45 +0000 (+0000) Subject: updates for windows X-Git-Tag: php-5.6.0alpha1~110^2~355^2~1 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=3f927019cb1cda2bf774bbb934184135f9268e49;p=php updates for windows --- diff --git a/config.w32 b/config.w32 index 2359283998..b3893ccc2d 100644 --- a/config.w32 +++ b/config.w32 @@ -1,5 +1,6 @@ ARG_ENABLE('phpdbg', 'Build phpdbg', 'yes'); if (PHP_PHPDBG == "yes") { - SAPI('phpdbg', 'phpdbg.c phpdbg_prompt.c phpdbg_help.c phpdbg_print.c phpdbg_bp.c phpdbg_opcode.c phpdbg_list.c phpdbg_utils.c', 'phpdbg.exe'); + SAPI('phpdbg', 'phpdbg.c phpdbg_prompt.c phpdbg_help.c phpdbg_break.c phpdbg_print.c phpdbg_bp.c phpdbg_opcode.c phpdbg_list.c phpdbg_utils.c', 'phpdbg.exe'); } + diff --git a/phpdbg_prompt.c b/phpdbg_prompt.c index c2bedddcec..fb19bc703e 100644 --- a/phpdbg_prompt.c +++ b/phpdbg_prompt.c @@ -30,7 +30,44 @@ #include "phpdbg_list.h" #include "phpdbg_utils.h" -static const phpdbg_command_t phpdbg_prompt_commands[]; +/* {{{ forward declarations */ +static PHPDBG_COMMAND(exec); +static PHPDBG_COMMAND(compile); +static PHPDBG_COMMAND(step); +static PHPDBG_COMMAND(next); +static PHPDBG_COMMAND(run); +static PHPDBG_COMMAND(eval); +static PHPDBG_COMMAND(print); +static PHPDBG_COMMAND(break); +static PHPDBG_COMMAND(back); +static PHPDBG_COMMAND(list); +static PHPDBG_COMMAND(clean); +static PHPDBG_COMMAND(clear); +static PHPDBG_COMMAND(help); +static PHPDBG_COMMAND(quiet); +static PHPDBG_COMMAND(aliases); +static PHPDBG_COMMAND(quit); /* }}} */ + +/* {{{ command declarations */ +static const phpdbg_command_t phpdbg_prompt_commands[] = { + PHPDBG_COMMAND_EX_D(exec, "set execution context", 'e'), + PHPDBG_COMMAND_EX_D(compile, "attempt to pre-compile execution context", 'c'), + PHPDBG_COMMAND_EX_D(step, "step through execution", 's'), + PHPDBG_COMMAND_EX_D(next, "continue execution", 'n'), + PHPDBG_COMMAND_EX_D(run, "attempt execution", 'r'), + PHPDBG_COMMAND_EX_D(eval, "evaluate some code", 'E'), + PHPDBG_COMMAND_EX_D(print, "print something", 'p'), + PHPDBG_COMMAND_EX_D(break, "set breakpoint", 'b'), + PHPDBG_COMMAND_EX_D(back, "show trace", 't'), + PHPDBG_COMMAND_EX_D(list, "list specified line or function", 'l'), + PHPDBG_COMMAND_EX_D(clean, "clean the execution environment", 'X'), + PHPDBG_COMMAND_EX_D(clear, "clear breakpoints", 'C'), + PHPDBG_COMMAND_EX_D(help, "show help menu", 'h'), + PHPDBG_COMMAND_EX_D(quiet, "silence some output", 'Q'), + PHPDBG_COMMAND_EX_D(aliases, "show alias list", 'a'), + PHPDBG_COMMAND_EX_D(quit, "exit phpdbg", 'q'), + {NULL, 0, 0} +}; /* }}} */ ZEND_EXTERN_MODULE_GLOBALS(phpdbg); @@ -202,14 +239,17 @@ static PHPDBG_COMMAND(eval) /* {{{ */ static PHPDBG_COMMAND(back) /* {{{ */ { + zval zbacktrace; + zval **tmp; + HashPosition position; + int i = 0, limit = 0; + if (!EG(in_execution)) { phpdbg_error("Not executing!"); return FAILURE; } - zval zbacktrace; - zval **tmp; - HashPosition position; - int i = 0, limit = (expr != NULL) ? atoi(expr) : 0; + + limit = (expr != NULL) ? atoi(expr) : 0; zend_fetch_debug_backtrace(&zbacktrace, 0, 0, limit TSRMLS_CC); @@ -545,26 +585,6 @@ static PHPDBG_COMMAND(list) /* {{{ */ return SUCCESS; } /* }}} */ -static const phpdbg_command_t phpdbg_prompt_commands[] = { - PHPDBG_COMMAND_EX_D(exec, "set execution context", 'e'), - PHPDBG_COMMAND_EX_D(compile, "attempt to pre-compile execution context", 'c'), - PHPDBG_COMMAND_EX_D(step, "step through execution", 's'), - PHPDBG_COMMAND_EX_D(next, "continue execution", 'n'), - PHPDBG_COMMAND_EX_D(run, "attempt execution", 'r'), - PHPDBG_COMMAND_EX_D(eval, "evaluate some code", 'E'), - PHPDBG_COMMAND_EX_D(print, "print something", 'p'), - PHPDBG_COMMAND_EX_D(break, "set breakpoint", 'b'), - PHPDBG_COMMAND_EX_D(back, "show trace", 't'), - PHPDBG_COMMAND_EX_D(list, "list specified line or function", 'l'), - PHPDBG_COMMAND_EX_D(clean, "clean the execution environment", 'X'), - PHPDBG_COMMAND_EX_D(clear, "clear breakpoints", 'C'), - PHPDBG_COMMAND_EX_D(help, "show help menu", 'h'), - PHPDBG_COMMAND_EX_D(quiet, "silence some output", 'Q'), - PHPDBG_COMMAND_EX_D(aliases, "show alias list", 'a'), - PHPDBG_COMMAND_EX_D(quit, "exit phpdbg", 'q'), - {NULL, 0, 0} -}; - int phpdbg_do_cmd(const phpdbg_command_t *command, char *cmd_line, size_t cmd_len TSRMLS_DC) /* {{{ */ { char *expr = NULL; diff --git a/phpdbg_utils.c b/phpdbg_utils.c index 02fd46af5f..d506a25eed 100644 --- a/phpdbg_utils.c +++ b/phpdbg_utils.c @@ -91,21 +91,21 @@ int phpdbg_print(int type TSRMLS_DC, const char *format, ...) /* {{{ */ /* TODO(anyone) colours */ switch (type) { - case ERROR: + case P_ERROR: rc = printf("%s%s%s\n", ((PHPDBG_G(flags) & PHPDBG_IS_COLOURED) ? "\033[1;31m[" : "["), buffer, ((PHPDBG_G(flags) & PHPDBG_IS_COLOURED) ? "]\033[0m" : "]")); break; - case NOTICE: + case P_NOTICE: rc = printf("%s%s%s\n", ((PHPDBG_G(flags) & PHPDBG_IS_COLOURED) ? "\033[1;64m[" : "["), buffer, ((PHPDBG_G(flags) & PHPDBG_IS_COLOURED) ? "]\033[0m" : "]")); break; - case WRITELN: { + case P_WRITELN: { if (buffer) { rc = printf("%s%s%s\n", ((PHPDBG_G(flags) & PHPDBG_IS_COLOURED) ? "\033[37m" : ""), @@ -116,7 +116,7 @@ int phpdbg_print(int type TSRMLS_DC, const char *format, ...) /* {{{ */ } } break; - case WRITE: if (buffer) { + case P_WRITE: if (buffer) { rc = printf("%s%s%s", ((PHPDBG_G(flags) & PHPDBG_IS_COLOURED) ? "\033[37m" : ""), buffer, diff --git a/phpdbg_utils.h b/phpdbg_utils.h index b45342d0e0..615e33506b 100644 --- a/phpdbg_utils.h +++ b/phpdbg_utils.h @@ -32,18 +32,18 @@ int phpdbg_is_class_method(const char*, size_t, char**, char**); * Error/notice/formatting helper */ enum { - ERROR = 1, - NOTICE, - WRITELN, - WRITE + P_ERROR = 1, + P_NOTICE, + P_WRITELN, + P_WRITE }; int phpdbg_print(int TSRMLS_DC, const char*, ...); -#define phpdbg_error(fmt, ...) phpdbg_print(ERROR TSRMLS_CC, fmt, ##__VA_ARGS__) -#define phpdbg_notice(fmt, ...) phpdbg_print(NOTICE TSRMLS_CC, fmt, ##__VA_ARGS__) -#define phpdbg_writeln(fmt, ...) phpdbg_print(WRITELN TSRMLS_CC, fmt, ##__VA_ARGS__) -#define phpdbg_write(fmt, ...) phpdbg_print(WRITE TSRMLS_CC, fmt, ##__VA_ARGS__) +#define phpdbg_error(fmt, ...) phpdbg_print(P_ERROR TSRMLS_CC, fmt, ##__VA_ARGS__) +#define phpdbg_notice(fmt, ...) phpdbg_print(P_NOTICE TSRMLS_CC, fmt, ##__VA_ARGS__) +#define phpdbg_writeln(fmt, ...) phpdbg_print(P_WRITELN TSRMLS_CC, fmt, ##__VA_ARGS__) +#define phpdbg_write(fmt, ...) phpdbg_print(P_WRITE TSRMLS_CC, fmt, ##__VA_ARGS__) /* {{{ For writing blank lines */ #define EMPTY "" /* }}} */