115 @param frame the frame object |
115 @param frame the frame object |
116 @return fixed up file name (string) |
116 @return fixed up file name (string) |
117 """ |
117 """ |
118 # get module name from __file__ |
118 # get module name from __file__ |
119 if not isinstance(frame, profile.Profile.fake_frame) and \ |
119 if not isinstance(frame, profile.Profile.fake_frame) and \ |
120 '__file__' in frame.f_globals: |
120 '__file__' in frame.f_globals: |
121 root, ext = os.path.splitext(frame.f_globals['__file__']) |
121 root, ext = os.path.splitext(frame.f_globals['__file__']) |
122 if ext in ['.pyc', '.py', '.py3', '.pyo']: |
122 if ext in ['.pyc', '.py', '.py3', '.pyo']: |
123 fixedName = root + '.py' |
123 fixedName = root + '.py' |
124 if os.path.exists(fixedName): |
124 if os.path.exists(fixedName): |
125 return fixedName |
125 return fixedName |
146 if not isinstance(rframe, profile.Profile.fake_frame): |
146 if not isinstance(rframe, profile.Profile.fake_frame): |
147 assert rframe.f_back is frame.f_back, ("Bad call", rfn, |
147 assert rframe.f_back is frame.f_back, ("Bad call", rfn, |
148 rframe, rframe.f_back, |
148 rframe, rframe.f_back, |
149 frame, frame.f_back) |
149 frame, frame.f_back) |
150 self.trace_dispatch_return(rframe, 0) |
150 self.trace_dispatch_return(rframe, 0) |
151 assert (self.cur is None or \ |
151 assert (self.cur is None or |
152 frame.f_back is self.cur[-2]), ("Bad call", |
152 frame.f_back is self.cur[-2]), ("Bad call", |
153 self.cur[-3]) |
153 self.cur[-3]) |
154 fcode = frame.f_code |
154 fcode = frame.f_code |
155 fn = (self.fix_frame_filename(frame), |
155 fn = (self.fix_frame_filename(frame), |
156 fcode.co_firstlineno, fcode.co_name) |
156 fcode.co_firstlineno, fcode.co_name) |
169 "return": profile.Profile.trace_dispatch_return, |
169 "return": profile.Profile.trace_dispatch_return, |
170 "c_call": profile.Profile.trace_dispatch_c_call, |
170 "c_call": profile.Profile.trace_dispatch_c_call, |
171 "c_exception": profile.Profile.trace_dispatch_return, |
171 "c_exception": profile.Profile.trace_dispatch_return, |
172 # the C function returned |
172 # the C function returned |
173 "c_return": profile.Profile.trace_dispatch_return, |
173 "c_return": profile.Profile.trace_dispatch_return, |
174 } |
174 } |