php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #30561 PHP code execution tracing
Submitted: 2004-10-26 11:48 UTC Modified: 2013-09-12 13:55 UTC
From: asidorov at hotbox dot ru Assigned:
Status: Wont fix Package: *General Issues
PHP Version: 4.3.8 OS: Windows XP
Private report: No CVE-ID: None
Have you experienced this issue?
Rate the importance of this bug to you:

 [2004-10-26 11:48 UTC] asidorov at hotbox dot ru
Description:
------------
The very very helpful thing would be adding trace capability to PHP to avoid writing all this annoying var_dump's and echo's. Example output is unsuitable ofcourse. It is provided just to show the idea. There may be some number of output templates (full, medium, ...).
I know that there are debug_backtrace() and xDebug but those are not the requested.
Thank you and best regards.

Reproduce code:
---------------
<?php

/* ... */ 

// deep - deepness of tracing function calls
// output - output file
##TRACE medium, deep(0), output('trace.txt')
   // ...
   for ($i=0; $i<$n; $i++) {
      $a += $arr1[$i]/$arr2[$i] + foo($i);
   }
   // ...
##ENDTRACE

/* ... */
?>

Expected result:
----------------
trace.txt:

//for ($i=0; $i<$n; $i++) {
   Init: $i=0;

   Loop:
      1) 0($i) < 1($n) == TRUE
         //$a += $arr1[$i]/$arr2[$i+1] + foo($i);
         
         $a = -1($a) + 3($arr1[0]) / 2($arr2[1]) + 0(foo(0)) == 0.5
      2) 1($i) < 1($n) == FALSE
   End loop.
//}


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2004-10-26 12:00 UTC] derick@php.net
Xdebug does this just fine, what do you mean?
 [2004-10-26 13:02 UTC] asidorov at hotbox dot ru
XDebug doesn't trace variables automatically. I need expicitly call xdebug_var_dump(), var_dump() or echo. I mean that trace will dump all variables, expressions. Something like dumping program execution tree all expression trees and how they are collapsing.
There are situations where I need to know how my code is ran  in true details. I suppose it is hard to implement (simply I don't know how the interpreter is implemented so I really don't know).
 [2013-09-12 13:55 UTC] nikic@php.net
-Status: Open +Status: Wont fix -Package: Feature/Change Request +Package: *General Issues
 [2013-09-12 13:55 UTC] nikic@php.net
Won't be added to PHP. Stuff like this are the job of debugging extensions.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Apr 19 06:01:29 2024 UTC