Example #1
0
		public static bool GoToIL(IModuleIdProvider moduleIdProvider, IDocumentTabService documentTabService, IModuleLoader moduleLoader, CorFrame frame, bool newTab) {
			if (!CanGoToIL(frame))
				return false;

			var func = frame.Function;
			if (func == null)
				return false;

			return DebugUtils.GoToIL(moduleIdProvider, documentTabService, moduleLoader.LoadModule(func.Module, canLoadDynFile: true, isAutoLoaded: true), frame.Token, frame.GetILOffset(moduleLoader), newTab);
		}
Example #2
0
		public static bool GoToIL(IFileTabManager fileTabManager, IModuleLoader moduleLoader, CorFrame frame, bool newTab) {
			if (!CanGoToIL(frame))
				return false;

			var func = frame.Function;
			if (func == null)
				return false;

			return DebugUtils.GoToIL(fileTabManager, moduleLoader.LoadModule(func.Module, true), frame.Token, frame.GetILOffset(moduleLoader), newTab);
		}
Example #3
0
		public static bool GoToIL(CorFrame frame, bool newTab) {
			if (!CanGoToIL(frame))
				return false;

			var func = frame.Function;
			if (func == null)
				return false;

			return DebugUtils.GoToIL(ModuleLoader.Instance.LoadModule(func.Module, true), frame.Token, frame.GetILOffset(), newTab);
		}
Example #4
0
        public static bool GoToIL(CorFrame frame, bool newTab)
        {
            if (!CanGoToIL(frame))
            {
                return(false);
            }

            var serAsm = frame.GetSerializedDnModuleWithAssembly();

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

            return(DebugUtils.GoToIL(serAsm.Value, frame.Token, frame.GetILOffset(), newTab));
        }
Example #5
0
        CodeLocation? GetCodeLocation(CorFrame frame)
        {
            if (ProcessState != DebuggerProcessState.Stopped)
                return null;
            if (frame == null)
                return null;
            var sma = frame.GetSerializedDnModuleWithAssembly();
            if (sma == null)
                return null;
            uint token = frame.Token;
            if (token == 0)
                return null;

            return new CodeLocation(sma.Value, token, frame.GetILOffset(), frame.ILFrameIP.Mapping);
        }
Example #6
0
        StepRange[] GetStepRanges(DnDebugger debugger, CorFrame frame, bool isStepInto)
        {
            if (frame == null)
                return null;
            if (!frame.IsILFrame)
                return null;
            if (frame.ILFrameIP.IsUnmappedAddress)
                return null;

            var key = CreateMethodKey(debugger, frame);
            if (key == null)
                return null;

            MemberMapping mapping;
            var textView = MainWindow.Instance.SafeActiveTextView;
            var cm = textView.CodeMappings;
            if (cm == null || !cm.TryGetValue(key.Value, out mapping)) {
                // User has decompiled some other code or switched to another tab
                UpdateCurrentMethod();
                JumpToCurrentStatement(textView);

                // It could be cached and immediately available. Check again
                cm = textView.CodeMappings;
                if (cm == null || !cm.TryGetValue(key.Value, out mapping))
                    return null;
            }

            bool isMatch;
            var scm = mapping.GetInstructionByOffset(frame.GetILOffset(), out isMatch);
            uint[] ilRanges;
            if (scm == null)
                ilRanges = mapping.ToArray(null, false);
            else
                ilRanges = scm.ToArray(isMatch);

            if (ilRanges.Length == 0)
                return null;
            return CreateStepRanges(ilRanges);
        }
Example #7
0
        public static bool GoToIL(IModuleIdProvider moduleIdProvider, IDocumentTabService documentTabService, IModuleLoader moduleLoader, CorFrame frame, bool newTab)
        {
            if (!CanGoToIL(frame))
            {
                return(false);
            }

            var func = frame.Function;

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

            return(DebugUtils.GoToIL(moduleIdProvider, documentTabService, moduleLoader.LoadModule(func.Module, canLoadDynFile: true, isAutoLoaded: true), frame.Token, frame.GetILOffset(moduleLoader), newTab));
        }
Example #8
0
        public static bool GoToIL(IFileTabManager fileTabManager, IModuleLoader moduleLoader, CorFrame frame, bool newTab)
        {
            if (!CanGoToIL(frame))
            {
                return(false);
            }

            var func = frame.Function;

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

            return(DebugUtils.GoToIL(fileTabManager, moduleLoader.LoadModule(func.Module, true), frame.Token, frame.GetILOffset(moduleLoader), newTab));
        }
Example #9
0
		StepRange[] GetStepRanges(DnDebugger debugger, CorFrame frame, bool isStepInto) {
			if (frame == null)
				return null;
			if (!frame.IsILFrame)
				return null;
			if (frame.ILFrameIP.IsUnmappedAddress)
				return null;

			var key = CreateMethodKey(debugger, frame);
			if (key == null)
				return null;

			MethodDebugInfo info;
			var tab = documentTabService.GetOrCreateActiveTab();
			var documentViewer = tab.TryGetDocumentViewer();
			var methodDebugService = documentViewer.GetMethodDebugService();
			if ((info = methodDebugService.TryGetMethodDebugInfo(key.Value)) == null) {
				// User has decompiled some other code or switched to another tab
				UpdateCurrentMethod();
				JumpToCurrentStatement(tab);

				// It could be cached and immediately available. Check again
				documentViewer = tab.TryGetDocumentViewer();
				methodDebugService = documentViewer.GetMethodDebugService();
				if ((info = methodDebugService.TryGetMethodDebugInfo(key.Value)) == null)
					return null;
			}

			var sourceStatement = info.GetSourceStatementByCodeOffset(frame.GetILOffset(moduleLoader.Value));
			uint[] ranges;
			if (sourceStatement == null)
				ranges = info.GetUnusedRanges();
			else
				ranges = info.GetRanges(sourceStatement.Value);

			if (ranges.Length == 0)
				return null;
			return CreateStepRanges(ranges);
		}
Example #10
0
		CodeLocation? GetCodeLocation(CorFrame frame) {
			if (ProcessState != DebuggerProcessState.Paused)
				return null;
			if (frame == null)
				return null;
			var func = frame.Function;
			if (func == null)
				return null;

			return new CodeLocation(func, frame.GetILOffset(moduleLoader.Value), frame.ILFrameIP.Mapping);
		}
Example #11
0
        public static bool GoToIL(CorFrame frame, bool newTab)
        {
            if (!CanGoToIL(frame))
            {
                return(false);
            }

            var func = frame.Function;

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

            return(DebugUtils.GoToIL(ModuleLoader.Instance.LoadModule(func.Module, true), frame.Token, frame.GetILOffset(), newTab));
        }
Example #12
0
		StepRange[] GetStepRanges(DnDebugger debugger, CorFrame frame, bool isStepInto) {
			if (frame == null)
				return null;
			if (!frame.IsILFrame)
				return null;
			if (frame.ILFrameIP.IsUnmappedAddress)
				return null;

			var key = CreateMethodKey(debugger, frame);
			if (key == null)
				return null;

			MemberMapping mapping;
			var tab = fileTabManager.GetOrCreateActiveTab();
			var uiContext = tab.TryGetTextEditorUIContext();
			var cm = uiContext.GetCodeMappings();
			if ((mapping = cm.TryGetMapping(key.Value)) == null) {
				// User has decompiled some other code or switched to another tab
				UpdateCurrentMethod();
				JumpToCurrentStatement(tab);

				// It could be cached and immediately available. Check again
				uiContext = tab.TryGetTextEditorUIContext();
				cm = uiContext.GetCodeMappings();
				if ((mapping = cm.TryGetMapping(key.Value)) == null)
					return null;
			}

			bool isMatch;
			var scm = mapping.GetInstructionByOffset(frame.GetILOffset(moduleLoader.Value), out isMatch);
			uint[] ilRanges;
			if (scm == null)
				ilRanges = mapping.ToArray(null, false);
			else
				ilRanges = scm.ToArray(isMatch);

			if (ilRanges.Length == 0)
				return null;
			return CreateStepRanges(ilRanges);
		}