コード例 #1
0
 public void ScenarioStep4()
 {
     CallStack.Add(nameof(ScenarioStep4));
 }
コード例 #2
0
 public void NonMatchingStep4()
 {
     CallStack.Add(nameof(NonMatchingStep4));
 }
コード例 #3
0
ファイル: Debugger.cs プロジェクト: laszlo-kiss/Dataphor
        /// <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);
            }
        }