64 self.__isBroken = "" |
65 self.__isBroken = "" |
65 self.cFrame = None |
66 self.cFrame = None |
66 |
67 |
67 # current frame we are at |
68 # current frame we are at |
68 self.currentFrame = None |
69 self.currentFrame = None |
69 self.currentFrameLocals = None |
|
70 |
70 |
71 # frame that we are stepping in, can be different than currentFrame |
71 # frame that we are stepping in, can be different than currentFrame |
72 self.stepFrame = None |
72 self.stepFrame = None |
73 |
73 |
74 # provide a hook to perform a hard breakpoint |
74 # provide a hook to perform a hard breakpoint |
97 |
97 |
98 @keyparam frmnr distance of frame to get locals dictionary of. 0 is |
98 @keyparam frmnr distance of frame to get locals dictionary of. 0 is |
99 the current frame (int) |
99 the current frame (int) |
100 @return locals dictionary of the frame |
100 @return locals dictionary of the frame |
101 """ |
101 """ |
102 if frmnr: |
102 f = self.currentFrame |
103 f = self.currentFrame |
103 while f is not None and frmnr > 0: |
104 while f is not None and frmnr > 0: |
104 f = f.f_back |
105 f = f.f_back |
105 frmnr -= 1 |
106 frmnr -= 1 |
106 return f.f_locals |
107 return f.f_locals |
107 |
108 else: |
108 def storeFrameLocals(self, frmnr=0): |
109 return self.currentFrameLocals |
109 """ |
|
110 Public method to store the locals into the frame, so an access to |
|
111 frame.f_locals returns the last data. |
|
112 |
|
113 @keyparam frmnr distance of frame to store locals dictionary to. 0 is |
|
114 the current frame (int) |
|
115 """ |
|
116 cf = self.currentFrame |
|
117 while cf is not None and frmnr > 0: |
|
118 cf = cf.f_back |
|
119 frmnr -= 1 |
|
120 ctypes.pythonapi.PyFrame_LocalsToFast( |
|
121 ctypes.py_object(cf), |
|
122 ctypes.c_int(0)) |
110 |
123 |
111 def step(self, traceMode): |
124 def step(self, traceMode): |
112 """ |
125 """ |
113 Public method to perform a step operation in this thread. |
126 Public method to perform a step operation in this thread. |
114 |
127 |
598 if fn != self._dbgClient.getRunning(): |
611 if fn != self._dbgClient.getRunning(): |
599 return |
612 return |
600 self._dbgClient.mainFrame = frame |
613 self._dbgClient.mainFrame = frame |
601 |
614 |
602 self.currentFrame = frame |
615 self.currentFrame = frame |
603 self.currentFrameLocals = frame.f_locals |
|
604 # remember the locals because it is reinitialized when accessed |
|
605 |
616 |
606 fr = frame |
617 fr = frame |
607 stack = [] |
618 stack = [] |
608 while fr is not None: |
619 while fr is not None: |
609 # Reset the trace function so we can be sure |
620 # Reset the trace function so we can be sure |
705 if exctb: |
716 if exctb: |
706 frlist = self.__extract_stack(exctb) |
717 frlist = self.__extract_stack(exctb) |
707 frlist.reverse() |
718 frlist.reverse() |
708 |
719 |
709 self.currentFrame = frlist[0] |
720 self.currentFrame = frlist[0] |
710 self.currentFrameLocals = frlist[0].f_locals |
|
711 # remember the locals because it is reinitialized when accessed |
|
712 |
721 |
713 for fr in frlist: |
722 for fr in frlist: |
714 filename = self._dbgClient.absPath(self.fix_frame_filename(fr)) |
723 filename = self._dbgClient.absPath(self.fix_frame_filename(fr)) |
715 |
724 |
716 if os.path.basename(filename).startswith("DebugClient") or \ |
725 if os.path.basename(filename).startswith("DebugClient") or \ |