상속: CommandResult
예제 #1
0
        internal CommandResult StartOperation(ThreadingModel model, SingleSteppingEngine caller)
        {
            if (!ThreadManager.InBackgroundThread)
            {
                throw new InternalError();
            }

            if ((current_state != ProcessState.Stopped) && (current_state != ProcessState.SingleThreaded))
            {
                throw new TargetException(TargetError.NotStopped);
            }

            if ((model & ThreadingModel.ThreadingMode) == ThreadingModel.Single)
            {
                current_state = ProcessState.SingleThreaded;
                if ((model & ThreadingModel.ResumeThreads) != 0)
                {
                    ResumeUserThreads(model, caller);
                }
                return(new ThreadCommandResult(caller.Thread));
            }
            else if ((model & ThreadingModel.ThreadingMode) != ThreadingModel.Process)
            {
                throw new ArgumentException();
            }

            lock (this) {
                current_state = ProcessState.Running;
                stopped_event.Reset();
                current_operation = new ProcessCommandResult(this, model);
            }

            ResumeUserThreads(model, caller);
            return(current_operation);
        }
예제 #2
0
        internal void OperationCompleted(SingleSteppingEngine caller, TargetEventArgs result, ThreadingModel model)
        {
            if (!ThreadManager.InBackgroundThread && Inferior.HasThreadEvents)
            {
                throw new InternalError();
            }

            if (current_state == ProcessState.Stopping)
            {
                return;
            }
            else if (current_state != ProcessState.Running)
            {
                throw new InternalError();
            }

            if ((result != null) && (caller != main_thread) &&
                ((result.Type == TargetEventType.TargetExited) || (result.Type == TargetEventType.TargetSignaled)))
            {
                return;
            }

            current_state = ProcessState.Stopping;
            SuspendUserThreads(model, caller);

            lock (this) {
                current_state = ProcessState.Stopped;
                current_operation.Completed();
                current_operation = null;
                stopped_event.Set();
            }
        }
예제 #3
0
        CommandResult CloneParentOperation(SingleSteppingEngine new_thread)
        {
            if (parent.current_state == ProcessState.SingleThreaded)
            {
                current_state = ProcessState.SingleThreaded;
                return(new ThreadCommandResult(new_thread.Thread));
            }

            if (parent.current_state != ProcessState.Running)
            {
                throw new InternalError();
            }

            current_state = ProcessState.Running;
            if ((parent.current_operation.ThreadingModel & ThreadingModel.ThreadingMode) == ThreadingModel.Global)
            {
                current_operation = parent.current_operation;
            }
            else if ((parent.current_operation.ThreadingModel & ThreadingModel.ThreadingMode) == ThreadingModel.Process)
            {
                current_operation = new ProcessCommandResult(this, parent.current_operation.ThreadingModel);
            }
            else
            {
                throw new InternalError();
            }

            return(current_operation);
        }
예제 #4
0
        internal void Stop()
        {
            main_thread.Invoke(delegate {
                current_state = ProcessState.Stopping;

                SuspendUserThreads(ThreadingModel.Process, null);
                current_state = ProcessState.Stopped;
                if (current_operation != null)
                {
                    current_operation.Completed();
                    current_operation = null;
                }
                stopped_event.Set();
                return(null);
            }, null);
        }
예제 #5
0
        void OperationCompleted(SingleSteppingEngine caller, TargetEventArgs result, ThreadingModel model)
        {
            if (!ThreadManager.InBackgroundThread)
            {
                throw new InternalError();
            }

            foreach (Process process in process_hash.Values)
            {
                process.OperationCompleted(caller, result, model);
            }

            lock (this) {
                current_operation = null;
                stopped_event.Set();
            }
        }
예제 #6
0
        internal void StartGlobalOperation(ThreadingModel model, SingleSteppingEngine caller, OperationCommandResult operation)
        {
            if (!ThreadManager.InBackgroundThread)
            {
                throw new InternalError();
            }

            if ((current_state != ProcessState.Stopped) && (current_state != ProcessState.SingleThreaded))
            {
                throw new TargetException(TargetError.NotStopped);
            }

            lock (this) {
                current_state = ProcessState.Running;
                stopped_event.Reset();
                current_operation = operation;
            }

            ResumeUserThreads(model, caller);
        }
예제 #7
0
        internal CommandResult StartOperation(ThreadingModel model, SingleSteppingEngine caller)
        {
            if (!ThreadManager.InBackgroundThread)
            {
                throw new InternalError();
            }

            if ((model & ThreadingModel.ThreadingMode) == ThreadingModel.Default)
            {
                if (Inferior.HasThreadEvents)
                {
                    model |= ThreadingModel.Single;
                }
                else
                {
                    model |= ThreadingModel.Process;
                }
            }

            if ((model & ThreadingModel.ThreadingMode) != ThreadingModel.Global)
            {
                return(caller.Process.StartOperation(model, caller));
            }

            if (current_operation != null)
            {
                throw new TargetException(TargetError.NotStopped);
            }

            lock (this) {
                stopped_event.Reset();
                current_operation = new GlobalCommandResult(this, model);
            }

            foreach (Process process in process_hash.Values)
            {
                process.StartGlobalOperation(model, caller, current_operation);
            }

            return(current_operation);
        }
예제 #8
0
파일: Process.cs 프로젝트: baulig/debugger
        CommandResult CloneParentOperation(SingleSteppingEngine new_thread)
        {
            if (parent.current_state == ProcessState.SingleThreaded) {
                current_state = ProcessState.SingleThreaded;
                return new ThreadCommandResult (new_thread.Thread);
            }

            if (parent.current_state != ProcessState.Running)
                throw new InternalError ();

            current_state = ProcessState.Running;
            if ((parent.current_operation.ThreadingModel & ThreadingModel.ThreadingMode) == ThreadingModel.Global)
                current_operation = parent.current_operation;
            else if ((parent.current_operation.ThreadingModel & ThreadingModel.ThreadingMode) == ThreadingModel.Process)
                current_operation = new ProcessCommandResult (this, parent.current_operation.ThreadingModel);
            else
                throw new InternalError ();

            return current_operation;
        }
예제 #9
0
파일: Process.cs 프로젝트: baulig/debugger
        internal void Stop()
        {
            main_thread.Invoke (delegate {
                current_state = ProcessState.Stopping;

                SuspendUserThreads (ThreadingModel.Process, null);
                current_state = ProcessState.Stopped;
                if (current_operation != null) {
                    current_operation.Completed ();
                    current_operation = null;
                }
                stopped_event.Set ();
                return null;
            }, null);
        }
예제 #10
0
파일: Process.cs 프로젝트: baulig/debugger
        internal CommandResult StartOperation(ThreadingModel model, SingleSteppingEngine caller)
        {
            if (!ThreadManager.InBackgroundThread)
                throw new InternalError ();

            if ((current_state != ProcessState.Stopped) && (current_state != ProcessState.SingleThreaded))
                throw new TargetException (TargetError.NotStopped);

            if ((model & ThreadingModel.ThreadingMode) == ThreadingModel.Single) {
                current_state = ProcessState.SingleThreaded;
                if ((model & ThreadingModel.ResumeThreads) != 0)
                    ResumeUserThreads (model, caller);
                return new ThreadCommandResult (caller.Thread);
            } else if ((model & ThreadingModel.ThreadingMode) != ThreadingModel.Process) {
                throw new ArgumentException ();
            }

            lock (this) {
                current_state = ProcessState.Running;
                stopped_event.Reset ();
                current_operation = new ProcessCommandResult (this, model);
            }

            ResumeUserThreads (model, caller);
            return current_operation;
        }
예제 #11
0
파일: Process.cs 프로젝트: baulig/debugger
        internal void StartGlobalOperation(ThreadingModel model, SingleSteppingEngine caller, OperationCommandResult operation)
        {
            if (!ThreadManager.InBackgroundThread)
                throw new InternalError ();

            if ((current_state != ProcessState.Stopped) && (current_state != ProcessState.SingleThreaded))
                throw new TargetException (TargetError.NotStopped);

            lock (this) {
                current_state = ProcessState.Running;
                stopped_event.Reset ();
                current_operation = operation;
            }

            ResumeUserThreads (model, caller);
        }
예제 #12
0
파일: Process.cs 프로젝트: baulig/debugger
        internal void OperationCompleted(SingleSteppingEngine caller, TargetEventArgs result, ThreadingModel model)
        {
            if (!ThreadManager.InBackgroundThread && Inferior.HasThreadEvents)
                throw new InternalError ();

            if (current_state == ProcessState.Stopping)
                return;
            else if (current_state != ProcessState.Running)
                throw new InternalError ();

            if ((result != null) && (caller != main_thread) &&
                ((result.Type == TargetEventType.TargetExited) || (result.Type == TargetEventType.TargetSignaled)))
                return;

            current_state = ProcessState.Stopping;
            SuspendUserThreads (model, caller);

            lock (this) {
                current_state = ProcessState.Stopped;
                current_operation.Completed ();
                current_operation = null;
                stopped_event.Set ();
            }
        }
예제 #13
0
파일: Process.cs 프로젝트: baulig/debugger
        internal void OnProcessExitedEvent()
        {
            DropGlobalThreadLock ();

            if (current_state == ProcessState.Running) {
                current_state = ProcessState.Exited;
                current_operation.Completed ();
                current_operation = null;
                stopped_event.Set ();
            }

            if (!is_forked)
                session.OnProcessExited (this);
            session.MainThreadGroup.RemoveThread (main_thread.ID);
            manager.Debugger.OnProcessExitedEvent (this);
        }
예제 #14
0
파일: Debugger.cs 프로젝트: baulig/debugger
        void OperationCompleted(SingleSteppingEngine caller, TargetEventArgs result, ThreadingModel model)
        {
            if (!ThreadManager.InBackgroundThread)
                throw new InternalError ();

            foreach (Process process in process_hash.Values) {
                process.OperationCompleted (caller, result, model);
            }

            lock (this) {
                current_operation = null;
                stopped_event.Set ();
            }
        }
예제 #15
0
파일: Debugger.cs 프로젝트: baulig/debugger
        internal CommandResult StartOperation(ThreadingModel model, SingleSteppingEngine caller)
        {
            if (!ThreadManager.InBackgroundThread)
                throw new InternalError ();

            if ((model & ThreadingModel.ThreadingMode) == ThreadingModel.Default) {
                if (Inferior.HasThreadEvents)
                    model |= ThreadingModel.Single;
                else
                    model |= ThreadingModel.Process;
            }

            if ((model & ThreadingModel.ThreadingMode) != ThreadingModel.Global)
                return caller.Process.StartOperation (model, caller);

            if (current_operation != null)
                throw new TargetException (TargetError.NotStopped);

            lock (this) {
                stopped_event.Reset ();
                current_operation = new GlobalCommandResult (this, model);
            }

            foreach (Process process in process_hash.Values) {
                process.StartGlobalOperation (model, caller, current_operation);
            }

            return current_operation;
        }