Example #1
0
        public int ChangeEngineState(DEBUG_CES Flags, ulong Argument)
        {
            if (Flags == DEBUG_CES.EXECUTION_STATUS && Argument == (ulong)DEBUG_STATUS.BREAK)
            {
                BreakHappened?.Invoke(this, new EventArgs());
            }

            return(HResult.Ok);
        }
            public override int ChangeEngineState(DEBUG_CES flags, UInt64 argument)
            {
                if ((flags & DEBUG_CES.EXECUTION_STATUS) != 0)
                {
                    ExecutionStatus = (((DEBUG_STATUS)argument) & DEBUG_STATUS.MASK);

                    if ((((DEBUG_CES_EXECUTION_STATUS)argument) & DEBUG_CES_EXECUTION_STATUS.INSIDE_WAIT) == 0)
                    {
                        _utilities.DebugClient.ExitDispatch(_utilities.DebugClient);
                    }
                }
                return(S_OK);
            }
        int IDebugEventCallbacksWide.ChangeEngineState(DEBUG_CES Flags, ulong Argument)
        {
            Debug.WriteLine("IDebugEventCallbacksWide.ChangeEngineState");

            if (Flags.HasFlag(DEBUG_CES.BREAKPOINTS))
            {
                // some breakpoints changed
                OnBreakpointChanged(new BreakpointChangedEventArgs((uint)Argument));
            }

            _stateChanged = true;
            UpdateStatus(Flags.HasFlag(DEBUG_CES.CURRENT_THREAD));
            return((int)DEBUG_STATUS.NO_CHANGE);
        }
Example #4
0
            } // end ChangeDebuggeeState()

            public int ChangeEngineState(DEBUG_CES Flags, ulong Argument)
            {
                LogManager.Trace("ChangeEngineState: {0}, 0x{1:x}", Flags, Argument);
                try
                {
                    var eventArgs = new EngineStateChangedEventArgs(m_debugger, Flags, Argument);
                    if (eventArgs.Flags.HasFlag(DEBUG_CES.EVENT_FILTERS))
                    {
                        // Need to refresh our filters.
                        if (eventArgs.Argument == DbgEventArgs.DEBUG_ANY_ID)
                        {
                            m_debugger._ResetFilters();
                        }
                        else
                        {
                            m_debugger._RefreshSingleFilter((uint)eventArgs.Argument);
                        }
                    }

                    if (eventArgs.Flags.HasFlag(DEBUG_CES.BREAKPOINTS))
                    {
                        // Need to refresh our breakpoints.
                        m_debugger.FixupBpStuff(eventArgs.Argument);
                    }

                    if ((eventArgs.Flags.HasFlag(DEBUG_CES.SYSTEMS)))
                    {
                        // DbgEng doesn't seem to set up its symbol path until you first
                        // attach to something, but it doesn't raise the event saying that
                        // the symbol path has changed when that happens. As a workaround,
                        // we'll dump our cached symbol path here.
                        m_debugger.m_sympath = null;
                        // Another oddity with the symbol path: before attaching to any
                        // system, dbgeng will say that the symbol path is blank. Then,
                        // once it gets attached to something, it will append the value of
                        // the environment variable _NT_SYMBOL_PATH to it.

                        if ((DEBUG_ANY_ID != (uint)eventArgs.Argument))
                        {
                            // We're adding a system. This might be a handy spot to do
                            // something, so I'm leaving the condition here even though I'm
                            // not currently using it.
                            // (this gets traced by the eventArgs constructor)
                        }
                        else
                        {
                            // Removing a system. (this gets traced by the eventArgs
                            // constructor)
                        }
                    }

                    if (eventArgs.Flags.HasFlag(DEBUG_CES.EFFECTIVE_PROCESSOR))
                    {
                        //DbgProvider.ForceRebuildNamespace();
                        LogManager.Trace("Effective processor changed; queueing request to rebuild namespace.");
                        DbgProvider.RequestExecuteBeforeNextPrompt("[MS.Dbg.DbgProvider]::ForceRebuildNamespace()");
                    }

                    if (eventArgs.Flags.HasFlag(DEBUG_CES.EXECUTION_STATUS))
                    {
                        m_executionStatusCookie++;
                    }

                    int retVal = _RaiseEvent(m_debugger.EngineStateChanged, eventArgs);
                    if (_ShouldOutput(retVal, eventArgs))
                    {
                        _PsPipe.WriteObject(eventArgs);
                    }

                    if (DEBUG_CES.EXECUTION_STATUS == Flags)
                    {
                        var  status       = (DEBUG_STATUS)(Argument & (ulong)DEBUG_STATUS.MASK);
                        bool insideWait   = false;
                        bool waitTimedOut = false;
                        if (status != (DEBUG_STATUS)Argument)
                        {
                            insideWait   = 0 != (Argument & (ulong)DEBUG_STATUS_FLAGS.INSIDE_WAIT);
                            waitTimedOut = 0 != (Argument & (ulong)DEBUG_STATUS_FLAGS.WAIT_TIMEOUT);
                        }

                        LogManager.Trace("EXECUTION_STATUS changed. Argument: 0x{0:x} ({1}{2}{3})",
                                         Argument,
                                         status,
                                         insideWait ? " + INSIDE_WAIT" : "",
                                         waitTimedOut ? " + WAIT_TIMEOUT" : "");

                        DbgEngDebugger._GlobalDebugger.DbgEngCookie++;
                        if (0 == ((ulong)DEBUG_STATUS_FLAGS.INSIDE_WAIT & Argument))
                        {
                            // Formerly, we would use this code to signal the currently-
                            // running cmdlet to exit its message loop. The idea was that
                            // there had been problems with more notification events arriving
                            // /after/ WaitForEvent returned. But I can't currently repro
                            // that. (There /are/ some notifications that occur after
                            // WaitForEvent returns, but they are caused by my own actions--
                            // setting assembly options and text aliases.)
                            //
                            // There is also the difference that now I call WaitForEvent on
                            // the dbgeng thread, whereas originally I had been calling it on
                            // a threadpool thread. I'm not sure how that would have made a
                            // difference, though.
                            //
                            // For now, I'm going to get rid of this stuff. It seems fragile
                            // and horribly complicated--I really hope I don't have to bring
                            // it back.
                            //
                            // // TODO: This seems terribly fragile. But I don't see how else to make
                            // // sure we process all callbacks before exiting ProcessRecord. I'm probably
                            // // going to have to add more cases... :(
                            // if( DEBUG_STATUS.BREAK == (DEBUG_STATUS) Argument )
                            // {
                            //     if( _SignalPipeOnBreak )
                            //     {
                            //         LogManager.Trace( "EXECUTION_STATUS is BREAK; signaling pipeline." );
                            //         _PsPipe.SignalDone();
                            //     }
                            //     else
                            //     {
                            //         LogManager.Trace( "EXECUTION_STATUS is BREAK, but we're ignoring it." );
                            //     }
                            // }

                            if (DEBUG_STATUS.NO_DEBUGGEE == (DEBUG_STATUS)Argument)
                            {
                                // We have no target. This might be a handy spot to do
                                // something, so I'm leaving the condition here even
                                // though I'm not currently using it.
                                LogManager.Trace("No debuggee.");
                            }
                        } // end if( inside wait )
                    }     // end if( exec status )

                    return(retVal);
                }
                catch (Exception e)
                {
                    Util.FailFast("Unexpected exception during event callback.", e);
                    return(0);
                }
            } // end ChangeEngineState()
Example #5
0
 public int ChangeEngineState(DEBUG_CES Flags, ulong Argument)
 {
     throw new NotImplementedException();
 }
		public virtual int ChangeEngineState(DEBUG_CES Flags, UInt64 Argument)
		{
			return 0;
		}
Example #7
0
        public Int32 ChangeEngineState([In] DEBUG_CES Flags, [In] ulong Argument)
        {
            // Output.Output.Log(Output.LogLevel.Debug, "Change engine State: " + Flags.ToString());

            return((Int32)DEBUG_STATUS.BREAK);
        }
Example #8
0
 public virtual int ChangeEngineState(DEBUG_CES flags, UInt64 argument)
 {
     return(0);
 }
Example #9
0
 public int ChangeEngineState(DEBUG_CES Flags, ulong Argument)
 {
     throw new NotImplementedException();
 }
 public int ChangeEngineState(DEBUG_CES Flags, ulong Argument)
 {
     return((int)DEBUG_STATUS.NO_CHANGE);
 }
Example #11
0
 public int ChangeEngineState([In] DEBUG_CES Flags, [In] ulong Argument)
 {
     return(0);
 }
Example #12
0
 public int ChangeEngineState(DEBUG_CES Flags, ulong Argument)
 {
     DebugApi.DebugWriteLine("Change Enginee State: {0} - {1:x}", Flags, Argument);
     return(0); //  BitConverter.ToInt32(BitConverter.GetBytes((uint)HRESULT.E_NOTIMPL),0);
 }