Mono.Debugger.Backend.Mono.MonoDebuggerInfo.Create C# (CSharp) Метод

Create() публичный статический Метод

public static Create ( TargetMemoryAccess memory, TargetAddress info ) : MonoDebuggerInfo
memory Mono.Debugger.TargetMemoryAccess
info Mono.Debugger.TargetAddress
Результат MonoDebuggerInfo
        public static MonoDebuggerInfo Create(TargetMemoryAccess memory, TargetAddress info)
        {
            TargetBinaryReader header = memory.ReadMemory (info, 24).GetReader ();
            long magic = header.ReadInt64 ();
            if (magic != DynamicMagic) {
                Report.Error ("`MONO_DEBUGGER__debugger_info' at {0} has unknown magic {1:x}.", info, magic);
                return null;
            }

            int version = header.ReadInt32 ();
            if (version < MinDynamicVersion) {
                Report.Error ("`MONO_DEBUGGER__debugger_info' has version {0}, " +
                          "but expected at least {1}.", version,
                          MonoDebuggerInfo.MinDynamicVersion);
                return null;
            }
            if (version > MaxDynamicVersion) {
                Report.Error ("`MONO_DEBUGGER__debugger_info' has version {0}, " +
                          "but expected at most {1}.", version,
                          MonoDebuggerInfo.MaxDynamicVersion);
                return null;
            }

            header.ReadInt32 (); // minor version
            header.ReadInt32 ();

            int size = header.ReadInt32 ();

            TargetReader reader = new TargetReader (memory.ReadMemory (info, size));
            return new MonoDebuggerInfo (memory, reader);
        }

Usage Example

Пример #1
0
        public static MonoThreadManager Initialize(Process process, Inferior inferior,
                                                   TargetAddress info, bool attach)
        {
            MonoDebuggerInfo debugger_info = MonoDebuggerInfo.Create(inferior, info);

            if (debugger_info == null)
            {
                return(null);
            }

            if (attach)
            {
                if (!debugger_info.CheckRuntimeVersion(81, 2))
                {
                    Report.Error("The Mono runtime of the target application is too old to support attaching,\n" +
                                 "attaching as a native application.");
                    return(null);
                }

                if ((debugger_info.RuntimeFlags & 1) != 1)
                {
                    Report.Error("The Mono runtime of the target application does not support attaching,\n" +
                                 "attaching as a native application.");
                    return(null);
                }
            }

            return(new MonoThreadManager(process, inferior, debugger_info));
        }