mirror of
https://github.com/php/php-src.git
synced 2025-08-20 01:14:28 +02:00
Work in progress chekpoint of changes to help module. To allow peer review and feedback
This commit is contained in:
parent
261a5305c6
commit
88bd558a73
16 changed files with 948 additions and 723 deletions
|
@ -27,6 +27,22 @@
|
||||||
|
|
||||||
ZEND_EXTERN_MODULE_GLOBALS(phpdbg);
|
ZEND_EXTERN_MODULE_GLOBALS(phpdbg);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Commands
|
||||||
|
*/
|
||||||
|
const phpdbg_command_t phpdbg_break_commands[] = {
|
||||||
|
PHPDBG_COMMAND_D_EX(file, "specify breakpoint by file:line", 'F', break_file, NULL, 1),
|
||||||
|
PHPDBG_COMMAND_D_EX(func, "specify breakpoint by global function name", 'f', break_func, NULL, 1),
|
||||||
|
PHPDBG_COMMAND_D_EX(method, "specify breakpoint by class::method", 'm', break_method, NULL, 1),
|
||||||
|
PHPDBG_COMMAND_D_EX(address, "specify breakpoint by address", 'a', break_address, NULL, 1),
|
||||||
|
PHPDBG_COMMAND_D_EX(op, "specify breakpoint by opcode", 'O', break_op, NULL, 1),
|
||||||
|
PHPDBG_COMMAND_D_EX(on, "specify breakpoint by condition", 'o', break_on, NULL, 1),
|
||||||
|
PHPDBG_COMMAND_D_EX(at, "specify breakpoint by location and condition", 'A', break_at, NULL, 1),
|
||||||
|
PHPDBG_COMMAND_D_EX(lineno, "specify breakpoint by line of currently executing file", 'l', break_lineno, NULL, 1),
|
||||||
|
PHPDBG_COMMAND_D_EX(del, "delete breakpoint by identifier number", 'd', break_del, NULL, 1),
|
||||||
|
PHPDBG_END_COMMAND
|
||||||
|
};
|
||||||
|
|
||||||
PHPDBG_BREAK(file) /* {{{ */
|
PHPDBG_BREAK(file) /* {{{ */
|
||||||
{
|
{
|
||||||
switch (param->type) {
|
switch (param->type) {
|
||||||
|
|
|
@ -39,20 +39,6 @@ PHPDBG_BREAK(on);
|
||||||
PHPDBG_BREAK(lineno);
|
PHPDBG_BREAK(lineno);
|
||||||
PHPDBG_BREAK(del);
|
PHPDBG_BREAK(del);
|
||||||
|
|
||||||
/**
|
extern const phpdbg_command_t phpdbg_break_commands[];
|
||||||
* Commands
|
|
||||||
*/
|
|
||||||
static const phpdbg_command_t phpdbg_break_commands[] = {
|
|
||||||
PHPDBG_COMMAND_D_EX(file, "specify breakpoint by file:line", 'F', break_file, NULL, 1),
|
|
||||||
PHPDBG_COMMAND_D_EX(func, "specify breakpoint by global function name", 'f', break_func, NULL, 1),
|
|
||||||
PHPDBG_COMMAND_D_EX(method, "specify breakpoint by class::method", 'm', break_method, NULL, 1),
|
|
||||||
PHPDBG_COMMAND_D_EX(address, "specify breakpoint by address", 'a', break_address, NULL, 1),
|
|
||||||
PHPDBG_COMMAND_D_EX(op, "specify breakpoint by opcode", 'O', break_op, NULL, 1),
|
|
||||||
PHPDBG_COMMAND_D_EX(on, "specify breakpoint by condition", 'o', break_on, NULL, 1),
|
|
||||||
PHPDBG_COMMAND_D_EX(at, "specify breakpoint by location and condition", 'A', break_at, NULL, 1),
|
|
||||||
PHPDBG_COMMAND_D_EX(lineno, "specify breakpoint by line of currently executing file", 'l', break_lineno, NULL, 1),
|
|
||||||
PHPDBG_COMMAND_D_EX(del, "delete breakpoint by identifier number", 'd', break_del, NULL, 1),
|
|
||||||
PHPDBG_END_COMMAND
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif /* PHPDBG_BREAK_H */
|
#endif /* PHPDBG_BREAK_H */
|
||||||
|
|
1398
phpdbg_help.c
1398
phpdbg_help.c
File diff suppressed because it is too large
Load diff
|
@ -30,63 +30,19 @@
|
||||||
/**
|
/**
|
||||||
* Helper Forward Declarations
|
* Helper Forward Declarations
|
||||||
*/
|
*/
|
||||||
PHPDBG_HELP(exec);
|
PHPDBG_HELP(aliases);
|
||||||
PHPDBG_HELP(compile);
|
|
||||||
PHPDBG_HELP(step);
|
|
||||||
PHPDBG_HELP(next);
|
|
||||||
PHPDBG_HELP(run);
|
|
||||||
PHPDBG_HELP(eval);
|
|
||||||
PHPDBG_HELP(until);
|
|
||||||
PHPDBG_HELP(finish);
|
|
||||||
PHPDBG_HELP(leave);
|
|
||||||
PHPDBG_HELP(print);
|
|
||||||
PHPDBG_HELP(break);
|
|
||||||
PHPDBG_HELP(clean);
|
|
||||||
PHPDBG_HELP(clear);
|
|
||||||
PHPDBG_HELP(info);
|
|
||||||
PHPDBG_HELP(back);
|
|
||||||
PHPDBG_HELP(frame);
|
|
||||||
PHPDBG_HELP(quiet);
|
|
||||||
PHPDBG_HELP(list);
|
|
||||||
PHPDBG_HELP(set);
|
|
||||||
PHPDBG_HELP(register);
|
|
||||||
PHPDBG_HELP(options);
|
|
||||||
PHPDBG_HELP(source);
|
|
||||||
PHPDBG_HELP(shell);
|
|
||||||
|
|
||||||
/**
|
extern const phpdbg_command_t phpdbg_help_commands[];
|
||||||
* Commands
|
|
||||||
*/
|
|
||||||
static const phpdbg_command_t phpdbg_help_commands[] = {
|
|
||||||
PHPDBG_COMMAND_D_EX(exec, "the execution context should be a valid path", 'e', help_exec, NULL, 0),
|
|
||||||
PHPDBG_COMMAND_D_EX(compile, "allow inspection of code before execution", 'c', help_compile, NULL, 0),
|
|
||||||
PHPDBG_COMMAND_D_EX(step, "step through execution to break at every opcode", 's', help_step, NULL, 0),
|
|
||||||
PHPDBG_COMMAND_D_EX(next, "continue executing while stepping or after breaking", 'n', help_next, NULL, 0),
|
|
||||||
PHPDBG_COMMAND_D_EX(run, "execute inside the phpdbg vm", 'r', help_run, NULL, 0),
|
|
||||||
PHPDBG_COMMAND_D_EX(eval, "access to eval() allows affecting the environment", 'E', help_eval, NULL, 0),
|
|
||||||
PHPDBG_COMMAND_D_EX(until, "continue until the current line is executed", 'u', help_until, NULL, 0),
|
|
||||||
PHPDBG_COMMAND_D_EX(finish, "continue until the current function has returned", 'F', help_finish, NULL, 0),
|
|
||||||
PHPDBG_COMMAND_D_EX(leave, "continue until the current function is returning", 'L', help_leave, NULL, 0),
|
|
||||||
PHPDBG_COMMAND_D_EX(print, "print context information or instructions", 'p', help_print, NULL, 0),
|
|
||||||
PHPDBG_COMMAND_D_EX(break, "breakpoints allow execution interruption", 'b', help_break, NULL, 0),
|
|
||||||
PHPDBG_COMMAND_D_EX(clean, "resetting the environment is useful while debugging", 'X', help_clean, NULL, 0),
|
|
||||||
PHPDBG_COMMAND_D_EX(clear, "reset breakpoints to execute without interruption", 'c', help_clear, NULL, 0),
|
|
||||||
PHPDBG_COMMAND_D_EX(info, "quick access to useful information on the console", 'i', help_info, NULL, 0),
|
|
||||||
PHPDBG_COMMAND_D_EX(back, "show debug backtrace information during execution", 't', help_back, NULL, 0),
|
|
||||||
PHPDBG_COMMAND_D_EX(frame, "switch to a frame in the current stack for inspection", 'f', help_frame, 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(set, "configure how phpdbg looks and behaves", 'S', help_set, 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(source, "load a phpdbginit file at the console", '.', help_source, NULL, 0),
|
|
||||||
PHPDBG_COMMAND_D_EX(shell, "execute system commands with direct shell access", '-', help_shell, NULL, 0),
|
|
||||||
PHPDBG_END_COMMAND
|
|
||||||
};
|
|
||||||
|
|
||||||
#define phpdbg_help_header() \
|
#define phpdbg_help_header() \
|
||||||
phpdbg_notice("Welcome to phpdbg, the interactive PHP debugger, v%s", PHPDBG_VERSION);
|
phpdbg_notice("Welcome to phpdbg, the interactive PHP debugger, v%s", PHPDBG_VERSION);
|
||||||
#define phpdbg_help_footer() \
|
#define phpdbg_help_footer() \
|
||||||
phpdbg_notice("Please report bugs to <%s>", PHPDBG_ISSUES);
|
phpdbg_notice("Please report bugs to <%s>", PHPDBG_ISSUES);
|
||||||
|
|
||||||
|
typedef struct _phpdbg_help_text_t {
|
||||||
|
char *key;
|
||||||
|
char *text;
|
||||||
|
} phpdbg_help_text_t;
|
||||||
|
|
||||||
|
extern phpdbg_help_text_t phpdbg_help_text[];
|
||||||
#endif /* PHPDBG_HELP_H */
|
#endif /* PHPDBG_HELP_H */
|
||||||
|
|
|
@ -26,6 +26,18 @@
|
||||||
|
|
||||||
ZEND_EXTERN_MODULE_GLOBALS(phpdbg);
|
ZEND_EXTERN_MODULE_GLOBALS(phpdbg);
|
||||||
|
|
||||||
|
const phpdbg_command_t phpdbg_info_commands[] = {
|
||||||
|
PHPDBG_COMMAND_D_EX(break, "show breakpoints", 'b', info_break, NULL, 0),
|
||||||
|
PHPDBG_COMMAND_D_EX(files, "show included files", 'F', info_files, NULL, 0),
|
||||||
|
PHPDBG_COMMAND_D_EX(classes, "show loaded classes", 'c', info_classes, NULL, 0),
|
||||||
|
PHPDBG_COMMAND_D_EX(funcs, "show loaded classes", 'f', info_funcs, NULL, 0),
|
||||||
|
PHPDBG_COMMAND_D_EX(error, "show last error", 'e', info_error, NULL, 0),
|
||||||
|
PHPDBG_COMMAND_D_EX(vars, "show active variables", 'v', info_vars, NULL, 0),
|
||||||
|
PHPDBG_COMMAND_D_EX(literal, "show active literal constants", 'l', info_literal, NULL, 0),
|
||||||
|
PHPDBG_COMMAND_D_EX(memory, "show memory manager stats", 'm', info_memory, NULL, 0),
|
||||||
|
PHPDBG_END_COMMAND
|
||||||
|
};
|
||||||
|
|
||||||
PHPDBG_INFO(break) /* {{{ */
|
PHPDBG_INFO(break) /* {{{ */
|
||||||
{
|
{
|
||||||
phpdbg_print_breakpoints(PHPDBG_BREAK_FILE TSRMLS_CC);
|
phpdbg_print_breakpoints(PHPDBG_BREAK_FILE TSRMLS_CC);
|
||||||
|
|
|
@ -34,16 +34,6 @@ PHPDBG_INFO(vars);
|
||||||
PHPDBG_INFO(literal);
|
PHPDBG_INFO(literal);
|
||||||
PHPDBG_INFO(memory);
|
PHPDBG_INFO(memory);
|
||||||
|
|
||||||
static const phpdbg_command_t phpdbg_info_commands[] = {
|
extern const phpdbg_command_t phpdbg_info_commands[];
|
||||||
PHPDBG_COMMAND_D_EX(break, "show breakpoints", 'b', info_break, NULL, 0),
|
|
||||||
PHPDBG_COMMAND_D_EX(files, "show included files", 'F', info_files, NULL, 0),
|
|
||||||
PHPDBG_COMMAND_D_EX(classes, "show loaded classes", 'c', info_classes, NULL, 0),
|
|
||||||
PHPDBG_COMMAND_D_EX(funcs, "show loaded classes", 'f', info_funcs, NULL, 0),
|
|
||||||
PHPDBG_COMMAND_D_EX(error, "show last error", 'e', info_error, NULL, 0),
|
|
||||||
PHPDBG_COMMAND_D_EX(vars, "show active variables", 'v', info_vars, NULL, 0),
|
|
||||||
PHPDBG_COMMAND_D_EX(literal, "show active literal constants", 'l', info_literal, NULL, 0),
|
|
||||||
PHPDBG_COMMAND_D_EX(memory, "show memory manager stats", 'm', info_memory, NULL, 0),
|
|
||||||
PHPDBG_END_COMMAND
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif /* PHPDBG_INFO_H */
|
#endif /* PHPDBG_INFO_H */
|
||||||
|
|
|
@ -32,6 +32,14 @@
|
||||||
|
|
||||||
ZEND_EXTERN_MODULE_GLOBALS(phpdbg);
|
ZEND_EXTERN_MODULE_GLOBALS(phpdbg);
|
||||||
|
|
||||||
|
const phpdbg_command_t phpdbg_list_commands[] = {
|
||||||
|
PHPDBG_COMMAND_D_EX(lines, "lists the specified lines", 'l', list_lines, NULL, 1),
|
||||||
|
PHPDBG_COMMAND_D_EX(class, "lists the specified class", 'c', list_class, NULL, 1),
|
||||||
|
PHPDBG_COMMAND_D_EX(method, "lists the specified method", 'm', list_method, NULL, 1),
|
||||||
|
PHPDBG_COMMAND_D_EX(func, "lists the specified function", 'f', list_func, NULL, 1),
|
||||||
|
PHPDBG_END_COMMAND
|
||||||
|
};
|
||||||
|
|
||||||
PHPDBG_LIST(lines) /* {{{ */
|
PHPDBG_LIST(lines) /* {{{ */
|
||||||
{
|
{
|
||||||
if (!PHPDBG_G(exec) && !zend_is_executing(TSRMLS_C)) {
|
if (!PHPDBG_G(exec) && !zend_is_executing(TSRMLS_C)) {
|
||||||
|
|
|
@ -36,12 +36,6 @@ void phpdbg_list_function_byname(const char *, size_t TSRMLS_DC);
|
||||||
void phpdbg_list_function(const zend_function* TSRMLS_DC);
|
void phpdbg_list_function(const zend_function* TSRMLS_DC);
|
||||||
void phpdbg_list_file(const char*, long, long, int TSRMLS_DC);
|
void phpdbg_list_file(const char*, long, long, int TSRMLS_DC);
|
||||||
|
|
||||||
static const phpdbg_command_t phpdbg_list_commands[] = {
|
extern const phpdbg_command_t phpdbg_list_commands[];
|
||||||
PHPDBG_COMMAND_D_EX(lines, "lists the specified lines", 'l', list_lines, NULL, 1),
|
|
||||||
PHPDBG_COMMAND_D_EX(class, "lists the specified class", 'c', list_class, NULL, 1),
|
|
||||||
PHPDBG_COMMAND_D_EX(method, "lists the specified method", 'm', list_method, NULL, 1),
|
|
||||||
PHPDBG_COMMAND_D_EX(func, "lists the specified function", 'f', list_func, NULL, 1),
|
|
||||||
PHPDBG_END_COMMAND
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif /* PHPDBG_LIST_H */
|
#endif /* PHPDBG_LIST_H */
|
||||||
|
|
|
@ -26,6 +26,16 @@
|
||||||
|
|
||||||
ZEND_EXTERN_MODULE_GLOBALS(phpdbg);
|
ZEND_EXTERN_MODULE_GLOBALS(phpdbg);
|
||||||
|
|
||||||
|
const phpdbg_command_t phpdbg_print_commands[] = {
|
||||||
|
PHPDBG_COMMAND_D_EX(exec, "print out the instructions in the execution context", 'e', print_exec, NULL, 0),
|
||||||
|
PHPDBG_COMMAND_D_EX(opline, "print out the instruction in the current opline", 'o', print_opline, NULL, 0),
|
||||||
|
PHPDBG_COMMAND_D_EX(class, "print out the instructions in the specified class", 'c', print_class, NULL, 1),
|
||||||
|
PHPDBG_COMMAND_D_EX(method, "print out the instructions in the specified method", 'm', print_method, NULL, 1),
|
||||||
|
PHPDBG_COMMAND_D_EX(func, "print out the instructions in the specified function", 'f', print_func, NULL, 1),
|
||||||
|
PHPDBG_COMMAND_D_EX(stack, "print out the instructions in the current stack", 's', print_stack, NULL, 0),
|
||||||
|
PHPDBG_END_COMMAND
|
||||||
|
};
|
||||||
|
|
||||||
PHPDBG_PRINT(opline) /* {{{ */
|
PHPDBG_PRINT(opline) /* {{{ */
|
||||||
{
|
{
|
||||||
if (EG(in_execution) && EG(current_execute_data)) {
|
if (EG(in_execution) && EG(current_execute_data)) {
|
||||||
|
|
|
@ -35,17 +35,6 @@ PHPDBG_PRINT(method);
|
||||||
PHPDBG_PRINT(func);
|
PHPDBG_PRINT(func);
|
||||||
PHPDBG_PRINT(stack);
|
PHPDBG_PRINT(stack);
|
||||||
|
|
||||||
/**
|
extern const phpdbg_command_t phpdbg_print_commands[];
|
||||||
* Commands
|
|
||||||
*/
|
|
||||||
static const phpdbg_command_t phpdbg_print_commands[] = {
|
|
||||||
PHPDBG_COMMAND_D_EX(exec, "print out the instructions in the execution context", 'e', print_exec, NULL, 0),
|
|
||||||
PHPDBG_COMMAND_D_EX(opline, "print out the instruction in the current opline", 'o', print_opline, NULL, 0),
|
|
||||||
PHPDBG_COMMAND_D_EX(class, "print out the instructions in the specified class", 'c', print_class, NULL, 1),
|
|
||||||
PHPDBG_COMMAND_D_EX(method, "print out the instructions in the specified method", 'm', print_method, NULL, 1),
|
|
||||||
PHPDBG_COMMAND_D_EX(func, "print out the instructions in the specified function", 'f', print_func, NULL, 1),
|
|
||||||
PHPDBG_COMMAND_D_EX(stack, "print out the instructions in the current stack", 's', print_stack, NULL, 0),
|
|
||||||
PHPDBG_END_COMMAND
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif /* PHPDBG_PRINT_H */
|
#endif /* PHPDBG_PRINT_H */
|
||||||
|
|
|
@ -57,7 +57,6 @@ const phpdbg_command_t phpdbg_prompt_commands[] = {
|
||||||
PHPDBG_COMMAND_D(clear, "clear breakpoints", 'C', NULL, 0),
|
PHPDBG_COMMAND_D(clear, "clear breakpoints", 'C', NULL, 0),
|
||||||
PHPDBG_COMMAND_D(help, "show help menu", 'h', phpdbg_help_commands, 2),
|
PHPDBG_COMMAND_D(help, "show help menu", 'h', phpdbg_help_commands, 2),
|
||||||
PHPDBG_COMMAND_D(quiet, "silence some output", 'Q', NULL, 1),
|
PHPDBG_COMMAND_D(quiet, "silence some output", 'Q', NULL, 1),
|
||||||
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(source, "execute a phpdbginit", '.', NULL, 1),
|
||||||
|
@ -908,76 +907,6 @@ PHPDBG_COMMAND(clear) /* {{{ */
|
||||||
return SUCCESS;
|
return SUCCESS;
|
||||||
} /* }}} */
|
} /* }}} */
|
||||||
|
|
||||||
PHPDBG_COMMAND(aliases) /* {{{ */
|
|
||||||
{
|
|
||||||
const phpdbg_command_t *prompt_command = phpdbg_prompt_commands;
|
|
||||||
|
|
||||||
phpdbg_help_header();
|
|
||||||
phpdbg_writeln("Below are the aliased, short versions of all supported commands");
|
|
||||||
while (prompt_command && prompt_command->name) {
|
|
||||||
if (prompt_command->alias) {
|
|
||||||
if (prompt_command->subs) {
|
|
||||||
const phpdbg_command_t *sub_command = prompt_command->subs;
|
|
||||||
phpdbg_writeln(EMPTY);
|
|
||||||
phpdbg_writeln(" %c -> %9s", prompt_command->alias, prompt_command->name);
|
|
||||||
while (sub_command && sub_command->name) {
|
|
||||||
if (sub_command->alias) {
|
|
||||||
phpdbg_writeln(" |-------- %c -> %15s\t%s", sub_command->alias,
|
|
||||||
sub_command->name, sub_command->tip);
|
|
||||||
}
|
|
||||||
++sub_command;
|
|
||||||
}
|
|
||||||
phpdbg_writeln(EMPTY);
|
|
||||||
} else {
|
|
||||||
phpdbg_writeln(" %c -> %9s\t\t\t%s", prompt_command->alias,
|
|
||||||
prompt_command->name, prompt_command->tip);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
++prompt_command;
|
|
||||||
}
|
|
||||||
phpdbg_help_footer();
|
|
||||||
|
|
||||||
return SUCCESS;
|
|
||||||
} /* }}} */
|
|
||||||
|
|
||||||
PHPDBG_COMMAND(help) /* {{{ */
|
|
||||||
{
|
|
||||||
switch (param->type) {
|
|
||||||
case EMPTY_PARAM: {
|
|
||||||
const phpdbg_command_t *prompt_command = phpdbg_prompt_commands;
|
|
||||||
const phpdbg_command_t *help_command = phpdbg_help_commands;
|
|
||||||
|
|
||||||
phpdbg_help_header();
|
|
||||||
phpdbg_writeln("To get help regarding a specific command type \"help command\"");
|
|
||||||
|
|
||||||
phpdbg_notice("Commands");
|
|
||||||
|
|
||||||
while (prompt_command && prompt_command->name) {
|
|
||||||
phpdbg_writeln(
|
|
||||||
" %10s\t%s", prompt_command->name, prompt_command->tip);
|
|
||||||
++prompt_command;
|
|
||||||
}
|
|
||||||
|
|
||||||
phpdbg_notice("Help Commands");
|
|
||||||
|
|
||||||
while (help_command && help_command->name) {
|
|
||||||
phpdbg_writeln(" %10s\t%s", help_command->name, help_command->tip);
|
|
||||||
++help_command;
|
|
||||||
}
|
|
||||||
|
|
||||||
phpdbg_help_footer();
|
|
||||||
} break;
|
|
||||||
|
|
||||||
default: {
|
|
||||||
phpdbg_error(
|
|
||||||
"No help can be found for the subject \"%s\"", param->str);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return SUCCESS;
|
|
||||||
} /* }}} */
|
|
||||||
|
|
||||||
PHPDBG_COMMAND(quiet) /* {{{ */
|
PHPDBG_COMMAND(quiet) /* {{{ */
|
||||||
{
|
{
|
||||||
switch (param->type) {
|
switch (param->type) {
|
||||||
|
|
|
@ -48,7 +48,6 @@ PHPDBG_COMMAND(clean);
|
||||||
PHPDBG_COMMAND(clear);
|
PHPDBG_COMMAND(clear);
|
||||||
PHPDBG_COMMAND(help);
|
PHPDBG_COMMAND(help);
|
||||||
PHPDBG_COMMAND(quiet);
|
PHPDBG_COMMAND(quiet);
|
||||||
PHPDBG_COMMAND(aliases);
|
|
||||||
PHPDBG_COMMAND(shell);
|
PHPDBG_COMMAND(shell);
|
||||||
PHPDBG_COMMAND(set);
|
PHPDBG_COMMAND(set);
|
||||||
PHPDBG_COMMAND(source);
|
PHPDBG_COMMAND(source);
|
||||||
|
|
11
phpdbg_set.c
11
phpdbg_set.c
|
@ -26,6 +26,17 @@
|
||||||
|
|
||||||
ZEND_EXTERN_MODULE_GLOBALS(phpdbg);
|
ZEND_EXTERN_MODULE_GLOBALS(phpdbg);
|
||||||
|
|
||||||
|
const phpdbg_command_t phpdbg_set_commands[] = {
|
||||||
|
PHPDBG_COMMAND_D_EX(prompt, "usage: set prompt <string>", 'p', set_prompt, NULL, 0),
|
||||||
|
#ifndef _WIN32
|
||||||
|
PHPDBG_COMMAND_D_EX(color, "usage: set color <element> <color>", 'c', set_color, NULL, 1),
|
||||||
|
PHPDBG_COMMAND_D_EX(colors, "usage: set colors <on|off>", 'C', set_colors, NULL, 1),
|
||||||
|
#endif
|
||||||
|
PHPDBG_COMMAND_D_EX(oplog, "usage: set oplog <output>", 'O', set_oplog, NULL, 0),
|
||||||
|
PHPDBG_COMMAND_D_EX(break, "usage: set break [id] <on|off>", 'b', set_break, NULL, 0),
|
||||||
|
PHPDBG_END_COMMAND
|
||||||
|
};
|
||||||
|
|
||||||
PHPDBG_SET(prompt) /* {{{ */
|
PHPDBG_SET(prompt) /* {{{ */
|
||||||
{
|
{
|
||||||
switch (param->type) {
|
switch (param->type) {
|
||||||
|
|
11
phpdbg_set.h
11
phpdbg_set.h
|
@ -33,15 +33,6 @@ PHPDBG_SET(colors);
|
||||||
PHPDBG_SET(oplog);
|
PHPDBG_SET(oplog);
|
||||||
PHPDBG_SET(break);
|
PHPDBG_SET(break);
|
||||||
|
|
||||||
static const phpdbg_command_t phpdbg_set_commands[] = {
|
extern const phpdbg_command_t phpdbg_set_commands[];
|
||||||
PHPDBG_COMMAND_D_EX(prompt, "usage: set prompt <string>", 'p', set_prompt, NULL, 0),
|
|
||||||
#ifndef _WIN32
|
|
||||||
PHPDBG_COMMAND_D_EX(color, "usage: set color <element> <color>", 'c', set_color, NULL, 1),
|
|
||||||
PHPDBG_COMMAND_D_EX(colors, "usage: set colors <on|off>", 'C', set_colors, NULL, 1),
|
|
||||||
#endif
|
|
||||||
PHPDBG_COMMAND_D_EX(oplog, "usage: set oplog <output>", 'O', set_oplog, NULL, 0),
|
|
||||||
PHPDBG_COMMAND_D_EX(break, "usage: set break [id] <on|off>", 'b', set_break, NULL, 0),
|
|
||||||
PHPDBG_END_COMMAND
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif /* PHPDBG_SET_H */
|
#endif /* PHPDBG_SET_H */
|
||||||
|
|
|
@ -30,6 +30,8 @@
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
# include "win32/time.h"
|
# include "win32/time.h"
|
||||||
|
#elif defined(HAVE_SYS_IOCTL_H)
|
||||||
|
# include "sys/ioctl.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
ZEND_EXTERN_MODULE_GLOBALS(phpdbg);
|
ZEND_EXTERN_MODULE_GLOBALS(phpdbg);
|
||||||
|
@ -385,3 +387,22 @@ PHPDBG_API const char *phpdbg_get_prompt(TSRMLS_D) /* {{{ */
|
||||||
|
|
||||||
return PHPDBG_G(prompt)[1];
|
return PHPDBG_G(prompt)[1];
|
||||||
} /* }}} */
|
} /* }}} */
|
||||||
|
|
||||||
|
PHPDBG_API int phpdbg_get_terminal_width(TSRMLS_D) /* {{{ */
|
||||||
|
{
|
||||||
|
int columns;
|
||||||
|
#ifdef _win32
|
||||||
|
CONSOLE_SCREEN_BUFFER_INFO csbi;
|
||||||
|
|
||||||
|
GetConsoleScreenBufferInfo(GetStdHandle(STD_OUTPUT_HANDLE), &csbi);
|
||||||
|
columns = csbi.srWindow.Right - csbi.srWindow.Left + 1;
|
||||||
|
#elif defined(HAVE_SYS_IOCTL_H)
|
||||||
|
struct winsize w;
|
||||||
|
|
||||||
|
columns = ioctl(fileno(stdout), TIOCGWINSZ, &w) == 0 ? w.ws_col : 100;
|
||||||
|
#else
|
||||||
|
columns = 100;
|
||||||
|
#endif
|
||||||
|
return columns;
|
||||||
|
} /* }}} */
|
||||||
|
|
||||||
|
|
|
@ -107,4 +107,7 @@ PHPDBG_API const phpdbg_color_t* phpdbg_get_colors(TSRMLS_D); /* }}} */
|
||||||
PHPDBG_API void phpdbg_set_prompt(const char* TSRMLS_DC);
|
PHPDBG_API void phpdbg_set_prompt(const char* TSRMLS_DC);
|
||||||
PHPDBG_API const char *phpdbg_get_prompt(TSRMLS_D); /* }}} */
|
PHPDBG_API const char *phpdbg_get_prompt(TSRMLS_D); /* }}} */
|
||||||
|
|
||||||
|
/* {{{ Console Width */
|
||||||
|
PHPDBG_API int phpdbg_get_terminal_width(TSRMLS_D); /* }}} */
|
||||||
|
|
||||||
#endif /* PHPDBG_UTILS_H */
|
#endif /* PHPDBG_UTILS_H */
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue