com php-src: Merge remote-tracking branch 'origin/PHP-5.6': sapi/phpdbg/phpdbg.h sapi/phpdbg/phpdbg_bp.c sapi/phpdbg/ phpdbg_bp.h
| From: | Bob Weinand | Date: | Mon, 27 Oct 2014 13:32:58 +0000 |
| Subject: | com php-src: Merge remote-tracking branch 'origin/PHP-5.6': sapi/phpdbg/phpdbg.h sapi/phpdbg/phpdbg_bp.c sapi/phpdbg/ phpdbg_bp.h | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-82701@lists.php.net to get a copy of this message | ||
Commit: baba4254ce481b779beab6dd75cbe6a9612b3243
Author: Bob Weinand <bobwei9@hotmail.com> Mon, 27 Oct 2014 14:32:58 +0100
Parents: a3ae40152490eacdced73408b9978c8ba31d0179 0ede82d4665fb0c03ef6cf43bdf05e14f475b230
Branches: master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=baba4254ce481b779beab6dd75cbe6a9612b3243
Log:
Merge remote-tracking branch 'origin/PHP-5.6'
Conflicts:
sapi/phpdbg/phpdbg_bp.c
Changed paths:
MM sapi/phpdbg/phpdbg.h
MM sapi/phpdbg/phpdbg_bp.c
MM sapi/phpdbg/phpdbg_bp.h
Diff:
diff --cc sapi/phpdbg/phpdbg_bp.c
index f6610cd,cf28a33..4402404
--- a/sapi/phpdbg/phpdbg_bp.c
+++ b/sapi/phpdbg/phpdbg_bp.c
@@@ -248,8 -265,23 +248,21 @@@ PHPDBG_API void phpdbg_set_breakpoint_f
new_break.filename = estrndup(path, path_len);
new_break.line = line_num;
- zend_hash_index_update(broken, line_num, (void **) &new_break, sizeof(phpdbg_breakfile_t),
NULL);
+ zend_hash_index_update_mem(broken, line_num, &new_break, sizeof(phpdbg_breakfile_t));
+ PHPDBG_BREAK_MAPPING(new_break.id, broken);
+
+ if (pending) {
- for (zend_hash_internal_pointer_reset_ex(&PHPDBG_G(file_sources), &position);
- zend_hash_get_current_key_ex(&PHPDBG_G(file_sources), &file, &filelen, NULL,
0, &position) == HASH_KEY_IS_STRING;
- zend_hash_move_forward_ex(&PHPDBG_G(file_sources), &position)) {
- if (!(pending = ((broken = phpdbg_resolve_pending_file_break_ex(file, filelen, path, path_len,
broken TSRMLS_CC)) == NULL))) {
- phpdbg_breakfile_t *brake;
- zend_hash_index_find(broken, line_num, (void **) &brake);
- new_break = *brake;
++ zend_string *file, *path_str = zend_string_init(path, path_len, 0);
++ ZEND_HASH_FOREACH_STR_KEY(&PHPDBG_G(file_sources), file) {
++ if (!(pending = ((broken = phpdbg_resolve_pending_file_break_ex(file->val, file->len,
path_str, broken TSRMLS_CC)) == NULL))) {
++ new_break = *(phpdbg_breakfile_t *) zend_hash_index_find_ptr(broken, line_num);
+ break;
+ }
- }
++ } ZEND_HASH_FOREACH_END();
++ zend_string_release(path_str);
+ }
+
if (pending) {
PHPDBG_G(flags) |= PHPDBG_HAS_PENDING_FILE_BP;
@@@ -266,53 -296,72 +277,62 @@@
}
} /* }}} */
- PHPDBG_API void phpdbg_resolve_pending_file_break(const char *file TSRMLS_DC) /* {{{ */
-PHPDBG_API HashTable *phpdbg_resolve_pending_file_break_ex(const char *file, uint filelen, const
char *cur, uint curlen, HashTable *fileht TSRMLS_DC) /* {{{ */
++PHPDBG_API HashTable *phpdbg_resolve_pending_file_break_ex(const char *file, uint filelen,
zend_string *cur, HashTable *fileht TSRMLS_DC) /* {{{ */
{
- HashTable *fileht;
- uint filelen = strlen(file);
- zend_string *cur;
- if (curlen < filelen && file[filelen - curlen - 1] == '/' &&
!memcmp(file + filelen - curlen, cur, curlen)) {
++ if (cur->len < filelen && file[filelen - cur->len - 1] == '/'
&& !memcmp(file + filelen - cur->len, cur->val, cur->len)) {
+ phpdbg_breakfile_t *brake, new_brake;
+ HashTable *master = NULL;
- HashPosition position;
+ dtor_func_t dtor;
- ZEND_HASH_FOREACH_STR_KEY_PTR(&PHPDBG_G(bp)[PHPDBG_BREAK_FILE_PENDING], cur, fileht) {
- if (cur->len < filelen && file[filelen - cur->len - 1] == '/'
&& !memcmp(file + filelen - cur->len, cur->val, cur->len)) {
- phpdbg_breakfile_t *brake, new_brake;
- HashTable *master;
- dtor_func_t dtor;
+ PHPDBG_G(flags) |= PHPDBG_HAS_FILE_BP;
- PHPDBG_G(flags) |= PHPDBG_HAS_FILE_BP;
- if (zend_hash_find(&PHPDBG_G(bp)[PHPDBG_BREAK_FILE], file, filelen, (void **) &master)
== FAILURE) {
++ if (!(master = zend_hash_str_find_ptr(&PHPDBG_G(bp)[PHPDBG_BREAK_FILE], file, filelen))) {
+ dtor = PHPDBG_G(bp)[PHPDBG_BREAK_FILE_PENDING].pDestructor;
+ PHPDBG_G(bp)[PHPDBG_BREAK_FILE_PENDING].pDestructor = NULL;
- zend_hash_add(&PHPDBG_G(bp)[PHPDBG_BREAK_FILE], file, filelen, fileht, sizeof(HashTable),
(void **) &fileht);
++ fileht = zend_hash_str_add_mem(&PHPDBG_G(bp)[PHPDBG_BREAK_FILE], file, filelen, fileht,
sizeof(HashTable));
+ }
- if (!(master = zend_hash_str_find_ptr(&PHPDBG_G(bp)[PHPDBG_BREAK_FILE], file, filelen))) {
- dtor = PHPDBG_G(bp)[PHPDBG_BREAK_FILE_PENDING].pDestructor;
- PHPDBG_G(bp)[PHPDBG_BREAK_FILE_PENDING]..pDestructor = NULL;
- fileht = zend_hash_str_add_mem(&PHPDBG_G(bp)[PHPDBG_BREAK_FILE], file, filelen, fileht,
sizeof(HashTable));
- for (zend_hash_internal_pointer_reset_ex(fileht, &position);
- zend_hash_get_current_data_ex(fileht, (void**)&brake, &position) == SUCCESS;
- zend_hash_move_forward_ex(fileht, &position)) {
++ ZEND_HASH_FOREACH_PTR(fileht, brake) {
+ new_brake = *brake;
+ new_brake.filename = estrndup(file, filelen);
+ PHPDBG_BREAK_UNMAPPING(brake->id);
+
+ if (master) {
- zend_hash_index_update(master, brake->line, (void **) &new_brake,
sizeof(phpdbg_breakfile_t), NULL);
++ zend_hash_index_update_mem(master, brake->line, &new_brake,
sizeof(phpdbg_breakfile_t));
+ PHPDBG_BREAK_MAPPING(brake->id, master);
+ } else {
+ efree((char *) brake->filename);
+ *brake = new_brake;
+ PHPDBG_BREAK_MAPPING(brake->id, fileht);
}
- }
++ } ZEND_HASH_FOREACH_END();
- ZEND_HASH_FOREACH_PTR(fileht, brake) {
- new_brake = *brake;
- new_brake.filename = estrndup(file, filelen);
- PHPDBG_BREAK_UNMAPPING(brake->id);
-
- if (master) {
- zend_hash_index_update_mem(master, brake->line, &new_brake,
sizeof(phpdbg_breakfile_t));
- PHPDBG_BREAK_MAPPING(brake->id, master);
- } else {
- efree((char *) brake->filename);
- *brake = new_brake;
- PHPDBG_BREAK_MAPPING(brake->id, fileht);
- }
- } ZEND_HASH_FOREACH_END();
-
- zend_hash_del(&PHPDBG_G(bp)[PHPDBG_BREAK_FILE_PENDING], cur);
- zend_hash_del(&PHPDBG_G(bp)[PHPDBG_BREAK_FILE_PENDING], cur, curlen);
++ zend_hash_del(&PHPDBG_G(bp)[PHPDBG_BREAK_FILE_PENDING], cur);
- if (!master) {
- PHPDBG_G(bp)[PHPDBG_BREAK_FILE_PENDING].pDestructor = dtor;
- }
+ if (!master) {
+ PHPDBG_G(bp)[PHPDBG_BREAK_FILE_PENDING].pDestructor = dtor;
+ }
- if (!zend_hash_num_elements(&PHPDBG_G(bp)[PHPDBG_BREAK_FILE_PENDING])) {
- PHPDBG_G(flags) &= ~PHPDBG_HAS_PENDING_FILE_BP;
- }
+ if (!zend_hash_num_elements(&PHPDBG_G(bp)[PHPDBG_BREAK_FILE_PENDING])) {
+ PHPDBG_G(flags) &= ~PHPDBG_HAS_PENDING_FILE_BP;
}
+
+ return fileht;
+ }
+
+ return NULL;
+ } /* }}} */
+
+ PHPDBG_API void phpdbg_resolve_pending_file_break(const char *file TSRMLS_DC) /* {{{ */
+ {
- HashPosition position;
+ HashTable *fileht;
+ uint filelen = strlen(file);
++ zend_string *cur;
+
- zend_hash_internal_pointer_reset_ex(&PHPDBG_G(bp)[PHPDBG_BREAK_FILE_PENDING], &position);
- while (zend_hash_get_current_data_ex(&PHPDBG_G(bp)[PHPDBG_BREAK_FILE_PENDING], (void**)
&fileht, &position) == SUCCESS) {
- const char *cur;
- uint curlen;
-
- zend_hash_get_current_key_ex(&PHPDBG_G(bp)[PHPDBG_BREAK_FILE_PENDING], (char **) &cur,
&curlen, NULL, 0, &position);
- zend_hash_move_forward_ex(&PHPDBG_G(bp)[PHPDBG_BREAK_FILE_PENDING], &position);
-
- phpdbg_resolve_pending_file_break_ex(file, filelen, cur, curlen, fileht TSRMLS_CC);
- }
-}
++ ZEND_HASH_FOREACH_STR_KEY_PTR(&PHPDBG_G(bp)[PHPDBG_BREAK_FILE_PENDING], cur, fileht) {
++ phpdbg_resolve_pending_file_break_ex(file, filelen, cur, fileht TSRMLS_CC);
+ } ZEND_HASH_FOREACH_END();
+} /* }}} */
PHPDBG_API void phpdbg_set_breakpoint_symbol(const char *name, size_t name_len TSRMLS_DC) /* {{{
*/
{
diff --cc sapi/phpdbg/phpdbg_bp.h
index a8d2316,eca5953..83c8bbc
--- a/sapi/phpdbg/phpdbg_bp.h
+++ b/sapi/phpdbg/phpdbg_bp.h
@@@ -121,6 -121,7 +121,7 @@@ typedef struct _phpdbg_breakcond_t
PHPDBG_API void phpdbg_resolve_op_array_breaks(zend_op_array *op_array TSRMLS_DC);
PHPDBG_API int phpdbg_resolve_op_array_break(phpdbg_breakopline_t *brake, zend_op_array *op_array
TSRMLS_DC);
PHPDBG_API int phpdbg_resolve_opline_break(phpdbg_breakopline_t *new_break TSRMLS_DC);
-PHPDBG_API HashTable *phpdbg_resolve_pending_file_break_ex(const char *file, uint filelen, const
char *cur, uint curlen, HashTable *fileht TSRMLS_DC);
++PHPDBG_API HashTable *phpdbg_resolve_pending_file_break_ex(const char *file, uint filelen,
zend_string *cur, HashTable *fileht TSRMLS_DC);
PHPDBG_API void phpdbg_resolve_pending_file_break(const char *file TSRMLS_DC); /* }}} */
/* {{{ Breakpoint Creation API */