GetSectionAddress() public method

public GetSectionAddress ( string name ) : TargetAddress
name string
return Mono.Debugger.TargetAddress
示例#1
0
        protected CoreFile(ThreadManager manager, ProcessStart start)
            : base(manager, start)
        {
            info = Inferior.GetTargetMemoryInfo(manager.AddressDomain);

            bfd = (Bfd)NativeLanguage.OperatingSystem.LoadExecutable(
                info, start.TargetApplication, true);

            core_file = start.CoreFile;

            core_bfd = bfd.OpenCoreFile(core_file);

#if FIXME
            string   crash_program      = core_bfd.CrashProgram;
            string[] crash_program_args = crash_program.Split(' ');

            if (crash_program_args [0] != application)
            {
                throw new TargetException(
                          TargetError.CannotStartTarget,
                          "Core file (generated from {0}) doesn't match executable {1}.",
                          crash_program, application);
            }

            bool ok;
            try {
                DateTime core_date = Directory.GetLastWriteTime(core_file);
                DateTime app_date  = Directory.GetLastWriteTime(application);

                ok = app_date < core_date;
            } catch {
                ok = false;
            }

            if (!ok)
            {
                throw new TargetException(
                          TargetError.CannotStartTarget,
                          "Executable {0} is more recent than core file {1}.",
                          application, core_file);
            }
#endif

            read_note_section();
            main_thread = (CoreFileThread)threads [0];

            TargetMemoryAccess target_access = ((CoreFileThread)threads [0]).TargetAccess;
            // bfd.UpdateSharedLibraryInfo (null, target_access);

            TargetAddress mdb_debug_info = bfd.GetSectionAddress(".mdb_debug_info");
            if (!mdb_debug_info.IsNull)
            {
                mdb_debug_info = main_thread.ReadAddress(mdb_debug_info);
                debugger_info  = MonoDebuggerInfo.Create(target_access, mdb_debug_info);
                read_thread_table();
                CreateMonoLanguage(debugger_info);
                mono_language.InitializeCoreFile(target_access);
                mono_language.Update(target_access);
            }
        }
        void check_for_mono_runtime(Inferior inferior, Bfd bfd)
        {
            TargetAddress info = bfd.GetSectionAddress(".mdb_debug_info");

            if (info.IsNull)
            {
                return;
            }

            TargetAddress data = inferior.ReadAddress(info);

            if (data.IsNull)
            {
                //
                // See CheckForPendingMonoInit() below - this should only happen when
                // the Mono runtime is embedded - for instance Moonlight inside Firefox.
                //
                // Note that we have to do a symbol lookup for it because we do not know
                // whether the mono runtime is recent enough to have this variable.
                //
                data = bfd.LookupSymbol("MONO_DEBUGGER__using_debugger");
                if (data.IsNull)
                {
                    Report.Error("Failed to initialize the Mono runtime!");
                    return;
                }

                inferior.WriteInteger(data, 1);
                pending_mono_init = info;
                return;
            }

            Process.InitializeMono(inferior, data);
        }
示例#3
0
        protected CoreFile(ThreadManager manager, ProcessStart start)
            : base(manager, start)
        {
            info = Inferior.GetTargetMemoryInfo (manager.AddressDomain);

            bfd = (Bfd) NativeLanguage.OperatingSystem.LoadExecutable (
                info, start.TargetApplication, true);

            core_file = start.CoreFile;

            core_bfd = bfd.OpenCoreFile (core_file);

            #if FIXME
            string crash_program = core_bfd.CrashProgram;
            string[] crash_program_args = crash_program.Split (' ');

            if (crash_program_args [0] != application)
                throw new TargetException (
                    TargetError.CannotStartTarget,
                    "Core file (generated from {0}) doesn't match executable {1}.",
                    crash_program, application);

            bool ok;
            try {
                DateTime core_date = Directory.GetLastWriteTime (core_file);
                DateTime app_date = Directory.GetLastWriteTime (application);

                ok = app_date < core_date;
            } catch {
                ok = false;
            }

            if (!ok)
                throw new TargetException (
                    TargetError.CannotStartTarget,
                    "Executable {0} is more recent than core file {1}.",
                    application, core_file);
            #endif

            read_note_section ();
            main_thread = (CoreFileThread) threads [0];

            TargetMemoryAccess target_access = ((CoreFileThread) threads [0]).TargetAccess;
            // bfd.UpdateSharedLibraryInfo (null, target_access);

            TargetAddress mdb_debug_info = bfd.GetSectionAddress (".mdb_debug_info");
            if (!mdb_debug_info.IsNull) {
                mdb_debug_info = main_thread.ReadAddress (mdb_debug_info);
                debugger_info = MonoDebuggerInfo.Create (target_access, mdb_debug_info);
                read_thread_table ();
                CreateMonoLanguage (debugger_info);
                mono_language.InitializeCoreFile (target_access);
                mono_language.Update (target_access);
            }
        }
示例#4
0
        void check_for_mono_runtime(Inferior inferior, Bfd bfd)
        {
            TargetAddress info = bfd.GetSectionAddress (".mdb_debug_info");
            if (info.IsNull)
                return;

            TargetAddress data = inferior.ReadAddress (info);
            if (data.IsNull) {
                //
                // See CheckForPendingMonoInit() below - this should only happen when
                // the Mono runtime is embedded - for instance Moonlight inside Firefox.
                //
                // Note that we have to do a symbol lookup for it because we do not know
                // whether the mono runtime is recent enough to have this variable.
                //
                data = bfd.LookupSymbol ("MONO_DEBUGGER__using_debugger");
                if (data.IsNull) {
                    Report.Error ("Failed to initialize the Mono runtime!");
                    return;
                }

                inferior.WriteInteger (data, 1);
                pending_mono_init = info;
                return;
            }

            Process.InitializeMono (inferior, data);
        }