示例#1
0
        public BreakpointManager(BreakpointManager old)
        {
            Lock ();

            index_hash = new Hashtable ();
            _manager = mono_debugger_breakpoint_manager_clone (old.Manager);

            foreach (int index in old.index_hash.Keys) {
                BreakpointEntry entry = (BreakpointEntry) old.index_hash [index];
                index_hash.Add (index, entry);
            }

            Unlock ();
        }
        public BreakpointManager(BreakpointManager old)
        {
            Lock();

            index_hash = new Hashtable();
            _manager   = mono_debugger_breakpoint_manager_clone(old.Manager);

            foreach (int index in old.index_hash.Keys)
            {
                BreakpointEntry entry = (BreakpointEntry)old.index_hash [index];
                index_hash.Add(index, entry);
            }

            Unlock();
        }
示例#3
0
        protected Inferior(ThreadManager thread_manager, Process process,
				    ProcessStart start, BreakpointManager bpm,
				    DebuggerErrorHandler error_handler,
				    AddressDomain address_domain)
        {
            this.thread_manager = thread_manager;
            this.process = process;
            this.start = start;
            this.native = start.IsNative;
            this.error_handler = error_handler;
            this.breakpoint_manager = bpm;
            this.address_domain = address_domain;

            server_handle = mono_debugger_server_create_inferior (breakpoint_manager.Manager);
            if (server_handle == IntPtr.Zero)
                throw new InternalError ("mono_debugger_server_initialize() failed.");
        }
示例#4
0
        void DoDispose()
        {
            if (!is_forked) {
                if (architecture != null) {
                    architecture.Dispose ();
                    architecture = null;
                }

                if (mono_language != null) {
                    mono_language.Dispose();
                    mono_language = null;
                }

                if (native_language != null) {
                    native_language.Dispose ();
                    native_language = null;
                }

                if (os != null) {
                    os.Dispose ();
                    os = null;
                }

                if (symtab_manager != null) {
                    symtab_manager.Dispose ();
                    symtab_manager = null;
                }
            }

            if (breakpoint_manager != null) {
                breakpoint_manager.Dispose ();
                breakpoint_manager = null;
            }

            if (thread_db != null) {
                thread_db.Dispose ();
                thread_db = null;
            }

            if (thread_lock_mutex != null) {
                thread_lock_mutex.Dispose ();
                thread_lock_mutex = null;
            }

            exception_handlers = null;

            manager.RemoveProcess (this);
        }
示例#5
0
        internal Process(ThreadManager manager, ProcessStart start)
            : this(manager, start.Session)
        {
            this.start = start;

            is_attached = start.PID != 0;

            breakpoint_manager = new BreakpointManager ();

            exception_handlers = new Dictionary<int,ExceptionCatchPoint> ();

            symtab_manager = new SymbolTableManager (session);

            os = Inferior.CreateOperatingSystemBackend (this);
            native_language = new NativeLanguage (this, os, target_info);

            session.OnProcessCreated (this);
        }
示例#6
0
        internal void ChildExecd(SingleSteppingEngine engine, Inferior inferior)
        {
            is_execed = true;

            if (!is_forked) {
                if (mono_language != null)
                    mono_language.Dispose();

                if (native_language != null)
                    native_language.Dispose ();

                if (os != null)
                    os.Dispose ();

                if (symtab_manager != null)
                    symtab_manager.Dispose ();
            }

            if (breakpoint_manager != null)
                breakpoint_manager.Dispose ();

            session.OnProcessExecd (this);

            breakpoint_manager = new BreakpointManager ();

            exception_handlers = new Dictionary<int,ExceptionCatchPoint> ();

            symtab_manager = new SymbolTableManager (session);

            os = Inferior.CreateOperatingSystemBackend (this);
            native_language = new NativeLanguage (this, os, target_info);

            Inferior new_inferior = Inferior.CreateInferior (manager, this, start);
            try {
                new_inferior.InitializeAfterExec (inferior.PID);
            } catch (Exception ex) {
                if ((ex is TargetException) && (((TargetException) ex).Type == TargetError.PermissionDenied)) {
                    Report.Error ("Permission denied when trying to debug exec()ed child {0}, detaching!",
                              inferior.PID);
                } else {
                    Report.Error ("InitializeAfterExec() failed on pid {0}: {1}", inferior.PID, ex);
                }
                new_inferior.DetachAfterFork ();
                return;
            }

            SingleSteppingEngine new_thread = new SingleSteppingEngine (
                manager, this, new_inferior, inferior.PID);

            ThreadServant[] threads;
            lock (thread_hash.SyncRoot) {
                threads = new ThreadServant [thread_hash.Count];
                thread_hash.Values.CopyTo (threads, 0);
            }

            for (int i = 0; i < threads.Length; i++) {
                if (threads [i].PID != inferior.PID)
                    threads [i].Kill ();
            }

            thread_hash [inferior.PID] = new_thread;

            inferior.Dispose ();
            inferior = null;

            manager.Debugger.OnProcessExecdEvent (this);
            manager.Debugger.OnThreadCreatedEvent (new_thread.Thread);
            initialized = is_forked = false;
            main_thread = new_thread;

            if ((engine.Thread.ThreadFlags & Thread.Flags.StopOnExit) != 0)
                new_thread.Thread.ThreadFlags |= Thread.Flags.StopOnExit;

            CommandResult result = engine.OnExecd (new_thread);
            new_thread.StartExecedChild (result);
        }
示例#7
0
        private Process(Process parent, int pid)
            : this(parent.manager, parent.session)
        {
            this.start = new ProcessStart (parent.ProcessStart, pid);

            this.is_forked = true;
            this.initialized = true;

            this.parent = parent;

            breakpoint_manager = new BreakpointManager (parent.breakpoint_manager);

            exception_handlers = new Dictionary<int,ExceptionCatchPoint> ();
            foreach (KeyValuePair<int,ExceptionCatchPoint> catchpoint in parent.exception_handlers)
                exception_handlers.Add (catchpoint.Key, catchpoint.Value);

            symtab_manager = parent.symtab_manager;

            native_language = parent.native_language;
            os = parent.os;
        }