From: krakjoe Date: Mon, 25 Nov 2013 16:39:14 +0000 (+0000) Subject: add source command X-Git-Tag: php-5.6.0alpha1~110^2~63 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=3078834098dec69eb666087fd725655abb3a8c44;p=php add source command --- diff --git a/phpdbg_help.c b/phpdbg_help.c index f233d9005e..fe621fb818 100644 --- a/phpdbg_help.c +++ b/phpdbg_help.c @@ -501,6 +501,19 @@ PHPDBG_HELP(register) /* {{{ */ return SUCCESS; } /* }}} */ +PHPDBG_HELP(source) /* {{{ */ +{ + phpdbg_help_header(); + phpdbg_writeln("Sourcing a phpdbginit during your debugging session might save some time"); + phpdbg_writeln(EMPTY); + phpdbg_notice("Examples"); + phpdbg_writeln("\t%ssource /my/phpdbginit", PROMPT); + phpdbg_writeln("\t%s. /my/phpdbginit", PROMPT); + phpdbg_writeln("\tWill execute the init file at /my/phpdbginit"); + phpdbg_help_footer(); + return SUCCESS; +} /* }}} */ + PHPDBG_HELP(shell) /* {{{ */ { phpdbg_help_header(); diff --git a/phpdbg_help.h b/phpdbg_help.h index d1e37ace5e..f9306e5c61 100644 --- a/phpdbg_help.h +++ b/phpdbg_help.h @@ -48,6 +48,7 @@ PHPDBG_HELP(frame); PHPDBG_HELP(quiet); PHPDBG_HELP(list); PHPDBG_HELP(set); +PHPDBG_HELP(source); PHPDBG_HELP(register); PHPDBG_HELP(options); PHPDBG_HELP(shell); @@ -75,6 +76,7 @@ static const phpdbg_command_t phpdbg_help_commands[] = { PHPDBG_COMMAND_D_EX(quiet, "be quiet during execution", 'Q', help_quiet, NULL, 0), PHPDBG_COMMAND_D_EX(list, "list code gives you quick access to code", 'l', help_list, NULL, 0), PHPDBG_COMMAND_D_EX(set, "configure how phpdbg looks and behaves", 'S', help_set, NULL, 0), + PHPDBG_COMMAND_D_EX(source, "load a phpdbginit file at the console", '.', help_source, NULL, 0), PHPDBG_COMMAND_D_EX(register, "register a function for use as a command", 'R', help_register,NULL, 0), PHPDBG_COMMAND_D_EX(options, "show information about command line options", 'o', help_options, NULL, 0), PHPDBG_COMMAND_D_EX(shell, "execute system commands with direct shell access", '-', help_shell, NULL, 0), diff --git a/phpdbg_prompt.c b/phpdbg_prompt.c index b1e5aecf88..7328d4f075 100644 --- a/phpdbg_prompt.c +++ b/phpdbg_prompt.c @@ -59,6 +59,7 @@ const phpdbg_command_t phpdbg_prompt_commands[] = { PHPDBG_COMMAND_D(aliases, "show alias list", 'a', NULL, 0), PHPDBG_COMMAND_D(set, "set phpdbg configuration", 'S', phpdbg_set_commands, 1), PHPDBG_COMMAND_D(register,"register a function", 'R', NULL, 1), + PHPDBG_COMMAND_D(source, "execute a phpdbginit", '.', NULL, 1), PHPDBG_COMMAND_D(shell, "shell a command", '-', NULL, 1), PHPDBG_COMMAND_D(quit, "exit phpdbg", 'q', NULL, 0), PHPDBG_END_COMMAND @@ -822,6 +823,18 @@ PHPDBG_COMMAND(shell) /* {{{ */ return SUCCESS; } /* }}} */ +PHPDBG_COMMAND(source) /* {{{ */ +{ + switch (param->type) { + case STR_PARAM: { + phpdbg_init(param->str, param->len, 0 TSRMLS_CC); + } break; + + phpdbg_default_switch_case(); + } + return SUCCESS; +} /* }}} */ + PHPDBG_COMMAND(register) /* {{{ */ { switch (param->type) { diff --git a/phpdbg_prompt.h b/phpdbg_prompt.h index d227422c55..8ed2d83c40 100644 --- a/phpdbg_prompt.h +++ b/phpdbg_prompt.h @@ -49,6 +49,7 @@ PHPDBG_COMMAND(quiet); PHPDBG_COMMAND(aliases); PHPDBG_COMMAND(shell); PHPDBG_COMMAND(set); +PHPDBG_COMMAND(source); PHPDBG_COMMAND(register); PHPDBG_COMMAND(quit); /* }}} */