private MsgTuple ParamsToTuple(IEnumerable <RValue> args, CoalescedFrame frame)
        {
            var tuple = new MsgTuple();

            foreach (var arg in args)
            {
                if (arg is ConstantValue)
                {
                    tuple.Column.Add(ConstantToTypedValue(arg as ConstantValue));
                }
                else
                {
                    if (frame != null)
                    {
                        tuple.Column.Add(VariableToTypedValue(arg as LocalVar, frame));
                    }
                    else
                    {
                        throw new RequestFailedException("Local variables cannot be referenced without a stack frame");
                    }
                }
            }

            return(tuple);
        }
Exemplo n.º 2
0
        public UInt32 SendEvaluate(DbgEvaluate.Types.EvalType type, UInt32 nodeId, MsgTuple args)
        {
            var msg = new DebuggerToBackend
            {
                Evaluate = new DbgEvaluate
                {
                    Type   = type,
                    NodeId = nodeId,
                    Params = args
                }
            };

            return(Send(msg));
        }
        public string GetFrameName(MsgFrame frame, MsgTuple arguments)
        {
            switch (frame.Type)
            {
            case MsgFrame.Types.FrameType.GoalInitAction:
            {
                var goal = DebugInfo.Goals[frame.GoalId].Name;
                return(goal + " (INIT)");
            }

            case MsgFrame.Types.FrameType.GoalExitAction:
            {
                var goal = DebugInfo.Goals[frame.GoalId].Name;
                return(goal + " (EXIT)");
            }

            case MsgFrame.Types.FrameType.Insert:
            case MsgFrame.Types.FrameType.Delete:
            {
                string argumentsFmt = "";
                if (arguments != null)
                {
                    argumentsFmt = "(" + TupleToString(arguments) + ")";
                }

                var node = DebugInfo.Nodes[frame.NodeId];
                if (node.Type == Node.Type.Database)
                {
                    var db = DebugInfo.Databases[node.DatabaseId];
                    if (frame.Type == MsgFrame.Types.FrameType.Insert)
                    {
                        return(db.Name + argumentsFmt + " (INSERT)");
                    }
                    else
                    {
                        return(db.Name + argumentsFmt + " (DELETE)");
                    }
                }
                else
                {
                    return(node.Name + argumentsFmt);
                }
            }

            default:
                throw new InvalidOperationException($"Unsupported root frame type: {frame.Type}");
            }
        }
 public void Add(MsgTuple tuple)
 {
     Tuples.Add(tuple);
 }
 public string TupleToString(MsgTuple tuple)
 {
     return(String.Join(", ", tuple.Column.Select(val => ValueToString(val))));
 }