add source command

This commit is contained in:
krakjoe 2013-11-25 16:39:14 +00:00
parent 36c09510fb
commit 3078834098
4 changed files with 29 additions and 0 deletions

View file

@ -501,6 +501,19 @@ PHPDBG_HELP(register) /* {{{ */
return SUCCESS; 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(shell) /* {{{ */
{ {
phpdbg_help_header(); phpdbg_help_header();

View file

@ -48,6 +48,7 @@ PHPDBG_HELP(frame);
PHPDBG_HELP(quiet); PHPDBG_HELP(quiet);
PHPDBG_HELP(list); PHPDBG_HELP(list);
PHPDBG_HELP(set); PHPDBG_HELP(set);
PHPDBG_HELP(source);
PHPDBG_HELP(register); PHPDBG_HELP(register);
PHPDBG_HELP(options); PHPDBG_HELP(options);
PHPDBG_HELP(shell); 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(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(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(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(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(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), PHPDBG_COMMAND_D_EX(shell, "execute system commands with direct shell access", '-', help_shell, NULL, 0),

View file

@ -59,6 +59,7 @@ const phpdbg_command_t phpdbg_prompt_commands[] = {
PHPDBG_COMMAND_D(aliases, "show alias list", 'a', NULL, 0), 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(set, "set phpdbg configuration", 'S', phpdbg_set_commands, 1),
PHPDBG_COMMAND_D(register,"register a function", 'R', NULL, 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(shell, "shell a command", '-', NULL, 1),
PHPDBG_COMMAND_D(quit, "exit phpdbg", 'q', NULL, 0), PHPDBG_COMMAND_D(quit, "exit phpdbg", 'q', NULL, 0),
PHPDBG_END_COMMAND PHPDBG_END_COMMAND
@ -822,6 +823,18 @@ PHPDBG_COMMAND(shell) /* {{{ */
return SUCCESS; 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) /* {{{ */ PHPDBG_COMMAND(register) /* {{{ */
{ {
switch (param->type) { switch (param->type) {

View file

@ -49,6 +49,7 @@ PHPDBG_COMMAND(quiet);
PHPDBG_COMMAND(aliases); PHPDBG_COMMAND(aliases);
PHPDBG_COMMAND(shell); PHPDBG_COMMAND(shell);
PHPDBG_COMMAND(set); PHPDBG_COMMAND(set);
PHPDBG_COMMAND(source);
PHPDBG_COMMAND(register); PHPDBG_COMMAND(register);
PHPDBG_COMMAND(quit); /* }}} */ PHPDBG_COMMAND(quit); /* }}} */