[xdebug-dev] svn: /xdebug/trunk/ tests/bug00631.phpt tests/bug00639-2.inc tests/bug00639.phpt xdebug_profiler.c

From: Derick Rethans <derick[@]derickrethans.nl>
Date: Mon, 21 Mar 2011 20:09:20 +0000

derick Mon, 21 Mar 2011 20:09:20 +0000

Revision: http://svn.xdebug.org/cgi-bin/viewvc.cgi?view=rev&revision=3413&root=xdebug

Log:
- Tentative fix for bug #639: Xdebug profiling: output not correct - missing
  'cfl='.

Changed paths:
    U xdebug/trunk/tests/bug00631.phpt
    A xdebug/trunk/tests/bug00639-2.inc
    A xdebug/trunk/tests/bug00639.phpt
    U xdebug/trunk/xdebug_profiler.c

Modified: xdebug/trunk/tests/bug00631.phpt
===================================================================
--- xdebug/trunk/tests/bug00631.phpt 2011-03-21 20:09:19 UTC (rev 3412)
+++ xdebug/trunk/tests/bug00631.phpt 2011-03-21 20:09:20 UTC (rev 3413)
@@ -35,9 +35,11 @@
 summary: %d

 %d %d
+cfl=php:internal
 cfn=php::register_shutdown_function
 calls=1 0 0
 %d %d
+cfl=php:internal
 cfn=php::strlen
 calls=1 0 0
 %d %d

Added: xdebug/trunk/tests/bug00639-2.inc
===================================================================
--- xdebug/trunk/tests/bug00639-2.inc (rev 0)
+++ xdebug/trunk/tests/bug00639-2.inc 2011-03-21 20:09:20 UTC (rev 3413)
@@ -0,0 +1,6 @@
+<?php
+function func2()
+{
+ strlen("42");
+}
+?>

Added: xdebug/trunk/tests/bug00639.phpt
===================================================================
--- xdebug/trunk/tests/bug00639.phpt (rev 0)
+++ xdebug/trunk/tests/bug00639.phpt 2011-03-21 20:09:20 UTC (rev 3413)
@@ -0,0 +1,110 @@
+--TEST--
+Test for bug #639: Xdebug profiling: output not correct - missing 'cfl='
+--INI--
+xdebug.profiler_enable=1
+--FILE--
+<?php
+require 'bug00639-2.inc';
+
+function func1()
+{
+ func2();
+ func2();
+}
+
+func1();
+func2();
+func2();
+func2();
+
+echo file_get_contents(xdebug_get_profiler_filename());
+unlink(xdebug_get_profiler_filename());
+?>
+--EXPECTF--
+version: 1
+creator: xdebug 2.%s
+cmd: %sbug00639.php
+part: 1
+positions: line
+
+events: Time
+
+fl=%sbug00639-2.inc
+fn=require::%sbug00639-2.inc
+1 %d
+
+fl=php:internal
+fn=php::strlen
+4 %d
+
+fl=%sbug00639-2.inc
+fn=func2
+6 %d
+cfl=php:internal
+cfn=php::strlen
+calls=1 0 0
+4 %d
+
+fl=php:internal
+fn=php::strlen
+4 %d
+
+fl=%sbug00639-2.inc
+fn=func2
+7 %d
+cfl=php:internal
+cfn=php::strlen
+calls=1 0 0
+4 %d
+
+fl=%sbug00639.php
+fn=func1
+10 %d
+cfl=%sbug00639-2.inc
+cfn=func2
+calls=1 0 0
+6 %d
+cfl=%sbug00639-2.inc
+cfn=func2
+calls=1 0 0
+7 %d
+
+fl=php:internal
+fn=php::strlen
+4 %d
+
+fl=%sbug00639-2.inc
+fn=func2
+11 %d
+cfl=php:internal
+cfn=php::strlen
+calls=1 0 0
+4 %d
+
+fl=php:internal
+fn=php::strlen
+4 %d
+
+fl=%sbug00639-2.inc
+fn=func2
+12 %d
+cfl=php:internal
+cfn=php::strlen
+calls=1 0 0
+4 %d
+
+fl=php:internal
+fn=php::strlen
+4 %d
+
+fl=%sbug00639-2.inc
+fn=func2
+13 %d
+cfl=php:internal
+cfn=php::strlen
+calls=1 0 0
+4 %d
+
+fl=php:internal
+fn=php::xdebug_get_profiler_filename
+15 %d

Modified: xdebug/trunk/xdebug_profiler.c
===================================================================
--- xdebug/trunk/xdebug_profiler.c 2011-03-21 20:09:19 UTC (rev 3412)
+++ xdebug/trunk/xdebug_profiler.c 2011-03-21 20:09:20 UTC (rev 3413)
@@ -160,7 +160,7 @@

         if (fse->prev) {
                 xdebug_call_entry *ce = xdmalloc(sizeof(xdebug_call_entry));
- ce->filename = xdstrdup(fse->filename);
+ ce->filename = op_array ? xdstrdup(op_array->filename) : xdstrdup(fse->filename);
                 ce->function = xdstrdup(tmp_name);
                 ce->time_taken = fse->profile.time;
                 ce->lineno = fse->lineno;
@@ -211,8 +211,10 @@
                 xdebug_call_entry *call_entry = XDEBUG_LLIST_VALP(le);

                 if (call_entry->user_defined == XDEBUG_EXTERNAL) {
+ fprintf(XG(profile_file), "cfl=%s\n", call_entry->filename);
                         fprintf(XG(profile_file), "cfn=%s\n", call_entry->function);
                 } else {
+ fprintf(XG(profile_file), "cfl=php:internal\n");
                         fprintf(XG(profile_file), "cfn=php::%s\n", call_entry->function);
                 }

Received on Mon Mar 21 2011 - 20:09:20 GMT

This archive was generated by hypermail 2.2.0 : Sun Jun 24 2018 - 04:00:03 BST