Example #1
0
        public LocalVariable[] GetLocals()
        {
            if (locals == null)
            {
                LocalsInfo li = new LocalsInfo();
                try {
                    li = vm.conn.Method_GetLocalsInfo(id);
                } catch (CommandException) {
                    throw new AbsentInformationException();
                }

                // Add the arguments as well
                var pi = vm.conn.Method_GetParamInfo(id);

                locals = new LocalVariable [pi.param_count + li.names.Length];

                for (int i = 0; i < pi.param_count; ++i)
                {
                    locals [i] = new LocalVariable(vm, this, i, pi.param_types [i], pi.param_names [i], -1, -1, true);
                }

                for (int i = 0; i < li.names.Length; ++i)
                {
                    locals [i + pi.param_count] = new LocalVariable(vm, this, i, li.types [i], li.names [i], li.live_range_start [i], li.live_range_end [i], false);
                }
            }
            return(locals);
        }
Example #2
0
        public LocalVariable[] GetLocals()
        {
            if (locals == null)
            {
                LocalsInfo li = new LocalsInfo();
                try {
                    li = vm.conn.Method_GetLocalsInfo(id);
                } catch (CommandException) {
                    throw new AbsentInformationException();
                }

                // Add the arguments as well
                var pi = GetParameters();

                locals = new LocalVariable [pi.Length + li.names.Length];

                for (int i = 0; i < pi.Length; ++i)
                {
                    locals [i] = new LocalVariable(vm, this, i, pi[i].ParameterType.Id, pi[i].Name, -1, -1, true);
                }

                for (int i = 0; i < li.names.Length; ++i)
                {
                    locals [i + pi.Length] = new LocalVariable(vm, this, i, li.types [i], li.names [i], li.live_range_start [i], li.live_range_end [i], false);
                }

                if (vm.Version.AtLeast(2, 43))
                {
                    scopes = new LocalScope [li.scopes_start.Length];
                    for (int i = 0; i < scopes.Length; ++i)
                    {
                        scopes [i] = new LocalScope(vm, this, li.scopes_start [i], li.scopes_end [i]);
                    }
                }
            }
            return(locals);
        }
Example #3
0
        internal LocalsInfo Method_GetLocalsInfo(long id)
        {
            var res = SendReceive(CommandSet.METHOD, (int)CmdMethod.GET_LOCALS_INFO, new PacketWriter().WriteId(id));

            LocalsInfo info = new LocalsInfo();
            int nlocals = res.ReadInt();
            info.types = new long[nlocals];
            for (int i = 0; i < nlocals; ++i)
                info.types[i] = res.ReadId();
            info.names = new string[nlocals];
            for (int i = 0; i < nlocals; ++i)
                info.names[i] = res.ReadString();
            info.live_range_start = new int[nlocals];
            info.live_range_end = new int[nlocals];
            for (int i = 0; i < nlocals; ++i)
            {
                info.live_range_start[i] = res.ReadInt();
                info.live_range_end[i] = res.ReadInt();
            }

            return info;
        }