]> granicus.if.org Git - php/commitdiff
export command
authorkrakjoe <joe.watkins@live.co.uk>
Mon, 24 Feb 2014 19:03:55 +0000 (19:03 +0000)
committerkrakjoe <joe.watkins@live.co.uk>
Mon, 24 Feb 2014 19:03:55 +0000 (19:03 +0000)
phpdbg_help.c
phpdbg_prompt.c
phpdbg_prompt.h

index 47289fb6731fcdf0a99a9a81cb310c8a2b0e5095..941d58ce670b71652da73144b3e8702fe5c1cbbc 100644 (file)
@@ -853,17 +853,21 @@ phpdbg_help_text_t phpdbg_help_text[] = {
 {"source",
 "Sourcing a **phpdbginit** script during your debugging session might save some time." CR CR
 
-"The source command can also be used to export breakpoints to a phpdbginit file." CR CR
-
 "**Examples**" CR CR
 
 "    $P source /my/init" CR
-"    $P . /my/init" CR
+"    $P < /my/init" CR
 "    Will execute the phpdbginit file at /my/init" CR CR
+},
+
+{"export",
+"Exporting breakpoints allows you to share, and or save your current debugging session" CR CR
+
+"**Examples**" CR CR
 
-"    $P source export /my/init" CR
-"    $P . export /my/init" CR
-"    Will export breakpoints to /my/init in phpdbginit file format"
+"    $P export /my/exports" CR
+"    $P > /my/exports" CR
+"    Will export all breakpoints to /my/exports" CR CR
 },
 
 {"step",
index b55e5d7a591fa545c71b5272e751a9baca289495..2cae1b6aa962ef560bf9789848813588f28a4f1f 100644 (file)
@@ -62,7 +62,8 @@ const phpdbg_command_t phpdbg_prompt_commands[] = {
        PHPDBG_COMMAND_D(help,    "show help menu",                           'h', phpdbg_help_commands, "|s"),
        PHPDBG_COMMAND_D(set,     "set phpdbg configuration",                 'S', phpdbg_set_commands,   "s"),
        PHPDBG_COMMAND_D(register,"register a function",                      'R', NULL, "s"),
-       PHPDBG_COMMAND_D(source,  "execute a phpdbginit",                     '-', NULL, "s"),
+       PHPDBG_COMMAND_D(source,  "execute a phpdbginit",                     '<', NULL, "s"),
+       PHPDBG_COMMAND_D(export,  "export breaks to a .phpdbginit script",    '>', NULL, "s"),
        PHPDBG_COMMAND_D(sh,      "shell a command",                           0, NULL, "i"),
        PHPDBG_COMMAND_D(quit,    "exit phpdbg",                              'q', NULL, 0),
        PHPDBG_END_COMMAND
@@ -818,11 +819,29 @@ PHPDBG_COMMAND(source) /* {{{ */
        
        if (VCWD_STAT(param->str, &sb) != -1) {
                phpdbg_try_file_init(param->str, param->len, 0 TSRMLS_CC);
-       } else phpdbg_error("Cannot stat %s", param->str);
+       } else {
+               phpdbg_error(
+                       "Failed to stat %s, file does not exist", param->str);
+       }
                        
        return SUCCESS;
 } /* }}} */
 
+PHPDBG_COMMAND(export) /* {{{ */
+{
+       FILE *handle = VCWD_FOPEN(param->str, "w+");
+       
+       if (handle) {
+               phpdbg_export_breakpoints(handle TSRMLS_CC);
+               fclose(handle);
+       } else {
+               phpdbg_error(
+                       "Failed to open or create %s, check path and permissions", param->str);
+       }
+       
+       return SUCCESS;
+} /* }}} */
+
 PHPDBG_COMMAND(register) /* {{{ */
 {
        zend_function *function;
index 5590dd41219771cfa38d6676940f3e034dd2fb0b..1a48acade371cb7aa9cb06e82dd6809aaffd7f36 100644 (file)
@@ -50,6 +50,7 @@ PHPDBG_COMMAND(help);
 PHPDBG_COMMAND(sh);
 PHPDBG_COMMAND(set);
 PHPDBG_COMMAND(source);
+PHPDBG_COMMAND(export);
 PHPDBG_COMMAND(register);
 PHPDBG_COMMAND(quit); /* }}} */