Example #1
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);
            }
        }
Example #2
0
        public List <CoalescedFrame> BreakpointToStack(BkBreakpointTriggered message)
        {
            var rawFrames = message.CallStack.Select(frame => MsgFrameToLocal(frame)).ToList();
            List <CoalescedFrame> mergedFrames;

            if (MergeFrames)
            {
                mergedFrames = MergeCallStack(rawFrames);
            }
            else
            {
                mergedFrames = rawFrames;
            }

            mergedFrames.Reverse();
            return(mergedFrames);
        }
Example #3
0
        private void OnBreakpointTriggered(BkBreakpointTriggered bp)
        {
            var state = GetThread(bp.Context);

            state.Stack = new List <StackFrame>();
            foreach (var frame in bp.Stack)
            {
                var stkFrame = new StackFrame();
                stkFrame.Function = frame.Function;
                if (frame.Source == "=[C]")
                {
                    stkFrame.Source         = "(C++ Code)";
                    stkFrame.Path           = null;
                    stkFrame.Line           = 0;
                    stkFrame.ScopeFirstLine = 0;
                    stkFrame.ScopeLastLine  = 0;
                }
                else
                {
                    stkFrame.Source         = Path.GetFileName(frame.Source);
                    stkFrame.Path           = frame.Path.Replace("/", "\\");
                    stkFrame.Line           = frame.Line;
                    stkFrame.ScopeFirstLine = frame.ScopeFirstLine;
                    stkFrame.ScopeLastLine  = frame.ScopeLastLine;
                }
                state.Stack.Add(stkFrame);
            }

            state.Stopped = true;

            var stopped = new DAPStoppedEvent
            {
                threadId = GetThreadId(bp.Context)
            };

            switch (bp.Reason)
            {
            case BkBreakpointTriggered.Types.Reason.Breakpoint:
                stopped.reason = "breakpoint";
                break;

            case BkBreakpointTriggered.Types.Reason.Exception:
                stopped.reason      = "exception";
                stopped.description = "Paused on exception";
                stopped.text        = bp.Message;
                break;

            case BkBreakpointTriggered.Types.Reason.Pause:
                stopped.reason = "pause";
                break;

            case BkBreakpointTriggered.Types.Reason.Step:
                stopped.reason = "step";
                break;

            default:
                stopped.reason = "breakpoint";
                break;
            }

            Stream.SendEvent("stopped", stopped);
        }
 private void BreakpointTriggered(BkBreakpointTriggered message)
 {
     OnBreakpointTriggered(message);
 }