コード例 #1
0
        internal bool AddBreakpoint(DnModule module)
        {
            foreach (var bp in rawBps)
            {
                if (bp.Module == module)
                {
                    return(true);
                }
            }

            var c = code;

            if (c == null)
            {
                var func = module.CorModule.GetFunctionFromToken(Token);
                if (func == null)
                {
                    return(false);
                }

                c = GetCode(func);
            }
            else
            {
                if (GetModule(code) != module.SerializedDnModule)
                {
                    return(false);
                }
            }
            if (c == null)
            {
                return(false);
            }

            var funcBp = c.CreateBreakpoint(Offset);

            if (funcBp == null)
            {
                return(false);
            }

            var modIlBp = new ModuleCodeBreakpoint(module, funcBp);

            rawBps.Add(modIlBp);
            funcBp.IsActive = IsEnabled;

            return(true);
        }
コード例 #2
0
        DnCodeBreakpointError AddBreakpointCore(DnModule module)
        {
            foreach (var bp in rawBps)
            {
                if (bp.Module == module)
                {
                    return(DnCodeBreakpointError.None);
                }
            }

            var c = code;

            if (c == null)
            {
                var func = module.CorModule.GetFunctionFromToken(Token);
                if (func == null)
                {
                    return(DnCodeBreakpointError.FunctionNotFound);
                }

                c = GetCode(func);
            }
            else
            {
                if (c.Function?.Module != module.CorModule)
                {
                    return(DnCodeBreakpointError.OtherError);
                }
            }
            if (c == null)
            {
                return(DnCodeBreakpointError.FunctionNotFound);
            }

            var funcBp = c.CreateBreakpoint(Offset);

            if (funcBp == null)
            {
                return(DnCodeBreakpointError.CouldNotCreateBreakpoint);
            }

            var modIlBp = new ModuleCodeBreakpoint(module, funcBp);

            rawBps.Add(modIlBp);
            funcBp.IsActive = IsEnabled;

            return(DnCodeBreakpointError.None);
        }
コード例 #3
0
ファイル: DnCodeBreakpoint.cs プロジェクト: manojdjoshi/dnSpy
		internal bool AddBreakpoint(DnModule module) {
			foreach (var bp in rawBps) {
				if (bp.Module == module)
					return true;
			}

			var c = code;
			if (c == null) {
				var func = module.CorModule.GetFunctionFromToken(Token);
				if (func == null)
					return false;

				c = GetCode(func);
			}
			else {
				if (GetModule(code) != module.DnModuleId)
					return false;
			}
			if (c == null)
				return false;

			var funcBp = c.CreateBreakpoint(Offset);
			if (funcBp == null)
				return false;

			var modIlBp = new ModuleCodeBreakpoint(module, funcBp);
			rawBps.Add(modIlBp);
			funcBp.IsActive = IsEnabled;

			return true;
		}