View Issue Details

IDProjectCategoryView StatusLast Update
0000997XdebugFeature/Change requestpublic2016-12-11 22:13
ReportermpdudeAssigned Toderick 
PrioritynormalSeverityminorReproducibilityalways
Status acknowledgedResolutionopen 
Product Version2.2.3 
Target VersionFixed in Version 
Summary0000997: In trace output, show which object a method is called on
DescriptionIt would be great if the trace output could convey the object instance a method is called on.

A hint with the locally (in the caller's scope) used variable name would be an extra bonus; global object identity (so objects can be recognized when called multiple times) would be the main requirement.

Background:

Given this information, it should be straightforward to write a filter/converter that can compile trace files to PlantUML notation - that is, you can get UML sequence diagrams for your scripts :-)
TagsNo tags attached.
Operating System
PHP Version5.3.5

Activities

derick

2016-12-11 12:55

administrator   ~0003981

If you're still interested - could you give me a changed (originally generated) trace file with this extra information added by hand?

mpdude

2016-12-11 20:46

reporter   ~0003996

Would it be OK to add the information needed to the "human readable" trace file, also if I ultimately probably will use trace_format=1?

derick

2016-12-11 21:20

administrator   ~0003997

Certainly.

Adding it to the 1 format is likely going to be trickier as I can't break the existing format.

mpdude

2016-12-11 21:42

reporter   ~0003998

While preparing the example, I noticed that constructor invocations seem not to be logged in traces. Is that by design or impossible due to PHP internals?

mpdude

2016-12-11 21:47

reporter  

scratch_12.txt (2,602 bytes)
RACE START [2016-12-11 21:36:28]
    0.0003     237640     -> OrdPrinter->setSplitter($s = class Splitter {  }) /var/www/test/trace.php:53 [calling on @1, local name $op]
    0.0004     237776      >=> NULL
    0.0004     237760     -> OrdPrinter->setOrd($o = class Ord {  }) /var/www/test/trace.php:54 [calling on @1, local name $op]
    0.0004     237896      >=> NULL
    0.0004     237976     -> OrdPrinter->run($string = 'Xdebug') /var/www/test/trace.php:55 [calling on @1, local name $op]
    0.0004     238008       -> Splitter->split($str = 'Xdebug') /var/www/test/trace.php:42 [calling on @2, local name $this->splitter]
    0.0004     238056         -> str_split('Xdebug') /var/www/test/trace.php:13
    0.0004     239248          >=> array (0 => 'X', 1 => 'd', 2 => 'e', 3 => 'b', 4 => 'u', 5 => 'g')
    0.0004     239248        >=> array (0 => 'X', 1 => 'd', 2 => 'e', 3 => 'b', 4 => 'u', 5 => 'g')
    0.0008     239312       -> Ord->getOrd($char = 'X') /var/www/test/trace.php:43 [calling on @3, local name $this->ord]
    0.0008     239360         -> ord('X') /var/www/test/trace.php:21
    0.0008     239360          >=> 88
    0.0008     239360        >=> 88
    0.0016     239312       -> Ord->getOrd($char = 'd') /var/www/test/trace.php:43 [calling on @3, local name $this->ord]
    0.0016     239360         -> ord('d') /var/www/test/trace.php:21
    0.0016     239360          >=> 100
    0.0016     239360        >=> 100
    0.0024     239312       -> Ord->getOrd($char = 'e') /var/www/test/trace.php:43 [calling on @3, local name $this->ord]
    0.0024     239360         -> ord('e') /var/www/test/trace.php:21
    0.0024     239360          >=> 101
    0.0024     239360        >=> 101
    0.0032     239312       -> Ord->getOrd($char = 'b') /var/www/test/trace.php:43 [calling on @3, local name $this->ord]
    0.0033     239360         -> ord('b') /var/www/test/trace.php:21
    0.0033     239360          >=> 98
    0.0033     239360        >=> 98
    0.0040     239312       -> Ord->getOrd($char = 'u') /var/www/test/trace.php:43 [calling on @3, local name $this->ord]
    0.0041     239360         -> ord('u') /var/www/test/trace.php:21
    0.0041     239360          >=> 117
    0.0042     239360        >=> 117
    0.0051     239312       -> Ord->getOrd($char = 'g') /var/www/test/trace.php:43 [calling on @3, local name $this->ord]
    0.0052     239360         -> ord('g') /var/www/test/trace.php:21
    0.0052     239360          >=> 103
    0.0052     239360        >=> 103
    0.0056     238120      >=> NULL
    0.0057       8240
TRACE END   [2016-12-11 21:36:28]
scratch_12.txt (2,602 bytes)

mpdude

2016-12-11 21:51

reporter   ~0003999

Last edited: 2016-12-11 21:52

View 2 revisions

Trace file added. I added square brackets at the end of method invocation lines to note the information I'd like to see there.

Most useful would be some kind of global (i. e. script-wide unique) object ID of whatever kind to identify the object a method is invoked on (the callee). With that information, the target of the invocation could be referenced/looked up in an UML sequence diagram.

If the "local name" (field/variable name) holding the reference would be included, some additional information could be included in the diagram, but I guess it should work without this as well.

Cheers!

derick

2016-12-11 22:13

administrator   ~0004000

A constructor should end up in the trace as long as there is one defined in the class. I'll have A look at the trace soon. Could you add the script as well please?

Issue History

Date Modified Username Field Change
2013-10-31 23:08 mpdude New Issue
2016-12-11 12:55 derick Note Added: 0003981
2016-12-11 12:55 derick Assigned To => derick
2016-12-11 12:55 derick Status new => feedback
2016-12-11 20:46 mpdude Note Added: 0003996
2016-12-11 20:46 mpdude Status feedback => assigned
2016-12-11 21:20 derick Note Added: 0003997
2016-12-11 21:20 derick Status assigned => feedback
2016-12-11 21:42 mpdude Note Added: 0003998
2016-12-11 21:42 mpdude Status feedback => assigned
2016-12-11 21:47 mpdude File Added: scratch_12.txt
2016-12-11 21:51 mpdude Note Added: 0003999
2016-12-11 21:52 mpdude Note Edited: 0003999 View Revisions
2016-12-11 22:13 derick Note Added: 0004000
2016-12-11 22:13 derick Status assigned => acknowledged