Skip to content

Commit af97939

Browse files
committed
resolve all warnings
1 parent 058b59b commit af97939

File tree

4 files changed

+83
-14
lines changed

4 files changed

+83
-14
lines changed

phpdbg.h

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -105,8 +105,7 @@
105105
#define PHPDBG_HAS_OPCODE_BP (1<<6)
106106
#define PHPDBG_HAS_FUNCTION_OPLINE_BP (1<<7)
107107
#define PHPDBG_HAS_METHOD_OPLINE_BP (1<<8)
108-
#define PHPDBG_HAS_FILE_OPLINE_BP (1<<9)
109-
#define PHPDBG_BP_MASK (PHPDBG_HAS_FILE_BP|PHPDBG_HAS_SYM_BP|PHPDBG_HAS_METHOD_BP|PHPDBG_HAS_OPLINE_BP|PHPDBG_HAS_COND_BP|PHPDBG_HAS_OPCODE_BP|PHPDBG_HAS_FUNCTION_OPLINE_BP|PHPDBG_HAS_METHOD_OPLINE_BP|PHPDBG_HAS_FILE_OPLINE_BP)
108+
#define PHPDBG_HAS_FILE_OPLINE_BP (1<<9) /* }}} */
110109

111110
/*
112111
END: DO NOT CHANGE DO NOT CHANGE DO NOT CHANGE
@@ -124,7 +123,6 @@
124123
#define PHPDBG_IN_UNTIL (1<<17)
125124
#define PHPDBG_IN_FINISH (1<<18)
126125
#define PHPDBG_IN_LEAVE (1<<19)
127-
#define PHPDBG_SEEK_MASK (PHPDBG_IN_UNTIL|PHPDBG_IN_FINISH|PHPDBG_IN_LEAVE)
128126

129127
#define PHPDBG_IS_REGISTERED (1<<20)
130128
#define PHPDBG_IS_STEPONEVAL (1<<21)
@@ -135,6 +133,10 @@
135133
#define PHPDBG_IS_REMOTE (1<<26)
136134
#define PHPDBG_IS_DISCONNECTED (1<<27)
137135

136+
#define PHPDBG_SEEK_MASK (PHPDBG_IN_UNTIL|PHPDBG_IN_FINISH|PHPDBG_IN_LEAVE)
137+
#define PHPDBG_BP_RESOLVE_MASK (PHPDBG_HAS_FUNCTION_OPLINE_BP|PHPDBG_HAS_METHOD_OPLINE_BP|PHPDBG_HAS_FILE_OPLINE_BP)
138+
#define PHPDBG_BP_MASK (PHPDBG_HAS_FILE_BP|PHPDBG_HAS_SYM_BP|PHPDBG_HAS_METHOD_BP|PHPDBG_HAS_OPLINE_BP|PHPDBG_HAS_COND_BP|PHPDBG_HAS_OPCODE_BP|PHPDBG_HAS_FUNCTION_OPLINE_BP|PHPDBG_HAS_METHOD_OPLINE_BP|PHPDBG_HAS_FILE_OPLINE_BP)
139+
138140
#ifndef _WIN32
139141
# define PHPDBG_DEFAULT_FLAGS (PHPDBG_IS_QUIET|PHPDBG_IS_COLOURED|PHPDBG_IS_BP_ENABLED)
140142
#else

phpdbg_bp.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -536,8 +536,8 @@ PHPDBG_API void phpdbg_set_breakpoint_method_opline(const char *class, const cha
536536

537537
if (zend_hash_index_exists(method_table, opline)) {
538538
phpdbg_notice("Breakpoint already exists for %s::%s#%ld", new_break.class_name, new_break.func_name, opline);
539-
efree(new_break.func_name);
540-
efree(new_break.class_name);
539+
efree((char*)new_break.func_name);
540+
efree((char*)new_break.class_name);
541541
PHPDBG_G(bp_count)--;
542542
return;
543543
}
@@ -586,7 +586,7 @@ PHPDBG_API void phpdbg_set_breakpoint_function_opline(const char *function, zend
586586

587587
if (zend_hash_index_exists(func_table, opline)) {
588588
phpdbg_notice("Breakpoint already exists for %s#%ld", new_break.func_name, opline);
589-
efree(new_break.func_name);
589+
efree((char*)new_break.func_name);
590590
PHPDBG_G(bp_count)--;
591591
return;
592592
}
@@ -635,7 +635,7 @@ PHPDBG_API void phpdbg_set_breakpoint_file_opline(const char *file, zend_ulong o
635635

636636
if (zend_hash_index_exists(file_table, opline)) {
637637
phpdbg_notice("Breakpoint already exists for %s:%ld", new_break.class_name, opline);
638-
efree(new_break.class_name);
638+
efree((char*)new_break.class_name);
639639
PHPDBG_G(bp_count)--;
640640
return;
641641
}

phpdbg_cmd.c

Lines changed: 69 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -170,10 +170,31 @@ PHPDBG_API char* phpdbg_param_tostring(const phpdbg_param_t *param, char **point
170170
break;
171171

172172
case FILE_PARAM:
173+
if (param->num) {
174+
asprintf(pointer,
175+
"%s:%lu#%lu",
176+
param->file.name,
177+
param->file.line,
178+
param->num);
179+
} else {
180+
asprintf(pointer,
181+
"%s:%lu",
182+
param->file.name,
183+
param->file.line);
184+
}
185+
break;
186+
187+
case NUMERIC_FUNCTION_PARAM:
188+
asprintf(pointer,
189+
"%s#%lu", param->str, param->num);
190+
break;
191+
192+
case NUMERIC_METHOD_PARAM:
173193
asprintf(pointer,
174-
"%s:%lu",
175-
param->file.name,
176-
param->file.line);
194+
"%s::%s#%lu",
195+
param->method.class,
196+
param->method.name,
197+
param->num);
177198
break;
178199

179200
default:
@@ -208,6 +229,20 @@ PHPDBG_API void phpdbg_copy_param(const phpdbg_param_t* src, phpdbg_param_t* des
208229
case FILE_PARAM:
209230
dest->file.name = estrdup(src->file.name);
210231
dest->file.line = src->file.line;
232+
if (src->num)
233+
dest->num = src->num;
234+
break;
235+
236+
case NUMERIC_FUNCTION_PARAM:
237+
dest->str = estrndup(src->str, src->len);
238+
dest->num = src->num;
239+
dest->len = src->len;
240+
break;
241+
242+
case NUMERIC_METHOD_PARAM:
243+
dest->method.class = estrdup(src->method.class);
244+
dest->method.name = estrdup(src->method.name);
245+
dest->num = src->num;
211246
break;
212247

213248
case EMPTY_PARAM: { /* do nothing */ } break;
@@ -231,6 +266,8 @@ PHPDBG_API zend_ulong phpdbg_hash_param(const phpdbg_param_t *param TSRMLS_DC) /
231266
case FILE_PARAM:
232267
hash += zend_inline_hash_func(param->file.name, strlen(param->file.name));
233268
hash += param->file.line;
269+
if (param->num)
270+
hash += param->num;
234271
break;
235272

236273
case ADDR_PARAM:
@@ -241,6 +278,18 @@ PHPDBG_API zend_ulong phpdbg_hash_param(const phpdbg_param_t *param TSRMLS_DC) /
241278
hash += param->num;
242279
break;
243280

281+
case NUMERIC_FUNCTION_PARAM:
282+
hash += zend_inline_hash_func(param->str, param->len);
283+
hash += param->num;
284+
break;
285+
286+
case NUMERIC_METHOD_PARAM:
287+
hash += zend_inline_hash_func(param->method.class, strlen(param->method.class));
288+
hash += zend_inline_hash_func(param->method.name, strlen(param->method.name));
289+
if (param->num)
290+
hash+= param->num;
291+
break;
292+
244293
case EMPTY_PARAM: { /* do nothing */ } break;
245294
}
246295

@@ -252,6 +301,13 @@ PHPDBG_API zend_bool phpdbg_match_param(const phpdbg_param_t *l, const phpdbg_pa
252301
if (l && r) {
253302
if (l->type == r->type) {
254303
switch (l->type) {
304+
305+
case NUMERIC_FUNCTION_PARAM:
306+
if (l->num != r->num) {
307+
break;
308+
}
309+
/* break intentionally omitted */
310+
255311
case STR_PARAM:
256312
return (l->len == r->len) &&
257313
(memcmp(l->str, r->str, l->len) == SUCCESS);
@@ -268,12 +324,20 @@ PHPDBG_API zend_bool phpdbg_match_param(const phpdbg_param_t *l, const phpdbg_pa
268324
strlen(l->file.name), strlen(r->file.name)};
269325

270326
if (lengths[0] == lengths[1]) {
271-
return (memcmp(
272-
l->file.name, r->file.name, lengths[0]) == SUCCESS);
327+
if ((!l->num && !r->num) || (l->num == r->num)) {
328+
return (memcmp(
329+
l->file.name, r->file.name, lengths[0]) == SUCCESS);
330+
}
273331
}
274332
}
275333
} break;
276334

335+
case NUMERIC_METHOD_PARAM:
336+
if (l->num != r->num) {
337+
break;
338+
}
339+
/* break intentionally omitted */
340+
277341
case METHOD_PARAM: {
278342
size_t lengths[2] = {
279343
strlen(l->method.class), strlen(r->method.class)};

phpdbg_prompt.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1183,8 +1183,11 @@ void phpdbg_execute_ex(zend_op_array *op_array TSRMLS_DC) /* {{{ */
11831183
#endif
11841184

11851185
while (1) {
1186-
/* resolve nth opline breakpoints */
1187-
phpdbg_resolve_op_array_breaks(EG(active_op_array) TSRMLS_CC);
1186+
1187+
if ((PHPDBG_G(flags) & PHPDBG_BP_RESOLVE_MASK)) {
1188+
/* resolve nth opline breakpoints */
1189+
phpdbg_resolve_op_array_breaks(EG(active_op_array) TSRMLS_CC);
1190+
}
11881191

11891192
#ifdef ZEND_WIN32
11901193
if (EG(timed_out)) {

0 commit comments

Comments
 (0)