コード例 #1
0
ファイル: ValuesTracker.cs プロジェクト: dbremner/smokey
            // Returns -1 if there isn't one instruction that sets the stack entry.
            public int GetStackIndex(int index, int nth)
            {
                DBC.FastPre(index >= 0 && index < m_states.Length, "index out of range");
                DBC.FastPre(nth >= 0, "nth out of range");

                List <StackEntry> stack = m_states[index].Stack;

                if (stack == null)
                {
                    if (!m_skipped)
                    {
                        Log.WarningLine(this, "stack was null at {0:X2}", m_instructions[index].Untyped.Offset);
                        Log.DebugLine(this, "{0:F}", m_instructions);
                    }
                    return(-1);
                }

                if (nth < stack.Count)
                {
                    return(stack[stack.Count - nth - 1].Index);
                }
                else
                {
                    return(-1);
                }
            }