Esempio n. 1
0
		void AddStartupBreakpoint() {
			switch (type) {
			case BreakProcessKind.None:
				break;

			case BreakProcessKind.EntryPoint:
				breakpoint = debugger.CreateBreakpoint(DebugEventBreakpointKind.LoadModule, OnLoadModule);
				break;

			default:
				Debug.Fail($"Unknown BreakProcessKind: {type}");
				break;
			}
		}
Esempio n. 2
0
 public void Initialize(DnDebugger dbg)
 {
     Debug.Assert(debugger.Dispatcher.CheckAccess());
     Debug.Assert(dbgBreakpoint == null);
     if (dbgBreakpoint != null)
     {
         throw new InvalidOperationException();
     }
     dbgBreakpoint           = dbg.CreateBreakpoint(Module.ToDnModuleId(), Token, Offset, a => cond(this));
     dbgBreakpoint.IsEnabled = isEnabled;
     dbgBreakpoint.Tag       = this;
 }
Esempio n. 3
0
 public void Initialize(DnDebugger dbg)
 {
     Debug.Assert(debugger.Dispatcher.CheckAccess());
     Debug.Assert(dbgBreakpoint == null);
     if (dbgBreakpoint != null)
     {
         throw new InvalidOperationException();
     }
     dbgBreakpoint           = dbg.CreateBreakpoint(EventKind.ToDebugEventBreakpointKind(), HitHandler);
     dbgBreakpoint.IsEnabled = isEnabled;
     dbgBreakpoint.Tag       = this;
 }
Esempio n. 4
0
        void AddStartupBreakpoint()
        {
            switch (type)
            {
            case BreakProcessType.None:
                break;

            case BreakProcessType.CreateProcess:
                CreateStartupDebugBreakEvent(DebugEventBreakpointType.CreateProcess);
                break;

            case BreakProcessType.CreateAppDomain:
                CreateStartupDebugBreakEvent(DebugEventBreakpointType.CreateAppDomain);
                break;

            case BreakProcessType.CreateThread:
                CreateStartupDebugBreakEvent(DebugEventBreakpointType.CreateThread);
                break;

            case BreakProcessType.LoadModule:
                CreateStartupDebugBreakEvent(DebugEventBreakpointType.LoadModule);
                break;

            case BreakProcessType.LoadClass:
                bool oldLoadClass = debugger.Options.ModuleClassLoadCallbacks;
                debugger.Options.ModuleClassLoadCallbacks = true;
                CreateStartupDebugBreakEvent(DebugEventBreakpointType.LoadClass, ctx => {
                    ctx.Debugger.Options.ModuleClassLoadCallbacks = oldLoadClass;
                    return(true);
                });
                break;

            case BreakProcessType.ExeLoadClass:
                CreateStartupAnyDebugBreakEvent(ctx => {
                    if (ctx.EventArgs.Type == DebugCallbackType.LoadModule)
                    {
                        var lm  = (LoadModuleDebugCallbackEventArgs)ctx.EventArgs;
                        var mod = lm.CorModule;
                        if (IsOurModule(mod))
                        {
                            mod.EnableClassLoadCallbacks(true);
                        }
                    }
                    else if (ctx.EventArgs.Type == DebugCallbackType.LoadClass)
                    {
                        var lc  = (LoadClassDebugCallbackEventArgs)ctx.EventArgs;
                        var cls = lc.CorClass;
                        var mod = cls == null ? null : cls.Module;
                        return(IsOurModule(mod));
                    }

                    return(false);
                });
                break;

            case BreakProcessType.ExeLoadModule:
                CreateStartupDebugBreakEvent(DebugEventBreakpointType.LoadModule, ctx => {
                    var e   = (LoadModuleDebugCallbackEventArgs)ctx.EventArgs;
                    var mod = e.CorModule;
                    if (mod == null)
                    {
                        return(false);
                    }
                    return(IsOurModule(mod));
                });
                break;

            case BreakProcessType.ModuleCctorOrEntryPoint:
            case BreakProcessType.EntryPoint:
                breakpoint = debugger.CreateBreakpoint(DebugEventBreakpointType.LoadModule, OnLoadModule);
                break;

            default:
                Debug.Fail(string.Format("Unknown BreakProcessType: {0}", type));
                break;
            }
        }