noted = 1;
}
- fprintf(
- handle, "break %s::%s\n", brake->class_name, brake->func_name);
+ fprintf(handle, "break %s::%s\n", brake->class_name, brake->func_name);
+ }
+ }
+ }
+
+ if (PHPDBG_G(flags) & PHPDBG_HAS_METHOD_OPLINE_BP) {
+ HashTable *class, *method;
+ phpdbg_breakopline_t *brake;
+ HashPosition mposition[2];
+ zend_bool noted = 0;
+
+ table = &PHPDBG_G(bp)[PHPDBG_BREAK_METHOD_OPLINE];
+
+ for (zend_hash_internal_pointer_reset_ex(table, &position);
+ zend_hash_get_current_data_ex(table, (void**) &class, &position) == SUCCESS;
+ zend_hash_move_forward_ex(table, &position)) {
+ for (zend_hash_internal_pointer_reset_ex(class, &mposition[0]);
+ zend_hash_get_current_data_ex(class, (void**) &method, &mposition[0]) == SUCCESS;
+ zend_hash_move_forward_ex(class, &mposition[0])) {
+ noted = 0;
+
+ for (zend_hash_internal_pointer_reset_ex(method, &mposition[1]);
+ zend_hash_get_current_data_ex(method, (void**) &brake, &mposition[1]) == SUCCESS;
+ zend_hash_move_forward_ex(method, &mposition[1])) {
+ if (!noted) {
+ phpdbg_notice(
+ "Exporting method opline breakpoints in %s::%s (%d)",
+ brake->class_name, brake->func_name, zend_hash_num_elements(method));
+ noted = 1;
+ }
+
+ fprintf(handle, "break %s::%s#%d\n", brake->class_name, brake->func_name, brake->opline);
+ }
+ }
+ }
+ }
+
+ if (PHPDBG_G(flags) & PHPDBG_HAS_FUNCTION_OPLINE_BP) {
+ HashTable *function;
+ phpdbg_breakopline_t *brake;
+ HashPosition fposition;
+ zend_bool noted = 0;
+
+ table = &PHPDBG_G(bp)[PHPDBG_BREAK_FUNCTION_OPLINE];
+
+ for (zend_hash_internal_pointer_reset_ex(table, &position);
+ zend_hash_get_current_data_ex(table, (void**) &function, &position) == SUCCESS;
+ zend_hash_move_forward_ex(table, &position)) {
+ noted = 0;
+
+ for (zend_hash_internal_pointer_reset_ex(function, &fposition);
+ zend_hash_get_current_data_ex(function, (void**) &brake, &fposition) == SUCCESS;
+ zend_hash_move_forward_ex(function, &fposition)) {
+ if (!noted) {
+ phpdbg_notice(
+ "Exporting function opline breakpoints in %s (%d)",
+ brake->func_name, zend_hash_num_elements(function));
+ noted = 1;
+ }
+
+ fprintf(handle, "break %s#%d\n", brake->func_name, brake->opline);
+ }
+ }
+ }
+
+ if (PHPDBG_G(flags) & PHPDBG_HAS_FILE_OPLINE_BP) {
+ HashTable *file;
+ phpdbg_breakopline_t *brake;
+ HashPosition fposition;
+ zend_bool noted = 0;
+
+ table = &PHPDBG_G(bp)[PHPDBG_BREAK_FILE_OPLINE];
+
+ for (zend_hash_internal_pointer_reset_ex(table, &position);
+ zend_hash_get_current_data_ex(table, (void**) &file, &position) == SUCCESS;
+ zend_hash_move_forward_ex(table, &position)) {
+ noted = 0;
+
+ for (zend_hash_internal_pointer_reset_ex(file, &fposition);
+ zend_hash_get_current_data_ex(file, (void**) &brake, &fposition) == SUCCESS;
+ zend_hash_move_forward_ex(file, &fposition)) {
+ if (!noted) {
+ phpdbg_notice(
+ "Exporting file opline breakpoints in %s (%d)",
+ brake->class_name, zend_hash_num_elements(file));
+ noted = 1;
+ }
+
+ fprintf(handle, "break a %s#%d\n", brake->func_name, brake->opline);
}
}
}
zend_hash_get_current_data_ex(table, (void**) &brake, &position) == SUCCESS;
zend_hash_move_forward_ex(table, &position)) {
- fprintf(
- handle, "break op %s\n", brake->name);
+ fprintf(handle, "break op %s\n", brake->name);
}
}
zend_hash_get_current_data_ex(table, (void**) &brake, &position) == SUCCESS;
zend_hash_move_forward_ex(table, &position)) {
- fprintf(
- handle, "break on %s\n", Z_STRVAL(brake->code));
+ fprintf(handle, "break on %s\n", Z_STRVAL(brake->code));
}
}
} /* }}} */
return;
}
- if (zend_hash_find(func_table, op_array->function_name?op_array->function_name:"", op_array->function_name?strlen(op_array->function_name):0, (void **)&oplines_table) == FAILURE) {
+ if (op_array->function_name == NULL) {
+ if (zend_hash_find(&PHPDBG_G(bp)[PHPDBG_BREAK_FILE_OPLINE], op_array->filename, strlen(op_array->filename), (void **)&oplines_table) == FAILURE) {
+ return;
+ }
+ } else if (zend_hash_find(func_table, op_array->function_name?op_array->function_name:"", op_array->function_name?strlen(op_array->function_name):0, (void **)&oplines_table) == FAILURE) {
return;
}
zend_hash_internal_pointer_end(&PHPDBG_G(bp)[PHPDBG_BREAK_OPLINE]);
zend_hash_get_current_data(&PHPDBG_G(bp)[PHPDBG_BREAK_OPLINE], (void **)&opline_break);
- phpdbg_notice("Breakpoint #%d resolved at %s%s%s:%d (opline %#lx)", brake->id, brake->class_name?brake->class_name:"", brake->class_name?"::":"", brake->func_name, brake->opline, opline_break->opline);
+ phpdbg_notice("Breakpoint #%d resolved at %s%s%s#%d (opline %#lx)", brake->id, brake->class_name?brake->class_name:"", brake->class_name&&brake->func_name?"::":"", brake->func_name?brake->func_name:"", brake->opline, opline_break->opline);
}
}
}
switch (phpdbg_resolve_opline_break(&new_break TSRMLS_CC)) {
case FAILURE:
- phpdbg_notice("Pending breakpoint #%d at %s::%s:%d", new_break.id, new_break.class_name, new_break.func_name, opline);
+ phpdbg_notice("Pending breakpoint #%d at %s::%s#%d", new_break.id, new_break.class_name, new_break.func_name, opline);
break;
case SUCCESS:
- phpdbg_notice("Breakpoint #%d added at %s::%s:%d", new_break.id, new_break.class_name, new_break.func_name, opline);
+ phpdbg_notice("Breakpoint #%d added at %s::%s#%d", new_break.id, new_break.class_name, new_break.func_name, opline);
break;
case 2:
}
if (zend_hash_index_exists(method_table, opline)) {
- phpdbg_notice("Breakpoint already exists for %s::%s:%d", new_break.class_name, new_break.func_name, opline);
+ phpdbg_notice("Breakpoint already exists for %s::%s#%d", new_break.class_name, new_break.func_name, opline);
efree(new_break.func_name);
efree(new_break.class_name);
PHPDBG_G(bp_count)--;
switch (phpdbg_resolve_opline_break(&new_break TSRMLS_CC)) {
case FAILURE:
- phpdbg_notice("Pending breakpoint #%d at %s:%d", new_break.id, new_break.func_name, new_break.opline);
+ phpdbg_notice("Pending breakpoint #%d at %s#%d", new_break.id, new_break.func_name, new_break.opline);
break;
case SUCCESS:
- phpdbg_notice("Breakpoint #%d added at %s:%d", new_break.id, new_break.func_name, new_break.opline);
+ phpdbg_notice("Breakpoint #%d added at %s#%d", new_break.id, new_break.func_name, new_break.opline);
break;
case 2:
}
if (zend_hash_index_exists(func_table, opline)) {
- phpdbg_notice("Breakpoint already exists for %s:%d", new_break.func_name, opline);
+ phpdbg_notice("Breakpoint already exists for %s#%d", new_break.func_name, opline);
efree(new_break.func_name);
PHPDBG_G(bp_count)--;
return;
return "numeric";
case METHOD_PARAM:
return "method";
+ case NUMERIC_FUNCTION_PARAM:
+ return "function opline";
case NUMERIC_METHOD_PARAM:
return "method opline";
case FILE_PARAM:
- return "file or function opline";
+ return "file or file opline";
case STR_PARAM:
return "string";
default: /* this is bad */
char *line_pos = strrchr(str, ':');
if (line_pos && phpdbg_is_numeric(line_pos+1)) {
- param->len = line_pos - str;
- param->str = estrndup(str, param->len);
-
if (strchr(str, ':') == line_pos) {
+ char path[MAXPATHLEN];
+
+ memcpy(path, str, line_pos - str);
+ path[line_pos - str] = 0;
*line_pos = 0;
- param->file.name = phpdbg_resolve_path(param->str TSRMLS_CC);
- param->num = param->file.line = strtol(line_pos+1, NULL, 0);
+ param->file.name = phpdbg_resolve_path(path TSRMLS_CC);
+ param->file.line = strtol(line_pos+1, NULL, 0);
param->type = FILE_PARAM;
- } else {
+
+ goto parsed;
+ }
+ }
+
+ line_pos = strrchr(str, '#');
+
+ if (line_pos && phpdbg_is_numeric(line_pos+1)) {
+ if (strchr(str, '#') == line_pos) {
*line_pos = 0;
- if (phpdbg_is_class_method(str, line_pos - str, &class_name, &func_name)) {
- param->num = strtol(str, NULL, 0);
+ param->num = strtol(line_pos + 1, NULL, 0);
+
+ if (phpdbg_is_class_method(str, line_pos - str, &class_name, &func_name)) {
param->method.class = class_name;
param->method.name = func_name;
param->type = NUMERIC_METHOD_PARAM;
} else {
- phpdbg_error("Impossible to parse %s", str);
+ param->len = line_pos - str;
+ param->str = estrndup(str, param->len);
+ param->type = NUMERIC_FUNCTION_PARAM;
}
- }
- goto parsed;
+ goto parsed;
+ }
}
}