Anybody know of a debugger whose variable window shows call stack object properties

I'm using a debugger for php.  In break mode, I can navigate the call stack to examine code and the variables window for any stack frame; however, the "this" variables window panel seems only to report property values associated with the scope of the current breakpoint (i.e. top stack frame) instead of the currently selected stack frame.

I'm curious if anyone knows of a debugger (for php or any other OO  languages) which display the properties of the object associated with a stack frame, and in addition, those property values displayed are those which were in effect at the time that stack frame was the current/top frame?
Who is Participating?
Jeffrey DakeConnect With a Mentor Senior Director of TechnologyCommented:
Sorry it took awhile to get back.  I have attached three pictures that I think will show what you were expecting see.  The debug window in the top right shows the values of the variables, and the left screen shows the call hierarchy that you can jump through.

First shows values of the list
More data on the list.
Going back to see the employee record.
Hope this helps
George K.Commented:

Have a look at  Xdebug 2 and let me know.
Jacques Bourgeois (James Burger)PresidentCommented:
Such a debugger would require a lot of resources, because it has to record the state of a lot of variables.

Think about what is should record in big loops or recursions that deal with objects that have a lot of properties. And one of the things that designers try to optimize when they create a debugger is that it uses few resources in order to have as little impact as possible on the running application.

I do not know if php has the concept of a local variable, but in VB.NET, to solve such a problem, I simply create a local variable at the point where I want to check my class level variable, and assign it the value of the variable I want to check. When I hit a breakpoint, I simply navigate to the calling method from the Call Stack and get the from of the local variable.
Cloud Class® Course: Microsoft Azure 2017

Azure has a changed a lot since it was originally introduce by adding new services and features. Do you know everything you need to about Azure? This course will teach you about the Azure App Service, monitoring and application insights, DevOps, and Team Services.

SAbboushiAuthor Commented:
Merci Jacques-

Thanks for sharing your thoughts.

Anyone else?  I'm not looking for any solutions here, just whether or not anyone knows of a debugger which behaves as I've described.
SAbboushiAuthor Commented:
Thanks George - I scanned through the link you posted, but a lot of it is beyond my knowledge, so I couldn't tell...
Ray PaseurCommented:
PHP has both local variables and object properties.  The latter are referred to with $this-> prepended to the variable name.  These local variables are visible only inside the method that defines the variables.  Object properties are visible in other methods, subject to the rules of scope inheritance, and outside of the scope of the object via var_dump() as shown here.

object(Thing)#1 (1) {

<?php // demo/temp_sabboushi.php

 * SEE:
echo '<pre>';

Class Thing
    public function set_a_variable($x)
        $y = $x;

    public function set_a_property($x)
        $this->y = $x;

$abc = new Thing;


Open in new window

As a practical matter, developers do not use debuggers in PHP any more.  Instead we rely on unit testing with products like phpunit.  These tools allow us to create mock objects with highly predictable inputs and outputs, and we can use these mock objects to run our code and get a near-real-time report of success or failure in each of the inflection points.  A phpunit test takes at most a few seconds, even for a complex application.  If you run one prior to every commit, you can be sure that your new code additions did not break any of your earlier code!
SAbboushiAuthor Commented:
Thanks Ray.  I'll look into phpunit.

Anyone else?
Jeffrey Dake Senior Director of TechnologyCommented:
I am mostly a Java developer and I use the debugger in eclipse. Java is a different beast then php and the debugger does let you look at any allocated object. However like the others it will still only show you variables that are within the call hierarchy.   Java is kind of a memory hog, which for debugging is kind of helpful. Not sure if this helps at all.
SAbboushiAuthor Commented:
Hi Jeffrey - thanks for your response.

However like the others it will still only show you variables that are within the call hierarchy.

Can you clarify using the following java example (first time I've looked at java, so I hope my example is adequate):  

1  import*;
2  public class EmployeeTest{
4     public static void main(String args[]){
5        Employee empOne = new Employee("James Smith");
6        this.arrOne = empOne.arrOne;
7  	  ArrayList2 arrTwo = new ArrayList2();
8     }
9  }

Open in new window

public class Employee{
  String name;

  public Employee(String name){ = name;
    ArrayList1 arrOne = new ArrayList1();
    this.arrOne = arrOne.list;

Open in new window

public class ArrayList1 {
  public ArrayList1 {
    ArrayList<String> list = new ArrayList<String>();
    this.list = list;    

Open in new window

public class ArrayList2 {
  public ArrayList2 {
    ArrayList<String> list = new ArrayList<String>();
    this.list = list;
    ... Q1: If I break here, I expect the variables window to have a variable
                'list' that I can expand to see 'ItemA'...'ItemC'; I also expect an 
                entry somewhere for 'this' with property 'list' which I can also 
                expand to see 'ItemA'...'ItemC', correct?
    ... Q2: I expect the Call Stack to have an entry for EmployeeTest.main 
                line: 7 
               If you select that call stack entry and look at the variables 
               window, I expect to see 'empOne.arrOne'.  If so, can you expand 
               'empOne.arrOne' and see elements 'Item1'...'Item3'?
    ... Q3: I expect there to be an entry somewhere for 'this' with property 
               'arrOne'. If so, can you expand 'this.arrOne' and see elements 
            Responding with a screen shot of the call stack and the variable 
             windows for both stack frame entries would be really helpful, but 
             I'd be grateful if you merely gave me a correct answer ; )
             The key issue here is whether variables in the variables window 
             for all call stack frames maintain the correct scope values, 
             particularly for those variables/properties which must be 
             expanded (like arrays) in order to see their values (e.g. array 

Open in new window

SAbboushiAuthor Commented:
Perfect!  Thanks for spending the time to do that!

I also confirmed that Visual Studios (I tested php) behaves the same way i.e. retaining all variables for each stack frame.

Thanks again for your help.

PS - Curious if/what corrections you needed to make to my code (I don't know java, so I imagine it had some errors...)
SAbboushiAuthor Commented:
Jeffrey Dake Senior Director of TechnologyCommented:
Most of it worked as is.  Your usages of the keyword this. didn't always work, because you didn't have any instances variables of the class to set it too.  Here are the files I used.
SAbboushiAuthor Commented:
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.