From: krakjoe Date: Sat, 16 Nov 2013 11:11:47 +0000 (+0000) Subject: add phpdbg_debug function and --enable-phpdbg-debug configure option X-Git-Tag: php-5.6.0alpha1~110^2~293 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=19ada893cbe55edc148021951413db87ebccfb44;p=php add phpdbg_debug function and --enable-phpdbg-debug configure option added debug statement to do_cmd in preparation for updates --- diff --git a/config.m4 b/config.m4 index 7d6b8262bf..3ee8ec8d99 100644 --- a/config.m4 +++ b/config.m4 @@ -5,9 +5,18 @@ dnl PHP_ARG_ENABLE(phpdbg, for phpdbg support, [ --enable-phpdbg Build phpdbg], yes, yes) +PHP_ARG_ENABLE(phpdbg-debug, for phpdbg debug build, +[ --enable-phpdbg-debug Build phpdbg in debug mode], no, no) + if test "$PHP_PHPDBG" != "no"; then AC_DEFINE(HAVE_PHPDBG, 1, [ ]) - + + if test "$PHP_PHPDBG_DEBUG" != "no"; then + AC_DEFINE(PHPDBG_DEBUG, 1, [ ]) + else + AC_DEFINE(PHPDBG_DEBUG, 0, [ ]) + fi + PHP_PHPDBG_CFLAGS="-I$abc_srcdir" PHP_PHPDBG_FILES="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" diff --git a/phpdbg_prompt.c b/phpdbg_prompt.c index aef50d851e..4baa2029b6 100644 --- a/phpdbg_prompt.c +++ b/phpdbg_prompt.c @@ -681,12 +681,14 @@ int phpdbg_do_cmd(const phpdbg_command_t *command, char *cmd_line, size_t cmd_le if ((command->name_len == expr_len && memcmp(cmd, command->name, expr_len) == 0) || ((expr_len == 1) && (command->alias && command->alias == cmd_line[0]))) { - PHPDBG_G(last) = (phpdbg_command_t*) command; PHPDBG_G(last_params) = expr; PHPDBG_G(last_params_len) = (cmd_len - expr_len) ? (((cmd_len - expr_len) - sizeof(" "))+1) : 0; - + + phpdbg_debug("phpdbg_do_cmd(%s, \"%s\", %lu)", + command->name, PHPDBG_G(last_params), PHPDBG_G(last_params_len)); + return command->handler( PHPDBG_G(last_params), PHPDBG_G(last_params_len) TSRMLS_CC); } diff --git a/phpdbg_utils.h b/phpdbg_utils.h index 4174f16412..8077d8f236 100644 --- a/phpdbg_utils.h +++ b/phpdbg_utils.h @@ -84,6 +84,12 @@ int phpdbg_print(int TSRMLS_DC, FILE*, const char*, ...); #define phpdbg_write_ex(out, fmt, ...) phpdbg_print(P_WRITE TSRMLS_CC, out, fmt, ##__VA_ARGS__) #define phpdbg_log_ex(out, fmt, ...) phpdbg_print(P_LOG TSRMLS_CC, out, fmt, ##__VA_ARGS__) +#if PHPDBG_DEBUG +# define phpdbg_debug(fmt, ...) phpdbg_print(P_LOG TSRMLS_CC, stderr, fmt, ##__VA_ARGS__) +#else +# define phpdbg_debug +#endif + /* {{{ For writing blank lines */ #define EMPTY "" /* }}} */