Пример #1
0
        public CodeBlockEntry[] GetCodeBlocks()
        {
            lock (SymbolFile) {
                if (code_blocks != null)
                {
                    return(code_blocks);
                }

                if (CodeBlockTableOffset == 0)
                {
                    return(null);
                }

                MyBinaryReader reader  = SymbolFile.BinaryReader;
                long           old_pos = reader.BaseStream.Position;
                reader.BaseStream.Position = CodeBlockTableOffset;

                int num_code_blocks = reader.ReadLeb128();
                code_blocks = new CodeBlockEntry [num_code_blocks];

                for (int i = 0; i < num_code_blocks; i++)
                {
                    code_blocks [i] = new CodeBlockEntry(i, reader);
                }

                reader.BaseStream.Position = old_pos;
                return(code_blocks);
            }
        }
        public void StartBlock(CodeBlockEntry.Type type, int start_offset, int scopeIndex)
        {
            if (_block_stack == null)
            {
                _block_stack = new Stack <CodeBlockEntry> ();
            }

            if (_blocks == null)
            {
                _blocks = new List <CodeBlockEntry> ();
            }

            int parent = CurrentBlock != null ? CurrentBlock.Index : -1;

            CodeBlockEntry block = new CodeBlockEntry(
                scopeIndex, parent, type, start_offset);

            _block_stack.Push(block);
            _blocks.Add(block);
        }
        public void EndBlock(int end_offset)
        {
            CodeBlockEntry block = (CodeBlockEntry)_block_stack.Pop();

            block.Close(end_offset);
        }