当前位置: 首页>>代码示例>>C#>>正文


C# TargetMemoryAccess.ReadInteger方法代码示例

本文整理汇总了C#中TargetMemoryAccess.ReadInteger方法的典型用法代码示例。如果您正苦于以下问题:C# TargetMemoryAccess.ReadInteger方法的具体用法?C# TargetMemoryAccess.ReadInteger怎么用?C# TargetMemoryAccess.ReadInteger使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在TargetMemoryAccess的用法示例。


在下文中一共展示了TargetMemoryAccess.ReadInteger方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: GetTrampoline

        public MethodSource GetTrampoline(TargetMemoryAccess memory,
						   TargetAddress address)
        {
            #if FIXME
            int insn_size;
            TargetAddress target;
            CallTargetType type = memory.Architecture.GetCallTarget (
                memory, address, out target, out insn_size);
            if (type != CallTargetType.MonoTrampoline)
                return null;

            int token = memory.ReadInteger (target + 4);
            TargetAddress klass = memory.ReadAddress (target + 8);
            TargetAddress image = memory.ReadAddress (klass);

            foreach (MonoSymbolFile file in symfile_by_index.Values) {
                if (file.MonoImage != image)
                    continue;

                return file.GetMethodByToken (token);
            }
            #endif

            return null;
        }
开发者ID:atomia,项目名称:mono_debugger,代码行数:25,代码来源:MonoLanguageBackend.cs

示例2: unwind_method

        StackFrame unwind_method(StackFrame frame, TargetMemoryAccess memory, byte[] code,
					  int pos, int offset)
        {
            Registers old_regs = frame.Registers;
            Registers regs = new Registers (old_regs);

            TargetAddress ebp = new TargetAddress (
                memory.AddressDomain, old_regs [(int) X86_Register.RBP].GetValue ());

            int addr_size = TargetAddressSize;
            TargetAddress new_ebp = memory.ReadAddress (ebp);
            regs [(int) X86_Register.RBP].SetValue (ebp, new_ebp);

            TargetAddress new_eip = memory.ReadAddress (ebp + addr_size);
            regs [(int) X86_Register.RIP].SetValue (ebp + addr_size, new_eip);

            TargetAddress new_esp = ebp + 2 * addr_size;
            regs [(int) X86_Register.RSP].SetValue (ebp, new_esp);

            regs [(int) X86_Register.RSI].Valid = true;
            regs [(int) X86_Register.RDI].Valid = true;

            ebp -= addr_size;

            int length = System.Math.Min (code.Length, offset);
            while (pos < length) {
                byte opcode = code [pos++];

                if ((opcode < 0x50) || (opcode > 0x57))
                    break;

                long value;
                switch (opcode) {
                case 0x50: /* eax */
                    value = (long) (uint) memory.ReadInteger (ebp);
                    regs [(int) X86_Register.RAX].SetValue (ebp, value);
                    break;
                case 0x51: /* ecx */
                    value = (long) (uint) memory.ReadInteger (ebp);
                    regs [(int) X86_Register.RCX].SetValue (ebp, value);
                    break;
                case 0x52: /* edx */
                    value = (long) (uint) memory.ReadInteger (ebp);
                    regs [(int) X86_Register.RDX].SetValue (ebp, value);
                    break;
                case 0x53: /* ebx */
                    value = (long) (uint) memory.ReadInteger (ebp);
                    regs [(int) X86_Register.RBX].SetValue (ebp, value);
                    break;
                case 0x56: /* esi */
                    value = (long) (uint) memory.ReadInteger (ebp);
                    regs [(int) X86_Register.RSI].SetValue (ebp, value);
                    break;
                case 0x57: /* edi */
                    value = (long) (uint) memory.ReadInteger (ebp);
                    regs [(int) X86_Register.RDI].SetValue (ebp, value);
                    break;
                }

                ebp -= addr_size;
            }

            return CreateFrame (frame.Thread, FrameType.Normal, memory, new_eip, new_esp, new_ebp, regs);
        }
开发者ID:baulig,项目名称:debugger,代码行数:64,代码来源:Architecture_I386.cs

示例3: read_range_entry

        Method read_range_entry(TargetMemoryAccess target, TargetAddress address)
        {
            int size = target.ReadInteger (address);
            TargetReader reader = new TargetReader (target.ReadMemory (address, size));

            byte[] contents = reader.BinaryReader.PeekBuffer (size);

            reader.BinaryReader.ReadInt32 ();
            int file_idx = reader.BinaryReader.ReadInt32 ();
            MonoSymbolFile file = (MonoSymbolFile) symfile_by_index [file_idx];

            return file.ReadRangeEntry (target, reader, contents);
        }
开发者ID:atomia,项目名称:mono_debugger,代码行数:13,代码来源:MonoLanguageBackend.cs

示例4: MetadataInfo

            public MetadataInfo(TargetMemoryAccess memory, TargetAddress address)
            {
                int size = memory.ReadInteger (address);
                TargetBinaryReader reader = memory.ReadMemory (address, size).GetReader ();
                reader.ReadInt32 ();

                MonoDefaultsSize = reader.ReadInt32 ();
                MonoDefaultsAddress = new TargetAddress (
                    memory.AddressDomain, reader.ReadAddress ());

                TypeSize = reader.ReadInt32 ();
                ArrayTypeSize = reader.ReadInt32 ();
                KlassSize = reader.ReadInt32 ();
                ThreadSize = reader.ReadInt32 ();

                ThreadTidOffset = reader.ReadInt32 ();
                ThreadStackPtrOffset = reader.ReadInt32 ();
                ThreadEndStackOffset = reader.ReadInt32 ();

                KlassImageOffset = reader.ReadInt32 ();
                KlassInstanceSizeOffset = reader.ReadInt32 ();
                KlassParentOffset = reader.ReadInt32 ();
                KlassTokenOffset = reader.ReadInt32 ();
                KlassFieldOffset = reader.ReadInt32 ();
                KlassMethodsOffset = reader.ReadInt32 ();
                KlassMethodCountOffset = reader.ReadInt32 ();
                KlassThisArgOffset = reader.ReadInt32 ();
                KlassByValArgOffset = reader.ReadInt32 ();
                KlassGenericClassOffset = reader.ReadInt32 ();
                KlassGenericContainerOffset = reader.ReadInt32 ();
                KlassVTableOffset = reader.ReadInt32 ();

                FieldInfoSize = reader.ReadInt32 ();
                FieldInfoTypeOffset = reader.ReadInt32 ();
                FieldInfoOffsetOffset = reader.ReadInt32 ();

                KlassFieldCountOffset = KlassMethodCountOffset - 8;

                MonoDefaultsCorlibOffset = reader.ReadInt32 ();
                MonoDefaultsObjectOffset = reader.ReadInt32 ();
                MonoDefaultsByteOffset = reader.ReadInt32 ();
                MonoDefaultsVoidOffset = reader.ReadInt32 ();
                MonoDefaultsBooleanOffset = reader.ReadInt32 ();
                MonoDefaultsSByteOffset = reader.ReadInt32 ();
                MonoDefaultsInt16Offset = reader.ReadInt32 ();
                MonoDefaultsUInt16Offset = reader.ReadInt32 ();
                MonoDefaultsInt32Offset = reader.ReadInt32 ();
                MonoDefaultsUInt32Offset = reader.ReadInt32 ();
                MonoDefaultsIntOffset = reader.ReadInt32 ();
                MonoDefaultsUIntOffset = reader.ReadInt32 ();
                MonoDefaultsInt64Offset = reader.ReadInt32 ();
                MonoDefaultsUInt64Offset = reader.ReadInt32 ();
                MonoDefaultsSingleOffset = reader.ReadInt32 ();
                MonoDefaultsDoubleOffset = reader.ReadInt32 ();
                MonoDefaultsCharOffset = reader.ReadInt32 ();
                MonoDefaultsStringOffset = reader.ReadInt32 ();
                MonoDefaultsEnumOffset = reader.ReadInt32 ();
                MonoDefaultsArrayOffset = reader.ReadInt32 ();
                MonoDefaultsDelegateOffset = reader.ReadInt32 ();
                MonoDefaultsExceptionOffset = reader.ReadInt32 ();

                MonoMethodKlassOffset = reader.ReadInt32 ();
                MonoMethodTokenOffset = reader.ReadInt32 ();
                MonoMethodFlagsOffset = reader.ReadInt32 ();
                MonoMethodInflatedOffset = reader.ReadInt32 ();

                MonoVTableKlassOffset = reader.ReadInt32 ();
                MonoVTableVTableOffset = reader.ReadInt32 ();
            }
开发者ID:baulig,项目名称:debugger,代码行数:69,代码来源:MetadataHelper.cs

示例5: try_pthread_cond_timedwait

        StackFrame try_pthread_cond_timedwait(StackFrame frame, TargetMemoryAccess memory)
        {
            Symbol name = frame.Name;

            /*
             * This is a hack for pthread_cond_timedwait() on Red Hat 9.
             */
            if ((name == null) || (name.Name != "pthread_cond_timedwait") ||
                (name.Offset != 0xe5))
                return null;

            /*
             * Disassemble some bytes of the method to find out whether
             * it's the "correct" one.
             */
            uint data = (uint) memory.ReadInteger (name.Address);
            if (data != 0x53565755)
                return null;
            data = (uint) memory.ReadInteger (name.Address + 4);
            if (data != 0x14245c8b)
                return null;
            data = (uint) memory.ReadInteger (name.Address + 8);
            if (data != 0x1c246c8b)
                return null;

            data = (uint) memory.ReadInteger (frame.TargetAddress);
            if (data != 0x8910eb83)
                return null;

            data = (uint) memory.ReadInteger (frame.TargetAddress + 0x7b);
            if (data != 0x852cc483)
                return null;
            data = (uint) memory.ReadInteger (frame.TargetAddress + 0x7f);
            if (data != 0xc6440fc0)
                return null;

            TargetAddress esp = frame.StackPointer;

            Registers regs = new Registers (this);

            TargetAddress ebx = memory.ReadAddress (esp + 0x2c);
            TargetAddress esi = memory.ReadAddress (esp + 0x30);
            TargetAddress edi = memory.ReadAddress (esp + 0x34);
            TargetAddress ebp = memory.ReadAddress (esp + 0x38);
            TargetAddress eip = memory.ReadAddress (esp + 0x3c);

            regs [(int)X86_Register.RBX].SetValue (esp + 0x2c, ebx);
            regs [(int)X86_Register.RSI].SetValue (esp + 0x30, esi);
            regs [(int)X86_Register.RDI].SetValue (esp + 0x34, edi);
            regs [(int)X86_Register.RBP].SetValue (esp + 0x38, ebp);
            regs [(int)X86_Register.RIP].SetValue (esp + 0x3c, eip);

            esp += 0x40;
            regs [(int)X86_Register.RSP].SetValue (esp.Address);

            return CreateFrame (frame.Thread, FrameType.Normal, memory, eip, esp, ebp, regs);
        }
开发者ID:baulig,项目名称:debugger,代码行数:57,代码来源:Architecture_I386.cs

示例6: MonoTypeGetIsByRef

 public bool MonoTypeGetIsByRef(TargetMemoryAccess memory, TargetAddress type)
 {
     uint flags = (uint) memory.ReadInteger (
         type + memory.TargetMemoryInfo.TargetAddressSize);
     return (int) ((flags & 0x40000000) >> 30) != 0;
 }
开发者ID:baulig,项目名称:debugger,代码行数:6,代码来源:MetadataHelper.cs

示例7: MonoTypeGetType

        //
        // MonoType
        //
        public MonoTypeEnum MonoTypeGetType(TargetMemoryAccess memory, TargetAddress type)
        {
            uint flags = (uint) memory.ReadInteger (
                type + memory.TargetMemoryInfo.TargetAddressSize);

            return (MonoTypeEnum) ((flags & 0x00ff0000) >> 16);
        }
开发者ID:baulig,项目名称:debugger,代码行数:10,代码来源:MetadataHelper.cs

示例8: MonoClassGetToken

        public int MonoClassGetToken(TargetMemoryAccess memory,
					      TargetAddress klass)
        {
            return memory.ReadInteger (klass + MonoMetadataInfo.KlassTokenOffset);
        }
开发者ID:baulig,项目名称:debugger,代码行数:5,代码来源:MetadataHelper.cs

示例9: MonoMethodGetToken

 //
 // MonoMethod
 //
 public int MonoMethodGetToken(TargetMemoryAccess memory, TargetAddress method)
 {
     return memory.ReadInteger (method + MonoMetadataInfo.MonoMethodTokenOffset);
 }
开发者ID:baulig,项目名称:debugger,代码行数:7,代码来源:MetadataHelper.cs

示例10: MonoClassGetInstanceSize

        public int MonoClassGetInstanceSize(TargetMemoryAccess memory,
						     TargetAddress klass)
        {
            int flags = memory.ReadInteger (klass + 4 * memory.TargetAddressSize);

            bool size_inited = (flags & 4) != 0;
            bool valuetype = (flags & 8) != 0;

            if (!size_inited)
                throw new TargetException (TargetError.ClassNotInitialized);

            int size = memory.ReadInteger (klass + 4 + 3 * memory.TargetAddressSize);
            if (valuetype)
                size -= 2 * memory.TargetAddressSize;

            return size;
        }
开发者ID:baulig,项目名称:debugger,代码行数:17,代码来源:MetadataHelper.cs

示例11: MonoClassGetFieldOffset

        public int MonoClassGetFieldOffset(TargetMemoryAccess memory, TargetAddress klass,
						    int index)
        {
            int offset = index * MonoMetadataInfo.FieldInfoSize +
                MonoMetadataInfo.FieldInfoOffsetOffset;

            TargetAddress fields = memory.ReadAddress (
                klass + MonoMetadataInfo.KlassFieldOffset);
            if (fields.IsNull)
                throw new TargetException (TargetError.ClassNotInitialized);

            return memory.ReadInteger (fields + offset);
        }
开发者ID:baulig,项目名称:debugger,代码行数:13,代码来源:MetadataHelper.cs

示例12: MonoClassGetFieldCount

 public int MonoClassGetFieldCount(TargetMemoryAccess memory, TargetAddress klass)
 {
     return memory.ReadInteger (klass + MonoMetadataInfo.KlassFieldCountOffset);
 }
开发者ID:baulig,项目名称:debugger,代码行数:4,代码来源:MetadataHelper.cs

示例13: GetMethodSignature

        public MonoMethodSignature GetMethodSignature(MonoLanguageBackend mono,
							       TargetMemoryAccess memory,
							       TargetAddress signature)
        {
            int count = memory.ReadInteger (signature + 4) & 0x0000ffff;

            int offset = memory.TargetAddressSize == 8 ? 16 : 12;
            TargetAddress ret = memory.ReadAddress (signature + offset);

            TargetType ret_type = mono.ReadType (memory, ret);
            if (count == 0)
                return new MonoMethodSignature (ret_type, new TargetType [0]);

            offset += memory.TargetAddressSize;
            TargetReader reader = new TargetReader (
                memory.ReadMemory (signature + offset, count * memory.TargetAddressSize));

            TargetType[] param_types = new TargetType [count];
            for (int i = 0; i < count; i++)
                param_types [i] = mono.ReadType (memory, reader.ReadAddress ());

            return new MonoMethodSignature (ret_type, param_types);
        }
开发者ID:baulig,项目名称:debugger,代码行数:23,代码来源:MetadataHelper.cs

示例14: GetGenericClass

        //
        // The following API is new in `terrania'.
        //
        public GenericClassInfo GetGenericClass(TargetMemoryAccess memory,
							 TargetAddress address)
        {
            int addr_size = memory.TargetMemoryInfo.TargetAddressSize;

            TargetReader reader = new TargetReader (memory.ReadMemory (address, 5 * addr_size));
            TargetAddress container = reader.ReadAddress ();
            TargetAddress class_inst = reader.ReadAddress ();
            reader.ReadAddress (); /* method_inst */
            reader.ReadAddress ();
            TargetAddress cached_class = reader.ReadAddress ();

            int inst_id = memory.ReadInteger (class_inst);
            int inst_data = memory.ReadInteger (class_inst + 4);

            TargetAddress inst_argv;
            if (MonoDebuggerInfo.MajorVersion == 80)
                inst_argv = memory.ReadAddress (class_inst + 8);
            else
                inst_argv = class_inst + 8;

            int type_argc = inst_data & 0x3fffff;

            TargetReader argv_reader = new TargetReader (
                memory.ReadMemory (inst_argv, type_argc * addr_size));

            TargetAddress[] type_args = new TargetAddress [type_argc];
            for (int i = 0; i < type_argc; i++)
                type_args [i] = argv_reader.ReadAddress ();

            TargetAddress cached_class_ptr = address + 4 * addr_size;

            return new GenericClassInfo (container, type_args, cached_class_ptr,
                             cached_class);
        }
开发者ID:baulig,项目名称:debugger,代码行数:38,代码来源:MetadataHelper.cs


注:本文中的TargetMemoryAccess.ReadInteger方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。