mirror of
https://github.com/php/php-src.git
synced 2025-08-19 08:49:28 +02:00
- Moved catch cmd to "break op" cmd
This commit is contained in:
parent
6fbffc68ac
commit
70d4ac8ef3
11 changed files with 93 additions and 80 deletions
|
@ -4,8 +4,7 @@ ChangeLog for phpdbg
|
||||||
Version 0.1.1 2013-00-00
|
Version 0.1.1 2013-00-00
|
||||||
------------------------
|
------------------------
|
||||||
|
|
||||||
1. New commands:
|
|
||||||
- catch (catch an opcode before its execution)
|
|
||||||
|
|
||||||
Version 0.1.0 2013-11-23
|
Version 0.1.0 2013-11-23
|
||||||
------------------------
|
------------------------
|
||||||
|
|
4
phpdbg.c
4
phpdbg.c
|
@ -116,10 +116,10 @@ static PHP_RINIT_FUNCTION(phpdbg) /* {{{ */
|
||||||
zend_hash_init(&PHPDBG_G(bp)[PHPDBG_BREAK_FILE], 8, NULL, php_phpdbg_destroy_bp_file, 0);
|
zend_hash_init(&PHPDBG_G(bp)[PHPDBG_BREAK_FILE], 8, NULL, php_phpdbg_destroy_bp_file, 0);
|
||||||
zend_hash_init(&PHPDBG_G(bp)[PHPDBG_BREAK_SYM], 8, NULL, php_phpdbg_destroy_bp_symbol, 0);
|
zend_hash_init(&PHPDBG_G(bp)[PHPDBG_BREAK_SYM], 8, NULL, php_phpdbg_destroy_bp_symbol, 0);
|
||||||
zend_hash_init(&PHPDBG_G(bp)[PHPDBG_BREAK_OPLINE], 8, NULL, NULL, 0);
|
zend_hash_init(&PHPDBG_G(bp)[PHPDBG_BREAK_OPLINE], 8, NULL, NULL, 0);
|
||||||
|
zend_hash_init(&PHPDBG_G(bp)[PHPDBG_BREAK_OPCODE], 8, NULL, NULL, 0);
|
||||||
zend_hash_init(&PHPDBG_G(bp)[PHPDBG_BREAK_METHOD], 8, NULL, php_phpdbg_destroy_bp_methods, 0);
|
zend_hash_init(&PHPDBG_G(bp)[PHPDBG_BREAK_METHOD], 8, NULL, php_phpdbg_destroy_bp_methods, 0);
|
||||||
zend_hash_init(&PHPDBG_G(bp)[PHPDBG_BREAK_COND], 8, NULL, php_phpdbg_destroy_bp_condition, 0);
|
zend_hash_init(&PHPDBG_G(bp)[PHPDBG_BREAK_COND], 8, NULL, php_phpdbg_destroy_bp_condition, 0);
|
||||||
zend_hash_init(&PHPDBG_G(seek), 8, NULL, NULL, 0);
|
zend_hash_init(&PHPDBG_G(seek), 8, NULL, NULL, 0);
|
||||||
zend_hash_init(&PHPDBG_G(catch), 8, NULL, NULL, 0);
|
|
||||||
zend_hash_init(&PHPDBG_G(registered), 8, NULL, php_phpdbg_destroy_registered, 0);
|
zend_hash_init(&PHPDBG_G(registered), 8, NULL, php_phpdbg_destroy_registered, 0);
|
||||||
|
|
||||||
return SUCCESS;
|
return SUCCESS;
|
||||||
|
@ -130,10 +130,10 @@ static PHP_RSHUTDOWN_FUNCTION(phpdbg) /* {{{ */
|
||||||
zend_hash_destroy(&PHPDBG_G(bp)[PHPDBG_BREAK_FILE]);
|
zend_hash_destroy(&PHPDBG_G(bp)[PHPDBG_BREAK_FILE]);
|
||||||
zend_hash_destroy(&PHPDBG_G(bp)[PHPDBG_BREAK_SYM]);
|
zend_hash_destroy(&PHPDBG_G(bp)[PHPDBG_BREAK_SYM]);
|
||||||
zend_hash_destroy(&PHPDBG_G(bp)[PHPDBG_BREAK_OPLINE]);
|
zend_hash_destroy(&PHPDBG_G(bp)[PHPDBG_BREAK_OPLINE]);
|
||||||
|
zend_hash_destroy(&PHPDBG_G(bp)[PHPDBG_BREAK_OPCODE]);
|
||||||
zend_hash_destroy(&PHPDBG_G(bp)[PHPDBG_BREAK_METHOD]);
|
zend_hash_destroy(&PHPDBG_G(bp)[PHPDBG_BREAK_METHOD]);
|
||||||
zend_hash_destroy(&PHPDBG_G(bp)[PHPDBG_BREAK_COND]);
|
zend_hash_destroy(&PHPDBG_G(bp)[PHPDBG_BREAK_COND]);
|
||||||
zend_hash_destroy(&PHPDBG_G(seek));
|
zend_hash_destroy(&PHPDBG_G(seek));
|
||||||
zend_hash_destroy(&PHPDBG_G(catch));
|
|
||||||
zend_hash_destroy(&PHPDBG_G(registered));
|
zend_hash_destroy(&PHPDBG_G(registered));
|
||||||
|
|
||||||
if (PHPDBG_G(exec)) {
|
if (PHPDBG_G(exec)) {
|
||||||
|
|
38
phpdbg.h
38
phpdbg.h
|
@ -80,7 +80,8 @@
|
||||||
#define PHPDBG_BREAK_OPLINE 2
|
#define PHPDBG_BREAK_OPLINE 2
|
||||||
#define PHPDBG_BREAK_METHOD 3
|
#define PHPDBG_BREAK_METHOD 3
|
||||||
#define PHPDBG_BREAK_COND 4
|
#define PHPDBG_BREAK_COND 4
|
||||||
#define PHPDBG_BREAK_TABLES 5 /* }}} */
|
#define PHPDBG_BREAK_OPCODE 5
|
||||||
|
#define PHPDBG_BREAK_TABLES 6 /* }}} */
|
||||||
|
|
||||||
/* {{{ flags */
|
/* {{{ flags */
|
||||||
#define PHPDBG_HAS_FILE_BP (1<<1)
|
#define PHPDBG_HAS_FILE_BP (1<<1)
|
||||||
|
@ -88,29 +89,29 @@
|
||||||
#define PHPDBG_HAS_OPLINE_BP (1<<3)
|
#define PHPDBG_HAS_OPLINE_BP (1<<3)
|
||||||
#define PHPDBG_HAS_METHOD_BP (1<<4)
|
#define PHPDBG_HAS_METHOD_BP (1<<4)
|
||||||
#define PHPDBG_HAS_COND_BP (1<<5)
|
#define PHPDBG_HAS_COND_BP (1<<5)
|
||||||
#define PHPDBG_BP_MASK (PHPDBG_HAS_FILE_BP|PHPDBG_HAS_SYM_BP|PHPDBG_HAS_METHOD_BP|PHPDBG_HAS_OPLINE_BP|PHPDBG_HAS_COND_BP)
|
#define PHPDBG_HAS_OPCODE_BP (1<<6)
|
||||||
|
#define PHPDBG_BP_MASK (PHPDBG_HAS_FILE_BP|PHPDBG_HAS_SYM_BP|PHPDBG_HAS_METHOD_BP|PHPDBG_HAS_OPLINE_BP|PHPDBG_HAS_COND_BP|PHPDBG_HAS_OPCODE_BP)
|
||||||
|
|
||||||
#define PHPDBG_IN_COND_BP (1<<6)
|
#define PHPDBG_IN_COND_BP (1<<7)
|
||||||
#define PHPDBG_IN_EVAL (1<<7)
|
#define PHPDBG_IN_EVAL (1<<8)
|
||||||
|
|
||||||
#define PHPDBG_IS_STEPPING (1<<8)
|
#define PHPDBG_IS_STEPPING (1<<9)
|
||||||
#define PHPDBG_IS_QUIET (1<<9)
|
#define PHPDBG_IS_QUIET (1<<10)
|
||||||
#define PHPDBG_IS_QUITTING (1<<10)
|
#define PHPDBG_IS_QUITTING (1<<11)
|
||||||
#define PHPDBG_IS_COLOURED (1<<11)
|
#define PHPDBG_IS_COLOURED (1<<12)
|
||||||
#define PHPDBG_IS_CLEANING (1<<12)
|
#define PHPDBG_IS_CLEANING (1<<13)
|
||||||
|
|
||||||
#define PHPDBG_IN_UNTIL (1<<13)
|
#define PHPDBG_IN_UNTIL (1<<14)
|
||||||
#define PHPDBG_IN_FINISH (1<<14)
|
#define PHPDBG_IN_FINISH (1<<15)
|
||||||
#define PHPDBG_IN_LEAVE (1<<15)
|
#define PHPDBG_IN_LEAVE (1<<16)
|
||||||
#define PHPDBG_SEEK_MASK (PHPDBG_IN_UNTIL|PHPDBG_IN_FINISH|PHPDBG_IN_LEAVE)
|
#define PHPDBG_SEEK_MASK (PHPDBG_IN_UNTIL|PHPDBG_IN_FINISH|PHPDBG_IN_LEAVE)
|
||||||
|
|
||||||
#define PHPDBG_IS_REGISTERED (1<<16)
|
#define PHPDBG_IS_REGISTERED (1<<17)
|
||||||
#define PHPDBG_IS_STEPONEVAL (1<<17)
|
#define PHPDBG_IS_STEPONEVAL (1<<18)
|
||||||
#define PHPDBG_IS_INITIALIZING (1<<18)
|
#define PHPDBG_IS_INITIALIZING (1<<19)
|
||||||
#define PHPDBG_IS_SIGNALED (1<<19)
|
#define PHPDBG_IS_SIGNALED (1<<20)
|
||||||
#define PHPDBG_IS_INTERACTIVE (1<<20)
|
#define PHPDBG_IS_INTERACTIVE (1<<21)
|
||||||
|
|
||||||
#define PHPDBG_HAS_CATCH (1<<21)
|
|
||||||
|
|
||||||
#ifndef _WIN32
|
#ifndef _WIN32
|
||||||
# define PHPDBG_DEFAULT_FLAGS (PHPDBG_IS_QUIET|PHPDBG_IS_COLOURED)
|
# define PHPDBG_DEFAULT_FLAGS (PHPDBG_IS_QUIET|PHPDBG_IS_COLOURED)
|
||||||
|
@ -140,7 +141,6 @@ ZEND_BEGIN_MODULE_GLOBALS(phpdbg)
|
||||||
phpdbg_param_t lparam; /* last param */
|
phpdbg_param_t lparam; /* last param */
|
||||||
FILE *oplog; /* opline log */
|
FILE *oplog; /* opline log */
|
||||||
HashTable seek; /* seek oplines */
|
HashTable seek; /* seek oplines */
|
||||||
HashTable catch; /* seek opcodes */
|
|
||||||
zend_ulong flags; /* phpdbg flags */
|
zend_ulong flags; /* phpdbg flags */
|
||||||
HashTable registered; /* registered */
|
HashTable registered; /* registered */
|
||||||
phpdbg_frame_t frame; /* frame */
|
phpdbg_frame_t frame; /* frame */
|
||||||
|
|
41
phpdbg_bp.c
41
phpdbg_bp.c
|
@ -162,6 +162,25 @@ PHPDBG_API void phpdbg_set_breakpoint_opline(zend_ulong opline TSRMLS_DC) /* {{{
|
||||||
}
|
}
|
||||||
} /* }}} */
|
} /* }}} */
|
||||||
|
|
||||||
|
PHPDBG_API void phpdbg_set_breakpoint_opcode(zend_ulong hash TSRMLS_DC) /* {{{ */
|
||||||
|
{
|
||||||
|
phpdbg_breakop_t new_break;
|
||||||
|
|
||||||
|
if (zend_hash_index_exists(&PHPDBG_G(bp)[PHPDBG_BREAK_OPCODE], hash)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
new_break.hash = hash;
|
||||||
|
new_break.id = PHPDBG_G(bp_count)++;
|
||||||
|
|
||||||
|
zend_hash_index_update(&PHPDBG_G(bp)[PHPDBG_BREAK_OPCODE], hash,
|
||||||
|
&new_break, sizeof(phpdbg_breakop_t), NULL);
|
||||||
|
|
||||||
|
PHPDBG_G(flags) |= PHPDBG_HAS_OPCODE_BP;
|
||||||
|
|
||||||
|
phpdbg_notice("Breakpoint #%d added", new_break.id);
|
||||||
|
} /* }}} */
|
||||||
|
|
||||||
PHPDBG_API void phpdbg_set_breakpoint_opline_ex(phpdbg_opline_ptr_t opline TSRMLS_DC) /* {{{ */
|
PHPDBG_API void phpdbg_set_breakpoint_opline_ex(phpdbg_opline_ptr_t opline TSRMLS_DC) /* {{{ */
|
||||||
{
|
{
|
||||||
if (!zend_hash_index_exists(&PHPDBG_G(bp)[PHPDBG_BREAK_OPLINE], (zend_ulong) opline)) {
|
if (!zend_hash_index_exists(&PHPDBG_G(bp)[PHPDBG_BREAK_OPLINE], (zend_ulong) opline)) {
|
||||||
|
@ -334,6 +353,28 @@ int phpdbg_find_breakpoint_opline(phpdbg_opline_ptr_t opline TSRMLS_DC) /* {{{ *
|
||||||
return FAILURE;
|
return FAILURE;
|
||||||
} /* }}} */
|
} /* }}} */
|
||||||
|
|
||||||
|
int phpdbg_find_breakpoint_opcode(zend_uchar opcode TSRMLS_DC) /* {{{ */
|
||||||
|
{
|
||||||
|
phpdbg_breakop_t *bp;
|
||||||
|
const char *opname = phpdbg_decode_opcode(opcode);
|
||||||
|
|
||||||
|
if (memcmp(opname, PHPDBG_STRL("UNKNOWN")) == 0) {
|
||||||
|
return FAILURE;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (zend_hash_index_find(&PHPDBG_G(bp)[PHPDBG_BREAK_OPCODE],
|
||||||
|
zend_hash_func(opname, strlen(opname)), (void**)&bp) == SUCCESS) {
|
||||||
|
phpdbg_notice("Breakpoint #%d in %s at %s:%u",
|
||||||
|
bp->id,
|
||||||
|
opname,
|
||||||
|
zend_get_executed_filename(TSRMLS_C),
|
||||||
|
zend_get_executed_lineno(TSRMLS_C));
|
||||||
|
|
||||||
|
return SUCCESS;
|
||||||
|
}
|
||||||
|
return FAILURE;
|
||||||
|
} /* }}} */
|
||||||
|
|
||||||
int phpdbg_find_conditional_breakpoint(TSRMLS_D) /* {{{ */
|
int phpdbg_find_conditional_breakpoint(TSRMLS_D) /* {{{ */
|
||||||
{
|
{
|
||||||
phpdbg_breakcond_t *bp;
|
phpdbg_breakcond_t *bp;
|
||||||
|
|
11
phpdbg_bp.h
11
phpdbg_bp.h
|
@ -60,6 +60,14 @@ typedef struct _phpdbg_breakline_t {
|
||||||
int id;
|
int id;
|
||||||
} phpdbg_breakline_t;
|
} phpdbg_breakline_t;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Breakpoint opcode based representation
|
||||||
|
*/
|
||||||
|
typedef struct _phpdbg_breakop_t {
|
||||||
|
zend_ulong hash;
|
||||||
|
int id;
|
||||||
|
} phpdbg_breakop_t;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Breakpoint opline based representation
|
* Breakpoint opline based representation
|
||||||
*/
|
*/
|
||||||
|
@ -72,6 +80,7 @@ typedef struct _phpdbg_breakcond_t {
|
||||||
PHPDBG_API void phpdbg_set_breakpoint_file(const char*, long TSRMLS_DC);
|
PHPDBG_API void phpdbg_set_breakpoint_file(const char*, long TSRMLS_DC);
|
||||||
PHPDBG_API void phpdbg_set_breakpoint_symbol(const char* TSRMLS_DC);
|
PHPDBG_API void phpdbg_set_breakpoint_symbol(const char* TSRMLS_DC);
|
||||||
PHPDBG_API void phpdbg_set_breakpoint_method(const char*, const char* TSRMLS_DC);
|
PHPDBG_API void phpdbg_set_breakpoint_method(const char*, const char* TSRMLS_DC);
|
||||||
|
PHPDBG_API void phpdbg_set_breakpoint_opcode(zend_ulong TSRMLS_DC);
|
||||||
PHPDBG_API void phpdbg_set_breakpoint_opline(zend_ulong TSRMLS_DC);
|
PHPDBG_API void phpdbg_set_breakpoint_opline(zend_ulong TSRMLS_DC);
|
||||||
PHPDBG_API void phpdbg_set_breakpoint_opline_ex(phpdbg_opline_ptr_t TSRMLS_DC);
|
PHPDBG_API void phpdbg_set_breakpoint_opline_ex(phpdbg_opline_ptr_t TSRMLS_DC);
|
||||||
PHPDBG_API void phpdbg_set_breakpoint_expression(const char*, size_t TSRMLS_DC);
|
PHPDBG_API void phpdbg_set_breakpoint_expression(const char*, size_t TSRMLS_DC);
|
||||||
|
@ -80,7 +89,9 @@ int phpdbg_find_breakpoint_file(zend_op_array* TSRMLS_DC);
|
||||||
int phpdbg_find_breakpoint_symbol(zend_function* TSRMLS_DC);
|
int phpdbg_find_breakpoint_symbol(zend_function* TSRMLS_DC);
|
||||||
int phpdbg_find_breakpoint_method(zend_op_array* TSRMLS_DC);
|
int phpdbg_find_breakpoint_method(zend_op_array* TSRMLS_DC);
|
||||||
int phpdbg_find_breakpoint_opline(phpdbg_opline_ptr_t TSRMLS_DC);
|
int phpdbg_find_breakpoint_opline(phpdbg_opline_ptr_t TSRMLS_DC);
|
||||||
|
int phpdbg_find_breakpoint_opcode(zend_uchar TSRMLS_DC);
|
||||||
int phpdbg_find_conditional_breakpoint(TSRMLS_D);
|
int phpdbg_find_conditional_breakpoint(TSRMLS_D);
|
||||||
|
int phpdbg_find_catch(zend_uchar TSRMLS_DC);
|
||||||
|
|
||||||
PHPDBG_API void phpdbg_clear_breakpoints(TSRMLS_D);
|
PHPDBG_API void phpdbg_clear_breakpoints(TSRMLS_D);
|
||||||
PHPDBG_API void phpdbg_print_breakpoints(zend_ulong type TSRMLS_DC);
|
PHPDBG_API void phpdbg_print_breakpoints(zend_ulong type TSRMLS_DC);
|
||||||
|
|
|
@ -58,7 +58,7 @@ PHPDBG_BREAK(address) /* {{{ */
|
||||||
case ADDR_PARAM:
|
case ADDR_PARAM:
|
||||||
phpdbg_set_breakpoint_opline(param->addr TSRMLS_CC);
|
phpdbg_set_breakpoint_opline(param->addr TSRMLS_CC);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
phpdbg_default_switch_case();
|
phpdbg_default_switch_case();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -66,7 +66,7 @@ PHPDBG_BREAK(address) /* {{{ */
|
||||||
} /* }}} */
|
} /* }}} */
|
||||||
|
|
||||||
PHPDBG_BREAK(on) /* {{{ */
|
PHPDBG_BREAK(on) /* {{{ */
|
||||||
{
|
{
|
||||||
switch (param->type) {
|
switch (param->type) {
|
||||||
case STR_PARAM:
|
case STR_PARAM:
|
||||||
phpdbg_set_breakpoint_expression(param->str, param->len TSRMLS_CC);
|
phpdbg_set_breakpoint_expression(param->str, param->len TSRMLS_CC);
|
||||||
|
@ -108,3 +108,16 @@ PHPDBG_BREAK(func) /* {{{ */
|
||||||
|
|
||||||
return SUCCESS;
|
return SUCCESS;
|
||||||
} /* }}} */
|
} /* }}} */
|
||||||
|
|
||||||
|
PHPDBG_BREAK(op) /* {{{ */
|
||||||
|
{
|
||||||
|
switch (param->type) {
|
||||||
|
case STR_PARAM:
|
||||||
|
phpdbg_set_breakpoint_opcode(zend_hash_func(param->str, param->len) TSRMLS_CC);
|
||||||
|
break;
|
||||||
|
|
||||||
|
phpdbg_default_switch_case();
|
||||||
|
}
|
||||||
|
|
||||||
|
return SUCCESS;
|
||||||
|
} /* }}} */
|
||||||
|
|
|
@ -34,6 +34,7 @@ PHPDBG_BREAK(address);
|
||||||
PHPDBG_BREAK(on);
|
PHPDBG_BREAK(on);
|
||||||
PHPDBG_BREAK(lineno);
|
PHPDBG_BREAK(lineno);
|
||||||
PHPDBG_BREAK(func);
|
PHPDBG_BREAK(func);
|
||||||
|
PHPDBG_BREAK(op);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Commands
|
* Commands
|
||||||
|
@ -42,6 +43,7 @@ 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(file, "specify breakpoint by file:line", 'F', break_file, NULL, 1),
|
||||||
PHPDBG_COMMAND_D_EX(method, "specify breakpoint by class::method", 'm', break_method, 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(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 expression", 'o', break_on, NULL, 1),
|
PHPDBG_COMMAND_D_EX(on, "specify breakpoint by expression", 'o', break_on, NULL, 1),
|
||||||
PHPDBG_COMMAND_D_EX(lineno, "specify breakpoint by line of currently executing file", 'l', break_lineno, NULL, 1),
|
PHPDBG_COMMAND_D_EX(lineno, "specify breakpoint by line of currently executing file", 'l', break_lineno, NULL, 1),
|
||||||
PHPDBG_COMMAND_D_EX(func, "specify breakpoint by global function name", 'f', break_func, NULL, 1),
|
PHPDBG_COMMAND_D_EX(func, "specify breakpoint by global function name", 'f', break_func, NULL, 1),
|
||||||
|
|
|
@ -341,19 +341,6 @@ PHPDBG_HELP(back) /* {{{ */
|
||||||
return SUCCESS;
|
return SUCCESS;
|
||||||
} /* }}} */
|
} /* }}} */
|
||||||
|
|
||||||
PHPDBG_HELP(catch) /* {{{ */
|
|
||||||
{
|
|
||||||
phpdbg_help_header();
|
|
||||||
phpdbg_writeln("Catch a VM opcode before its execution");
|
|
||||||
phpdbg_writeln(EMPTY);
|
|
||||||
phpdbg_notice("Examples");
|
|
||||||
phpdbg_writeln("\t%scatch ZEND_ADD", PROMPT);
|
|
||||||
phpdbg_writeln("\t%so ZEND_ADD", PROMPT);
|
|
||||||
phpdbg_writeln("\tWill break the execution before the specified opcode is reached");
|
|
||||||
phpdbg_help_footer();
|
|
||||||
return SUCCESS;
|
|
||||||
} /* }}} */
|
|
||||||
|
|
||||||
PHPDBG_HELP(frame) /* {{{ */
|
PHPDBG_HELP(frame) /* {{{ */
|
||||||
{
|
{
|
||||||
phpdbg_help_header();
|
phpdbg_help_header();
|
||||||
|
|
|
@ -44,7 +44,6 @@ PHPDBG_HELP(clean);
|
||||||
PHPDBG_HELP(clear);
|
PHPDBG_HELP(clear);
|
||||||
PHPDBG_HELP(info);
|
PHPDBG_HELP(info);
|
||||||
PHPDBG_HELP(back);
|
PHPDBG_HELP(back);
|
||||||
PHPDBG_HELP(catch);
|
|
||||||
PHPDBG_HELP(frame);
|
PHPDBG_HELP(frame);
|
||||||
PHPDBG_HELP(quiet);
|
PHPDBG_HELP(quiet);
|
||||||
PHPDBG_HELP(list);
|
PHPDBG_HELP(list);
|
||||||
|
@ -72,7 +71,6 @@ static const phpdbg_command_t phpdbg_help_commands[] = {
|
||||||
PHPDBG_COMMAND_D_EX(clear, "reset breakpoints to execute without interruption", 'c', help_clear, 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(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(back, "show debug backtrace information during execution", 't', help_back, NULL, 0),
|
||||||
PHPDBG_COMMAND_D_EX(catch, "catch an opcode before its execution", 'o', help_catch, 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(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(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),
|
||||||
|
|
|
@ -48,7 +48,6 @@ const phpdbg_command_t phpdbg_prompt_commands[] = {
|
||||||
PHPDBG_COMMAND_D(print, "print something", 'p', phpdbg_print_commands, 2),
|
PHPDBG_COMMAND_D(print, "print something", 'p', phpdbg_print_commands, 2),
|
||||||
PHPDBG_COMMAND_D(break, "set breakpoint", 'b', phpdbg_break_commands, 1),
|
PHPDBG_COMMAND_D(break, "set breakpoint", 'b', phpdbg_break_commands, 1),
|
||||||
PHPDBG_COMMAND_D(back, "show trace", 't', NULL, 0),
|
PHPDBG_COMMAND_D(back, "show trace", 't', NULL, 0),
|
||||||
PHPDBG_COMMAND_D(catch, "catch an opcode", 'o', NULL, 1),
|
|
||||||
PHPDBG_COMMAND_D(frame, "switch to a frame", 'f', NULL, 1),
|
PHPDBG_COMMAND_D(frame, "switch to a frame", 'f', NULL, 1),
|
||||||
PHPDBG_COMMAND_D(list, "lists some code", 'l', phpdbg_list_commands, 2),
|
PHPDBG_COMMAND_D(list, "lists some code", 'l', phpdbg_list_commands, 2),
|
||||||
PHPDBG_COMMAND_D(info, "displays some informations", 'i', phpdbg_info_commands, 1),
|
PHPDBG_COMMAND_D(info, "displays some informations", 'i', phpdbg_info_commands, 1),
|
||||||
|
@ -164,38 +163,6 @@ next_line:
|
||||||
}
|
}
|
||||||
} /* }}} */
|
} /* }}} */
|
||||||
|
|
||||||
int phpdbg_find_catch(zend_uchar opcode TSRMLS_DC) /* {{{ */
|
|
||||||
{
|
|
||||||
const char *opname = phpdbg_decode_opcode(opcode);
|
|
||||||
|
|
||||||
if (memcmp(opname, PHPDBG_STRL("UNKNOWN")) == 0) {
|
|
||||||
return FAILURE;
|
|
||||||
}
|
|
||||||
|
|
||||||
return zend_hash_index_exists(&PHPDBG_G(catch),
|
|
||||||
zend_hash_func(opname, strlen(opname))) ? SUCCESS : FAILURE;
|
|
||||||
} /* }}} */
|
|
||||||
|
|
||||||
PHPDBG_COMMAND(catch) /* {{{ */
|
|
||||||
{
|
|
||||||
switch (param->type) {
|
|
||||||
case STR_PARAM: {
|
|
||||||
int tmp = 0;
|
|
||||||
|
|
||||||
zend_hash_index_update(&PHPDBG_G(catch),
|
|
||||||
zend_hash_func(param->str, param->len),
|
|
||||||
&tmp, sizeof(int), NULL);
|
|
||||||
|
|
||||||
PHPDBG_G(flags) |= PHPDBG_HAS_CATCH;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
phpdbg_default_switch_case();
|
|
||||||
}
|
|
||||||
|
|
||||||
return SUCCESS;
|
|
||||||
} /* }}} */
|
|
||||||
|
|
||||||
PHPDBG_COMMAND(exec) /* {{{ */
|
PHPDBG_COMMAND(exec) /* {{{ */
|
||||||
{
|
{
|
||||||
switch (param->type) {
|
switch (param->type) {
|
||||||
|
@ -1423,12 +1390,8 @@ zend_vm_enter:
|
||||||
DO_INTERACTIVE();
|
DO_INTERACTIVE();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (PHPDBG_G(flags) & PHPDBG_HAS_CATCH
|
if (PHPDBG_G(flags) & PHPDBG_HAS_OPCODE_BP
|
||||||
&& phpdbg_find_catch(execute_data->opline->opcode TSRMLS_CC) == SUCCESS) {
|
&& phpdbg_find_breakpoint_opcode(execute_data->opline->opcode TSRMLS_CC) == SUCCESS) {
|
||||||
phpdbg_notice("Catched opcode %s at %s:%u",
|
|
||||||
phpdbg_decode_opcode(execute_data->opline->opcode),
|
|
||||||
zend_get_executed_filename(TSRMLS_C),
|
|
||||||
zend_get_executed_lineno(TSRMLS_C));
|
|
||||||
DO_INTERACTIVE();
|
DO_INTERACTIVE();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -40,7 +40,6 @@ PHPDBG_COMMAND(frame);
|
||||||
PHPDBG_COMMAND(print);
|
PHPDBG_COMMAND(print);
|
||||||
PHPDBG_COMMAND(break);
|
PHPDBG_COMMAND(break);
|
||||||
PHPDBG_COMMAND(back);
|
PHPDBG_COMMAND(back);
|
||||||
PHPDBG_COMMAND(catch);
|
|
||||||
PHPDBG_COMMAND(list);
|
PHPDBG_COMMAND(list);
|
||||||
PHPDBG_COMMAND(info);
|
PHPDBG_COMMAND(info);
|
||||||
PHPDBG_COMMAND(clean);
|
PHPDBG_COMMAND(clean);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue