Date: Tue Dec 14 11:45:22 CET 2004
User: Derick Rethans
Directory: xdebug
Log Message:
[1.50]
- Fixed bug #107: Code Coverage only detects executable code in used functions
and classes.
Modified files:
xdebug/xdebug_code_coverage.c (version: 1.13)
[FILE: /xdebug/xdebug_code_coverage.c]
===================================================================
RCS file: cvstemp,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -r1.12 -r1.13
--- xdebug/xdebug_code_coverage.c:1.12 Fri Oct 29 08:01:17 2004 GMT
+++ xdebug/xdebug_code_coverage.c Tue Dec 14 09:45:22 2004 GMT
@@ -82,6 +82,46 @@
xdebug_count_line(fn, opcode.lineno, 1 TSRMLS_CC);
}
+static int prefil_from_function_table(zend_op_array *opa, int num_args, va_list args, zend_hash_key *hash_key)
+{
+ char *new_filename;
+ unsigned int i;
+
+ new_filename = va_arg(args, char*);
+ if (opa->type == ZEND_USER_FUNCTION) {
+ if (opa->filename && strcmp(opa->filename, new_filename) == 0) {
+ for (i = 0; i < opa->size; i++) {
+ prefil_from_opcode(NULL, new_filename, opa->opcodes[i] TSRMLS_CC);
+ }
+ }
+ }
+
+ return ZEND_HASH_APPLY_KEEP;
+}
+
+#ifdef ZEND_ENGINE_2
+static int prefil_from_class_table(zend_class_entry **class_entry, int num_args, va_list args, zend_hash_key *hash_key)
+#else
+static int prefil_from_class_table(zend_class_entry *class_entry, int num_args, va_list args, zend_hash_key *hash_key)
+#endif
+{
+ char *new_filename;
+ zend_class_entry *ce;
+
+#ifdef ZEND_ENGINE_2
+ ce = *class_entry;
+#else
+ ce = class_entry;
+#endif
+
+ new_filename = va_arg(args, char*);
+ if (ce->type == ZEND_USER_CLASS) {
+ zend_hash_apply_with_arguments(&ce->function_table, (apply_func_args_t) prefil_from_function_table, 1, new_filename);
+ }
+
+ return ZEND_HASH_APPLY_KEEP;
+}
+
void xdebug_prefil_code_coverage(function_stack_entry *fse, zend_op_array *op_array TSRMLS_DC)
{
unsigned int i;
@@ -89,6 +129,9 @@
for (i = 0; i < op_array->size; i++) {
prefil_from_opcode(fse, op_array->filename, op_array->opcodes[i] TSRMLS_CC);
}
+
+ zend_hash_apply_with_arguments(CG(function_table), (apply_func_args_t) prefil_from_function_table, 1, op_array->filename);
+ zend_hash_apply_with_arguments(CG(class_table), (apply_func_args_t) prefil_from_class_table, 1, op_array->filename);
}
PHP_FUNCTION(xdebug_start_code_coverage)
Received on Tue Dec 14 2004 - 11:45:30 GMT
This archive was generated by hypermail 2.2.0 : Sun Jun 24 2018 - 04:00:03 BST