]> granicus.if.org Git - php/commitdiff
add phpdbg_debug function and --enable-phpdbg-debug configure option
authorkrakjoe <joe.watkins@live.co.uk>
Sat, 16 Nov 2013 11:11:47 +0000 (11:11 +0000)
committerkrakjoe <joe.watkins@live.co.uk>
Sat, 16 Nov 2013 11:11:47 +0000 (11:11 +0000)
added debug statement to do_cmd in preparation for updates

config.m4
phpdbg_prompt.c
phpdbg_utils.h

index 7d6b8262bfed669306a1aac9b5f166ed54481c4d..3ee8ec8d99974f7db6d16e951825f5de58b0109b 100644 (file)
--- 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"
 
index aef50d851ebd8e1371590ef3deb648604af60f98..4baa2029b61883ed46bbc574b29c41e2feafdb85 100644 (file)
@@ -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);
                }
index 4174f164129af0e586204235bb321bea5c7b52d6..8077d8f236b38ab29dafa7311a9a329e81a975ed 100644 (file)
@@ -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 "" /* }}} */