private void ReadStack()
            {
                ExplicitStackEntry[] trueStack = null;

                if (_curThread.Depth > 0)
                {
                    // In format version 5, we began logging each thread's current call
                    // stack on the thread's first line in each block (i.e. when the
                    // StackDepth flag is set). This is the thread's true call stack at
                    // this point in the log. It reflects MethodEntry and MethodExit
                    // records that may have been lost when the log wrapped (as well
                    // as those that weren't lost).

                    trueStack = new ExplicitStackEntry[_curThread.Depth];
                    for (int i = 0; i < _curThread.Depth; ++i)
                    {
                        ExplicitStackEntry entry = new ExplicitStackEntry();
                        if (_reader.FormatVersion < 6)
                        {
                            entry.EntryLineNum = _fileReader.ReadUInt32(); // Changed from uint to ulong in version 6
                        }
                        else
                        {
                            // _reader.FormatVersion >= 6
                            entry.EntryLineNum = _fileReader.ReadUInt64(); // Changed from uint to ulong in version 6
                        }
                        entry.Level = (TracerX.TraceLevel)_fileReader.ReadByte();

                        if (Reader.Key == null)
                        {
                            entry.Logger = _reader.GetLogger(_fileReader.ReadString());
                            entry.Method = _reader.GetMethod(_fileReader.ReadString());
                        }
                        else
                        {
                            entry.Logger = _reader.GetLogger(Decrypt());
                            entry.Method = _reader.GetMethod(Decrypt());
                        }

                        entry.Depth  = (byte)(_curThread.Depth - i - 1);
                        trueStack[i] = entry;
                    }
                }

                _curThread.MakeMissingRecords(trueStack, GeneratedRecords, this);
            }
Esempio n. 2
0
        // This constructs a missing MethodEntry Record from the given ReaderStackEntry.
        // This is for MethodEntry records lost due to wrapping.
        public Record(ReaderThreadInfo threadInfo, ExplicitStackEntry methodEntry, Reader.Session session)
        {
            IsEntry = true;
            //IsExit = false;
            MsgNum     = 0;                 // TBD
            Time       = DateTime.MinValue; // TBD
            Index      = 0;                 // TBD
            Thread     = threadInfo.Thread;
            ThreadName = threadInfo.ThreadName;
            Level      = methodEntry.Level;
            Logger     = methodEntry.Logger;
            StackDepth = methodEntry.Depth;
            MethodName = methodEntry.Method;
            Lines      = new string[] { string.Format("{{{0}: entered (replaces record lost due to wrapping)", MethodName.Name) };
            Session    = session;

            // Each record also has a bool to indicate if it is bookmarked
            // and a row index it may map to.
            IsBookmarked = new bool[1];
            RowIndices   = new int[1];
        }