mirror of
https://github.com/php/php-src.git
synced 2026-04-28 10:43:30 +02:00
- Added print information about opcode breakpoint
This commit is contained in:
@@ -80,6 +80,12 @@ static void php_phpdbg_destroy_bp_symbol(void *brake) /* {{{ */
|
||||
efree((char*)((phpdbg_breaksymbol_t*)brake)->symbol);
|
||||
} /* }}} */
|
||||
|
||||
static void php_phpdbg_destroy_bp_opcode(void *brake) /* {{{ */
|
||||
{
|
||||
efree((char*)((phpdbg_breakop_t*)brake)->name);
|
||||
} /* }}} */
|
||||
|
||||
|
||||
static void php_phpdbg_destroy_bp_methods(void *brake) /* {{{ */
|
||||
{
|
||||
zend_hash_destroy((HashTable*)brake);
|
||||
@@ -116,7 +122,7 @@ 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_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_OPCODE], 8, NULL, NULL, 0);
|
||||
zend_hash_init(&PHPDBG_G(bp)[PHPDBG_BREAK_OPCODE], 8, NULL, php_phpdbg_destroy_bp_opcode, 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(seek), 8, NULL, NULL, 0);
|
||||
|
||||
+17
-3
@@ -163,15 +163,16 @@ 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_API void phpdbg_set_breakpoint_opcode(const char *name, size_t name_len TSRMLS_DC) /* {{{ */
|
||||
{
|
||||
phpdbg_breakop_t new_break;
|
||||
zend_ulong hash = zend_hash_func(name, name_len);
|
||||
|
||||
if (zend_hash_index_exists(&PHPDBG_G(bp)[PHPDBG_BREAK_OPCODE], hash)) {
|
||||
return;
|
||||
}
|
||||
|
||||
new_break.hash = hash;
|
||||
new_break.name = estrndup(name, name_len);
|
||||
new_break.id = PHPDBG_G(bp_count)++;
|
||||
|
||||
zend_hash_index_update(&PHPDBG_G(bp)[PHPDBG_BREAK_OPCODE], hash,
|
||||
@@ -179,7 +180,7 @@ PHPDBG_API void phpdbg_set_breakpoint_opcode(zend_ulong hash TSRMLS_DC) /* {{{ *
|
||||
|
||||
PHPDBG_G(flags) |= PHPDBG_HAS_OPCODE_BP;
|
||||
|
||||
phpdbg_notice("Breakpoint #%d added", new_break.id);
|
||||
phpdbg_notice("Breakpoint #%d added at %s", new_break.id, name);
|
||||
} /* }}} */
|
||||
|
||||
PHPDBG_API void phpdbg_set_breakpoint_opline_ex(phpdbg_opline_ptr_t opline TSRMLS_DC) /* {{{ */
|
||||
@@ -582,6 +583,19 @@ PHPDBG_API void phpdbg_print_breakpoints(zend_ulong type TSRMLS_DC) /* {{{ */
|
||||
phpdbg_writeln("#%d\t\t%s", brake->id, Z_STRVAL(brake->code));
|
||||
}
|
||||
} break;
|
||||
|
||||
case PHPDBG_BREAK_OPCODE: if (PHPDBG_G(flags) & PHPDBG_HAS_OPCODE_BP) {
|
||||
HashPosition position;
|
||||
phpdbg_breakop_t *brake;
|
||||
|
||||
phpdbg_writeln(SEPARATE);
|
||||
phpdbg_writeln("Opcode Breakpoints:");
|
||||
for (zend_hash_internal_pointer_reset_ex(&PHPDBG_G(bp)[PHPDBG_BREAK_OPCODE], &position);
|
||||
zend_hash_get_current_data_ex(&PHPDBG_G(bp)[PHPDBG_BREAK_OPCODE], (void**) &brake, &position) == SUCCESS;
|
||||
zend_hash_move_forward_ex(&PHPDBG_G(bp)[PHPDBG_BREAK_OPCODE], &position)) {
|
||||
phpdbg_writeln("#%d\t\t%s", brake->id, brake->name);
|
||||
}
|
||||
} break;
|
||||
}
|
||||
} /* }}} */
|
||||
|
||||
|
||||
+2
-2
@@ -64,7 +64,7 @@ typedef struct _phpdbg_breakline_t {
|
||||
* Breakpoint opcode based representation
|
||||
*/
|
||||
typedef struct _phpdbg_breakop_t {
|
||||
zend_ulong hash;
|
||||
const char *name;
|
||||
int id;
|
||||
} phpdbg_breakop_t;
|
||||
|
||||
@@ -80,7 +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_symbol(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_opcode(const char*, size_t 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_expression(const char*, size_t TSRMLS_DC);
|
||||
|
||||
+1
-1
@@ -113,7 +113,7 @@ PHPDBG_BREAK(op) /* {{{ */
|
||||
{
|
||||
switch (param->type) {
|
||||
case STR_PARAM:
|
||||
phpdbg_set_breakpoint_opcode(zend_hash_func(param->str, param->len) TSRMLS_CC);
|
||||
phpdbg_set_breakpoint_opcode(param->str, param->len TSRMLS_CC);
|
||||
break;
|
||||
|
||||
phpdbg_default_switch_case();
|
||||
|
||||
+3
-2
@@ -729,7 +729,7 @@ PHPDBG_COMMAND(print) /* {{{ */
|
||||
if (EG(in_execution)) {
|
||||
phpdbg_writeln("VM Return\t%d", PHPDBG_G(vmret));
|
||||
}
|
||||
|
||||
|
||||
phpdbg_writeln("Classes\t\t%d", zend_hash_num_elements(EG(class_table)));
|
||||
phpdbg_writeln("Functions\t%d", zend_hash_num_elements(EG(function_table)));
|
||||
phpdbg_writeln("Constants\t%d", zend_hash_num_elements(EG(zend_constants)));
|
||||
@@ -738,12 +738,13 @@ PHPDBG_COMMAND(print) /* {{{ */
|
||||
"Memory\t\t%.3f/%.3f (kB)",
|
||||
(float) (zend_memory_usage(1 TSRMLS_CC)/1024),
|
||||
(float) (zend_memory_usage(0 TSRMLS_CC)/1024));
|
||||
|
||||
|
||||
phpdbg_print_breakpoints(PHPDBG_BREAK_FILE TSRMLS_CC);
|
||||
phpdbg_print_breakpoints(PHPDBG_BREAK_SYM TSRMLS_CC);
|
||||
phpdbg_print_breakpoints(PHPDBG_BREAK_METHOD TSRMLS_CC);
|
||||
phpdbg_print_breakpoints(PHPDBG_BREAK_OPLINE TSRMLS_CC);
|
||||
phpdbg_print_breakpoints(PHPDBG_BREAK_COND TSRMLS_CC);
|
||||
phpdbg_print_breakpoints(PHPDBG_BREAK_OPCODE TSRMLS_CC);
|
||||
|
||||
phpdbg_writeln(SEPARATE);
|
||||
} break;
|
||||
|
||||
Reference in New Issue
Block a user