- Cosmetic changes

This commit is contained in:
Felipe Pena 2013-11-13 22:29:44 -02:00
parent b91a5053f8
commit 0eea7e4504
4 changed files with 29 additions and 21 deletions

View file

@ -142,7 +142,8 @@ void phpdbg_set_breakpoint_opline(zend_ulong opline TSRMLS_DC) /* {{{ */
new_break.opline = opline;
new_break.id = PHPDBG_G(bp_count)++;
zend_hash_index_update(&PHPDBG_G(bp)[PHPDBG_BREAK_OPLINE], opline, &new_break, sizeof(phpdbg_breakline_t), NULL);
zend_hash_index_update(&PHPDBG_G(bp)[PHPDBG_BREAK_OPLINE], opline,
&new_break, sizeof(phpdbg_breakline_t), NULL);
phpdbg_notice("Breakpoint #%d added at %#lx",
new_break.id, new_break.opline);
@ -161,7 +162,8 @@ void phpdbg_set_breakpoint_opline_ex(phpdbg_opline_ptr_t opline TSRMLS_DC) /* {{
new_break.opline = (zend_ulong) opline;
new_break.id = PHPDBG_G(bp_count)++;
zend_hash_index_update(&PHPDBG_G(bp)[PHPDBG_BREAK_OPLINE], (zend_ulong) opline, &new_break, sizeof(phpdbg_breakline_t), NULL);
zend_hash_index_update(&PHPDBG_G(bp)[PHPDBG_BREAK_OPLINE],
(zend_ulong) opline, &new_break, sizeof(phpdbg_breakline_t), NULL);
phpdbg_notice("Breakpoint #%d added at %#lx",
new_break.id, new_break.opline);
@ -203,11 +205,13 @@ void phpdbg_set_breakpoint_expression(const char* expr, size_t expr_len TSRMLS_D
phpdbg_breakcond_t *broken;
zend_hash_index_update(
&PHPDBG_G(bp)[PHPDBG_BREAK_COND], hash, &new_break, sizeof(phpdbg_breakcond_t), (void**)&broken);
phpdbg_notice(
"Conditional breakpoint #%d added %s/%p", broken->id, Z_STRVAL(broken->code), broken->ops);
PHPDBG_G(flags) |= PHPDBG_HAS_COND_BP;
&PHPDBG_G(bp)[PHPDBG_BREAK_COND], hash, &new_break,
sizeof(phpdbg_breakcond_t), (void**)&broken);
phpdbg_notice("Conditional breakpoint #%d added %s/%p",
broken->id, Z_STRVAL(broken->code), broken->ops);
PHPDBG_G(flags) |= PHPDBG_HAS_COND_BP;
} else {
phpdbg_error(
"Failed to compile code for expression %s", expr);
@ -227,8 +231,8 @@ int phpdbg_find_breakpoint_file(zend_op_array *op_array TSRMLS_DC) /* {{{ */
zend_llist *break_list;
zend_llist_element *le;
if (zend_hash_find(&PHPDBG_G(bp)[PHPDBG_BREAK_FILE], op_array->filename, name_len,
(void**)&break_list) == FAILURE) {
if (zend_hash_find(&PHPDBG_G(bp)[PHPDBG_BREAK_FILE], op_array->filename,
name_len, (void**)&break_list) == FAILURE) {
return FAILURE;
}
@ -245,8 +249,6 @@ int phpdbg_find_breakpoint_file(zend_op_array *op_array TSRMLS_DC) /* {{{ */
return FAILURE;
} /* }}} */
int phpdbg_find_breakpoint_symbol(zend_function *fbc TSRMLS_DC) /* {{{ */
{
const char *fname;
@ -288,8 +290,8 @@ int phpdbg_find_breakpoint_method(zend_op_array *ops TSRMLS_DC) /* {{{ */
HashTable *class_table;
phpdbg_breakmethod_t *bp;
if (zend_hash_find(&PHPDBG_G(bp)[PHPDBG_BREAK_METHOD], ops->scope->name, ops->scope->name_length,
(void**)&class_table) == SUCCESS) {
if (zend_hash_find(&PHPDBG_G(bp)[PHPDBG_BREAK_METHOD], ops->scope->name,
ops->scope->name_length, (void**)&class_table) == SUCCESS) {
if (zend_hash_find(
class_table,
ops->function_name,
@ -310,8 +312,8 @@ int phpdbg_find_breakpoint_opline(phpdbg_opline_ptr_t opline TSRMLS_DC) /* {{{ *
{
phpdbg_breakline_t *bp;
if (zend_hash_index_find(&PHPDBG_G(bp)[PHPDBG_BREAK_OPLINE], (zend_ulong) opline,
(void**)&bp) == SUCCESS) {
if (zend_hash_index_find(&PHPDBG_G(bp)[PHPDBG_BREAK_OPLINE],
(zend_ulong) opline, (void**)&bp) == SUCCESS) {
phpdbg_notice("Breakpoint #%d in %#lx at %s:%u",
bp->id, bp->opline,
zend_get_executed_filename(TSRMLS_C),

View file

@ -91,14 +91,11 @@ PHPDBG_BREAK(address) /* {{{ */
PHPDBG_BREAK(on) /* {{{ */
{
if (expr && expr_len > 0L) {
phpdbg_set_breakpoint_expression(
expr, expr_len TSRMLS_CC);
if (expr_len == 0) {
phpdbg_error("No expression provided!");
} else {
phpdbg_error(
"No expression provided!");
phpdbg_set_breakpoint_expression(expr, expr_len TSRMLS_CC);
}
return SUCCESS;
} /* }}} */

View file

@ -89,7 +89,13 @@ char *phpdbg_resolve_path(const char *path TSRMLS_DC) /* {{{ */
const char *phpdbg_current_file(TSRMLS_D) /* {{{ */
{
return PHPDBG_G(exec) ? PHPDBG_G(exec) : zend_get_executed_filename(TSRMLS_C);
const char *file = zend_get_executed_filename(TSRMLS_C);
if (memcmp(file, "[no active file]", sizeof("[no active file]")) == 0) {
return PHPDBG_G(exec);
}
return file;
} /* }}} */
int phpdbg_parse_param(const char *str, size_t len, phpdbg_param_t *param TSRMLS_DC) /* {{{ */

View file

@ -28,6 +28,9 @@ int phpdbg_is_empty(const char*);
int phpdbg_is_addr(const char*);
int phpdbg_is_class_method(const char*, size_t, char**, char**);
/**
* Parameter parsing stuff
*/
enum {
EMPTY_PARAM = 0,
ADDR_PARAM,