Beispiel #1
0
        private List <DebugVariable> TupleToVariables(MsgFrame frame)
        {
            var           variables = new List <DebugVariable>();
            NodeDebugInfo node      = null;
            RuleDebugInfo rule      = null;

            if (frame.NodeId != 0)
            {
                node = DebugInfo.Nodes[frame.NodeId];
                if (node.RuleId != 0)
                {
                    rule = DebugInfo.Rules[node.RuleId];
                }
            }

            for (var i = 0; i < frame.Tuple.Column.Count; i++)
            {
                var value    = frame.Tuple.Column[i];
                var variable = new DebugVariable
                {
                    Name = Formatter.TupleVariableIndexToName(rule, node, i),
                    // TODO type name!
                    Type       = value.TypeId.ToString(),
                    Value      = Formatter.ValueToString(value),
                    TypedValue = value
                };

                variables.Add(variable);
            }

            return(variables);
        }
Beispiel #2
0
        private void OnBreakpointTriggered(BkBreakpointTriggered bp)
        {
            Stack          = TracePrinter.BreakpointToStack(bp);
            Stopped        = true;
            PauseRequested = false;

            var stopped = new DAPStoppedEvent
            {
                reason   = "breakpoint",
                threadId = 1
            };

            Stream.SendEvent("stopped", stopped);

            LastQueryFunc    = null;
            LastQueryResults = null;
            if (bp.QueryResults != null)
            {
                var node = DebugInfo.Nodes[bp.QueryNodeId];

                if (node.FunctionName != null)
                {
                    var function = DebugInfo.Functions[node.FunctionName];
                    LastQueryFunc = function;

                    LastQueryResults = new List <DebugVariable>();
                    for (var i = 0; i < bp.QueryResults.Column.Count; i++)
                    {
                        if (function.Params[i].Out)
                        {
                            var col       = bp.QueryResults.Column[i];
                            var resultVar = new DebugVariable
                            {
                                Name       = "@" + function.Params[i].Name,
                                Type       = function.Params[i].TypeId.ToString(), // TODO name
                                Value      = Formatter.ValueToString(col),
                                TypedValue = col
                            };
                            LastQueryResults.Add(resultVar);
                        }
                    }
                }
            }

            if (bp.QuerySucceeded != BkBreakpointTriggered.Types.QueryStatus.NotAQuery)
            {
                var queryResult = new DAPCustomQueryResultEvent
                {
                    succeeded = (bp.QuerySucceeded == BkBreakpointTriggered.Types.QueryStatus.Succeeded)
                };
                Stream.SendEvent("osirisQueryResult", queryResult);
            }
        }