Insert() private method

private Insert ( Inferior inferior ) : void
inferior Mono.Debugger.Backend.Inferior
return void
Esempio n. 1
0
        protected MonoThreadManager(Process process, Inferior inferior,
					     MonoDebuggerInfo debugger_info)
        {
            this.process = process;
            this.debugger_info = debugger_info;

            inferior.WriteInteger (debugger_info.UsingMonoDebugger, 1);

            notification_bpt = new InitializeBreakpoint (this, debugger_info.Initialize);
            notification_bpt.Insert (inferior);
        }
Esempio n. 2
0
        void read_dynamic_info(Inferior inferior)
        {
            if (has_dynlink_info) {
                if (!first_link_map.IsNull)
                    do_update_shlib_info (inferior);
                return;
            }

            TargetAddress debug_base = main_bfd.ReadDynamicInfo (inferior);
            if (debug_base.IsNull)
                return;

            int size = 2 * inferior.TargetLongIntegerSize + 3 * inferior.TargetAddressSize;

            TargetReader reader = new TargetReader (inferior.ReadMemory (debug_base, size));
            if (reader.ReadLongInteger () != 1)
                return;

            first_link_map = reader.ReadAddress ();
            dynlink_breakpoint_addr = reader.ReadAddress ();

            rdebug_state_addr = debug_base + reader.Offset;

            if (reader.ReadLongInteger () != 0)
                return;

            has_dynlink_info = true;

            Instruction insn = inferior.Architecture.ReadInstruction (inferior, dynlink_breakpoint_addr);
            if ((insn == null) || !insn.CanInterpretInstruction)
                throw new InternalError ("Unknown dynlink breakpoint: {0}", dynlink_breakpoint_addr);

            dynlink_breakpoint = new DynlinkBreakpoint (this, insn);
            dynlink_breakpoint.Insert (inferior);

            do_update_shlib_info (inferior);

            check_loaded_library (inferior, main_bfd);
        }
Esempio n. 3
0
        void read_dynamic_info(Inferior inferior)
        {
            if (has_dynlink_info) {
                if (!dyld_all_image_infos.IsNull)
                    do_update_shlib_info (inferior);
                return;
            }

            TargetMemoryInfo info = Inferior.GetTargetMemoryInfo (AddressDomain.Global);
			Bfd dyld_image = new Bfd (this, info, "/usr/lib/dyld", TargetAddress.Null, true);

            dyld_all_image_infos = dyld_image.LookupSymbol("dyld_all_image_infos");
            if (dyld_all_image_infos.IsNull)
                return;

            int size = 2 * inferior.TargetLongIntegerSize + 2 * inferior.TargetAddressSize;
            TargetReader reader = new TargetReader (inferior.ReadMemory (dyld_all_image_infos, size));

            reader.ReadLongInteger (); // version
            reader.ReadLongInteger (); // infoArrayCount
            reader.ReadAddress (); // infoArray
            TargetAddress dyld_image_notifier = reader.ReadAddress ();

            has_dynlink_info = true;

            Instruction insn = inferior.Architecture.ReadInstruction (inferior, dyld_image_notifier);
            if ((insn == null) || !insn.CanInterpretInstruction)
                throw new InternalError ("Unknown dynlink breakpoint: {0}", dyld_image_notifier);

            dynlink_breakpoint = new DynlinkBreakpoint (this, insn);
            dynlink_breakpoint.Insert (inferior);

            do_update_shlib_info (inferior);

            check_loaded_library (inferior, main_bfd);
Esempio n. 4
0
        void check_nptl_setxid(Inferior inferior, Bfd bfd)
        {
            if (setxid_breakpoint != null)
                return;

            TargetAddress vtable = bfd.LookupSymbol ("__libc_pthread_functions");
            if (vtable.IsNull)
                return;

            /*
             * Big big hack to allow debugging gnome-vfs:
             * We intercept any calls to __nptl_setxid() and make it
             * return 0.  This is safe to do since we do not allow
             * debugging setuid programs or running as root, so setxid()
             * will always be a no-op anyways.
             */

            TargetAddress nptl_setxid = inferior.ReadAddress (vtable + 51 * inferior.TargetAddressSize);

            if (!nptl_setxid.IsNull) {
                setxid_breakpoint = new SetXidBreakpoint (this, nptl_setxid);
                setxid_breakpoint.Insert (inferior);
            }
        }