Skip to content

Commit 8f83506

Browse files
committed
export both types of conditional breakpoint properly
1 parent fd9026b commit 8f83506

File tree

1 file changed

+31
-3
lines changed

1 file changed

+31
-3
lines changed

phpdbg_bp.c

Lines changed: 31 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -142,9 +142,35 @@ PHPDBG_API void phpdbg_export_breakpoints(FILE *handle TSRMLS_DC) /* {{{ */
142142
} break;
143143

144144
case PHPDBG_BREAK_COND: {
145-
fprintf(handle,
146-
"break on %s\n",
147-
((phpdbg_breakcond_t*)brake)->code);
145+
phpdbg_breakcond_t *conditional = (phpdbg_breakcond_t*) brake;
146+
147+
if (conditional->paramed) {
148+
switch (conditional->param.type) {
149+
case STR_PARAM:
150+
fprintf(handle,
151+
"break at %s if %s\n", conditional->param.str, conditional->code);
152+
break;
153+
154+
case METHOD_PARAM:
155+
fprintf(handle,
156+
"break at %s::%s if %s\n",
157+
conditional->param.method.class, conditional->param.method.name,
158+
conditional->code);
159+
break;
160+
161+
case FILE_PARAM:
162+
fprintf(handle,
163+
"break at %s:%lu if %s\n",
164+
conditional->param.file.name, conditional->param.file.line,
165+
conditional->code);
166+
break;
167+
168+
default: { /* do nothing */ } break;
169+
}
170+
} else {
171+
fprintf(
172+
handle, "break on %s\n", conditional->code);
173+
}
148174
} break;
149175
}
150176
}
@@ -427,6 +453,8 @@ PHPDBG_API void phpdbg_set_breakpoint_at(const phpdbg_param_t *param, const phpd
427453
phpdbg_clear_param(
428454
&new_param TSRMLS_CC);
429455
goto usage;
456+
457+
default: { /* do nothing */ } break;
430458
}
431459

432460
expr_hash += phpdbg_hash_param(&new_param TSRMLS_CC);

0 commit comments

Comments
 (0)