Update of /cvsroot/pywin32/pywin32/com/win32comext/axdebug
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1781/axdebug
Modified Files:
adb.py expressions.py stackframe.py
Log Message:
Patches from Kiriakos Vlahos, as described in [ 1119799 ] Active Debugging
bugs.
Index: expressions.py
===================================================================
RCS file: /cvsroot/pywin32/pywin32/com/win32comext/axdebug/expressions.py,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** expressions.py 6 Jan 2000 04:14:49 -0000 1.2
--- expressions.py 11 Apr 2005 13:04:42 -0000 1.3
***************
*** 68,83 ****
return self.hresult, result
! def MakeEnumDebugProperty(object, dwFieldSpec, nRadix, iid):
name_vals = []
if hasattr(object, "has_key"): # If it is a dict.
name_vals = object.items()
infos = []
for name, val in name_vals:
! infos.append(GetPropertyInfo(name, val, dwFieldSpec, nRadix, 0))
return _wrap(EnumDebugPropertyInfo(infos), axdebug.IID_IEnumDebugPropertyInfo)
! def GetPropertyInfo(obname, obvalue, dwFieldSpec, nRadix, hresult=0):
# returns a tuple
! name = typ = value = fullname = None
if dwFieldSpec & axdebug.DBGPROP_INFO_VALUE:
value = MakeNiceString(obvalue)
--- 68,87 ----
return self.hresult, result
! def MakeEnumDebugProperty(object, dwFieldSpec, nRadix, iid, stackFrame = None):
name_vals = []
if hasattr(object, "has_key"): # If it is a dict.
name_vals = object.items()
+ dictionary = object
+ elif hasattr(object, "__dict__"): #object with dictionary, module
+ name_vals = object.__dict__.items()
+ dictionary = object.__dict__
infos = []
for name, val in name_vals:
! infos.append(GetPropertyInfo(name, val, dwFieldSpec, nRadix, 0, dictionary, stackFrame))
return _wrap(EnumDebugPropertyInfo(infos), axdebug.IID_IEnumDebugPropertyInfo)
! def GetPropertyInfo(obname, obvalue, dwFieldSpec, nRadix, hresult=0, dictionary = None, stackFrame = None):
# returns a tuple
! name = typ = value = fullname = attrib = dbgprop = None
if dwFieldSpec & axdebug.DBGPROP_INFO_VALUE:
value = MakeNiceString(obvalue)
***************
*** 94,98 ****
if dwFieldSpec & axdebug.DBGPROP_INFO_FULLNAME:
fullname = obname
! return name, typ, value, fullname
from win32com.server.util import ListEnumeratorGateway
--- 98,109 ----
if dwFieldSpec & axdebug.DBGPROP_INFO_FULLNAME:
fullname = obname
! if dwFieldSpec & axdebug.DBGPROP_INFO_ATTRIBUTES:
! if hasattr(obvalue, "has_key") or hasattr(obvalue, "__dict__"): # If it is a dict or object
! attrib = axdebug.DBGPROP_ATTRIB_VALUE_IS_EXPANDABLE
! else:
! attrib = 0
! if dwFieldSpec & axdebug.DBGPROP_INFO_DEBUGPROP:
! dbgprop = _wrap(DebugProperty(name, obvalue, None, hresult, dictionary, stackFrame), axdebug.IID_IDebugProperty)
! return name, typ, value, fullname, attrib, dbgprop
from win32com.server.util import ListEnumeratorGateway
***************
*** 117,128 ****
'EnumMembers', 'GetParent'
]
! def __init__(self, name, value, parent = None, hresult = 0):
self.name = name
self.value = value
self.parent = parent
self.hresult = hresult
def GetPropertyInfo(self, dwFieldSpec, nRadix):
! return GetPropertyInfo(self.name, self.value, dwFieldSpec, nRadix, hresult=self.hresult)
def GetExtendedInfo(self): ### Note - not in the framework.
--- 128,141 ----
'EnumMembers', 'GetParent'
]
! def __init__(self, name, value, parent = None, hresult = 0, dictionary = None, stackFrame = None):
self.name = name
self.value = value
self.parent = parent
self.hresult = hresult
+ self.dictionary = dictionary
+ self.stackFrame = stackFrame
def GetPropertyInfo(self, dwFieldSpec, nRadix):
! return GetPropertyInfo(self.name, self.value, dwFieldSpec, nRadix, self.hresult, dictionary, stackFrame)
def GetExtendedInfo(self): ### Note - not in the framework.
***************
*** 130,139 ****
def SetValueAsString(self, value, radix):
! #
! RaiseNotImpl("DebugProperty::SetValueAsString")
def EnumMembers(self, dwFieldSpec, nRadix, iid):
# Returns IEnumDebugPropertyInfo
! return MakeEnumDebugProperty(self.value, dwFieldSpec, nRadix, iid)
def GetParent(self):
--- 143,154 ----
def SetValueAsString(self, value, radix):
! if self.stackFrame and self.dictionary:
! self.dictionary[self.name]= eval(value,self.stackFrame.f_globals, self.stackFrame.f_locals)
! else:
! RaiseNotImpl("DebugProperty::SetValueAsString")
def EnumMembers(self, dwFieldSpec, nRadix, iid):
# Returns IEnumDebugPropertyInfo
! return MakeEnumDebugProperty(self.value, dwFieldSpec, nRadix, iid, self.stackFrame)
def GetParent(self):
Index: adb.py
===================================================================
RCS file: /cvsroot/pywin32/pywin32/com/win32comext/axdebug/adb.py,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** adb.py 6 Dec 2000 12:06:02 -0000 1.3
--- adb.py 11 Apr 2005 13:04:41 -0000 1.4
***************
*** 26,29 ****
--- 26,39 ----
tracev = trace # verbose trace
+ class OutputReflector:
+ def __init__(self, file, writefunc):
+ self.writefunc = writefunc
+ self.file = file
+ def __getattr__(self,name):
+ return getattr(self.file, name)
+ def write(self,message):
+ self.writefunc(message)
+ self.file.write(message)
+
def _dumpf(frame):
if frame is None:
***************
*** 88,93 ****
traceenter("stop_here", _dumpf(frame), _dumpf(self.stopframe))
# As per bdb.stop_here, except for logicalbotframe
! if self.stopframe is None:
! return 1
if frame is self.stopframe:
return 1
--- 98,103 ----
traceenter("stop_here", _dumpf(frame), _dumpf(self.stopframe))
# As per bdb.stop_here, except for logicalbotframe
! ## if self.stopframe is None:
! ## return 1
if frame is self.stopframe:
return 1
***************
*** 326,332 ****
--- 336,352 ----
traceenter("OnConnectDebugger", appDebugger)
self.appDebugger = appDebugger
+ # Reflect output to appDebugger
+ writefunc = lambda s: appDebugger.onDebugOutput(s)
+ sys.stdout = OutputReflector(sys.stdout, writefunc)
+ sys.stderr = OutputReflector(sys.stderr, writefunc)
def OnDisconnectDebugger(self):
traceenter("OnDisconnectDebugger")
+ # Stop reflecting output
+ if isinstance(sys.stdout, OutputReflector):
+ sys.stdout = sys.stdout.file
+ if isinstance(sys.stderr, OutputReflector):
+ sys.stderr = sys.stderr.file
+ self.appDebugger = None
self.set_quit()
***************
*** 375,381 ****
# want to hit the debugger the instant we return
if self.debuggingThreadStateHandle is not None and \
! self.breakFlags and \
! self.debuggingThread != win32api.GetCurrentThreadId():
! axdebug.SetThreadStateTrace(self.debuggingThreadStateHandle, self.trace_dispatch)
def _OnSetBreakPoint(self, key, codeContext, bps, lineNo):
traceenter("_OnSetBreakPoint", self, key, codeContext, bps, lineNo)
--- 395,401 ----
# want to hit the debugger the instant we return
if self.debuggingThreadStateHandle is not None and \
! self.breakFlags and \
! self.debuggingThread != win32api.GetCurrentThreadId():
! axdebug.SetThreadStateTrace(self.debuggingThreadStateHandle, self.trace_dispatch)
def _OnSetBreakPoint(self, key, codeContext, bps, lineNo):
traceenter("_OnSetBreakPoint", self, key, codeContext, bps, lineNo)
Index: stackframe.py
===================================================================
RCS file: /cvsroot/pywin32/pywin32/com/win32comext/axdebug/stackframe.py,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** stackframe.py 6 Jan 2000 04:45:44 -0000 1.2
--- stackframe.py 11 Apr 2005 13:04:42 -0000 1.3
***************
*** 141,145 ****
print "EnumMembers", dwFieldSpec, nRadix, iid
import expressions
! return expressions.MakeEnumDebugProperty(self.frame.f_locals, dwFieldSpec, nRadix, iid)
def GetParent(self):
--- 141,145 ----
print "EnumMembers", dwFieldSpec, nRadix, iid
import expressions
! return expressions.MakeEnumDebugProperty(self.frame.f_locals, dwFieldSpec, nRadix, iid, self.frame)
def GetParent(self):
|