Inheritance: IDebugProperty3
Example #1
0
 int IDebugExpression2.EvaluateAsync(enum_EVALFLAGS dwFlags, IDebugEventCallback2 pExprCallback) {
     _cts = new CancellationTokenSource();
     Task.Run(async () => {
         try {
             var res = await StackFrame.StackFrame.TryEvaluateAndDescribeAsync(_expression, AD7Property.PrefetchedProperties, AD7Property.Repr);
             _cts.Token.ThrowIfCancellationRequested();
             var prop = new AD7Property(StackFrame, res);
             StackFrame.Engine.Send(new AD7ExpressionEvaluationCompleteEvent(this, prop), AD7ExpressionEvaluationCompleteEvent.IID);
         } catch (Exception ex) when (!ex.IsCriticalException()) {
             StackFrame.Engine.Send(new AD7ExpressionEvaluationCompleteEvent(ex), AD7ExpressionEvaluationCompleteEvent.IID);
         } finally {
             _cts = null;
         }
     });
     return VSConstants.S_OK;
 }
Example #2
0
 int IDebugExpression2.EvaluateAsync(enum_EVALFLAGS dwFlags, IDebugEventCallback2 pExprCallback)
 {
     _cts = new CancellationTokenSource();
     Task.Run(async() => {
         try {
             var res = await StackFrame.StackFrame.TryEvaluateAndDescribeAsync(_expression, AD7Property.PrefetchedProperties, AD7Property.Repr);
             _cts.Token.ThrowIfCancellationRequested();
             var prop = new AD7Property(StackFrame, res);
             StackFrame.Engine.Send(new AD7ExpressionEvaluationCompleteEvent(this, prop), AD7ExpressionEvaluationCompleteEvent.IID);
         } catch (Exception ex) when(!ex.IsCriticalException())
         {
             StackFrame.Engine.Send(new AD7ExpressionEvaluationCompleteEvent(ex), AD7ExpressionEvaluationCompleteEvent.IID);
         } finally {
             _cts = null;
         }
     });
     return(VSConstants.S_OK);
 }
Example #3
0
        int IDebugProperty2.EnumChildren(enum_DEBUGPROP_INFO_FLAGS dwFields, uint dwRadix, ref Guid guidFilter, enum_DBG_ATTRIB_FLAGS dwAttribFilter, string pszNameFilter, uint dwTimeout, out IEnumDebugPropertyInfo2 ppEnum)
        {
            IEnumerable <IREvaluationResultInfo> children = _children.Value;

            if (!RToolsSettings.Current.ShowDotPrefixedVariables)
            {
                children = children.Where(v => v.Name != null && !v.Name.StartsWithOrdinal("."));
            }

            var infos = children.Select(v => new AD7Property(this, v).GetDebugPropertyInfo(dwRadix, dwFields));

            var valueResult = EvaluationResult as IRValueInfo;

            if (valueResult != null)
            {
                if (valueResult.HasAttributes() == true)
                {
                    string attrExpr   = Invariant($"base::attributes({valueResult.Expression})");
                    var    attrResult = TaskExtensions.RunSynchronouslyOnUIThread(ct => StackFrame.StackFrame.TryEvaluateAndDescribeAsync(attrExpr, "attributes()", PrefetchedProperties, Repr, ct));
                    if (!(attrResult is IRErrorInfo))
                    {
                        var attrInfo = new AD7Property(this, attrResult, isSynthetic: true).GetDebugPropertyInfo(dwRadix, dwFields);
                        infos = new[] { attrInfo }.Concat(infos);
                    }
                }

                if (valueResult.Flags.HasFlag(RValueFlags.HasParentEnvironment))
                {
                    string parentExpr   = Invariant($"base::parent.env({valueResult.Expression})");
                    var    parentResult = TaskExtensions.RunSynchronouslyOnUIThread(ct => StackFrame.StackFrame.TryEvaluateAndDescribeAsync(parentExpr, "parent.env()", PrefetchedProperties, Repr, ct));
                    if (!(parentResult is IRErrorInfo))
                    {
                        var parentInfo = new AD7Property(this, parentResult, isSynthetic: true).GetDebugPropertyInfo(dwRadix, dwFields);
                        infos = new[] { parentInfo }.Concat(infos);
                    }
                }
            }

            ppEnum = new AD7PropertyInfoEnum(infos.ToArray());
            return(VSConstants.S_OK);
        }
Example #4
0
 public AD7Property(AD7Property parent, IREvaluationResultInfo result, bool isSynthetic = false)
     : this(parent.StackFrame, result, isSynthetic, false)
 {
     Parent = parent;
 }
Example #5
0
 int IDebugExpression2.EvaluateSync(enum_EVALFLAGS dwFlags, uint dwTimeout, IDebugEventCallback2 pExprCallback, out IDebugProperty2 ppResult) {
     var res = TaskExtensions.RunSynchronouslyOnUIThread(ct => StackFrame.StackFrame.TryEvaluateAndDescribeAsync(_expression, AD7Property.PrefetchedProperties, AD7Property.Repr, ct));
     ppResult = new AD7Property(StackFrame, res);
     return VSConstants.S_OK;
 }
Example #6
0
        int IDebugProperty2.EnumChildren(enum_DEBUGPROP_INFO_FLAGS dwFields, uint dwRadix, ref Guid guidFilter, enum_DBG_ATTRIB_FLAGS dwAttribFilter, string pszNameFilter, uint dwTimeout, out IEnumDebugPropertyInfo2 ppEnum) {
            IEnumerable<IREvaluationResultInfo> children = _children.Value;

            if (!RToolsSettings.Current.ShowDotPrefixedVariables) {
                children = children.Where(v => v.Name != null && !v.Name.StartsWithOrdinal("."));
            }

            var infos = children.Select(v => new AD7Property(this, v).GetDebugPropertyInfo(dwRadix, dwFields));

            var valueResult = EvaluationResult as IRValueInfo;
            if (valueResult != null) {
                if (valueResult.HasAttributes() == true) {
                    string attrExpr = Invariant($"base::attributes({valueResult.Expression})");
                    var attrResult = TaskExtensions.RunSynchronouslyOnUIThread(ct => StackFrame.StackFrame.TryEvaluateAndDescribeAsync(attrExpr, "attributes()", PrefetchedProperties, Repr, ct));
                    if (!(attrResult is IRErrorInfo)) {
                        var attrInfo = new AD7Property(this, attrResult, isSynthetic: true).GetDebugPropertyInfo(dwRadix, dwFields);
                        infos = new[] { attrInfo }.Concat(infos);
                    }
                }

                if (valueResult.Flags.HasFlag(RValueFlags.HasParentEnvironment)) {
                    string parentExpr = Invariant($"base::parent.env({valueResult.Expression})");
                    var parentResult = TaskExtensions.RunSynchronouslyOnUIThread(ct => StackFrame.StackFrame.TryEvaluateAndDescribeAsync(parentExpr, "parent.env()", PrefetchedProperties, Repr, ct));
                    if (!(parentResult is IRErrorInfo)) {
                        var parentInfo = new AD7Property(this, parentResult, isSynthetic: true).GetDebugPropertyInfo(dwRadix, dwFields);
                        infos = new[] { parentInfo }.Concat(infos);
                    }
                }
            }

            ppEnum = new AD7PropertyInfoEnum(infos.ToArray());
            return VSConstants.S_OK;
        }
Example #7
0
 public AD7Property(AD7Property parent, IREvaluationResultInfo result, bool isSynthetic = false)
     : this(parent.StackFrame, result, isSynthetic, false) {
     Parent = parent;
 }