Index: branches/PushGP/HeuristicLab.PushGP/HeuristicLab.Problems.ProgramSynthesis/Push/Views/PushDebuggerView.cs
===================================================================
--- branches/PushGP/HeuristicLab.PushGP/HeuristicLab.Problems.ProgramSynthesis/Push/Views/PushDebuggerView.cs	(revision 14952)
+++ branches/PushGP/HeuristicLab.PushGP/HeuristicLab.Problems.ProgramSynthesis/Push/Views/PushDebuggerView.cs	(revision 15017)
@@ -15,5 +15,6 @@
 
   public partial class PushDebuggerView : ItemView {
-    private readonly IDictionary<StackTypes, ListBox> debugControlDict = new Dictionary<StackTypes, ListBox>();
+    private readonly IDictionary<StackTypes, ListBox> debugListDict = new Dictionary<StackTypes, ListBox>();
+    private readonly IDictionary<StackTypes, PushProgramTreeView> debugPushProgramDict = new Dictionary<StackTypes, PushProgramTreeView>();
 
     private PooledPushInterpreter interpreter;
@@ -157,22 +158,21 @@
 
     private void ClearDebugLists() {
-      foreach (var list in debugControlDict.Values) {
+      foreach (var list in debugListDict.Values) {
         list.Items.Clear();
       }
+
+      foreach (var treeView in debugPushProgramDict.Values) {
+        treeView.Nodes.Clear();
+      }
     }
 
     private void UpdateExecList() {
-      execList.Items.Clear();
-      var expressions = interpreter.ExecStack.AsEnumerable()
-        .Reverse()
-        .Select(e => e.StringRepresentation)
-        .ToArray();
-
-      execList.Items.AddRange(expressions);
-      execGroupBox.Text = string.Format(GROUP_BOX_TEXT_STRING_FORMAT, Enum.GetName(typeof(StackTypes), StackTypes.Exec), interpreter.ExecStack.Count);
+      execTreeView.LoadExpressions(interpreter.ExecStack.Reverse());
+      exec2GroupBox.Text = string.Format(GROUP_BOX_TEXT_STRING_FORMAT, Enum.GetName(typeof(StackTypes), StackTypes.Exec), interpreter.ExecStack.Count);
     }
 
     private void InitDebugLists(IReadOnlyPushConfiguration config) {
-      debugControlDict.Clear();
+      debugListDict.Clear();
+      debugPushProgramDict.Clear();
 
       // 2 = ExecList + EmptyColumn which is required to fill empty space
@@ -185,18 +185,41 @@
         if (stackType != StackTypes.Exec &&
             ExpressionTable.GetExpressionsByStackTypes(stackType).Intersect(config.EnabledExpressions).Any()) {
-          var list = CreateDebugList(stackType);
-          debugControlDict.Add(stackType, list);
+
+          switch (stackType) {
+            case StackTypes.Code:
+              var treeView = CreatePushProgramTreeView(stackType);
+              debugPushProgramDict.Add(stackType, treeView);
+              break;
+            default:
+              var list = CreateDebugList(stackType);
+              debugListDict.Add(stackType, list);
+              break;
+          }
         }
       }
     }
 
+    private PushProgramTreeView CreatePushProgramTreeView(StackTypes type) {
+
+      var treeView = new PushProgramTreeView {
+        Dock = DockStyle.Fill
+      };
+
+      AddStackControlToTableLayout(type, treeView, 400);
+
+      return treeView;
+    }
+
+    private void AddStackControlToTableLayout(StackTypes type, Control control, int width) {
+      var groupBox = CreateStackGroupBox(type);
+      groupBox.Controls.Add(control);
+
+      debugTableLayout.ColumnCount++;
+      debugTableLayout.ColumnStyles.Insert(1, new ColumnStyle(SizeType.Absolute, width));
+      debugTableLayout.Controls.Add(groupBox);
+      debugTableLayout.Controls.SetChildIndex(groupBox, 1);
+    }
+
     private ListBox CreateDebugList(StackTypes type) {
-      var groupBox = new GroupBox {
-        Anchor = AnchorStyles.Bottom | AnchorStyles.Right | AnchorStyles.Left | AnchorStyles.Top,
-        AutoSize = true,
-        AutoSizeMode = AutoSizeMode.GrowAndShrink,
-        Text = Enum.GetName(typeof(StackTypes), type)
-      };
-
       var list = new ListBox {
         Dock = DockStyle.Fill
@@ -227,16 +250,17 @@
       }
 
-      groupBox.Controls.Add(list);
-
-      var columnWidth = stackEntryType == typeof(Expression) ? 250 : 150;
-
-      debugTableLayout.ColumnCount++;
-      debugTableLayout.ColumnStyles.Insert(1, new ColumnStyle(SizeType.Absolute, columnWidth));
-      debugTableLayout.Controls.Add(groupBox);
-      debugTableLayout.Controls.SetChildIndex(groupBox, 1);
+      AddStackControlToTableLayout(type, list, 150);
 
       return list;
     }
 
+    private static GroupBox CreateStackGroupBox(StackTypes type) {
+      return new GroupBox {
+        Anchor = AnchorStyles.Bottom | AnchorStyles.Right | AnchorStyles.Left | AnchorStyles.Top,
+        AutoSize = true,
+        AutoSizeMode = AutoSizeMode.GrowAndShrink,
+        Text = Enum.GetName(typeof(StackTypes), type)
+      };
+    }
 
     private void UpdateDebugLists() {
@@ -246,7 +270,15 @@
         return;
 
-      foreach (var pair in debugControlDict) {
+      foreach (var pair in debugPushProgramDict) {
         var name = Enum.GetName(typeof(StackTypes), pair.Key);
-        var items = InterpreterStackStringifier.StringifyStack(interpreter, pair.Key).ToArray();
+        var stack = (IPushStack<Expression>)interpreter.Stacks[pair.Key];
+
+        pair.Value.AddExpressions(stack);
+        ((GroupBox)pair.Value.Parent).Text = string.Format(GROUP_BOX_TEXT_STRING_FORMAT, name, pair.Value.Nodes.Count);
+      }
+
+      foreach (var pair in debugListDict) {
+        var name = Enum.GetName(typeof(StackTypes), pair.Key);
+        var items = interpreter.StringifyStack(pair.Key).ToArray();
 
         pair.Value.Items.AddRange(items);
