Exemple #1
0
        public MonoVariable(string name, TargetType type, bool is_local, bool is_byref,
				     Method method, VariableInfo info, int start_scope_offset,
				     int end_scope_offset)
            : this(name, type, is_local, is_byref, method, info)
        {
            if (is_local) {
                start_scope = method.StartAddress + start_scope_offset;
                end_scope = method.StartAddress + end_scope_offset;
            } else if (method.HasMethodBounds) {
                start_scope = method.MethodStartAddress;
                end_scope = method.MethodEndAddress;
            } else {
                start_scope = method.StartAddress;
                end_scope = method.EndAddress;
            }

            if (has_liveness_info) {
                if (start_liveness < start_scope)
                    start_liveness = start_scope;
                if (end_liveness > end_scope)
                    end_liveness = end_scope;
            } else {
                start_liveness = start_scope;
                end_liveness = end_scope;
                has_liveness_info = true;
            }
        }
Exemple #2
0
        public MonoVariable(string name, TargetType type, bool is_local, bool is_byref,
				     Method method, VariableInfo info)
        {
            this.name = name;
            this.type = type;
            this.info = info;
            this.is_byref = is_byref;

            start_scope = method.StartAddress;
            end_scope = method.EndAddress;

            if (info.HasLivenessInfo) {
                start_liveness = method.StartAddress + info.BeginLiveness;
                end_liveness = method.StartAddress + info.EndLiveness;
                has_liveness_info = true;
            } else {
                start_liveness = method.MethodStartAddress;
                end_liveness = method.MethodEndAddress;
                has_liveness_info = false;
            }
        }
        public MethodAddress(TargetBinaryReader reader,
				      AddressDomain domain, Architecture arch)
        {
            // here we read the MonoDebugMethodAddress structure
            // as written out in mono_debug_add_method.
            reader.Position = 16;
            ReadAddress (reader, domain); // wrapper_data
            MonoMethod = ReadAddress (reader, domain);
            ReadAddress (reader, domain); // address_list
            StartAddress = ReadAddress (reader, domain);
            WrapperAddress = ReadAddress (reader, domain);
            int code_size = reader.ReadInt32 ();

            EndAddress = StartAddress + code_size;

            int prologue_end = reader.ReadLeb128 ();
            int epilogue_begin = reader.ReadLeb128 ();

            MethodStartAddress = prologue_end > 0 ?
                StartAddress + prologue_end : StartAddress;
            MethodEndAddress = epilogue_begin > 0 ?
                StartAddress + epilogue_begin : EndAddress;

            int num_line_numbers = reader.ReadLeb128 ();
            LineNumbers = new List<JitLineNumberEntry> ();

            for (int i = 0; i < num_line_numbers; i++) {
                int il_offset = reader.ReadSLeb128 ();
                int native_offset = reader.ReadSLeb128 ();

                if (il_offset < 0)
                    continue;

                LineNumbers.Add (new JitLineNumberEntry (il_offset, native_offset));
            }

            HasThis = reader.ReadByte () != 0;
            if (HasThis)
                ThisVariableInfo = new VariableInfo (arch, reader);

            int num_params = reader.ReadLeb128 ();
            ParamVariableInfo = new VariableInfo [num_params];
            for (int i = 0; i < num_params; i++)
                ParamVariableInfo [i] = new VariableInfo (arch, reader);

            int num_locals = reader.ReadLeb128 ();
            LocalVariableInfo = new VariableInfo [num_locals];
            for (int i = 0; i < num_locals; i++)
                LocalVariableInfo [i] = new VariableInfo (arch, reader);
        }