Skip to content

Commit 1e4cff9

Browse files
committed
Merge branch 'PHP-7.2' into PHP-7.3
* PHP-7.2: more work on phpdbg conditional breaks
2 parents e177d26 + 6d3a2b4 commit 1e4cff9

File tree

1 file changed

+33
-0
lines changed

1 file changed

+33
-0
lines changed

sapi/phpdbg/phpdbg_bp.c

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ static inline void _phpdbg_break_mapping(int id, HashTable *table) /* {{{ */
5353
zend_hash_index_del(&PHPDBG_G(bp)[PHPDBG_BREAK_MAP], (id))
5454

5555
#define PHPDBG_BREAK_INIT(b, t) do {\
56+
memset(&b, 0, sizeof(b)); \
5657
b.id = PHPDBG_G(bp_count)++; \
5758
b.type = t; \
5859
b.disabled = 0;\
@@ -192,6 +193,24 @@ PHPDBG_API void phpdbg_export_breakpoints_to_string(char **str) /* {{{ */
192193

193194
if (conditional->paramed) {
194195
switch (conditional->param.type) {
196+
case NUMERIC_FUNCTION_PARAM:
197+
phpdbg_asprintf(&new_str,
198+
"%sbreak at %s#%ld if %s\n",
199+
*str, conditional->param.str, conditional->param.num, conditional->code);
200+
break;
201+
202+
case NUMERIC_METHOD_PARAM:
203+
phpdbg_asprintf(&new_str,
204+
"%sbreak at %s::%s#%ld if %s\n",
205+
*str, conditional->param.method.class, conditional->param.method.name, conditional->param.num, conditional->code);
206+
break;
207+
208+
case ADDR_PARAM:
209+
phpdbg_asprintf(&new_str,
210+
"%sbreak at 0X%lx if %s\n",
211+
*str, conditional->param.addr, conditional->code);
212+
break;
213+
195214
case STR_PARAM:
196215
phpdbg_asprintf(&new_str,
197216
"%sbreak at %s if %s\n", *str, conditional->param.str, conditional->code);
@@ -835,6 +854,20 @@ static inline void phpdbg_create_conditional_break(phpdbg_breakcond_t *brake, co
835854
new_break.paramed = 1;
836855
phpdbg_copy_param(
837856
param, &new_break.param);
857+
if (new_break.param.type == FILE_PARAM ||
858+
new_break.param.type == NUMERIC_FILE_PARAM) {
859+
char realpath[MAXPATHLEN];
860+
861+
if (VCWD_REALPATH(new_break.param.file.name, realpath)) {
862+
efree(new_break.param.file.name);
863+
864+
new_break.param.file.name = estrdup(realpath);
865+
} else {
866+
phpdbg_error("eval", "type=\"invalidparameter\"", "Invalid file for conditional break %s", new_break.param.file.name);
867+
phpdbg_clear_param(&new_break.param);
868+
return;
869+
}
870+
}
838871
} else {
839872
new_break.paramed = 0;
840873
}

0 commit comments

Comments
 (0)