public DebugPropertyCreateEvent(enum_EVENTATTRIBUTES attributes, IDebugProperty2 property) : base(attributes) { Contract.Requires<ArgumentNullException>(property != null, "property"); _property = property; }
// This method evaluates the expression synchronously. int IDebugExpression2.EvaluateSync(enum_EVALFLAGS dwFlags, uint dwTimeout, IDebugEventCallback2 pExprCallback, out IDebugProperty2 ppResult) { AutoResetEvent completion = new AutoResetEvent(false); PythonEvaluationResult result = null; _frame.StackFrame.ExecuteText(_expression, (obj) => { result = obj; completion.Set(); }); while (!_frame.StackFrame.Thread.Process.HasExited && !completion.WaitOne(Math.Min((int)dwTimeout, 100))) { if (dwTimeout <= 100) { break; } dwTimeout -= 100; } if (_frame.StackFrame.Thread.Process.HasExited || result == null) { ppResult = null; return VSConstants.E_FAIL; } else if (result == null) { ppResult = null; return DebuggerConstants.E_EVALUATE_TIMEOUT; } ppResult = new AD7Property(_frame, result, _writable); return VSConstants.S_OK; }
public DebugReturnValueEvent(enum_EVENTATTRIBUTES attributes, IDebugProperty2 returnValue) : base(attributes) { Contract.Requires<ArgumentNullException>(returnValue != null, "returnValue"); _returnValue = returnValue; }
public int GetMethodProperty(IDebugSymbolProvider pSymbolProvider, IDebugAddress pAddress, IDebugBinder pBinder, int fIncludeHiddenLocals, out IDebugProperty2 ppProperty) { AD7Property method = new AD7Property(m_var); ppProperty = method; return VSConstants.S_OK; }
public JavaDebugProperty(IDebugProperty2 parent, EvaluatedExpression evaluatedExpression) { Contract.Requires<ArgumentNullException>(evaluatedExpression != null, "evaluatedExpression"); _parent = parent; _evaluatedExpression = evaluatedExpression; }
public static DEBUG_PROPERTY_INFO ConstructErrorPropertyInfo(enum_DEBUGPROP_INFO_FLAGS dwFields, string name, string error, IDebugProperty2 prop) { DEBUG_PROPERTY_INFO property = new DEBUG_PROPERTY_INFO(); ; if ((dwFields & enum_DEBUGPROP_INFO_FLAGS.DEBUGPROP_INFO_NAME) != 0) { property.bstrName = name; property.dwFields |= enum_DEBUGPROP_INFO_FLAGS.DEBUGPROP_INFO_NAME; } if ((dwFields & enum_DEBUGPROP_INFO_FLAGS.DEBUGPROP_INFO_VALUE) != 0) { property.bstrValue = error; property.dwFields |= enum_DEBUGPROP_INFO_FLAGS.DEBUGPROP_INFO_VALUE; } if ((dwFields & enum_DEBUGPROP_INFO_FLAGS.DEBUGPROP_INFO_ATTRIB) != 0) { property.dwAttrib |= enum_DBG_ATTRIB_FLAGS.DBG_ATTRIB_VALUE_ERROR; } if ((dwFields & enum_DEBUGPROP_INFO_FLAGS.DEBUGPROP_INFO_PROP) != 0) { property.pProperty = prop; property.dwFields |= enum_DEBUGPROP_INFO_FLAGS.DEBUGPROP_INFO_PROP; } return property; }
public DebugExpressionEvaluationCompleteEvent(enum_EVENTATTRIBUTES attributes, IDebugExpression2 expression, IDebugProperty2 property) : base(attributes) { Contract.Requires<ArgumentNullException>(expression != null, "expression"); Contract.Requires<ArgumentNullException>(property != null, "property"); _expression = expression; _property = property; }
/// <summary> /// This method evaluates the expression synchronously. /// </summary> public int EvaluateSync(enum_EVALFLAGS dwFlags, uint dwTimeout, IDebugEventCallback2 pExprCallback, out IDebugProperty2 ppResult) { ppResult = null; int idx = _index; if (string.IsNullOrEmpty(_castExpr)) { var reg = _stackFrame.GetRegistersAsync().Await((int) dwTimeout) .FirstOrDefault(r => r.Name == _registerType + _index); if (reg != null) { ppResult = new DebugStackFrameValueProperty(reg, null, _stackFrame); return VSConstants.S_OK; } } else { var tag = GetTagFromString(_castExpr); if (!tag.IsPrimitive() && (dwFlags & enum_EVALFLAGS.EVAL_NOSIDEEFFECTS) != 0) { // this evaluation has "side effects" in that it might crash the VM // if the cast is to "object" or "string", but the register does not // hold an object or string. ppResult = new DebugConstProperty(_expression, "(this cast might crash the VM if the register is not of the casted type)", _castExpr, null) { HasSideEffects = true }; return VSConstants.E_FAIL; } var isParam = _registerType == "p"; if (isParam) { var loc = _stackFrame.GetDocumentLocationAsync().Await((int) dwTimeout); if (loc == null) return VSConstants.E_FAIL; var methodDiss = _stackFrame.Thread.Program.DisassemblyProvider.GetFromLocation(loc); if (methodDiss == null) return VSConstants.E_FAIL; idx += methodDiss.Method.Body.Registers.Count - methodDiss.Method.Body.IncomingArguments; } var reg = _stackFrame.GetRegistersAsync(false, tag, idx).Await((int) dwTimeout); if (reg != null && reg.Count > 0) { ppResult = new DebugStackFrameValueProperty(reg[0], null, _stackFrame, _expression) { HasSideEffects = !tag.IsPrimitive() }; return VSConstants.S_OK; } } return VSConstants.E_FAIL; }
/// <summary> /// This method evaluates the expression synchronously. /// </summary> /// <param name="dwFlags">A combination of flags from the EVALFLAGS enumeration that control expression evaluation.</param> /// <param name="dwTimeout">Maximum time, in milliseconds, to wait before returning from this method. Use INFINITE to wait indefinitely.</param> /// <param name="pExprCallback">This parameter is always a null value.</param> /// <param name="ppResult">Returns the IDebugProperty2 object that contains the result of the expression evaluation.</param> /// <returns> /// If successful, returns S_OK; otherwise returns an error code. Some typical error codes are: /// Error Description /// E_EVALUATE_BUSY_WITH_EVALUATION Another expression is currently being evaluated, and simultaneous expression evaluation is not supported. /// E_EVALUATE_TIMEOUT Evaluation timed out. /// </returns> /// <remarks>For synchronous evaluation, it is not necessary to send an event back to Visual Studio upon completion of the evaluation.</remarks> public int EvaluateSync( enum_EVALFLAGS dwFlags, uint dwTimeout, IDebugEventCallback2 pExprCallback, out IDebugProperty2 ppResult) { Logger.Debug( string.Empty ); ppResult = null; return VSConstants.E_NOTIMPL; }
public JavaDebugStaticMembersPseudoProperty(IDebugProperty2 parent, IReferenceType referenceType, IEnumerable<IField> fields) { Contract.Requires<ArgumentNullException>(parent != null, "parent"); Contract.Requires<ArgumentNullException>(referenceType != null, "referenceType"); _parent = parent; _referenceType = referenceType; if (fields != null) _fields = fields.ToArray(); }
public JavaDebugProperty(IDebugProperty2 parent, string name, string fullName, IType propertyType, IValue value, bool hasSideEffects, IField field = null, IMethod method = null) { Contract.Requires<ArgumentNullException>(name != null, "name"); Contract.Requires<ArgumentNullException>(fullName != null, "fullName"); Contract.Requires<ArgumentNullException>(propertyType != null, "propertyType"); IObjectReference referencer = null; IType valueType = propertyType; bool strongReference = false; _evaluatedExpression = new EvaluatedExpression(name, fullName, default(ILocalVariable), referencer, field, method, default(int?), value, valueType, strongReference, hasSideEffects); }
/// <summary> /// This method evaluates the expression synchronously. /// </summary> /// <param name="dwFlags">[in] A combination of flags from the EVALFLAGS enumeration that control expression evaluation.</param> /// <param name="dwTimeout">[in] Maximum time, in milliseconds, to wait before returning from this method. Use INFINITE to wait indefinitely.</param> /// <param name="pExprCallback">[in]This parameter is always a null value.</param> /// <param name="ppResult">[out] Returns the IDebugProperty2 object that contains the result of the expression evaluation.</param> /// <returns> /// If successful, returns S_OK; otherwise returns an error code. Some typical error codes are: /// * E_EVALUATE_BUSY_WITH_EVALUATION Another expression is currently being evaluated, and simultaneous /// expression evaluation is not supported. /// * E_EVALUATE_TIMEOUT Evaluation timed out. /// </returns> /// <remarks> /// For synchronous evaluation, it is not necessary to send an event back to Visual Studio upon completion of the evaluation. /// </remarks> public int EvaluateSync(enum_EVALFLAGS dwFlags, uint dwTimeout, IDebugEventCallback2 pExprCallback, out IDebugProperty2 ppResult) { ppResult = null; Task<IDebugProperty2> task = Task.Factory.StartNew(() => EvaluateImpl(dwFlags)).HandleNonCriticalExceptions(); if (!task.Wait((int)dwTimeout)) return AD7Constants.E_EVALUATE_TIMEOUT; if (task.Status != TaskStatus.RanToCompletion || task.Result == null) return VSConstants.E_FAIL; ppResult = task.Result; return VSConstants.S_OK; }
/// <summary> /// This method evaluates the expression synchronously. /// </summary> public int EvaluateSync(enum_EVALFLAGS dwFlags, uint dwTimeout, IDebugEventCallback2 pExprCallback, out IDebugProperty2 ppResult) { ppResult = null; if (string.IsNullOrEmpty(_castExpr)) { var reg = _stackFrame.GetRegistersAsync().Await((int) dwTimeout) .FirstOrDefault(r => r.Name == _registerType + _index); if (reg != null) { ppResult = new DebugStackFrameValueProperty(reg, null, _stackFrame); return VSConstants.S_OK; } } else { var tag = GetTagFromString(_castExpr); if (!tag.IsPrimitive() && (dwFlags & enum_EVALFLAGS.EVAL_NOSIDEEFFECTS) != 0) { // this evaluation has "side effects" in that it might crash the VM // if the cast is to "object" or "string", but the register does not // hold an object or string. ppResult = new DebugConstProperty(_expression, "(this cast might crash a DalvikVM if the register is not of the casted type)", _castExpr, null) { HasSideEffects = true }; return VSConstants.E_FAIL; } var regNames = _stackFrame.GetRegisterNamesAsync().Await((int)dwTimeout); var vmIdx = regNames.GetVmIndex(_registerType == "p", _index); if (vmIdx < 0) return VSConstants.E_FAIL; var reg = _stackFrame.GetRegistersAsync(false, tag, vmIdx).Await((int)dwTimeout); if (reg != null && reg.Count > 0) { ppResult = new DebugStackFrameValueProperty(reg[0], null, _stackFrame, _expression) { HasSideEffects = !tag.IsPrimitive() }; return VSConstants.S_OK; } } return VSConstants.E_FAIL; }
int IDebugExpression2.EvaluateSync( enum_EVALFLAGS dwFlags, uint dwTimeout, IDebugEventCallback2 pExprCallback, out IDebugProperty2 ppResult) { if (MySql.Debugger.Debugger.GetTagHashCode(_stackFrame._rs.OwningRoutine.SourceCode) != DebuggerManager.Instance.Debugger.CurrentScope.OwningRoutine.Hash) { // This should never happen. ppResult = null; return VSConstants.E_NOTIMPL; } AD7Property prop = new AD7Property( _expr,_stackFrame.Node, _stackFrame._rs ); ppResult = prop; // Send evaluation complete event DebuggerManager.Instance._events.ExpressionEvalCompleted( _stackFrame.Node, ( IDebugExpression2 )this, ( IDebugProperty2 )prop ); return VSConstants.S_OK; }
// This method evaluates the expression synchronously. int IDebugExpression2.EvaluateSync(enum_EVALFLAGS dwFlags, uint dwTimeout, IDebugEventCallback2 pExprCallback, out IDebugProperty2 ppResult) { NodeEvaluationResult result; ppResult = null; try { result = _frame.StackFrame.EvaluateExpressionAsync(_expression).Result; } catch (Exception) { return VSConstants.E_FAIL; } if (result == null) { return VSConstants.E_FAIL; } ppResult = new AD7Property(result); return VSConstants.S_OK; }
// This method evaluates the expression synchronously. int IDebugExpression2.EvaluateSync(enum_EVALFLAGS dwFlags, uint dwTimeout, IDebugEventCallback2 pExprCallback, out IDebugProperty2 ppResult) { ppResult = null; if ((dwFlags & enum_EVALFLAGS.EVAL_NOSIDEEFFECTS) != 0 && _var.IsVisualized) { IVariableInformation variable = DebuggedProcess.g_Process.Natvis.Cache.Lookup(_var); if (variable == null) { ppResult = new AD7ErrorProperty(_var.Name, ResourceStrings.NoSideEffectsVisualizerMessage); } else { _var = variable; ppResult = new AD7Property(_var); } return Constants.S_OK; } _var.SyncEval(); ppResult = new AD7Property(_var); return Constants.S_OK; }
private JavaDebugProperty(JavaDebugProperty parent, string name, IType type) { Contract.Requires<ArgumentNullException>(parent != null, "parent"); Contract.Requires<ArgumentNullException>(name != null, "name"); Contract.Requires<ArgumentNullException>(type != null, "type"); Contract.Requires<ArgumentException>(!string.IsNullOrEmpty(name)); _parent = parent; _evaluatedExpression = new EvaluatedExpression( name, parent._evaluatedExpression.FullName, parent._evaluatedExpression.LocalVariable, parent._evaluatedExpression.Referencer, parent._evaluatedExpression.Field, parent._evaluatedExpression.Method, parent._evaluatedExpression.Index, parent._evaluatedExpression.Value, type, parent._evaluatedExpression.StrongReference, parent._evaluatedExpression.HasSideEffects); _useRawValues = parent._useRawValues; _preventMostDerived = parent._preventMostDerived; }
// This method evaluates the expression synchronously. int IDebugExpression2.EvaluateSync(enum_EVALFLAGS dwFlags, uint dwTimeout, IDebugEventCallback2 pExprCallback, out IDebugProperty2 ppResult) { AutoResetEvent completion = new AutoResetEvent(false); PythonEvaluationResult result = null; _frame.StackFrame.ExecuteText(_expression, (obj) => { result = obj; completion.Set(); }); while (!_frame.StackFrame.Thread.Process.HasExited && !completion.WaitOne(Math.Min((int)dwTimeout, 100))) { if (dwTimeout <= 100) { break; } dwTimeout -= 100; } if (_frame.StackFrame.Thread.Process.HasExited || result == null) { ppResult = null; return(VSConstants.E_FAIL); } else if (result == null) { ppResult = null; return(DebuggerConstants.E_EVALUATE_TIMEOUT); } ppResult = new AD7Property(_frame, result, _writable); return(VSConstants.S_OK); }
public void AsyncError(IDebugEventCallback2 pExprCallback, IDebugProperty2 error) { AsyncErrorImpl(pExprCallback != null ? new EngineCallback(_engine, pExprCallback) : _engine.Callback, this, error); }
int IDebugProperty3.GetPropertyInfo(enum_DEBUGPROP_INFO_FLAGS dwFields, uint dwRadix, uint dwTimeout, IDebugReference2[] rgpArgs, uint dwArgCount, DEBUG_PROPERTY_INFO[] pPropertyInfo) { return(IDebugProperty2.GetPropertyInfo(dwFields, dwRadix, dwTimeout, rgpArgs, dwArgCount, pPropertyInfo)); }
int IDebugProperty3.GetMemoryContext(out IDebugMemoryContext2 ppMemory) { return(IDebugProperty2.GetMemoryContext(out ppMemory)); }
// Returns the property that describes the most-derived property of a property // This is called to support object oriented languages. It allows the debug engine to return an IDebugProperty2 for the most-derived // object in a hierarchy. This engine does not support this. public int GetDerivedMostProperty(out IDebugProperty2 ppDerivedMost) { ppDerivedMost = null; return VSConstants.E_NOTIMPL; }
// Gets a description of the properties of a stack frame. // Calling the IDebugProperty2::EnumChildren method with appropriate filters can retrieve the local variables, method parameters, registers, and "this" // pointer associated with the stack frame. The debugger calls EnumProperties to obtain these values in the sample. int IDebugStackFrame2.GetDebugProperty(out IDebugProperty2 property) { property = this; return(VSConstants.S_OK); }
int IDebugProperty3.GetSize(out uint pdwSize) => IDebugProperty2.GetSize(out pdwSize);
int IDebugProperty3.GetParent(out IDebugProperty2 ppParent) => IDebugProperty2.GetParent(out ppParent);
int IDebugProperty3.GetMemoryContext(out IDebugMemoryContext2 ppMemory) => IDebugProperty2.GetMemoryContext(out ppMemory);
int IDebugProperty3.GetMemoryBytes(out IDebugMemoryBytes2 ppMemoryBytes) => IDebugProperty2.GetMemoryBytes(out ppMemoryBytes);
int IDebugProperty3.GetExtendedInfo(ref Guid guidExtendedInfo, out object pExtendedInfo) => IDebugProperty2.GetExtendedInfo(guidExtendedInfo, out pExtendedInfo);
int IDebugProperty3.GetDerivedMostProperty(out IDebugProperty2 ppDerivedMost) => IDebugProperty2.GetDerivedMostProperty(out ppDerivedMost);
// The properties returned by this method are specific to the program. If the program needs to return more than one property, // then the IDebugProperty2 object returned by this method is a container of additional properties and calling the // IDebugProperty2::EnumChildren method returns a list of all properties. // A program may expose any number and type of additional properties that can be described through the IDebugProperty2 interface. // An IDE might display the additional program properties through a generic property browser user interface. // The sample engine does not support this public int GetDebugProperty(out IDebugProperty2 ppProperty) { ppProperty = null; return VSConstants.E_NOTIMPL; }
public JavaDebugStaticMembersPseudoProperty(IDebugProperty2 parent, IReferenceType referenceType) : this(parent, referenceType, null) { }
int IDebugProperty3.GetReference(out IDebugReference2 ppReference) => IDebugProperty2.GetReference(out ppReference);
// Returns the parent of a property. // The sample engine does not support obtaining the parent of properties. public int GetParent(out IDebugProperty2 ppParent) { throw new NotImplementedException(); }
int IDebugProperty3.SetValueAsReference(IDebugReference2[] rgpArgs, uint dwArgCount, IDebugReference2 pValue, uint dwTimeout) => IDebugProperty2.SetValueAsReference(rgpArgs, dwArgCount, pValue, dwTimeout);
public AD7ExpressionEvaluationCompleteEvent(IDebugExpression2 expression, IDebugProperty2 property) { _expression = expression; _property = property; }
// The properties returned by this method are specific to the program. If the program needs to return more than one property, // then the IDebugProperty2 object returned by this method is a container of additional properties and calling the // IDebugProperty2::EnumChildren method returns a list of all properties. // A program may expose any number and type of additional properties that can be described through the IDebugProperty2 interface. // An IDE might display the additional program properties through a generic property browser user interface. // The sample engine does not support this public int GetDebugProperty(out IDebugProperty2 ppProperty) { throw new NotImplementedException(); }
int IDebugProperty3.GetParent(out IDebugProperty2 ppParent) { return(IDebugProperty2.GetParent(out ppParent)); }
int IDebugProgram2.GetDebugProperty(out IDebugProperty2 ppProperty) { ppProperty = null; return(VSConstants.E_NOTIMPL); }
public int EvaluateSync(enum_EVALFLAGS flags, uint timeout, IDebugEventCallback2 callback, out IDebugProperty2 result) { result = new MonoProperty(Expression, value); return(VSConstants.S_OK); }
int IDebugProgram3.GetDebugProperty(out IDebugProperty2 ppProperty) { return(IDebugProgram2.GetDebugProperty(out ppProperty)); }
public static void AsyncErrorImpl(EngineCallback engineCallback, IVariableInformation var, IDebugProperty2 error) { Task.Run(() => { engineCallback.OnExpressionEvaluationComplete(var, error); }); }
public int GetDebugProperty(out IDebugProperty2 ppProperty) { DLog.Debug(DContext.VSDebuggerComCall, "DebugStackFrame.GetDebugProperty"); throw new NotImplementedException(); }
int IDebugProperty2.GetParent(out IDebugProperty2 ppParent) { ppParent = null; return(VSConstants.E_NOTIMPL); }
// Gets a description of the properties of a stack frame. // Calling the IDebugProperty2::EnumChildren method with appropriate filters can retrieve the local variables, method parameters, registers, and "this" // pointer associated with the stack frame. The debugger calls EnumProperties to obtain these values in the sample. int IDebugStackFrame2.GetDebugProperty(out IDebugProperty2 property) { throw new NotImplementedException(); }
public int GetDebugProperty(out IDebugProperty2 ppProperty) { ppProperty = null; // _locals; return VSConstants.S_OK; }
public int GetDerivedMostProperty(out IDebugProperty2 ppDerivedMost) { throw new NotImplementedException(); }
public int GetDerivedMostProperty(out IDebugProperty2 ppDerivedMost) { ppDerivedMost = null; return AD7Constants.S_GETDERIVEDMOST_NO_DERIVED_MOST; }
int IDebugProperty3.SetValueAsString(string pszValue, uint dwRadix, uint dwTimeout) { return(IDebugProperty2.SetValueAsString(pszValue, dwRadix, dwTimeout)); }
public int GetParent(out IDebugProperty2 ppParent) { ppParent = _parent; return VSConstants.S_OK; }
int IDebugProperty3.EnumChildren(enum_DEBUGPROP_INFO_FLAGS dwFields, uint dwRadix, ref Guid guidFilter, enum_DBG_ATTRIB_FLAGS dwAttribFilter, string pszNameFilter, uint dwTimeout, out IEnumDebugPropertyInfo2 ppEnum) { return(IDebugProperty2.EnumChildren(dwFields, dwRadix, guidFilter, dwAttribFilter, pszNameFilter, dwTimeout, out ppEnum)); }
int IDebugProperty3.GetDerivedMostProperty(out IDebugProperty2 ppDerivedMost) { return(IDebugProperty2.GetDerivedMostProperty(out ppDerivedMost)); }
int IDebugProperty3.GetExtendedInfo(ref Guid guidExtendedInfo, out object pExtendedInfo) { return(IDebugProperty2.GetExtendedInfo(guidExtendedInfo, out pExtendedInfo)); }
int IDebugProperty3.GetMemoryBytes(out IDebugMemoryBytes2 ppMemoryBytes) { return(IDebugProperty2.GetMemoryBytes(out ppMemoryBytes)); }
// Returns the parent of a property. // The sample engine does not support obtaining the parent of properties. public int GetParent(out IDebugProperty2 ppParent) { ppParent = null; return VSConstants.E_NOTIMPL; }
public int GetParent(out IDebugProperty2 ppParent) { throw new NotImplementedException(); }
/// <summary> /// Gets the program's properties. The VSNDK debug engine does not support this. /// (http://msdn.microsoft.com/en-us/library/bb161801.aspx) /// </summary> /// <param name="ppProperty"> Returns an IDebugProperty2 object that represents the program's properties. </param> /// <returns> Not implemented. </returns> public int GetDebugProperty(out IDebugProperty2 ppProperty) { throw new Exception("The method or operation is not implemented."); }
int IDebugProperty2.GetDerivedMostProperty(out IDebugProperty2 ppDerivedMost) { ppDerivedMost = null; return(VSConstants.E_NOTIMPL); }
int IDebugProperty2.GetParent(out IDebugProperty2 ppParent) { ppParent = Parent; return(ppParent != null ? VSConstants.S_OK : DebuggerConstants.S_GETPARENT_NO_PARENT); }