com php-src: cs: phpdbg_bp.c phpdbg_bp.h
| From: | Bob Weinand | Date: | Mon, 02 Dec 2013 13:43:21 +0000 |
| Subject: | com php-src: cs: phpdbg_bp.c phpdbg_bp.h | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-75322@lists.php.net to get a copy of this message | ||
Commit: 9b4e855d72a4624baa01c4c608f3a02171cab933
Author: krakjoe <joe.watkins@live.co.uk> Mon, 2 Dec 2013 13:43:21 +0000
Parents: fed41baf28b8451e30bdc0f4a8b8d590a35f323e
Branches: PHP-5.6
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=9b4e855d72a4624baa01c4c608f3a02171cab933
Log:
cs
Changed paths:
M phpdbg_bp.c
M phpdbg_bp.h
Diff:
diff --git a/phpdbg_bp.c b/phpdbg_bp..c
index 125ceaa..caf3c8a 100644
--- a/phpdbg_bp.c
+++ b/phpdbg_bp.c
@@ -592,70 +592,59 @@ result:
PHPDBG_API void phpdbg_delete_breakpoint(zend_ulong num TSRMLS_DC) /* {{{ */
{
HashTable **table;
-
- if (zend_hash_index_find(&PHPDBG_G(bp)[PHPDBG_BREAK_MAP], num, (void**)&table) == SUCCESS)
{
- HashPosition position;
- phpdbg_breakbase_t *brake;
-
- for (zend_hash_internal_pointer_reset_ex((*table), &position);
- zend_hash_get_current_data_ex((*table), (void**)&brake, &position) == SUCCESS;
- zend_hash_move_forward_ex((*table), &position)) {
- char *key;
- zend_uint klen;
- zend_ulong idx;
-
- if (brake->id == num) {
- int type = brake->type;
- char *name = NULL;
- size_t name_len = 0L;
-
- switch (type) {
- case PHPDBG_BREAK_FILE:
- case PHPDBG_BREAK_METHOD:
- if (zend_hash_num_elements((*table)) == 1) {
- name = estrdup(brake->name);
- name_len = strlen(name);
- if (zend_hash_num_elements(&PHPDBG_G(bp)[type]) == 1) {
- PHPDBG_G(flags) &= ~(1<<(brake->type+1));
- }
- }
- break;
-
- default: {
- if (zend_hash_num_elements((*table)) == 1) {
- PHPDBG_G(flags) &= ~(1<<(brake->type+1));
- }
+ HashPosition position;
+ phpdbg_breakbase_t *brake;
+
+ if ((brake = phpdbg_find_breakbase_ex(num, &table, &position TSRMLS_CC))) {
+ char *key;
+ zend_uint klen;
+ zend_ulong idx;
+ int type = brake->type;
+ char *name = NULL;
+ size_t name_len = 0L;
+
+ switch (type) {
+ case PHPDBG_BREAK_FILE:
+ case PHPDBG_BREAK_METHOD:
+ if (zend_hash_num_elements((*table)) == 1) {
+ name = estrdup(brake->name);
+ name_len = strlen(name);
+ if (zend_hash_num_elements(&PHPDBG_G(bp)[type]) == 1) {
+ PHPDBG_G(flags) &= ~(1<<(brake->type+1));
}
}
+ break;
- switch (zend_hash_get_current_key_ex(
- (*table), &key, &klen, &idx, 0, &position)) {
+ default: {
+ if (zend_hash_num_elements((*table)) == 1) {
+ PHPDBG_G(flags) &= ~(1<<(brake->type+1));
+ }
+ }
+ }
- case HASH_KEY_IS_STRING:
- zend_hash_del((*table), key, klen);
- break;
+ switch (zend_hash_get_current_key_ex(
+ (*table), &key, &klen, &idx, 0, &position)) {
- default:
- zend_hash_index_del((*table), idx);
- }
+ case HASH_KEY_IS_STRING:
+ zend_hash_del((*table), key, klen);
+ break;
- switch (type) {
- case PHPDBG_BREAK_FILE:
- case PHPDBG_BREAK_METHOD:
- if (name) {
- zend_hash_del(&PHPDBG_G(bp)[type], name, name_len);
- efree(name);
- }
- break;
- }
+ default:
+ zend_hash_index_del((*table), idx);
+ }
- phpdbg_notice("Deleted breakpoint #%ld", num);
- PHPDBG_BREAK_UNMAPPING(num);
- return;
- }
+ switch (type) {
+ case PHPDBG_BREAK_FILE:
+ case PHPDBG_BREAK_METHOD:
+ if (name) {
+ zend_hash_del(&PHPDBG_G(bp)[type], name, name_len);
+ efree(name);
+ }
+ break;
}
- phpdbg_error("Failed to delete breakpoint #%ld", num);
+ phpdbg_notice("Deleted breakpoint #%ld", num);
+ PHPDBG_BREAK_UNMAPPING(num);
} else {
phpdbg_error("Failed to find breakpoint #%ld", num);
}
diff --git a/phpdbg_bp.h b/phpdbg_bp.h
index 55ffa74..d9ed37d 100644
--- a/phpdbg_bp.h
+++ b/phpdbg_bp.h
@@ -100,8 +100,6 @@ PHPDBG_API void phpdbg_set_breakpoint_expression(const char* expression, size_t
PHPDBG_API phpdbg_breakbase_t* phpdbg_find_breakpoint(zend_execute_data* TSRMLS_DC); /* }}} */
/* {{{ Misc Breakpoint API */
-PHPDBG_API phpdbg_breakbase_t *phpdbg_find_breakbase(zend_ulong id TSRMLS_DC);
-PHPDBG_API phpdbg_breakbase_t *phpdbg_find_breakbase_ex(zend_ulong id, HashTable ***table,
HashPosition *position TSRMLS_DC);
PHPDBG_API void phpdbg_hit_breakpoint(phpdbg_breakbase_t* brake, zend_bool output TSRMLS_DC);
PHPDBG_API void phpdbg_print_breakpoints(zend_ulong type TSRMLS_DC);
PHPDBG_API void phpdbg_print_breakpoint(phpdbg_breakbase_t* brake TSRMLS_DC);
@@ -113,6 +111,10 @@ PHPDBG_API void phpdbg_enable_breakpoint(zend_ulong id TSRMLS_DC);
PHPDBG_API void phpdbg_disable_breakpoint(zend_ulong id TSRMLS_DC);
PHPDBG_API void phpdbg_disable_breakpoints(TSRMLS_D); /* }}} */
+/* {{{ Breakbase API */
+PHPDBG_API phpdbg_breakbase_t *phpdbg_find_breakbase(zend_ulong id TSRMLS_DC);
+PHPDBG_API phpdbg_breakbase_t *phpdbg_find_breakbase_ex(zend_ulong id, HashTable ***table,
HashPosition *position TSRMLS_DC); /* }}} */
+
/* {{{ Breakpoint Exportation API */
PHPDBG_API void phpdbg_export_breakpoints(FILE *handle TSRMLS_DC); /* }}} */