Esempio n. 1
0
 void CreateLocalVariable(VariableDebugInformation variable, SymbolToken local_var_token, int start_offset, int end_offset)
 {
     writer.DefineLocalVariable2 (
         variable.Name,
         variable.Attributes,
         local_var_token,
         SymAddressKind.ILOffset,
         variable.Index,
         0,
         0,
         start_offset,
         end_offset);
 }
Esempio n. 2
0
        private void ReadScope(ScopeDebugInformation scope)
        {
            InstructionOffset instructionOffset = scope.Start;
            Instruction       instruction       = GetInstruction(instructionOffset.Offset);

            if (instruction != null)
            {
                scope.Start = new InstructionOffset(instruction);
            }
            instructionOffset = scope.End;
            Instruction       instruction2 = GetInstruction(instructionOffset.Offset);
            InstructionOffset end;

            if (instruction2 == null)
            {
                instructionOffset = default(InstructionOffset);
                end = instructionOffset;
            }
            else
            {
                end = new InstructionOffset(instruction2);
            }
            scope.End = end;
            if (!scope.variables.IsNullOrEmpty())
            {
                for (int i = 0; i < scope.variables.Count; i++)
                {
                    VariableDebugInformation variableDebugInformation = scope.variables[i];
                    VariableDefinition       variable = GetVariable(variableDebugInformation.Index);
                    if (variable != null)
                    {
                        variableDebugInformation.index = new VariableIndex(variable);
                    }
                }
            }
            if (!scope.scopes.IsNullOrEmpty())
            {
                ReadScopes(scope.scopes);
            }
        }
Esempio n. 3
0
        static ScopeDebugInformation ReadScopeAndLocals(PdbScope scope, MethodDebugInformation info)
        {
            var parent = new ScopeDebugInformation ();
            parent.Start = new InstructionOffset ((int) scope.offset);
            parent.End = new InstructionOffset ((int) (scope.offset + scope.length));

            if (!scope.slots.IsNullOrEmpty()) {
                parent.variables = new Collection<VariableDebugInformation> (scope.slots.Length);

                foreach (PdbSlot slot in scope.slots) {
                    if (slot.flags == 1) // parameter names
                        continue;

                    var index = (int) slot.slot;
                    var variable = new VariableDebugInformation (index, slot.name);
                    if (slot.flags == 4)
                        variable.IsDebuggerHidden = true;
                    parent.variables.Add (variable);
                }
            }

            if (!scope.constants.IsNullOrEmpty ()) {
                parent.constants = new Collection<ConstantDebugInformation> (scope.constants.Length);

                foreach (var constant in scope.constants) {
                    parent.constants.Add (new ConstantDebugInformation (
                        constant.name,
                        (TypeReference) info.method.Module.LookupToken ((int) constant.token),
                        constant.value));
                }
            }

            parent.scopes = ReadScopeAndLocals (scope.scopes, info);

            return parent;
        }
Esempio n. 4
0
        static void ReadLocalVariables(MethodEntry entry, ScopeDebugInformation [] scopes)
        {
            var locals = entry.GetLocals ();

            foreach (var local in locals) {
                var variable = new VariableDebugInformation (local.Index, local.Name);

                var index = local.BlockIndex;
                if (index < 0 || index >= scopes.Length)
                    continue;

                var scope = scopes [index];
                if (scope == null)
                    continue;

                scope.Variables.Add (variable);
            }
        }