Commits

anatoly techtonik  committed 371eb05

fix reinitialization of profile
attempt to restore proper stack structure for TreeCtrl

  • Participants
  • Parent commits a2ba0fc

Comments (0)

Files changed (2)

File wxdebuglib/analyzer.py

         for attr in 'hasheader', 'hasbody', 'percentloaded':
             self.__dict__[attr] = 0
         
-        for attr in 'summary', 'main', 'functions', 'stack':
+        for attr in 'main', 'functions':
             if self.profile.__dict__.has_key(attr):
                 del self.profile.__dict__[attr]
         
+        self.profile.summary = None
+        self.profile.stack = []
         self._initParseStates()
     
     def _initParseStates(self):
                     'name': self.profile.script,
                     'script': self.profile.script,
                     'time':self.profile.summary,
-                    'stack': []
+                    'stack': [
+                       {    'calls': ('1', '0', '0'),
+                            'lineno': '0',
+                            'name': '{main}',
+                            'time': self.profile.summary
+                       }
+                    ]
                 }
                 
         if self.profile.__dict__.has_key('main'):
-            maincall = {    'calls': ('1', '0', '0'),
-                            'lineno': '0',
-                            'name': '{main}',
-                            'time': self.profile.summary}
-            root['stack'] = [maincall] + self.profile.main['stack']
+            root['stack'] += self.profile.main['stack']
             self.profile.stack = [root,[[self.profile.main, self.profile.stack]]]
         else:
             # root['stack'] = self.profile.stack

File wxdebuglib/profile.py

         self.initialized = 1
         self.name = name
         self.functionstats = {}   # 'funcname' : {'calls':0,'selft':0,'cumt':0,'script':''}
-        # list of {'lineno':0,'name':'funcname','script':'php:internal', 'stack': [], 'time':0}
+        # list of {'lineno':0,'name':'funcname','script':'php:internal', 'stack':[], 'time':0}
+        #     and {'calls':('1','0','0'), 'lineno':'28', 'name':'php::substr', 'time':'0'}
         self.stack = [] 
         self.a = Analyzer(self)
         self._loadmeta()