Commit:    795e12b85e436badf24fae5377d359337f35d459
Author:    Felipe Pena <felipe...@gmail.com>         Sun, 24 Nov 2013 12:54:14 
-0200
Parents:   97f733e60d103ce2ebac7a11c26dbd707cd469e5
Branches:  PHP-5.6

Link:       
http://git.php.net/?p=php-src.git;a=commitdiff;h=795e12b85e436badf24fae5377d359337f35d459

Log:
- Added "set prompt" command

Changed paths:
  M  config.m4
  M  config.w32
  M  phpdbg.c
  M  phpdbg.h
  M  phpdbg_cmd.c
  M  phpdbg_prompt.c
  M  phpdbg_prompt.h
  M  phpdbg_utils.h


Diff:
diff --git a/config.m4 b/config.m4
index c6a25cf..7a1f164 100644
--- a/config.m4
+++ b/config.m4
@@ -18,7 +18,7 @@ if test "$PHP_PHPDBG" != "no"; then
   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 
phpdbg_info.c phpdbg_cmd.c"
+  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 
phpdbg_info.c phpdbg_cmd.c phpdbg_set.c"
 
   PHP_SUBST(PHP_PHPDBG_CFLAGS)
   PHP_SUBST(PHP_PHPDBG_FILES)
@@ -28,7 +28,7 @@ if test "$PHP_PHPDBG" != "no"; then
 
   BUILD_BINARY="sapi/phpdbg/phpdbg"
   BUILD_SHARED="sapi/phpdbg/libphpdbg.la"
-  
+
   BUILD_PHPDBG="\$(LIBTOOL) --mode=link \
         \$(CC) -export-dynamic \$(CFLAGS_CLEAN) \$(EXTRA_CFLAGS) 
\$(EXTRA_LDFLAGS_PROGRAM) \$(LDFLAGS) \$(PHP_RPATHS) \
                 \$(PHP_GLOBAL_OBJS) \
@@ -38,7 +38,7 @@ if test "$PHP_PHPDBG" != "no"; then
                 \$(PHPDBG_EXTRA_LIBS) \
                 \$(ZEND_EXTRA_LIBS) \
          -o \$(BUILD_BINARY)"
-  
+
   BUILD_PHPDBG_SHARED="\$(LIBTOOL) --mode=link \
         \$(CC) -shared -Wl,-soname,libphpdbg.so -export-dynamic 
\$(CFLAGS_CLEAN) \$(EXTRA_CFLAGS) \$(EXTRA_LDFLAGS_PROGRAM) \$(LDFLAGS) 
\$(PHP_RPATHS) \
                 \$(PHP_GLOBAL_OBJS) \
diff --git a/config.w32 b/config.w32
index eee355d..89778a3 100644
--- a/config.w32
+++ b/config.w32
@@ -1,7 +1,7 @@
 ARG_ENABLE('phpdbg', 'Build phpdbg', 'yes');
 
 if (PHP_PHPDBG == "yes") {
-    SAPI('phpdbg', 'phpdbg.c phpdbg_prompt.c phpdbg_cmd.c phpdbg_info.c 
phpdbg_help.c phpdbg_break.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_cmd.c phpdbg_info.c 
phpdbg_help.c phpdbg_break.c phpdbg_print.c phpdbg_bp.c phpdbg_opcode.c 
phpdbg_list.c phpdbg_utils.c phpdbg_set.c', 'phpdbg.exe');
     ADD_FLAG("LIBS_PHPDBG", "ws2_32.lib user32.lib");
 }
 
diff --git a/phpdbg.c b/phpdbg.c
index 94896cc..8a2369d 100644
--- a/phpdbg.c
+++ b/phpdbg.c
@@ -25,6 +25,7 @@
 #include "phpdbg_bp.h"
 #include "phpdbg_break.h"
 #include "phpdbg_utils.h"
+#include "phpdbg_set.h"
 
 ZEND_DECLARE_MODULE_GLOBALS(phpdbg);
 
@@ -36,6 +37,7 @@ void (*zend_execute_old)(zend_op_array *op_array TSRMLS_DC);
 
 static inline void php_phpdbg_globals_ctor(zend_phpdbg_globals *pg) /* {{{ */
 {
+       pg->prompt = NULL;
        pg->exec = NULL;
        pg->exec_len = 0;
        pg->ops = NULL;
@@ -147,6 +149,11 @@ static PHP_RSHUTDOWN_FUNCTION(phpdbg) /* {{{ */
                PHPDBG_G(exec) = NULL;
        }
 
+       if (PHPDBG_G(prompt)) {
+               efree(PHPDBG_G(prompt));
+               PHPDBG_G(prompt) = NULL;
+       }
+
        if (PHPDBG_G(oplog)) {
                fclose(
                                PHPDBG_G(oplog));
@@ -679,6 +686,9 @@ phpdbg_main:
                /* set flags from command line */
                PHPDBG_G(flags) = flags;
 
+               /* set default prompt */
+               phpdbg_set_prompt(PROMPT TSRMLS_CC);
+
                zend_try {
                        zend_activate_modules(TSRMLS_C);
                } zend_end_try();
diff --git a/phpdbg.h b/phpdbg.h
index 60a713a..8f455e8 100644
--- a/phpdbg.h
+++ b/phpdbg.h
@@ -131,6 +131,7 @@
 /* {{{ structs */
 ZEND_BEGIN_MODULE_GLOBALS(phpdbg)
     HashTable bp[PHPDBG_BREAK_TABLES];  /* break points */
+    char *prompt;                       /* prompt */
        char *exec;                         /* file to execute */
        size_t exec_len;                    /* size of exec */
        zend_op_array *ops;                 /* op_array */
diff --git a/phpdbg_cmd.c b/phpdbg_cmd.c
index 81d71da..1d12334 100644
--- a/phpdbg_cmd.c
+++ b/phpdbg_cmd.c
@@ -20,6 +20,7 @@
 #include "phpdbg.h"
 #include "phpdbg_cmd.h"
 #include "phpdbg_utils.h"
+#include "phpdbg_set.h"
 
 ZEND_EXTERN_MODULE_GLOBALS(phpdbg);
 
@@ -220,7 +221,7 @@ PHPDBG_API phpdbg_input_t *phpdbg_read_input(char *buffered 
TSRMLS_DC) /* {{{ */
                if (buffered == NULL) {
 #ifndef HAVE_LIBREADLINE
                        char buf[PHPDBG_MAX_CMD];
-                       if (!phpdbg_write(PROMPT) ||
+                       if (!phpdbg_write(phpdbg_get_prompt(TSRMLS_C)) ||
                                !fgets(buf, PHPDBG_MAX_CMD, 
PHPDBG_G(io)[PHPDBG_STDIN])) {
                                /* the user has gone away */
                                phpdbg_error("Failed to read console !");
@@ -231,7 +232,7 @@ PHPDBG_API phpdbg_input_t *phpdbg_read_input(char *buffered 
TSRMLS_DC) /* {{{ */
 
                        cmd = buf;
 #else
-                       cmd = readline(PROMPT);
+                       cmd = readline(phpdbg_get_prompt(TSRMLS_C));
                        if (!cmd) {
                                /* the user has gone away */
                                phpdbg_error("Failed to read console !");
@@ -381,7 +382,7 @@ PHPDBG_API int phpdbg_do_cmd(const phpdbg_command_t 
*command, phpdbg_input_t *in
                                }
 
                                rc = command->handler(&param, input TSRMLS_CC);
-                               
+
                                /* only set last command when it is worth it ! 
*/
                                if ((rc != FAILURE) &&
                                        !(PHPDBG_G(flags) & 
PHPDBG_IS_INITIALIZING)) {
diff --git a/phpdbg_prompt.c b/phpdbg_prompt.c
index 104d3de..da16df7 100644
--- a/phpdbg_prompt.c
+++ b/phpdbg_prompt.c
@@ -33,6 +33,7 @@
 #include "phpdbg_utils.h"
 #include "phpdbg_prompt.h"
 #include "phpdbg_cmd.h"
+#include "phpdbg_set.h"
 
 /* {{{ command declarations */
 const phpdbg_command_t phpdbg_prompt_commands[] = {
@@ -45,6 +46,7 @@ const phpdbg_command_t phpdbg_prompt_commands[] = {
        PHPDBG_COMMAND_D(until,   "continue past the current line",           
'u', NULL, 0),
        PHPDBG_COMMAND_D(finish,  "continue past the end of the stack",       
'F', NULL, 0),
        PHPDBG_COMMAND_D(leave,   "continue until the end of the stack",      
'L', NULL, 0),
+       PHPDBG_COMMAND_D(set,     "set debug properties",                     
'S', phpdbg_set_commands,   1),
        PHPDBG_COMMAND_D(print,   "print something",                          
'p', phpdbg_print_commands, 2),
        PHPDBG_COMMAND_D(break,   "set breakpoint",                           
'b', phpdbg_break_commands, 1),
        PHPDBG_COMMAND_D(back,    "show trace",                               
't', NULL, 0),
@@ -756,6 +758,14 @@ PHPDBG_COMMAND(info) /* {{{ */
        return SUCCESS;
 } /* }}} */
 
+PHPDBG_COMMAND(set) /* {{{ */
+{
+       phpdbg_error(
+               "No information command selected !");
+
+       return SUCCESS;
+} /* }}} */
+
 PHPDBG_COMMAND(break) /* {{{ */
 {
        switch (param->type) {
diff --git a/phpdbg_prompt.h b/phpdbg_prompt.h
index 7392b96..f2a15c0 100644
--- a/phpdbg_prompt.h
+++ b/phpdbg_prompt.h
@@ -37,6 +37,7 @@ PHPDBG_COMMAND(until);
 PHPDBG_COMMAND(finish);
 PHPDBG_COMMAND(leave);
 PHPDBG_COMMAND(frame);
+PHPDBG_COMMAND(set);
 PHPDBG_COMMAND(print);
 PHPDBG_COMMAND(break);
 PHPDBG_COMMAND(back);
diff --git a/phpdbg_utils.h b/phpdbg_utils.h
index b9c87b7..e59a7ed 100644
--- a/phpdbg_utils.h
+++ b/phpdbg_utils.h
@@ -70,7 +70,7 @@ int phpdbg_print(int TSRMLS_DC, FILE*, const char*, ...) 
PHP_ATTRIBUTE_FORMAT(pr
 #define EMPTY "" /* }}} */
 
 /* {{{ For prompt lines */
-#define PROMPT ((PHPDBG_G(flags) & PHPDBG_IS_COLOURED) ? 
"\033[1;64mphpdbg>\033[0m " : "phpdbg> ") /* }}} */
+#define PROMPT ((PHPDBG_G(flags) & PHPDBG_IS_COLOURED) ? 
"\033[1;64mphpdbg>\033[0m" : "phpdbg>") /* }}} */
 
 /* {{{ For separation */
 #define SEPARATE "------------------------------------------------" /* }}} */


--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to