mirror of
https://github.com/php/php-src.git
synced 2024-12-04 07:14:10 +08:00
remove input_t
support single char aliases ...
This commit is contained in:
parent
e2e93ac259
commit
996182993d
10
phpdbg.c
10
phpdbg.c
@ -271,19 +271,19 @@ static PHP_FUNCTION(phpdbg_break)
|
||||
|
||||
switch (type) {
|
||||
case METHOD_PARAM:
|
||||
phpdbg_do_break_method(¶m, NULL TSRMLS_CC);
|
||||
phpdbg_do_break_method(¶m TSRMLS_CC);
|
||||
break;
|
||||
|
||||
case FILE_PARAM:
|
||||
phpdbg_do_break_file(¶m, NULL TSRMLS_CC);
|
||||
phpdbg_do_break_file(¶m TSRMLS_CC);
|
||||
break;
|
||||
|
||||
case NUMERIC_PARAM:
|
||||
phpdbg_do_break_lineno(¶m, NULL TSRMLS_CC);
|
||||
phpdbg_do_break_lineno(¶m TSRMLS_CC);
|
||||
break;
|
||||
|
||||
case STR_PARAM:
|
||||
phpdbg_do_break_func(¶m, NULL TSRMLS_CC);
|
||||
phpdbg_do_break_func(¶m TSRMLS_CC);
|
||||
break;
|
||||
|
||||
default: zend_error(
|
||||
@ -1232,7 +1232,7 @@ phpdbg_main:
|
||||
|
||||
if (run) {
|
||||
/* no need to try{}, run does it ... */
|
||||
PHPDBG_COMMAND_HANDLER(run)(NULL, NULL TSRMLS_CC);
|
||||
PHPDBG_COMMAND_HANDLER(run)(NULL TSRMLS_CC);
|
||||
if (run > 1) {
|
||||
/* if -r is on the command line more than once just quit */
|
||||
goto phpdbg_out;
|
||||
|
@ -760,7 +760,7 @@ PHPDBG_API void phpdbg_set_breakpoint_expression(const char *expr, size_t expr_l
|
||||
}
|
||||
} /* }}} */
|
||||
|
||||
PHPDBG_API void phpdbg_set_breakpoint_at(const phpdbg_param_t *param, const phpdbg_input_t *input TSRMLS_DC) /* {{{ */
|
||||
PHPDBG_API void phpdbg_set_breakpoint_at(const phpdbg_param_t *param TSRMLS_DC) /* {{{ */
|
||||
{
|
||||
/*
|
||||
if (input->argc > 3 && phpdbg_argv_is(2, "if")) {
|
||||
|
@ -119,7 +119,7 @@ PHPDBG_API void phpdbg_set_breakpoint_method_opline(const char *class, const cha
|
||||
PHPDBG_API void phpdbg_set_breakpoint_function_opline(const char *function, zend_ulong opline TSRMLS_DC);
|
||||
PHPDBG_API void phpdbg_set_breakpoint_file_opline(const char *file, zend_ulong opline TSRMLS_DC);
|
||||
PHPDBG_API void phpdbg_set_breakpoint_expression(const char* expression, size_t expression_len TSRMLS_DC);
|
||||
PHPDBG_API void phpdbg_set_breakpoint_at(const phpdbg_param_t *param, const phpdbg_input_t *input TSRMLS_DC); /* }}} */
|
||||
PHPDBG_API void phpdbg_set_breakpoint_at(const phpdbg_param_t *param TSRMLS_DC); /* }}} */
|
||||
|
||||
/* {{{ Breakpoint Detection API */
|
||||
PHPDBG_API phpdbg_breakbase_t* phpdbg_find_breakpoint(zend_execute_data* TSRMLS_DC); /* }}} */
|
||||
|
@ -38,8 +38,8 @@ const phpdbg_command_t phpdbg_break_commands[] = {
|
||||
PHPDBG_COMMAND_D_EX(op, "specify breakpoint by opcode", 'O', break_op, NULL, "s"),
|
||||
PHPDBG_COMMAND_D_EX(on, "specify breakpoint by condition", 'o', break_on, NULL, "c"),
|
||||
PHPDBG_COMMAND_D_EX(at, "specify breakpoint by location and condition", 'A', break_at, NULL, "*c"),
|
||||
PHPDBG_COMMAND_D_EX(lineno, "specify breakpoint by line of currently executing file", 'l', break_lineno, NULL, "l"),
|
||||
PHPDBG_COMMAND_D_EX(del, "delete breakpoint by identifier number", 'd', break_del, NULL, "l"),
|
||||
PHPDBG_COMMAND_D_EX(lineno, "specify breakpoint by line of currently executing file", 'l', break_lineno, NULL, "n"),
|
||||
PHPDBG_COMMAND_D_EX(del, "delete breakpoint by identifier number", 'd', break_del, NULL, "n"),
|
||||
PHPDBG_END_COMMAND
|
||||
};
|
||||
|
||||
@ -109,7 +109,7 @@ PHPDBG_BREAK(on) /* {{{ */
|
||||
|
||||
PHPDBG_BREAK(at) /* {{{ */
|
||||
{
|
||||
phpdbg_set_breakpoint_at(param, input TSRMLS_CC);
|
||||
phpdbg_set_breakpoint_at(param TSRMLS_CC);
|
||||
|
||||
return SUCCESS;
|
||||
} /* }}} */
|
||||
|
87
phpdbg_cmd.c
87
phpdbg_cmd.c
@ -253,6 +253,10 @@ PHPDBG_API void phpdbg_copy_param(const phpdbg_param_t* src, phpdbg_param_t* des
|
||||
break;
|
||||
|
||||
case EMPTY_PARAM: { /* do nothing */ } break;
|
||||
|
||||
default: {
|
||||
/* not yet */
|
||||
}
|
||||
}
|
||||
} /* }}} */
|
||||
|
||||
@ -302,6 +306,10 @@ PHPDBG_API zend_ulong phpdbg_hash_param(const phpdbg_param_t *param TSRMLS_DC) /
|
||||
break;
|
||||
|
||||
case EMPTY_PARAM: { /* do nothing */ } break;
|
||||
|
||||
default: {
|
||||
/* not yet */
|
||||
}
|
||||
}
|
||||
|
||||
return hash;
|
||||
@ -371,6 +379,10 @@ PHPDBG_API zend_bool phpdbg_match_param(const phpdbg_param_t *l, const phpdbg_pa
|
||||
|
||||
case EMPTY_PARAM:
|
||||
return 1;
|
||||
|
||||
default: {
|
||||
/* not yet */
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -382,7 +394,7 @@ PHPDBG_API void phpdbg_param_debug(const phpdbg_param_t *param, const char *msg)
|
||||
if (param && param->type) {
|
||||
switch (param->type) {
|
||||
case STR_PARAM:
|
||||
fprintf(stderr, "%s STR_PARAM(%s=%d)\n", msg, param->str, param->len);
|
||||
fprintf(stderr, "%s STR_PARAM(%s=%lu)\n", msg, param->str, param->len);
|
||||
break;
|
||||
|
||||
case ADDR_PARAM:
|
||||
@ -390,7 +402,7 @@ PHPDBG_API void phpdbg_param_debug(const phpdbg_param_t *param, const char *msg)
|
||||
break;
|
||||
|
||||
case FILE_PARAM:
|
||||
fprintf(stderr, "%s FILE_PARAM(%s:%d)\n", msg, param->file.name, param->file.line);
|
||||
fprintf(stderr, "%s FILE_PARAM(%s:%lu)\n", msg, param->file.name, param->file.line);
|
||||
break;
|
||||
|
||||
case METHOD_PARAM:
|
||||
@ -402,7 +414,7 @@ PHPDBG_API void phpdbg_param_debug(const phpdbg_param_t *param, const char *msg)
|
||||
break;
|
||||
|
||||
case NUMERIC_FUNCTION_PARAM:
|
||||
fprintf(stderr, "%s NUMERIC_FUNCTION_PARAM(%s::%s)\n", msg, param->str, param->num);
|
||||
fprintf(stderr, "%s NUMERIC_FUNCTION_PARAM(%s::%ld)\n", msg, param->str, param->num);
|
||||
break;
|
||||
|
||||
case NUMERIC_PARAM:
|
||||
@ -410,8 +422,12 @@ PHPDBG_API void phpdbg_param_debug(const phpdbg_param_t *param, const char *msg)
|
||||
break;
|
||||
|
||||
case COND_PARAM:
|
||||
fprintf(stderr, "%s COND_PARAM(%s=%d)\n", msg, param->str, param->len);
|
||||
fprintf(stderr, "%s COND_PARAM(%s=%lu)\n", msg, param->str, param->len);
|
||||
break;
|
||||
|
||||
default: {
|
||||
/* not yet */
|
||||
}
|
||||
}
|
||||
}
|
||||
} /* }}} */
|
||||
@ -439,6 +455,10 @@ PHPDBG_API void phpdbg_stack_free(phpdbg_param_t *stack) {
|
||||
free(remove->file.name);
|
||||
}
|
||||
break;
|
||||
|
||||
default: {
|
||||
/* nothing */
|
||||
}
|
||||
}
|
||||
|
||||
free(remove);
|
||||
@ -471,7 +491,7 @@ PHPDBG_API void phpdbg_stack_push(phpdbg_param_t *stack, phpdbg_param_t *param)
|
||||
stack->len++;
|
||||
} /* }}} */
|
||||
|
||||
PHPDBG_API int phpdbg_stack_verify(phpdbg_command_t *command, const phpdbg_param_t **stack, char **why TSRMLS_DC) {
|
||||
PHPDBG_API int phpdbg_stack_verify(const phpdbg_command_t *command, phpdbg_param_t **stack, char **why TSRMLS_DC) {
|
||||
if (command && command->args) {
|
||||
const phpdbg_param_t *top = (stack != NULL) ? *stack : NULL;
|
||||
const char *arg = command->args;
|
||||
@ -502,7 +522,7 @@ PHPDBG_API int phpdbg_stack_verify(phpdbg_command_t *command, const phpdbg_param
|
||||
|
||||
case 'i': if (top->type != STR_PARAM) {
|
||||
asprintf(why,
|
||||
"%s expected raw input and got %s at parameter %d",
|
||||
"%s expected raw input and got %s at parameter %lu",
|
||||
command->name, phpdbg_get_param_type(top TSRMLS_CC),
|
||||
(command->args - arg) + 1);
|
||||
return FAILURE;
|
||||
@ -510,7 +530,7 @@ PHPDBG_API int phpdbg_stack_verify(phpdbg_command_t *command, const phpdbg_param
|
||||
|
||||
case 's': if (top->type != STR_PARAM) {
|
||||
asprintf(why,
|
||||
"%s expected string and got %s at parameter %d",
|
||||
"%s expected string and got %s at parameter %lu",
|
||||
command->name, phpdbg_get_param_type(top TSRMLS_CC),
|
||||
(command->args - arg) + 1);
|
||||
return FAILURE;
|
||||
@ -518,7 +538,7 @@ PHPDBG_API int phpdbg_stack_verify(phpdbg_command_t *command, const phpdbg_param
|
||||
|
||||
case 'n': if (top->type != NUMERIC_PARAM) {
|
||||
asprintf(why,
|
||||
"%s expected number and got %s at parameter %d",
|
||||
"%s expected number and got %s at parameter %lu",
|
||||
command->name, phpdbg_get_param_type(top TSRMLS_CC),
|
||||
(command->args - arg) + 1);
|
||||
return FAILURE;
|
||||
@ -526,7 +546,7 @@ PHPDBG_API int phpdbg_stack_verify(phpdbg_command_t *command, const phpdbg_param
|
||||
|
||||
case 'm': if (top->type != METHOD_PARAM) {
|
||||
asprintf(why,
|
||||
"%s expected method and got %s at parameter %d",
|
||||
"%s expected method and got %s at parameter %lu",
|
||||
command->name, phpdbg_get_param_type(top TSRMLS_CC),
|
||||
(command->args - arg) + 1);
|
||||
return FAILURE;
|
||||
@ -534,7 +554,7 @@ PHPDBG_API int phpdbg_stack_verify(phpdbg_command_t *command, const phpdbg_param
|
||||
|
||||
case 'a': if (top->type != ADDR_PARAM) {
|
||||
asprintf(why,
|
||||
"%s expected address and got %s at parameter %d",
|
||||
"%s expected address and got %s at parameter %lu",
|
||||
command->name, phpdbg_get_param_type(top TSRMLS_CC),
|
||||
(command->args - arg) + 1);
|
||||
return FAILURE;
|
||||
@ -542,7 +562,7 @@ PHPDBG_API int phpdbg_stack_verify(phpdbg_command_t *command, const phpdbg_param
|
||||
|
||||
case 'f': if (top->type != FILE_PARAM) {
|
||||
asprintf(why,
|
||||
"%s expected file:line and got %s at parameter %d",
|
||||
"%s expected file:line and got %s at parameter %lu",
|
||||
command->name, phpdbg_get_param_type(top TSRMLS_CC),
|
||||
(command->args - arg) + 1);
|
||||
return FAILURE;
|
||||
@ -550,7 +570,7 @@ PHPDBG_API int phpdbg_stack_verify(phpdbg_command_t *command, const phpdbg_param
|
||||
|
||||
case 'c': if (top->type != COND_PARAM) {
|
||||
asprintf(why,
|
||||
"%s expected condition and got %s at parameter %d",
|
||||
"%s expected condition and got %s at parameter %lu",
|
||||
command->name, phpdbg_get_param_type(top TSRMLS_CC),
|
||||
(command->args - arg) + 1);
|
||||
return FAILURE;
|
||||
@ -558,14 +578,14 @@ PHPDBG_API int phpdbg_stack_verify(phpdbg_command_t *command, const phpdbg_param
|
||||
|
||||
case 'b': if (top->type != NUMERIC_PARAM) {
|
||||
asprintf(why,
|
||||
"%s expected boolean and got %s at parameter %d",
|
||||
"%s expected boolean and got %s at parameter %lu",
|
||||
command->name, phpdbg_get_param_type(top TSRMLS_CC),
|
||||
(command->args - arg) + 1);
|
||||
return FAILURE;
|
||||
} else if (top->num > 1 || top->num < 0) {
|
||||
asprintf(why,
|
||||
"%s expected boolean and got number at parameter %d",
|
||||
command->name, phpdbg_get_param_type(top TSRMLS_CC),
|
||||
"%s expected boolean and got number at parameter %lu",
|
||||
command->name,
|
||||
(command->args - arg) + 1);
|
||||
return FAILURE;
|
||||
} break;
|
||||
@ -579,7 +599,7 @@ PHPDBG_API int phpdbg_stack_verify(phpdbg_command_t *command, const phpdbg_param
|
||||
|
||||
if ((received < expected) && (arg && *arg) && !optional) {
|
||||
asprintf(why,
|
||||
"%s expected %d arguments (%s) and received %d",
|
||||
"%s expected %lu arguments (%s) and received %lu",
|
||||
command->name,
|
||||
expected,
|
||||
command->args,
|
||||
@ -592,20 +612,28 @@ PHPDBG_API int phpdbg_stack_verify(phpdbg_command_t *command, const phpdbg_param
|
||||
}
|
||||
|
||||
/* {{{ */
|
||||
PHPDBG_API phpdbg_command_t* phpdbg_stack_resolve(const phpdbg_command_t *commands, const phpdbg_command_t *parent, phpdbg_param_t **top, char **why) {
|
||||
PHPDBG_API const phpdbg_command_t* phpdbg_stack_resolve(const phpdbg_command_t *commands, const phpdbg_command_t *parent, phpdbg_param_t **top, char **why) {
|
||||
const phpdbg_command_t *command = commands;
|
||||
phpdbg_param_t *name = *top;
|
||||
phpdbg_command_t *matched[3] = {NULL, NULL, NULL};
|
||||
|
||||
const phpdbg_command_t *matched[3] = {NULL, NULL, NULL};
|
||||
ulong matches = 0L;
|
||||
|
||||
while (command && command->name && command->handler) {
|
||||
if (command->name_len >= name->len) {
|
||||
if (memcmp(command->name, name->str, name->len) == SUCCESS) {
|
||||
if (matches < 3) {
|
||||
if ((name->len == 1) || (command->name_len >= name->len)) {
|
||||
/* match single letter alias */
|
||||
if (command->alias && (name->len == 1)) {
|
||||
if (command->alias == (*name->str)) {
|
||||
matched[matches] = command;
|
||||
matches++;
|
||||
} else break;
|
||||
}
|
||||
} else {
|
||||
/* match full command name */
|
||||
if (memcmp(command->name, name->str, name->len) == SUCCESS) {
|
||||
if (matches < 3) {
|
||||
matched[matches] = command;
|
||||
matches++;
|
||||
} else break;
|
||||
}
|
||||
}
|
||||
}
|
||||
command++;
|
||||
@ -629,7 +657,7 @@ PHPDBG_API phpdbg_command_t* phpdbg_stack_resolve(const phpdbg_command_t *comman
|
||||
default: {
|
||||
asprintf(
|
||||
why,
|
||||
"The command %s is ambigious, matching %d commands",
|
||||
"The command %s is ambigious, matching %lu commands",
|
||||
name->str, matches);
|
||||
} return NULL;
|
||||
}
|
||||
@ -645,9 +673,8 @@ PHPDBG_API phpdbg_command_t* phpdbg_stack_resolve(const phpdbg_command_t *comman
|
||||
|
||||
/* {{{ */
|
||||
PHPDBG_API int phpdbg_stack_execute(phpdbg_param_t *stack, char **why) {
|
||||
phpdbg_param_t *command = NULL,
|
||||
*params = NULL;
|
||||
phpdbg_command_t *handler = NULL;
|
||||
phpdbg_param_t *command = NULL;
|
||||
const phpdbg_command_t *handler = NULL;
|
||||
|
||||
if (stack->type != STACK_PARAM) {
|
||||
asprintf(
|
||||
@ -665,10 +692,10 @@ PHPDBG_API int phpdbg_stack_execute(phpdbg_param_t *stack, char **why) {
|
||||
|
||||
switch (command->type) {
|
||||
case EVAL_PARAM:
|
||||
return PHPDBG_COMMAND_HANDLER(eval)(command, NULL TSRMLS_CC);
|
||||
return PHPDBG_COMMAND_HANDLER(eval)(command TSRMLS_CC);
|
||||
|
||||
case SHELL_PARAM:
|
||||
return PHPDBG_COMMAND_HANDLER(shell)(command, NULL TSRMLS_CC);
|
||||
return PHPDBG_COMMAND_HANDLER(shell)(command TSRMLS_CC);
|
||||
|
||||
case STR_PARAM: {
|
||||
handler = phpdbg_stack_resolve(
|
||||
@ -676,7 +703,7 @@ PHPDBG_API int phpdbg_stack_execute(phpdbg_param_t *stack, char **why) {
|
||||
|
||||
if (handler) {
|
||||
if (phpdbg_stack_verify(handler, &command, why) == SUCCESS) {
|
||||
return handler->handler(command, NULL TSRMLS_CC);
|
||||
return handler->handler(command TSRMLS_CC);
|
||||
}
|
||||
}
|
||||
} return FAILURE;
|
||||
|
24
phpdbg_cmd.h
24
phpdbg_cmd.h
@ -23,8 +23,6 @@
|
||||
|
||||
#include "TSRM.h"
|
||||
|
||||
typedef struct _phpdbg_command_t phpdbg_command_t;
|
||||
|
||||
/* {{{ Command and Parameter */
|
||||
enum {
|
||||
NO_ARG = 0,
|
||||
@ -48,16 +46,6 @@ typedef enum {
|
||||
ORIG_PARAM
|
||||
} phpdbg_param_type;
|
||||
|
||||
typedef struct _phpdbg_input_t phpdbg_input_t;
|
||||
|
||||
struct _phpdbg_input_t {
|
||||
char * const *start;
|
||||
char *string;
|
||||
size_t length;
|
||||
phpdbg_input_t **argv;
|
||||
int argc;
|
||||
};
|
||||
|
||||
typedef struct _phpdbg_param phpdbg_param_t;
|
||||
struct _phpdbg_param {
|
||||
phpdbg_param_type type;
|
||||
@ -95,8 +83,9 @@ struct _phpdbg_param {
|
||||
#define YYSTYPE phpdbg_param_t
|
||||
#endif
|
||||
|
||||
typedef int (*phpdbg_command_handler_t)(const phpdbg_param_t*, const phpdbg_input_t* TSRMLS_DC);
|
||||
typedef int (*phpdbg_command_handler_t)(const phpdbg_param_t* TSRMLS_DC);
|
||||
|
||||
typedef struct _phpdbg_command_t phpdbg_command_t;
|
||||
struct _phpdbg_command_t {
|
||||
const char *name; /* Command name */
|
||||
size_t name_len; /* Command name length */
|
||||
@ -147,7 +136,8 @@ PHPDBG_API void phpdbg_destroy_input(char** TSRMLS_DC);
|
||||
* Stack Management
|
||||
*/
|
||||
PHPDBG_API void phpdbg_stack_push(phpdbg_param_t *stack, phpdbg_param_t *param);
|
||||
PHPDBG_API phpdbg_command_t* phpdbg_stack_resolve(const phpdbg_command_t *commands, const phpdbg_command_t *parent, phpdbg_param_t **top, char **why);
|
||||
PHPDBG_API const phpdbg_command_t* phpdbg_stack_resolve(const phpdbg_command_t *commands, const phpdbg_command_t *parent, phpdbg_param_t **top, char **why);
|
||||
PHPDBG_API int phpdbg_stack_verify(const phpdbg_command_t *command, phpdbg_param_t **stack, char **why TSRMLS_DC);
|
||||
PHPDBG_API int phpdbg_stack_execute(phpdbg_param_t *stack, char **why);
|
||||
PHPDBG_API void phpdbg_stack_free(phpdbg_param_t *stack);
|
||||
|
||||
@ -174,11 +164,11 @@ PHPDBG_API void phpdbg_param_debug(const phpdbg_param_t *param, const char *msg)
|
||||
#define PHPDBG_COMMAND_D(name, tip, alias, children, args) \
|
||||
{PHPDBG_STRL(#name), tip, sizeof(tip)-1, alias, phpdbg_do_##name, children, args}
|
||||
|
||||
#define PHPDBG_COMMAND(name) int phpdbg_do_##name(const phpdbg_param_t *param, const phpdbg_input_t *input TSRMLS_DC)
|
||||
#define PHPDBG_COMMAND(name) int phpdbg_do_##name(const phpdbg_param_t *param TSRMLS_DC)
|
||||
|
||||
#define PHPDBG_COMMAND_ARGS param, input TSRMLS_CC
|
||||
#define PHPDBG_COMMAND_ARGS param TSRMLS_CC
|
||||
|
||||
#define PHPDBG_END_COMMAND {NULL, 0, NULL, 0, '\0', NULL, NULL, '\0', '\0'}
|
||||
#define PHPDBG_END_COMMAND {NULL, 0, NULL, 0, '\0', NULL, NULL, '\0'}
|
||||
|
||||
/*
|
||||
* Default Switch Case
|
||||
|
@ -240,7 +240,7 @@ PHPDBG_COMMAND(help) /* {{{ */
|
||||
|
||||
if (n>0) {
|
||||
if (cmd->alias == 'a') { /* help aliases executes a canned routine */
|
||||
return cmd->handler(param, NULL TSRMLS_CC);
|
||||
return cmd->handler(param TSRMLS_CC);
|
||||
} else {
|
||||
pretty_print(get_help(cmd->name TSRMLS_CC) TSRMLS_CC);
|
||||
return SUCCESS;
|
||||
|
107
phpdbg_prompt.c
107
phpdbg_prompt.c
@ -73,66 +73,81 @@ const phpdbg_command_t phpdbg_prompt_commands[] = {
|
||||
|
||||
ZEND_EXTERN_MODULE_GLOBALS(phpdbg);
|
||||
|
||||
static inline int phpdbg_call_register(phpdbg_input_t *input TSRMLS_DC) /* {{{ */
|
||||
static inline int phpdbg_call_register(phpdbg_param_t *stack TSRMLS_DC) /* {{{ */
|
||||
{
|
||||
phpdbg_input_t *function = input->argv[0];
|
||||
phpdbg_param_t *name = stack;
|
||||
|
||||
if (zend_hash_exists(
|
||||
&PHPDBG_G(registered), function->string, function->length+1)) {
|
||||
if (name->type == STR_PARAM) {
|
||||
if (zend_hash_exists(
|
||||
&PHPDBG_G(registered), name->str, name->len+1)) {
|
||||
|
||||
zval fname, *fretval;
|
||||
zend_fcall_info fci;
|
||||
zval fname, *fretval;
|
||||
zend_fcall_info fci;
|
||||
|
||||
ZVAL_STRINGL(&fname, function->string, function->length, 1);
|
||||
ZVAL_STRINGL(&fname, name->str, name->len, 1);
|
||||
|
||||
memset(&fci, 0, sizeof(zend_fcall_info));
|
||||
memset(&fci, 0, sizeof(zend_fcall_info));
|
||||
|
||||
fci.size = sizeof(zend_fcall_info);
|
||||
fci.function_table = &PHPDBG_G(registered);
|
||||
fci.function_name = &fname;
|
||||
fci.symbol_table = EG(active_symbol_table);
|
||||
fci.object_ptr = NULL;
|
||||
fci.retval_ptr_ptr = &fretval;
|
||||
fci.no_separation = 1;
|
||||
fci.size = sizeof(zend_fcall_info);
|
||||
fci.function_table = &PHPDBG_G(registered);
|
||||
fci.function_name = &fname;
|
||||
fci.symbol_table = EG(active_symbol_table);
|
||||
fci.object_ptr = NULL;
|
||||
fci.retval_ptr_ptr = &fretval;
|
||||
fci.no_separation = 1;
|
||||
|
||||
if (input->argc > 1) {
|
||||
int param;
|
||||
zval params;
|
||||
if (stack->next) {
|
||||
zval params;
|
||||
phpdbg_param_t *next = stack->next;
|
||||
|
||||
array_init(¶ms);
|
||||
|
||||
array_init(¶ms);
|
||||
while (next) {
|
||||
switch (next->type) {
|
||||
case STR_PARAM:
|
||||
add_next_index_stringl(
|
||||
¶ms,
|
||||
next->str,
|
||||
next->len, 1);
|
||||
break;
|
||||
|
||||
case NUMERIC_PARAM:
|
||||
add_next_index_long(¶ms, next->num);
|
||||
break;
|
||||
|
||||
default: {
|
||||
/* not yet */
|
||||
}
|
||||
}
|
||||
|
||||
phpdbg_debug(
|
||||
"created param[%d] from argv[%d]: %s",
|
||||
param, param+1, next->str);
|
||||
next = next->next;
|
||||
}
|
||||
|
||||
for (param = 0; param < (input->argc-1); param++) {
|
||||
add_next_index_stringl(
|
||||
¶ms,
|
||||
input->argv[param+1]->string,
|
||||
input->argv[param+1]->length, 1);
|
||||
|
||||
phpdbg_debug(
|
||||
"created param[%d] from argv[%d]: %s",
|
||||
param, param+1, input->argv[param+1]->string);
|
||||
zend_fcall_info_args(&fci, ¶ms TSRMLS_CC);
|
||||
} else {
|
||||
fci.params = NULL;
|
||||
fci.param_count = 0;
|
||||
}
|
||||
|
||||
zend_fcall_info_args(&fci, ¶ms TSRMLS_CC);
|
||||
} else {
|
||||
fci.params = NULL;
|
||||
fci.param_count = 0;
|
||||
}
|
||||
phpdbg_debug(
|
||||
"created %d params from arguments",
|
||||
fci.param_count);
|
||||
|
||||
phpdbg_debug(
|
||||
"created %d params from %d arguments",
|
||||
fci.param_count, input->argc);
|
||||
zend_call_function(&fci, NULL TSRMLS_CC);
|
||||
|
||||
zend_call_function(&fci, NULL TSRMLS_CC);
|
||||
if (fretval) {
|
||||
zend_print_zval_r(
|
||||
fretval, 0 TSRMLS_CC);
|
||||
phpdbg_writeln(EMPTY);
|
||||
}
|
||||
|
||||
if (fretval) {
|
||||
zend_print_zval_r(
|
||||
fretval, 0 TSRMLS_CC);
|
||||
phpdbg_writeln(EMPTY);
|
||||
}
|
||||
zval_dtor(&fname);
|
||||
|
||||
zval_dtor(&fname);
|
||||
|
||||
return SUCCESS;
|
||||
return SUCCESS;
|
||||
}
|
||||
}
|
||||
|
||||
return FAILURE;
|
||||
@ -1027,7 +1042,7 @@ int phpdbg_interactive(TSRMLS_D) /* {{{ */
|
||||
last:
|
||||
if (PHPDBG_G(lcmd)) {
|
||||
ret = PHPDBG_G(lcmd)->handler(
|
||||
&PHPDBG_G(lparam), input TSRMLS_CC);
|
||||
&PHPDBG_G(lparam) TSRMLS_CC);
|
||||
goto out;
|
||||
}
|
||||
}
|
||||
|
15
phpdbg_set.c
15
phpdbg_set.c
@ -69,7 +69,7 @@ PHPDBG_SET(break) /* {{{ */
|
||||
break;
|
||||
|
||||
case NUMERIC_PARAM: {
|
||||
if (input && input->argc > 2) {
|
||||
if (param->next) {
|
||||
/*
|
||||
if (phpdbg_argv_is(2, "on")) {
|
||||
phpdbg_enable_breakpoint(param->num TSRMLS_CC);
|
||||
@ -99,14 +99,13 @@ PHPDBG_SET(break) /* {{{ */
|
||||
#ifndef _WIN32
|
||||
PHPDBG_SET(color) /* {{{ */
|
||||
{
|
||||
if ((param->type == STR_PARAM) && (input->argc == 3)) {
|
||||
/*if ((param->type == STR_PARAM) && (input->argc == 3)) {
|
||||
const phpdbg_color_t *color = phpdbg_get_color(
|
||||
input->argv[2]->string, input->argv[2]->length TSRMLS_CC);
|
||||
int element = PHPDBG_COLOR_INVALID;
|
||||
|
||||
/* @TODO(anyone) make this consistent with other set commands */
|
||||
if (color) {
|
||||
/*if (phpdbg_argv_is(1, "prompt")) {
|
||||
if (phpdbg_argv_is(1, "prompt")) {
|
||||
phpdbg_notice(
|
||||
"setting prompt color to %s (%s)", color->name, color->code);
|
||||
element = PHPDBG_COLOR_PROMPT;
|
||||
@ -125,9 +124,8 @@ PHPDBG_SET(color) /* {{{ */
|
||||
element = PHPDBG_COLOR_NOTICE;
|
||||
|
||||
} else goto usage;
|
||||
*/
|
||||
/* set color for element */
|
||||
/* phpdbg_set_color(element, color TSRMLS_CC); */
|
||||
|
||||
phpdbg_set_color(element, color TSRMLS_CC);
|
||||
} else {
|
||||
phpdbg_error(
|
||||
"Failed to find the requested color (%s)", input->argv[2]->string);
|
||||
@ -136,7 +134,8 @@ PHPDBG_SET(color) /* {{{ */
|
||||
usage:
|
||||
phpdbg_error(
|
||||
"set color used incorrectly: set color <prompt|error|notice> <color>");
|
||||
}
|
||||
} */
|
||||
|
||||
return SUCCESS;
|
||||
} /* }}} */
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user