Esempio n. 1
0
        public Event InsertBreakpoint(Thread target, ThreadGroup group,
                                      TargetAddress address)
        {
            Event handle = new AddressBreakpoint(address.ToString(), group, address);

            handle.Activate(target);
            AddEvent(handle);
            return(handle);
        }
Esempio n. 2
0
        public Event InsertHardwareWatchPoint(Thread target, TargetAddress address,
                                              HardwareWatchType type)
        {
            Event handle = new AddressBreakpoint(type, address);

            handle.Activate(target);
            AddEvent(handle);
            return(handle);
        }
Esempio n. 3
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. 4
0
        protected void initialize_notifications(Inferior inferior)
        {
            TargetAddress executable_code_buffer = inferior.ReadAddress (
                debugger_info.ExecutableCodeBuffer);
            HasCodeBuffer = !executable_code_buffer.IsNull;

            mono_runtime_info = mono_debugger_server_initialize_mono_runtime (
                inferior.TargetAddressSize,
                debugger_info.NotificationAddress.Address,
                executable_code_buffer.Address,
                debugger_info.ExecutableCodeBufferSize,
                debugger_info.BreakpointInfo.Address,
                debugger_info.BreakpointInfoIndex.Address,
                debugger_info.BreakpointArraySize);
            inferior.SetRuntimeInfo (mono_runtime_info);

            debugger_version = inferior.ReadInteger (debugger_info.DebuggerVersion);

            if (notification_bpt != null) {
                notification_bpt.Remove (inferior);
                notification_bpt = null;
            }

            if (debugger_info.HasThreadAbortSignal)
                thread_abort_signal = inferior.ReadInteger (debugger_info.ThreadAbortSignal);
            else
                thread_abort_signal = inferior.MonoThreadAbortSignal;
        }
Esempio n. 5
0
        public Event InsertHardwareWatchPoint(Thread target, TargetAddress address,
						       HardwareWatchType type)
        {
            Event handle = new AddressBreakpoint (type, address);
            handle.Activate (target);
            AddEvent (handle);
            return handle;
        }
Esempio n. 6
0
        public Event InsertBreakpoint(Thread target, ThreadGroup group,
					       TargetAddress address)
        {
            Event handle = new AddressBreakpoint (address.ToString (), group, address);
            handle.Activate (target);
            AddEvent (handle);
            return handle;
        }
Esempio n. 7
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. 8
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. 9
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);
            }
        }