Beispiel #1
0
 // Called by MDbgBreakpoint after it has set the Number property.
 internal void FireAddBreakpointEvent(MDbgBreakpoint breakpoint)
 {
     if (AddBreakpoint != null)
     {
         AddBreakpoint(this, new BreakpointCollectionChangedEventArgs(breakpoint));
     }
 }
Beispiel #2
0
 /// <summary>
 /// Fire the ChangedBreakpoint event for the given breakpoint.
 /// </summary>
 /// <param name="breakpoint">Breakpoint that has changed</param>
 internal void NotifyChanged(MDbgBreakpoint breakpoint)
 {
     if (ChangedBreakpoint != null)
     {
         ChangedBreakpoint(this, new BreakpointCollectionChangedEventArgs(breakpoint));
     }
 }
Beispiel #3
0
        internal void UnRegister(MDbgBreakpoint breakpoint)
        {
            Debug.Assert(breakpoint != null);
            m_items.Remove(breakpoint);

            if (RemoveBreakpoint != null)
            {
                RemoveBreakpoint(this, new BreakpointCollectionChangedEventArgs(breakpoint));
            }
        }
Beispiel #4
0
        internal int Register(MDbgBreakpoint breakpoint)
        {
            Debug.Assert(breakpoint != null);
            m_items.Add(breakpoint);

            // At this point, derived properties have not yet been set.
            // Let MDbgBreakpoint do a little more initialization and then it will fire the Add
            // event via calling FireAddBreakpointEvent

            return(m_freeBreakpointNumber++);
        }
Beispiel #5
0
 public BreakpointPair(MDbgBreakpoint bp, int iLine)
 {
     m_bp = bp;
     m_iLine = iLine;
 }
 internal BreakpointCollectionChangedEventArgs(MDbgBreakpoint breakpoint)
 {
     m_breakpoint = breakpoint;
 }
        internal void UnRegister(MDbgBreakpoint breakpoint)
        {
            Debug.Assert(breakpoint != null);
            m_items.Remove(breakpoint);

            if (RemoveBreakpoint != null)
            {
                RemoveBreakpoint(this, new BreakpointCollectionChangedEventArgs(breakpoint));
            }
        }
 // Called by MDbgBreakpoint after it has set the Number property. 
 internal void FireAddBreakpointEvent(MDbgBreakpoint breakpoint)
 {
     if (AddBreakpoint != null)
     {
         AddBreakpoint(this, new BreakpointCollectionChangedEventArgs(breakpoint));
     }
 }
        internal int Register(MDbgBreakpoint breakpoint)
        {
            Debug.Assert(breakpoint != null);
            m_items.Add(breakpoint);

            // At this point, derived properties have not yet been set.
            // Let MDbgBreakpoint do a little more initialization and then it will fire the Add 
            // event via calling FireAddBreakpointEvent

            return m_freeBreakpointNumber++;
        }
 /// <summary>
 /// Fire the ChangedBreakpoint event for the given breakpoint.
 /// </summary>
 /// <param name="breakpoint">Breakpoint that has changed</param>
 internal void NotifyChanged(MDbgBreakpoint breakpoint)
 {
     if (ChangedBreakpoint != null)
     {
         ChangedBreakpoint(this, new BreakpointCollectionChangedEventArgs(breakpoint));
     }
 }
Beispiel #11
0
 // Update process's state that to let them know we've hit this we've hit.
 internal void OnUserEntryBreakpointHit()
 {
     m_userEntryBreakpoint.Delete();
     m_userEntryBreakpointEnabled = false;
     m_userEntryBreakpoint = null;
 }
Beispiel #12
0
        private void LoadModuleEventHandler(Object sender, CorModuleEventArgs e)
        {
            MDbgModule m = m_moduleMgr.Register(e.Module);
            OriginalMDbgMessages.WriteLine("ManagedCallback::LoadModule(" + m.CorModule.Name + ")");

            if (!m_processAttaching
                && (m_debugMode != DebugModeFlag.Default))
            {
                // translate DebugModeFlags to JITCompilerFlags
                CorDebugJITCompilerFlags jcf = MapDebugModeToJITCompilerFlags(m_debugMode);

                OriginalMDbgMessages.WriteLine("Setting module jit compiler flags:" + jcf);

                try
                {
                    e.Module.JITCompilerFlags = jcf;

                    // Flags may succeed but not set all bits, so requery.
                    CorDebugJITCompilerFlags jcfActual = e.Module.JITCompilerFlags;
                    if (jcf != jcfActual)
                    {
                        OriginalMDbgMessages.WriteLine("Couldn't set all flags. Actual flags:" + jcfActual);
                    }
                }
                catch (COMException ex)
                {
                    // we'll ignore the error if we cannot set the jit flags
                    OriginalMDbgMessages.WriteLine(string.Format("Failed to set flags with hr=0x{0:x}", ex.ErrorCode));
                }
            }

            m_breakpointMgr.BindBreakpoints(m);
            // let's try to bind all unboud breakpoints (maybe the types got loaded this time)

            if (InternalHandleRawMode(ManagedCallbackType.OnModuleLoad, e))
                return;


            // Symbols track a user entry method.
            // We set a breakpoint at the user entry method and then just run to that to skip any 
            // compiler-injected non-user code before main.
            if (!m_processAttaching
                && m_userEntryBreakpointEnabled
                && m_userEntryBreakpoint == null)
            {
                //now try to set user entry Breakpoint
                if (m.SymReader != null)
                {
                    int st = 0;
                    st = m.SymReader.UserEntryPoint.GetToken();
                    if (st != 0)
                    {
                        MDbgFunction mfunc = m.GetFunction(st);
                        m_userEntryBreakpoint = new UserEntryBreakpoint(this, mfunc);
                        bool ok = m_userEntryBreakpoint.BindToModule(m);
                        Debug.Assert(ok);
                        // now we cannot call BindBreakpoints again otherwise userEntrBreakpoint will be bound
                        // twice
                    }

                    // We explicitly don't set JMC. An extension can hook up to this module and set JMC policy if it wants.
                }
            }

            if (HandleCustomPostCallback(ManagedCallbackType.OnModuleLoad, e))
                return;

            if (m_engine.Options.StopOnModuleLoad)
            {
                e.Continue = false;
                InternalSignalRuntimeIsStopped(null, new ModuleLoadedStopReason(Modules.Lookup(e.Module)));
            }
        }
Beispiel #13
0
        // Cleans up the process's resources. This may be called on any thread (including clalback threads). 
        private void CleanAfterProcessExit()
        {
            lock (this)
            {
                // synchronize with ReallyContinue 
                m_userEntryBreakpoint = null;

                m_threadMgr.Clear();
                m_breakpointMgr.Clear();

                m_moduleMgr.Dispose();

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

                m_engine.Processes.DeleteProcess(this);
            }

            // The SymbolReader interfaces hold a file lock to the pdb file. This lock is held
            // until the final SymbolReader (including any objects obtained from that SymReader
            // such as SymDocument, SymMethods) is released.
            //
            // We're holding Sym* objects via Com-interop wrappres. So we need to cut all references
            // and then force a GC to get the Com-wrapper finalizers to run and do the real release.
            ForceGCCollection();
        }
Beispiel #14
0
 /// <summary>
 /// Create a new instance of the BreakpointHitStopReason class.
 /// </summary>
 /// <param name="breakpoint">The breakpoint that has been hit.</param>
 public BreakpointHitStopReason(MDbgBreakpoint breakpoint)
 {
     Debug.Assert(breakpoint != null);
     m_breakpoint = breakpoint;
 }
Beispiel #15
0
 /// <summary>
 /// Create a new instance of the BreakpointHitStopReason class.
 /// </summary>
 /// <param name="breakpoint">The breakpoint that has been hit.</param>
 public BreakpointHitStopReason(MDbgBreakpoint breakpoint)
 {
     Debug.Assert(breakpoint != null);
     m_breakpoint = breakpoint;
 }
Beispiel #16
0
 internal BreakpointCollectionChangedEventArgs(MDbgBreakpoint breakpoint)
 {
     m_breakpoint = breakpoint;
 }