DebugClients/Python/PyProfile.py

changeset 3032
927a2f8b3669
parent 3021
801289962f4e
child 3160
209a07d7e401
equal deleted inserted replaced
3031:ed2eaa573ca5 3032:927a2f8b3669
113 @param frame the frame object 113 @param frame the frame object
114 @return fixed up file name (string) 114 @return fixed up file name (string)
115 """ 115 """
116 # get module name from __file__ 116 # get module name from __file__
117 if not isinstance(frame, profile.Profile.fake_frame) and \ 117 if not isinstance(frame, profile.Profile.fake_frame) and \
118 '__file__' in frame.f_globals: 118 '__file__' in frame.f_globals:
119 root, ext = os.path.splitext(frame.f_globals['__file__']) 119 root, ext = os.path.splitext(frame.f_globals['__file__'])
120 if ext == '.pyc' or ext == '.py': 120 if ext == '.pyc' or ext == '.py':
121 fixedName = root + '.py' 121 fixedName = root + '.py'
122 if os.path.exists(fixedName): 122 if os.path.exists(fixedName):
123 return fixedName 123 return fixedName
140 if not isinstance(rframe, profile.Profile.fake_frame): 140 if not isinstance(rframe, profile.Profile.fake_frame):
141 assert rframe.f_back is frame.f_back, ("Bad call", rfn, 141 assert rframe.f_back is frame.f_back, ("Bad call", rfn,
142 rframe, rframe.f_back, 142 rframe, rframe.f_back,
143 frame, frame.f_back) 143 frame, frame.f_back)
144 self.trace_dispatch_return(rframe, 0) 144 self.trace_dispatch_return(rframe, 0)
145 assert (self.cur is None or \ 145 assert (self.cur is None or
146 frame.f_back is self.cur[-2]), ("Bad call", 146 frame.f_back is self.cur[-2]), ("Bad call",
147 self.cur[-3]) 147 self.cur[-3])
148 fcode = frame.f_code 148 fcode = frame.f_code
149 fn = (self.fix_frame_filename(frame), 149 fn = (self.fix_frame_filename(frame),
150 fcode.co_firstlineno, fcode.co_name) 150 fcode.co_firstlineno, fcode.co_name)
163 "return": profile.Profile.trace_dispatch_return, 163 "return": profile.Profile.trace_dispatch_return,
164 "c_call": profile.Profile.trace_dispatch_c_call, 164 "c_call": profile.Profile.trace_dispatch_c_call,
165 "c_exception": profile.Profile.trace_dispatch_return, 165 "c_exception": profile.Profile.trace_dispatch_return,
166 # the C function returned 166 # the C function returned
167 "c_return": profile.Profile.trace_dispatch_return, 167 "c_return": profile.Profile.trace_dispatch_return,
168 } 168 }
169 169
170 # 170 #
171 # eflag: FileType = Python2 171 # eflag: FileType = Python2

eric ide

mercurial