예제 #1
0
        void check_for_mono_runtime(Inferior inferior, Bfd bfd)
        {
            TargetAddress info = bfd.LookupSymbol("MONO_DEBUGGER__debugger_info_ptr");

            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;

                // Add a breakpoint in mini_debugger_init, to make sure that InitializeMono()
                // gets called in time to set the breakpoint at debugger_initialize, needed to
                // initialize the notifications.
                TargetAddress mini_debugger_init = bfd.LookupSymbol("mini_debugger_init");
                if (!mini_debugger_init.IsNull)
                {
                    Instruction insn = inferior.Architecture.ReadInstruction(inferior, mini_debugger_init);
                    if ((insn == null) || !insn.CanInterpretInstruction)
                    {
                        throw new InternalError("Unknown dynlink breakpoint: {0}", mini_debugger_init);
                    }

                    DynlinkBreakpoint init_breakpoint = new DynlinkBreakpoint(this, insn);
                    init_breakpoint.Insert(inferior);
                }
                return;
            }

            Process.InitializeMono(inferior, data);
        }
예제 #2
0
        void check_for_mono_runtime(Inferior inferior, Bfd bfd)
        {
            TargetAddress info = bfd.LookupSymbol ("MONO_DEBUGGER__debugger_info_ptr");
            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;

                // Add a breakpoint in mini_debugger_init, to make sure that InitializeMono()
                // gets called in time to set the breakpoint at debugger_initialize, needed to
                // initialize the notifications.
                TargetAddress mini_debugger_init = bfd.LookupSymbol ("mini_debugger_init");
                if (!mini_debugger_init.IsNull)
                {
                    Instruction insn = inferior.Architecture.ReadInstruction (inferior, mini_debugger_init);
                    if ((insn == null) || !insn.CanInterpretInstruction)
                        throw new InternalError ("Unknown dynlink breakpoint: {0}", mini_debugger_init);

                    DynlinkBreakpoint init_breakpoint = new DynlinkBreakpoint (this, insn);
                    init_breakpoint.Insert (inferior);
                }
                return;
            }

            Process.InitializeMono (inferior, data);
        }