Example #1
0
 def _wrap(self, obj):
     # This enum returns a tuple, with 2 com objects in it.
     obFrame, min, lim, fFinal, obFinal = obj
     obFrame = _wrap(obFrame, axdebug.IID_IDebugStackFrame)
     if obFinal:
         obFinal = _wrap(obFinal, pythoncom.IID_IUnknown)
     return obFrame, min, lim, fFinal, obFinal
Example #2
0
 def _wrap(self, obj):
     # This enum returns a tuple, with 2 com objects in it.
     obFrame, min, lim, fFinal, obFinal = obj
     obFrame = _wrap(obFrame, axdebug.IID_IDebugStackFrame)
     if obFinal:
         obFinal = _wrap(obFinal, pythoncom.IID_IUnknown)
     return obFrame, min, lim, fFinal, obFinal
Example #3
0
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)
    if dwFieldSpec & axdebug.DBGPROP_INFO_NAME:
        name = obname
    if dwFieldSpec & axdebug.DBGPROP_INFO_TYPE:
        if hresult:
            typ = "Error"
        else:
            try:
                typ = type(obvalue).__name__
            except AttributeError:
                typ = str(type(obvalue))
    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
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)
	if dwFieldSpec & axdebug.DBGPROP_INFO_NAME:
		name = obname
	if dwFieldSpec & axdebug.DBGPROP_INFO_TYPE:
		if hresult:
			typ = "Error"
		else:
			try:
				typ = type(obvalue).__name__
			except AttributeError:
				typ = str(type(obvalue))
	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
Example #5
0
 def GetDocumentContext(self):
     if self.debugSite is not None:
         # We have a smart host - let him give it to us.
         return self.debugSite.GetDocumentContextFromPosition(
             self.codeContainer.sourceContext, self.offset, self.length)
     else:
         # Simple host - Fine - Ill do it myself!
         return _wrap(self, axdebug.IID_IDebugDocumentContext)
Example #6
0
    def _query_interface_(self, iid):
        if iid==axdebug.IID_IDebugExpressionContext:
            if self.expressionContext is None:
                self.expressionContext = _wrap(expressions.ExpressionContext(self.frame), axdebug.IID_IDebugExpressionContext)
            return self.expressionContext
#               from win32com.util import IIDToInterfaceName
#               print "DebugStackFrame QI with %s (%s)" % (IIDToInterfaceName(iid), str(iid))
        return 0
Example #7
0
    def _query_interface_(self, iid):
        if iid==axdebug.IID_IDebugExpressionContext:
            if self.expressionContext is None:
                self.expressionContext = _wrap(expressions.ExpressionContext(self.frame), axdebug.IID_IDebugExpressionContext)
            return self.expressionContext
#               from win32com.util import IIDToInterfaceName
#               print "DebugStackFrame QI with %s (%s)" % (IIDToInterfaceName(iid), str(iid))
        return 0
Example #8
0
 def GetDocumentContext(self):
     if self.debugSite is not None:
         # We have a smart host - let him give it to us.
         return self.debugSite.GetDocumentContextFromPosition(
                 self.codeContainer.sourceContext,
                 self.offset,
                 self.length)
     else:
         # Simple host - Fine - Ill do it myself!
         return _wrap(self, axdebug.IID_IDebugDocumentContext)
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)
Example #10
0
def MakeEnumDebugProperty(object, dwFieldSpec, nRadix, iid, stackFrame = None):
    name_vals = []
    if hasattr(object, "items") and hasattr(object, "keys"): # If it is a dict.
        name_vals = object.iteritems()
        dictionary = object
    elif hasattr(object, "__dict__"):  #object with dictionary, module
        name_vals = object.__dict__.iteritems()
        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)
Example #11
0
 def _MakeDebugCodeContext(self, lineNo, charPos, len):
     return _wrap(
         contexts.DebugCodeContext(lineNo, charPos, len, self, self.site),
         axdebug.IID_IDebugCodeContext)
Example #12
0
 def EnumStackFrames(self):
     trace("DebugStackFrameSniffer.EnumStackFrames called")
     return _wrap(EnumDebugStackFrames(self.debugger),
                  axdebug.IID_IEnumDebugStackFrames)
Example #13
0
 def GetDebugProperty(self):
     return _wrap(StackFrameDebugProperty(self.frame),
                  axdebug.IID_IDebugProperty)
Example #14
0
 def _MakeDebugCodeContext(self, lineNo, charPos, len):
     return _wrap(contexts.DebugCodeContext(lineNo, charPos, len, self, self.site), axdebug.IID_IDebugCodeContext)
Example #15
0
 def GetContextOfPosition(self, charPos, maxChars):
     # Make one
     doc = _wrap(self, axdebug.IID_IDebugDocument)
     rc = self.codeContainer.GetCodeContextAtPosition(charPos)
     return rc.QueryInterface(axdebug.IID_IDebugDocumentContext)
Example #16
0
 def GetDebugProperty(self):
     return _wrap(StackFrameDebugProperty(self.frame), axdebug.IID_IDebugProperty)
Example #17
0
 def ParseLanguageText(self, code, radix, delim, flags):
     return _wrap(Expression(self.frame, code, radix, delim, flags), axdebug.IID_IDebugExpression)
Example #18
0
 def _wrap(self, obj):
     return _wrap(obj, axdebug.IID_IDebugCodeContext)
Example #19
0
 def EnumCodeContexts(self):
     return _wrap(EnumDebugCodeContexts([self]), axdebug.IID_IEnumDebugCodeContexts)
	def ParseLanguageText(self, code, radix, delim, flags):
		return _wrap(Expression(self.frame, code, radix, delim, flags), axdebug.IID_IDebugExpression)
	def GetResultAsDebugProperty(self):
		result = _wrap(DebugProperty(self.code, self.result, None, self.hresult), axdebug.IID_IDebugProperty)
		return self.hresult, result
Example #22
0
 def GetContextOfPosition(self, charPos, maxChars):
     # Make one
     doc = _wrap(self, axdebug.IID_IDebugDocument)
     rc = self.codeContainer.GetCodeContextAtPosition(charPos)
     return rc.QueryInterface(axdebug.IID_IDebugDocumentContext)
Example #23
0
 def GetResultAsDebugProperty(self):
     result = _wrap(DebugProperty(self.code, self.result, None, self.hresult), axdebug.IID_IDebugProperty)
     return self.hresult, result
Example #24
0
 def EnumStackFrames(self):
     trace("DebugStackFrameSniffer.EnumStackFrames called")
     return _wrap(EnumDebugStackFrames(self.debugger), axdebug.IID_IEnumDebugStackFrames)