Exemple #1
0
 public void SetContext(PlanNode planNode)
 {
     if (planNode.Line > -1)
     {
         _line    = planNode.Line;
         _linePos = planNode.LinePos;
     }
     else
     {
         _context = planNode.SafeEmitStatementAsString();
     }
 }
Exemple #2
0
        /// <summary>
        /// Returns the current call stack of a process.
        /// </summary>
        public CallStack GetCallStack(int processID)
        {
            lock (_syncHandle)
            {
                CheckPaused();

                ServerProcess process = _processes.GetProcess(processID);

                CallStack callStack = new CallStack();

                if (process.IsRunning)
                {
                    for (int programIndex = process.ExecutingPrograms.Count - 1; programIndex > 0; programIndex--)
                    {
                        Program  program     = process.ExecutingPrograms[programIndex];
                        PlanNode currentNode = program.CurrentNode;
                        bool     afterNode   = program.AfterNode;

                        foreach (RuntimeStackWindow window in program.Stack.GetCallStack())
                        {
                            callStack.Add
                            (
                                new CallStackEntry
                                (
                                    callStack.Count,
                                    window.Originator != null
                                                                                ? window.Originator.Description
                                                                                :
                                    (
                                        program.Code != null
                                                                                                ? program.Code.Description
                                                                                                : window.Locator.Locator
                                    ),
                                    currentNode != null
                                                                                ?
                                    new DebugLocator
                                    (
                                        window.Locator,
                                        afterNode ? currentNode.EndLine : currentNode.Line,
                                        (afterNode && currentNode.Line != currentNode.EndLine) ? currentNode.EndLinePos : currentNode.LinePos
                                    )
                                                                                : new DebugLocator(window.Locator, -1, -1),
                                    window.Originator != null
                                                                                ? DebugLocator.OperatorLocator(window.GetOriginatingOperator().DisplayName)
                                                                                : DebugLocator.ProgramLocator(program.ID),
                                    currentNode != null
                                                                                ? currentNode.SafeEmitStatementAsString()
                                                                                :
                                    (
                                        program.Code != null
                                                                                                ? program.Code.SafeEmitStatementAsString()
                                                                                                : "<no statement available>"
                                    )
                                )
                            );

                            currentNode = window.Originator;
                            afterNode   = false;
                        }
                    }
                }

                return(callStack);
            }
        }