Exemple #1
0
        BreakpointsVM(IDecompilerService decompilerService, IDebuggerSettings debuggerSettings, ITheDebugger theDebugger, IBreakpointService breakpointService, IBreakpointSettings breakpointSettings, Lazy <IModuleLoader> moduleLoader, IInMemoryModuleService inMemoryModuleService, IClassificationFormatMapService classificationFormatMapService, ITextElementProvider textElementProvider)
        {
            var classificationFormatMap = classificationFormatMapService.GetClassificationFormatMap(AppearanceCategoryConstants.UIMisc);

            breakpointContext = new BreakpointContext(moduleLoader, classificationFormatMap, textElementProvider)
            {
                Decompiler         = decompilerService.Decompiler,
                SyntaxHighlight    = debuggerSettings.SyntaxHighlightBreakpoints,
                UseHexadecimal     = debuggerSettings.UseHexadecimal,
                ShowTokens         = breakpointSettings.ShowTokens,
                ShowModuleNames    = breakpointSettings.ShowModuleNames,
                ShowParameterTypes = breakpointSettings.ShowParameterTypes,
                ShowParameterNames = breakpointSettings.ShowParameterNames,
                ShowOwnerTypes     = breakpointSettings.ShowOwnerTypes,
                ShowReturnTypes    = breakpointSettings.ShowReturnTypes,
                ShowNamespaces     = breakpointSettings.ShowNamespaces,
                ShowTypeKeywords   = breakpointSettings.ShowTypeKeywords,
            };
            this.breakpointService                = breakpointService;
            this.theDebugger                      = theDebugger;
            breakpointList                        = new ObservableCollection <BreakpointVM>();
            breakpointSettings.PropertyChanged   += BreakpointSettings_PropertyChanged;
            breakpointService.BreakpointsAdded   += BreakpointService_BreakpointsAdded;
            breakpointService.BreakpointsRemoved += BreakpointService_BreakpointsRemoved;
            debuggerSettings.PropertyChanged     += DebuggerSettings_PropertyChanged;
            theDebugger.OnProcessStateChanged    += TheDebugger_OnProcessStateChanged;
            classificationFormatMap.ClassificationFormatMappingChanged += ClassificationFormatMap_ClassificationFormatMappingChanged;
            decompilerService.DecompilerChanged        += DecompilerService_DecompilerChanged;
            inMemoryModuleService.DynamicModulesLoaded += InMemoryModuleService_DynamicModulesLoaded;
            foreach (var bp in breakpointService.GetBreakpoints())
            {
                AddBreakpoint(bp);
            }
        }
Exemple #2
0
 AutoShowDebuggerWindowsLoader(IDebuggerSettings debuggerSettings, ITheDebugger theDebugger, IDsToolWindowService toolWindowService)
 {
     this.debuggerSettings              = debuggerSettings;
     this.theDebugger                   = theDebugger;
     this.toolWindowService             = toolWindowService;
     theDebugger.OnProcessStateChanged += TheDebugger_OnProcessStateChanged;
 }
Exemple #3
0
		TheDebugger(IDebuggerSettings debuggerSettings, [ImportMany] IEnumerable<Lazy<ILoadBeforeDebug>> loadBeforeDebugInsts) {
			this.debuggerSettings = debuggerSettings;
			dispatcher = Dispatcher.CurrentDispatcher;
			this.loadBeforeDebugInsts = loadBeforeDebugInsts.ToArray();
			debuggedProcessRunningNotifier = new DebuggedProcessRunningNotifier(this);
			debuggedProcessRunningNotifier.ProcessRunning += DebuggedProcessRunningNotifier_ProcessRunning;
		}
Exemple #4
0
 BreakpointsVM(ILanguageManager languageManager, IImageManager imageManager, IThemeManager themeManager, IDebuggerSettings debuggerSettings, ITheDebugger theDebugger, IBreakpointManager breakpointManager, IBreakpointSettings breakpointSettings, Lazy<IModuleLoader> moduleLoader, IInMemoryModuleManager inMemoryModuleManager)
 {
     this.breakpointContext = new BreakpointContext(imageManager, moduleLoader) {
         Language = languageManager.Language,
         SyntaxHighlight = debuggerSettings.SyntaxHighlightBreakpoints,
         UseHexadecimal = debuggerSettings.UseHexadecimal,
         ShowTokens = breakpointSettings.ShowTokens,
         ShowModuleNames = breakpointSettings.ShowModuleNames,
         ShowParameterTypes = breakpointSettings.ShowParameterTypes,
         ShowParameterNames = breakpointSettings.ShowParameterNames,
         ShowOwnerTypes = breakpointSettings.ShowOwnerTypes,
         ShowReturnTypes = breakpointSettings.ShowReturnTypes,
         ShowNamespaces = breakpointSettings.ShowNamespaces,
         ShowTypeKeywords = breakpointSettings.ShowTypeKeywords,
     };
     this.breakpointManager = breakpointManager;
     this.theDebugger = theDebugger;
     this.breakpointList = new ObservableCollection<BreakpointVM>();
     breakpointSettings.PropertyChanged += BreakpointSettings_PropertyChanged;
     breakpointManager.OnListModified += BreakpointManager_OnListModified;
     debuggerSettings.PropertyChanged += DebuggerSettings_PropertyChanged;
     theDebugger.OnProcessStateChanged += TheDebugger_OnProcessStateChanged;
     themeManager.ThemeChanged += ThemeManager_ThemeChanged;
     languageManager.LanguageChanged += LanguageManager_LanguageChanged;
     inMemoryModuleManager.DynamicModulesLoaded += InMemoryModuleManager_DynamicModulesLoaded;
     foreach (var bp in breakpointManager.Breakpoints)
         AddBreakpoint(bp);
 }
Exemple #5
0
 public static void Launch(this IDebuggerRunner runner, IDebuggerSettings settings, bool stopAtEntry, string program, params string[] args)
 {
     runner.RunCommand(new LaunchCommand(settings, program, false, args)
     {
         StopAtEntry = stopAtEntry
     });
 }
Exemple #6
0
        private static string GetObjectValue(IDebuggerSettings debuggerSettings, params string[] properties)
        {
            if (properties.Length % 2 != 0)
            {
                throw new ArgumentException("Missing a property!");
            }

            switch (debuggerSettings.DebuggerType)
            {
            case SupportedDebugger.Gdb_Gnu:
            case SupportedDebugger.Gdb_Cygwin:
            case SupportedDebugger.Gdb_MinGW:
            case SupportedDebugger.Lldb:
                return("{...}");

            case SupportedDebugger.VsDbg:
                StringBuilder sb = new StringBuilder("{");

                for (int i = 0; i < properties.Length; i += 2)
                {
                    string name  = properties[i];
                    string value = properties[i + 1];
                    sb.Append(name);
                    sb.Append("=");
                    sb.Append(value);
                    sb.Append(" ");
                }
                sb.Append("}");
                return(sb.ToString());

            default:
                Assert.True(false, "This debugger type doesn't have an object format.");
                return(null);
            }
        }
Exemple #7
0
        private static string GetIntArray(IDebuggerSettings debuggerSettings, params int[] value)
        {
            switch (debuggerSettings.DebuggerType)
            {
            case SupportedDebugger.Gdb_Gnu:
            case SupportedDebugger.Gdb_Cygwin:
            case SupportedDebugger.Gdb_MinGW:
            case SupportedDebugger.Lldb:
                return("[{0}]".FormatInvariantWithArgs(value.Length));

            case SupportedDebugger.VsDbg:
                StringBuilder sb = new StringBuilder("{");
                for (int i = 0; i < value.Length; i++)
                {
                    if (i != 0)
                    {
                        sb.Append(", ");
                    }
                    sb.Append(value[i]);
                }
                sb.Append("}");
                return(sb.ToString());

            default:
                Assert.True(false, "This debugger type doesn't have an object format.");
                return(null);
            }
        }
Exemple #8
0
 ModuleLoader(Lazy<ITheDebugger> theDebugger, IDebuggerSettings debuggerSettings, IFileManager fileManager, Lazy<IInMemoryModuleManager> inMemoryModuleManager)
 {
     this.theDebugger = theDebugger;
     this.debuggerSettings = debuggerSettings;
     this.fileManager = fileManager;
     this.inMemoryModuleManager = inMemoryModuleManager;
 }
Exemple #9
0
        LocalsVM(IImageManager imageManager, IDebuggerSettings debuggerSettings, ILocalsSettings localsSettings, IMethodLocalProvider methodLocalProvider, IStackFrameManager stackFrameManager, ITheDebugger theDebugger, IAskUser askUser)
        {
            this.dispatcher          = Dispatcher.CurrentDispatcher;
            this.askUser             = askUser;
            this.methodLocalProvider = methodLocalProvider;
            this.debuggerSettings    = debuggerSettings;
            this.stackFrameManager   = stackFrameManager;
            this.theDebugger         = theDebugger;

            this.printerContext = new PrinterContext(imageManager)
            {
                SyntaxHighlight  = debuggerSettings.SyntaxHighlightLocals,
                UseHexadecimal   = debuggerSettings.UseHexadecimal,
                TypePrinterFlags = TypePrinterFlags.ShowArrayValueSizes,
            };
            this.printerContext.TypePrinterFlags = GetTypePrinterFlags(localsSettings, this.printerContext.TypePrinterFlags);
            this.printerContext.TypePrinterFlags = GetTypePrinterFlags(debuggerSettings, this.printerContext.TypePrinterFlags);

            methodLocalProvider.NewMethodInfoAvailable += MethodLocalProvider_NewMethodInfoAvailable;
            this.rootNode = new SharpTreeNode();
            stackFrameManager.StackFramesUpdated += StackFrameManager_StackFramesUpdated;
            stackFrameManager.PropertyChanged    += StackFrameManager_PropertyChanged;
            theDebugger.OnProcessStateChanged    += TheDebugger_OnProcessStateChanged;
            theDebugger.ProcessRunning           += TheDebugger_ProcessRunning;
            debuggerSettings.PropertyChanged     += DebuggerSettings_PropertyChanged;
            localsSettings.PropertyChanged       += LocalsSettings_PropertyChanged;
        }
Exemple #10
0
        public AttachCommand(IDebuggerSettings settings, Process process)
        {
            this.Timeout = TimeSpan.FromSeconds(15);

            this.Args.processId        = process.Id;
            this.Args.name             = CreateName(settings);
            this.Args.program          = process.StartInfo.FileName;
            this.Args.args             = new string[] { };
            this.Args.request          = "attach";
            this.Args.environment      = new EnvironmentEntry[] { };
            this.Args.launchOptionType = "Local";
            this.Args.sourceFileMap    = new Dictionary <string, string>();

            if (settings.DebuggerType == SupportedDebugger.VsDbg)
            {
                this.Args.type = "cppvsdbg";
            }
            else
            {
                this.Args.stopAtEntry        = false;
                this.Args.cwd                = Path.GetDirectoryName(process.StartInfo.FileName);
                this.Args.type               = "cppdbg";
                this.Args.miDebuggerPath     = settings.DebuggerPath;
                this.Args.targetArchitecture = settings.DebuggeeArchitecture.ToArchitectureString();
                this.Args.noDebug            = false;
                this.Args.coreDumpPath       = null;
                this.Args.MIMode             = settings.MIMode;
            }
        }
Exemple #11
0
		ModuleLoader(Lazy<ITheDebugger> theDebugger, IDebuggerSettings debuggerSettings, IDsDocumentService documentService, Lazy<IInMemoryModuleService> inMemoryModuleService, IModuleIdProvider moduleIdProvider) {
			this.theDebugger = theDebugger;
			this.debuggerSettings = debuggerSettings;
			this.documentService = documentService;
			this.inMemoryModuleService = inMemoryModuleService;
			this.moduleIdProvider = moduleIdProvider;
		}
Exemple #12
0
        LocalsVM(IDebuggerSettings debuggerSettings, ILocalsSettings localsSettings, IMethodLocalProvider methodLocalProvider, IStackFrameService stackFrameService, ITheDebugger theDebugger, IAskUser askUser, IClassificationFormatMapService classificationFormatMapService, ITextElementProvider textElementProvider)
        {
            dispatcher               = Dispatcher.CurrentDispatcher;
            this.askUser             = askUser;
            this.methodLocalProvider = methodLocalProvider;
            this.debuggerSettings    = debuggerSettings;
            this.stackFrameService   = stackFrameService;
            TheDebugger              = theDebugger;

            var classificationFormatMap = classificationFormatMapService.GetClassificationFormatMap(AppearanceCategoryConstants.UIMisc);

            printerContext = new PrinterContext(classificationFormatMap, textElementProvider)
            {
                SyntaxHighlight  = debuggerSettings.SyntaxHighlightLocals,
                UseHexadecimal   = debuggerSettings.UseHexadecimal,
                TypePrinterFlags = TypePrinterFlags.ShowArrayValueSizes,
            };
            printerContext.TypePrinterFlags = GetTypePrinterFlags(localsSettings, printerContext.TypePrinterFlags);
            printerContext.TypePrinterFlags = GetTypePrinterFlags(debuggerSettings, printerContext.TypePrinterFlags);

            methodLocalProvider.NewMethodInfoAvailable += MethodLocalProvider_NewMethodInfoAvailable;
            Root = new SharpTreeNode();
            stackFrameService.StackFramesUpdated += StackFrameService_StackFramesUpdated;
            stackFrameService.PropertyChanged    += StackFrameService_PropertyChanged;
            theDebugger.OnProcessStateChanged    += TheDebugger_OnProcessStateChanged;
            theDebugger.ProcessRunning           += TheDebugger_ProcessRunning;
            debuggerSettings.PropertyChanged     += DebuggerSettings_PropertyChanged;
            localsSettings.PropertyChanged       += LocalsSettings_PropertyChanged;
            classificationFormatMap.ClassificationFormatMappingChanged += ClassificationFormatMap_ClassificationFormatMappingChanged;
        }
Exemple #13
0
		BreakpointsVM(IDecompilerService decompilerService, IDebuggerSettings debuggerSettings, ITheDebugger theDebugger, IBreakpointService breakpointService, IBreakpointSettings breakpointSettings, Lazy<IModuleLoader> moduleLoader, IInMemoryModuleService inMemoryModuleService, IClassificationFormatMapService classificationFormatMapService, ITextElementProvider textElementProvider) {
			var classificationFormatMap = classificationFormatMapService.GetClassificationFormatMap(AppearanceCategoryConstants.UIMisc);
			breakpointContext = new BreakpointContext(moduleLoader, classificationFormatMap, textElementProvider) {
				Decompiler = decompilerService.Decompiler,
				SyntaxHighlight = debuggerSettings.SyntaxHighlightBreakpoints,
				UseHexadecimal = debuggerSettings.UseHexadecimal,
				ShowTokens = breakpointSettings.ShowTokens,
				ShowModuleNames = breakpointSettings.ShowModuleNames,
				ShowParameterTypes = breakpointSettings.ShowParameterTypes,
				ShowParameterNames = breakpointSettings.ShowParameterNames,
				ShowOwnerTypes = breakpointSettings.ShowOwnerTypes,
				ShowReturnTypes = breakpointSettings.ShowReturnTypes,
				ShowNamespaces = breakpointSettings.ShowNamespaces,
				ShowTypeKeywords = breakpointSettings.ShowTypeKeywords,
			};
			this.breakpointService = breakpointService;
			this.theDebugger = theDebugger;
			breakpointList = new ObservableCollection<BreakpointVM>();
			breakpointSettings.PropertyChanged += BreakpointSettings_PropertyChanged;
			breakpointService.BreakpointsAdded += BreakpointService_BreakpointsAdded;
			breakpointService.BreakpointsRemoved += BreakpointService_BreakpointsRemoved;
			debuggerSettings.PropertyChanged += DebuggerSettings_PropertyChanged;
			theDebugger.OnProcessStateChanged += TheDebugger_OnProcessStateChanged;
			classificationFormatMap.ClassificationFormatMappingChanged += ClassificationFormatMap_ClassificationFormatMappingChanged;
			decompilerService.DecompilerChanged += DecompilerService_DecompilerChanged;
			inMemoryModuleService.DynamicModulesLoaded += InMemoryModuleService_DynamicModulesLoaded;
			foreach (var bp in breakpointService.GetBreakpoints())
				AddBreakpoint(bp);
		}
Exemple #14
0
 ModuleLoader(Lazy <ITheDebugger> theDebugger, IDebuggerSettings debuggerSettings, IFileManager fileManager, Lazy <IInMemoryModuleManager> inMemoryModuleManager)
 {
     this.theDebugger           = theDebugger;
     this.debuggerSettings      = debuggerSettings;
     this.fileManager           = fileManager;
     this.inMemoryModuleManager = inMemoryModuleManager;
 }
Exemple #15
0
 AutoShowDebuggerWindowsLoader(IDebuggerSettings debuggerSettings, ITheDebugger theDebugger, IMainToolWindowManager mainToolWindowManager)
 {
     this.debuggerSettings              = debuggerSettings;
     this.theDebugger                   = theDebugger;
     this.mainToolWindowManager         = mainToolWindowManager;
     theDebugger.OnProcessStateChanged += TheDebugger_OnProcessStateChanged;
 }
Exemple #16
0
 public ThreadContext(ITheDebugger theDebugger, IDebuggerSettings debuggerSettings, IClassificationFormatMap classificationFormatMap, ITextElementProvider textElementProvider)
 {
     TheDebugger             = theDebugger;
     DebuggerSettings        = debuggerSettings;
     ClassificationFormatMap = classificationFormatMap;
     TextElementProvider     = textElementProvider;
 }
Exemple #17
0
        /// <summary>
        /// Launches a new process and attaches to it
        /// </summary>
        /// <param name="program">The full path to the program to launch</param>
        /// <param name="architecture">The architecture of the program</param>
        /// <param name="args">[OPTIONAL] Args to pass to the program</param>
        public LaunchCommand(IDebuggerSettings settings, string program, bool isAttach = false, params string[] args)
        {
            this.Timeout = TimeSpan.FromSeconds(15);

            this.Args.name             = CreateName(settings);
            this.Args.program          = program;
            this.Args.args             = args ?? new string[] { };
            this.Args.request          = "launch";
            this.Args.cwd              = Path.GetDirectoryName(program);
            this.Args.environment      = new EnvironmentEntry[] { };
            this.Args.launchOptionType = "Local";
            this.Args.symbolSearchPath = String.Empty;
            this.Args.sourceFileMap    = new Dictionary <string, string>();

            if (settings.DebuggerType == SupportedDebugger.VsDbg)
            {
                this.Args.type = "cppvsdbg";
            }
            else
            {
                this.Args.type               = "cppdbg";
                this.Args.miDebuggerPath     = settings.DebuggerPath;
                this.Args.targetArchitecture = settings.DebuggeeArchitecture.ToArchitectureString();
                this.Args.MIMode             = settings.MIMode;
            }
        }
Exemple #18
0
 ModuleLoader(Lazy <ITheDebugger> theDebugger, IDebuggerSettings debuggerSettings, IDsDocumentService documentService, Lazy <IInMemoryModuleService> inMemoryModuleService, IModuleIdProvider moduleIdProvider)
 {
     this.theDebugger           = theDebugger;
     this.debuggerSettings      = debuggerSettings;
     this.documentService       = documentService;
     this.inMemoryModuleService = inMemoryModuleService;
     this.moduleIdProvider      = moduleIdProvider;
 }
Exemple #19
0
 TheDebugger(IDebuggerSettings debuggerSettings, [ImportMany] IEnumerable <Lazy <ILoadBeforeDebug> > loadBeforeDebugInsts)
 {
     this.debuggerSettings          = debuggerSettings;
     this.dispatcher                = Dispatcher.CurrentDispatcher;
     this.loadBeforeDebugInsts      = loadBeforeDebugInsts.ToArray();
     debuggedProcessRunningNotifier = new DebuggedProcessRunningNotifier(this);
     debuggedProcessRunningNotifier.ProcessRunning += DebuggedProcessRunningNotifier_ProcessRunning;
 }
Exemple #20
0
		public static DBG.AttachProcessOptions Convert(AttachOptions options, IDebuggerSettings settings, string debuggeeVersion = null) {
			if (options == null)
				throw new ArgumentNullException();
			var o = new DBG.AttachProcessOptions(new DBG.DesktopCLRTypeAttachInfo(debuggeeVersion));
			o.ProcessId = options.ProcessId;
			o.DebugMessageDispatcher = WpfDebugMessageDispatcher.Instance;
			o.DebugOptions.IgnoreBreakInstructions = settings.IgnoreBreakInstructions;
			return o;
		}
Exemple #21
0
		public static DBG.DebugProcessOptions Convert(DebugOptions options, IDebuggerSettings settings, DBG.CLRTypeDebugInfo info) {
			if (options == null)
				throw new ArgumentNullException();
			var o = new DBG.DebugProcessOptions(info);
			o.Filename = options.Filename;
			o.CommandLine = options.CommandLine;
			o.CurrentDirectory = options.CurrentDirectory;
			o.DebugMessageDispatcher = WpfDebugMessageDispatcher.Instance;
			o.BreakProcessKind = Convert(options.BreakProcessKind);
			o.DebugOptions.IgnoreBreakInstructions = settings.IgnoreBreakInstructions;
			return o;
		}
Exemple #22
0
		ModulesVM(ITheDebugger theDebugger, IDebuggerSettings debuggerSettings, IImageManager imageManager) {
			this.theDebugger = theDebugger;
			this.moduleContext = new ModuleContext(imageManager, theDebugger) {
				SyntaxHighlight = debuggerSettings.SyntaxHighlightModules,
				UseHexadecimal = debuggerSettings.UseHexadecimal,
			};
			this.modulesList = new ObservableCollection<ModuleVM>();
			theDebugger.OnProcessStateChanged += TheDebugger_OnProcessStateChanged;
			debuggerSettings.PropertyChanged += DebuggerSettings_PropertyChanged;
			if (theDebugger.ProcessState != DebuggerProcessState.Terminated)
				InstallDebuggerHooks(theDebugger.Debugger);
		}
Exemple #23
0
        public static DBG.AttachProcessOptions Convert(AttachOptions options, IDebuggerSettings settings, string debuggeeVersion = null)
        {
            if (options == null)
            {
                throw new ArgumentNullException();
            }
            var o = new DBG.AttachProcessOptions(new DBG.DesktopCLRTypeAttachInfo(debuggeeVersion));

            o.ProcessId = options.ProcessId;
            o.DebugMessageDispatcher = WpfDebugMessageDispatcher.Instance;
            o.DebugOptions.IgnoreBreakInstructions = settings.IgnoreBreakInstructions;
            return(o);
        }
Exemple #24
0
		ModulesVM(ITheDebugger theDebugger, IDebuggerSettings debuggerSettings, IClassificationFormatMapService classificationFormatMapService, ITextElementProvider textElementProvider) {
			var classificationFormatMap = classificationFormatMapService.GetClassificationFormatMap(AppearanceCategoryConstants.UIMisc);
			this.theDebugger = theDebugger;
			moduleContext = new ModuleContext(theDebugger, classificationFormatMap, textElementProvider) {
				SyntaxHighlight = debuggerSettings.SyntaxHighlightModules,
				UseHexadecimal = debuggerSettings.UseHexadecimal,
			};
			modulesList = new ObservableCollection<ModuleVM>();
			theDebugger.OnProcessStateChanged += TheDebugger_OnProcessStateChanged;
			debuggerSettings.PropertyChanged += DebuggerSettings_PropertyChanged;
			classificationFormatMap.ClassificationFormatMappingChanged += ClassificationFormatMap_ClassificationFormatMappingChanged;
			if (theDebugger.ProcessState != DebuggerProcessState.Terminated)
				InstallDebuggerHooks(theDebugger.Debugger);
		}
Exemple #25
0
		ThreadsVM(ITheDebugger theDebugger, IStackFrameManager stackFrameManager, IDebuggerSettings debuggerSettings, IImageManager imageManager) {
			this.theDebugger = theDebugger;
			this.stackFrameManager = stackFrameManager;
			this.threadContext = new ThreadContext(imageManager, theDebugger, debuggerSettings) {
				SyntaxHighlight = debuggerSettings.SyntaxHighlightThreads,
				UseHexadecimal = debuggerSettings.UseHexadecimal,
			};
			this.threadsList = new ObservableCollection<ThreadVM>();
			stackFrameManager.StackFramesUpdated += StackFrameManager_StackFramesUpdated;
			stackFrameManager.PropertyChanged += StackFrameManager_PropertyChanged;
			theDebugger.OnProcessStateChanged += TheDebugger_OnProcessStateChanged;
			debuggerSettings.PropertyChanged += DebuggerSettings_PropertyChanged;
			theDebugger.ProcessRunning += TheDebugger_ProcessRunning;
		}
Exemple #26
0
		ThreadsVM(ITheDebugger theDebugger, IStackFrameService stackFrameService, IDebuggerSettings debuggerSettings, IClassificationFormatMapService classificationFormatMapService, ITextElementProvider textElementProvider) {
			this.theDebugger = theDebugger;
			this.stackFrameService = stackFrameService;
			var classificationFormatMap = classificationFormatMapService.GetClassificationFormatMap(AppearanceCategoryConstants.UIMisc);
			threadContext = new ThreadContext(theDebugger, debuggerSettings, classificationFormatMap, textElementProvider) {
				SyntaxHighlight = debuggerSettings.SyntaxHighlightThreads,
				UseHexadecimal = debuggerSettings.UseHexadecimal,
			};
			threadsList = new ObservableCollection<ThreadVM>();
			stackFrameService.StackFramesUpdated += StackFrameService_StackFramesUpdated;
			stackFrameService.PropertyChanged += StackFrameService_PropertyChanged;
			theDebugger.OnProcessStateChanged += TheDebugger_OnProcessStateChanged;
			debuggerSettings.PropertyChanged += DebuggerSettings_PropertyChanged;
			theDebugger.ProcessRunning += TheDebugger_ProcessRunning;
			classificationFormatMap.ClassificationFormatMappingChanged += ClassificationFormatMap_ClassificationFormatMappingChanged;
		}
Exemple #27
0
 ExceptionsVM(IDebuggerSettings debuggerSettings, IExceptionManager exceptionManager, IExceptionListSettings exceptionListSettings, IGetNewExceptionName getNewExceptionName)
 {
     this.debuggerSettings      = debuggerSettings;
     this.exceptionManager      = exceptionManager;
     this.exceptionListSettings = exceptionListSettings;
     this.getNewExceptionName   = getNewExceptionName;
     this.exceptionContext      = new ExceptionContext(exceptionManager)
     {
         SyntaxHighlight = debuggerSettings.SyntaxHighlightExceptions,
     };
     this.exceptionsList = new ObservableCollection <ExceptionVM>();
     this.CollectionView = CollectionViewSource.GetDefaultView(exceptionsList);
     debuggerSettings.PropertyChanged += DebuggerSettings_PropertyChanged;
     exceptionManager.Changed         += ExceptionManager_Changed;
     InitializeDefaultExceptions();
 }
Exemple #28
0
 ModulesVM(ITheDebugger theDebugger, IDebuggerSettings debuggerSettings, IImageManager imageManager)
 {
     this.theDebugger   = theDebugger;
     this.moduleContext = new ModuleContext(imageManager, theDebugger)
     {
         SyntaxHighlight = debuggerSettings.SyntaxHighlightModules,
         UseHexadecimal  = debuggerSettings.UseHexadecimal,
     };
     this.modulesList = new ObservableCollection <ModuleVM>();
     theDebugger.OnProcessStateChanged += TheDebugger_OnProcessStateChanged;
     debuggerSettings.PropertyChanged  += DebuggerSettings_PropertyChanged;
     if (theDebugger.ProcessState != DebuggerProcessState.Terminated)
     {
         InstallDebuggerHooks(theDebugger.Debugger);
     }
 }
Exemple #29
0
        public static DBG.DebugProcessOptions Convert(DebugOptions options, IDebuggerSettings settings, DBG.CLRTypeDebugInfo info)
        {
            if (options == null)
            {
                throw new ArgumentNullException();
            }
            var o = new DBG.DebugProcessOptions(info);

            o.Filename               = options.Filename;
            o.CommandLine            = options.CommandLine;
            o.CurrentDirectory       = options.CurrentDirectory;
            o.DebugMessageDispatcher = WpfDebugMessageDispatcher.Instance;
            o.BreakProcessKind       = Convert(options.BreakProcessKind);
            o.DebugOptions.IgnoreBreakInstructions = settings.IgnoreBreakInstructions;
            return(o);
        }
Exemple #30
0
 ThreadsVM(ITheDebugger theDebugger, IStackFrameService stackFrameService, IDebuggerSettings debuggerSettings)
 {
     this.theDebugger       = theDebugger;
     this.stackFrameService = stackFrameService;
     this.threadContext     = new ThreadContext(theDebugger, debuggerSettings)
     {
         SyntaxHighlight = debuggerSettings.SyntaxHighlightThreads,
         UseHexadecimal  = debuggerSettings.UseHexadecimal,
     };
     this.threadsList = new ObservableCollection <ThreadVM>();
     stackFrameService.StackFramesUpdated += StackFrameService_StackFramesUpdated;
     stackFrameService.PropertyChanged    += StackFrameService_PropertyChanged;
     theDebugger.OnProcessStateChanged    += TheDebugger_OnProcessStateChanged;
     debuggerSettings.PropertyChanged     += DebuggerSettings_PropertyChanged;
     theDebugger.ProcessRunning           += TheDebugger_ProcessRunning;
 }
Exemple #31
0
        CallStackVM(IDebuggerSettings debuggerSettings, ICallStackSettings callStackSettings, IStackFrameManager stackFrameManager, ITheDebugger theDebugger, IImageManager imageManager)
        {
            this.debuggerSettings = debuggerSettings;
            this.callStackSettings = callStackSettings;
            this.theDebugger = theDebugger;
            this.stackFrameManager = stackFrameManager;
            this.framesList = new ObservableCollection<ICallStackFrameVM>();
            this.callStackFrameContext = new CallStackFrameContext(imageManager) {
                TypePrinterFlags = TypePrinterFlags,
                SyntaxHighlight = debuggerSettings.SyntaxHighlightCallStack,
            };

            stackFrameManager.StackFramesUpdated += StackFrameManager_StackFramesUpdated;
            stackFrameManager.PropertyChanged += StackFrameManager_PropertyChanged;
            callStackSettings.PropertyChanged += CallStackSettings_PropertyChanged;
            debuggerSettings.PropertyChanged += DebuggerSettings_PropertyChanged;
            theDebugger.ProcessRunning += TheDebugger_ProcessRunning;
        }
Exemple #32
0
        ThreadsVM(ITheDebugger theDebugger, IStackFrameService stackFrameService, IDebuggerSettings debuggerSettings, IClassificationFormatMapService classificationFormatMapService, ITextElementProvider textElementProvider)
        {
            this.theDebugger       = theDebugger;
            this.stackFrameService = stackFrameService;
            var classificationFormatMap = classificationFormatMapService.GetClassificationFormatMap(AppearanceCategoryConstants.UIMisc);

            threadContext = new ThreadContext(theDebugger, debuggerSettings, classificationFormatMap, textElementProvider)
            {
                SyntaxHighlight = debuggerSettings.SyntaxHighlightThreads,
                UseHexadecimal  = debuggerSettings.UseHexadecimal,
            };
            threadsList = new ObservableCollection <ThreadVM>();
            stackFrameService.StackFramesUpdated += StackFrameService_StackFramesUpdated;
            stackFrameService.PropertyChanged    += StackFrameService_PropertyChanged;
            theDebugger.OnProcessStateChanged    += TheDebugger_OnProcessStateChanged;
            debuggerSettings.PropertyChanged     += DebuggerSettings_PropertyChanged;
            theDebugger.ProcessRunning           += TheDebugger_ProcessRunning;
            classificationFormatMap.ClassificationFormatMappingChanged += ClassificationFormatMap_ClassificationFormatMappingChanged;
        }
Exemple #33
0
        CallStackVM(IDebuggerSettings debuggerSettings, ICallStackSettings callStackSettings, IStackFrameManager stackFrameManager, ITheDebugger theDebugger, IImageManager imageManager)
        {
            this.debuggerSettings      = debuggerSettings;
            this.callStackSettings     = callStackSettings;
            this.theDebugger           = theDebugger;
            this.stackFrameManager     = stackFrameManager;
            this.framesList            = new ObservableCollection <ICallStackFrameVM>();
            this.callStackFrameContext = new CallStackFrameContext(imageManager)
            {
                TypePrinterFlags = TypePrinterFlags,
                SyntaxHighlight  = debuggerSettings.SyntaxHighlightCallStack,
            };

            stackFrameManager.StackFramesUpdated += StackFrameManager_StackFramesUpdated;
            stackFrameManager.PropertyChanged    += StackFrameManager_PropertyChanged;
            callStackSettings.PropertyChanged    += CallStackSettings_PropertyChanged;
            debuggerSettings.PropertyChanged     += DebuggerSettings_PropertyChanged;
            theDebugger.ProcessRunning           += TheDebugger_ProcessRunning;
        }
Exemple #34
0
        ModulesVM(ITheDebugger theDebugger, IDebuggerSettings debuggerSettings, IClassificationFormatMapService classificationFormatMapService, ITextElementProvider textElementProvider)
        {
            var classificationFormatMap = classificationFormatMapService.GetClassificationFormatMap(AppearanceCategoryConstants.ModulesWindow);

            this.theDebugger   = theDebugger;
            this.moduleContext = new ModuleContext(theDebugger, classificationFormatMap, textElementProvider)
            {
                SyntaxHighlight = debuggerSettings.SyntaxHighlightModules,
                UseHexadecimal  = debuggerSettings.UseHexadecimal,
            };
            this.modulesList = new ObservableCollection <ModuleVM>();
            theDebugger.OnProcessStateChanged += TheDebugger_OnProcessStateChanged;
            debuggerSettings.PropertyChanged  += DebuggerSettings_PropertyChanged;
            classificationFormatMap.ClassificationFormatMappingChanged += ClassificationFormatMap_ClassificationFormatMappingChanged;
            if (theDebugger.ProcessState != DebuggerProcessState.Terminated)
            {
                InstallDebuggerHooks(theDebugger.Debugger);
            }
        }
Exemple #35
0
        private static string GetCharValue(IDebuggerSettings debuggerSettings, char value)
        {
            // Non-printable chars
            if (value < ' ')
            {
                switch (debuggerSettings.DebuggerType)
                {
                case SupportedDebugger.Gdb_Gnu:
                case SupportedDebugger.Gdb_Cygwin:
                case SupportedDebugger.Gdb_MinGW:
                    // 0 '\000'
                    return(@"{0} '\{0:D3}'".FormatInvariantWithArgs((int)value));

                case SupportedDebugger.Lldb:
                case SupportedDebugger.VsDbg:
                    // 0 '\0'
                    return(@"{0} '\{0}'".FormatInvariantWithArgs((int)value));

                default:
                    Assert.True(false, "Debugger type doesn't have a specification for char value");
                    return(null);
                }
            }

            // Printable chars
            switch (debuggerSettings.DebuggerType)
            {
            case SupportedDebugger.Gdb_Gnu:
            case SupportedDebugger.Gdb_Cygwin:
            case SupportedDebugger.Gdb_MinGW:
                return(EscapeIfNeeded(c => c == '\'', value));

            case SupportedDebugger.VsDbg:
                return(EscapeIfNeeded(c => c == '"', value));

            case SupportedDebugger.Lldb:
                return("{0} '{1}'".FormatInvariantWithArgs((int)value, value));

            default:
                Assert.True(false, "Debugger type doesn't have a specification for char value");
                return(null);
            }
        }
Exemple #36
0
        ExceptionsVM(IDebuggerSettings debuggerSettings, IExceptionService exceptionService, IExceptionListSettings exceptionListSettings, IGetNewExceptionName getNewExceptionName, IClassificationFormatMapService classificationFormatMapService, ITextElementProvider textElementProvider)
        {
            var classificationFormatMap = classificationFormatMapService.GetClassificationFormatMap(AppearanceCategoryConstants.UIMisc);

            this.debuggerSettings      = debuggerSettings;
            this.exceptionService      = exceptionService;
            this.exceptionListSettings = exceptionListSettings;
            this.getNewExceptionName   = getNewExceptionName;
            exceptionContext           = new ExceptionContext(exceptionService, classificationFormatMap, textElementProvider)
            {
                SyntaxHighlight = debuggerSettings.SyntaxHighlightExceptions,
            };
            exceptionsList = new ObservableCollection <ExceptionVM>();
            CollectionView = CollectionViewSource.GetDefaultView(exceptionsList);
            debuggerSettings.PropertyChanged += DebuggerSettings_PropertyChanged;
            exceptionService.Changed         += ExceptionService_Changed;
            classificationFormatMap.ClassificationFormatMappingChanged += ClassificationFormatMap_ClassificationFormatMappingChanged;
            InitializeDefaultExceptions();
        }
Exemple #37
0
        private static string GetVectorValue(IDebuggerSettings debuggerSettings, int vectorCount)
        {
            switch (debuggerSettings.DebuggerType)
            {
            case SupportedDebugger.Gdb_Gnu:
            case SupportedDebugger.Gdb_Cygwin:
            case SupportedDebugger.Gdb_MinGW:
                return("{...}");

            case SupportedDebugger.VsDbg:
                return("{{ size={0} }}".FormatInvariantWithArgs(vectorCount));

            case SupportedDebugger.Lldb:
                return("size={0}".FormatInvariantWithArgs(vectorCount));

            default:
                Assert.True(false, "This debugger type doesn't have a vector format.");
                return(null);
            }
        }
Exemple #38
0
        private static string GetWCharValue(IDebuggerSettings debuggerSettings, char value)
        {
            switch (debuggerSettings.DebuggerType)
            {
            case SupportedDebugger.Gdb_Gnu:
            case SupportedDebugger.Gdb_Cygwin:
            case SupportedDebugger.Gdb_MinGW:
                return("{0} L'{1}'".FormatInvariantWithArgs((int)value, value));

            case SupportedDebugger.Lldb:
                return("L'{0}'".FormatInvariantWithArgs(value));

            case SupportedDebugger.VsDbg:
                return("{0} '{1}'".FormatInvariantWithArgs((int)value, value));

            default:
                Assert.True(false, "Debugger type doesn't have a specification for wchar value");
                return(null);
            }
        }
Exemple #39
0
        private static string GetUndefinedError(IDebuggerSettings debuggerSettings, string variableName)
        {
            switch (debuggerSettings.DebuggerType)
            {
            case SupportedDebugger.Gdb_Gnu:
            case SupportedDebugger.Gdb_Cygwin:
            case SupportedDebugger.Gdb_MinGW:
                return("-var-create: unable to create variable object");

            case SupportedDebugger.Lldb:
                return("error: error: use of undeclared identifier '{0}'".FormatInvariantWithArgs(variableName));

            case SupportedDebugger.VsDbg:
                return(@"identifier ""{0}"" is undefined".FormatInvariantWithArgs(variableName));

            default:
                Assert.True(false, "This debugger type doesn't have a error message test.");
                return(null);
            }
        }
Exemple #40
0
        private static string GetDoubleValue(IDebuggerSettings debuggerSettings, double value)
        {
            if (double.IsPositiveInfinity(value))
            {
                switch (debuggerSettings.DebuggerType)
                {
                case SupportedDebugger.Gdb_Gnu:
                case SupportedDebugger.Gdb_Cygwin:
                case SupportedDebugger.Gdb_MinGW:
                case SupportedDebugger.VsDbg:
                    return("inf");

                case SupportedDebugger.Lldb:
                    return("+Inf");

                default:
                    Assert.True(false, "Debugger type doesn't have a specification for double value");
                    return(null);
                }
            }

            switch (debuggerSettings.DebuggerType)
            {
            case SupportedDebugger.Gdb_Gnu:
            case SupportedDebugger.Gdb_Cygwin:
            case SupportedDebugger.Gdb_MinGW:
            case SupportedDebugger.Lldb:
                //10.1
                //0
                return(value.ToString("R", CultureInfo.InvariantCulture));

            case SupportedDebugger.VsDbg:
                //10.100000000000000
                //0.00000000000000000
                return(value.ToString("G10", CultureInfo.InvariantCulture));

            default:
                Assert.True(false, "Debugger type doesn't have a specification for double value");
                return(null);
            }
        }
Exemple #41
0
        CallStackVM(IDebuggerSettings debuggerSettings, ICallStackSettings callStackSettings, IStackFrameService stackFrameService, ITheDebugger theDebugger, IClassificationFormatMapService classificationFormatMapService, ITextElementProvider textElementProvider)
        {
            var classificationFormatMap = classificationFormatMapService.GetClassificationFormatMap(AppearanceCategoryConstants.UIMisc);

            this.debuggerSettings  = debuggerSettings;
            this.callStackSettings = callStackSettings;
            this.theDebugger       = theDebugger;
            this.stackFrameService = stackFrameService;
            framesList             = new ObservableCollection <ICallStackFrameVM>();
            callStackFrameContext  = new CallStackFrameContext(classificationFormatMap, textElementProvider)
            {
                TypePrinterFlags = TypePrinterFlags,
                SyntaxHighlight  = debuggerSettings.SyntaxHighlightCallStack,
            };

            stackFrameService.StackFramesUpdated += StackFrameService_StackFramesUpdated;
            stackFrameService.PropertyChanged    += StackFrameService_PropertyChanged;
            callStackSettings.PropertyChanged    += CallStackSettings_PropertyChanged;
            debuggerSettings.PropertyChanged     += DebuggerSettings_PropertyChanged;
            theDebugger.ProcessRunning           += TheDebugger_ProcessRunning;
            classificationFormatMap.ClassificationFormatMappingChanged += ClassificationFormatMap_ClassificationFormatMappingChanged;
        }
Exemple #42
0
		DebugService(IAppWindow appWindow, IDocumentTabService documentTabService, IMessageBoxService messageBoxService, IDebuggerSettings debuggerSettings, ITheDebugger theDebugger, IStackFrameService stackFrameService, Lazy<IModuleLoader> moduleLoader, Lazy<IInMemoryModuleService> inMemoryModuleService, IModuleIdProvider moduleIdProvider, IClassificationFormatMapService classificationFormatMapService, ITextElementProvider textElementProvider) {
			this.appWindow = appWindow;
			this.documentTabService = documentTabService;
			this.messageBoxService = messageBoxService;
			DebuggerSettings = debuggerSettings;
			this.theDebugger = theDebugger;
			StackFrameService = stackFrameService;
			this.moduleLoader = moduleLoader;
			this.inMemoryModuleService = inMemoryModuleService;
			this.moduleIdProvider = moduleIdProvider;
			this.classificationFormatMapService = classificationFormatMapService;
			this.textElementProvider = textElementProvider;
			stackFrameService.PropertyChanged += StackFrameService_PropertyChanged;
			theDebugger.ProcessRunning += TheDebugger_ProcessRunning;
			theDebugger.OnProcessStateChanged += TheDebugger_OnProcessStateChanged;
			appWindow.MainWindowClosing += AppWindow_MainWindowClosing;
			debuggerSettings.PropertyChanged += DebuggerSettings_PropertyChanged;
		}
Exemple #43
0
 private static void AssertFloatValue(IDebuggerSettings debuggerSettings, string actualValue, float expectedValue)
 {
     Assert.StartsWith(InspectorValueExtensions.GetFloatValue(debuggerSettings, expectedValue), actualValue, StringComparison.Ordinal);
 }
Exemple #44
0
		public ThreadContext(ITheDebugger theDebugger, IDebuggerSettings debuggerSettings, IClassificationFormatMap classificationFormatMap, ITextElementProvider textElementProvider) {
			TheDebugger = theDebugger;
			DebuggerSettings = debuggerSettings;
			ClassificationFormatMap = classificationFormatMap;
			TextElementProvider = textElementProvider;
		}
Exemple #45
0
		ExceptionsVM(IDebuggerSettings debuggerSettings, IExceptionManager exceptionManager, IExceptionListSettings exceptionListSettings, IGetNewExceptionName getNewExceptionName) {
			this.debuggerSettings = debuggerSettings;
			this.exceptionManager = exceptionManager;
			this.exceptionListSettings = exceptionListSettings;
			this.getNewExceptionName = getNewExceptionName;
			this.exceptionContext = new ExceptionContext(exceptionManager) {
				SyntaxHighlight = debuggerSettings.SyntaxHighlightExceptions,
			};
			this.exceptionsList = new ObservableCollection<ExceptionVM>();
			this.collectionView = CollectionViewSource.GetDefaultView(exceptionsList);
			debuggerSettings.PropertyChanged += DebuggerSettings_PropertyChanged;
			exceptionManager.Changed += ExceptionManager_Changed;
			InitializeDefaultExceptions();
		}
Exemple #46
0
		CallStackVM(IDebuggerSettings debuggerSettings, ICallStackSettings callStackSettings, IStackFrameService stackFrameService, ITheDebugger theDebugger, IClassificationFormatMapService classificationFormatMapService, ITextElementProvider textElementProvider) {
			var classificationFormatMap = classificationFormatMapService.GetClassificationFormatMap(AppearanceCategoryConstants.UIMisc);
			this.debuggerSettings = debuggerSettings;
			this.callStackSettings = callStackSettings;
			this.theDebugger = theDebugger;
			this.stackFrameService = stackFrameService;
			framesList = new ObservableCollection<ICallStackFrameVM>();
			callStackFrameContext = new CallStackFrameContext(classificationFormatMap, textElementProvider) {
				TypePrinterFlags = TypePrinterFlags,
				SyntaxHighlight = debuggerSettings.SyntaxHighlightCallStack,
			};

			stackFrameService.StackFramesUpdated += StackFrameService_StackFramesUpdated;
			stackFrameService.PropertyChanged += StackFrameService_PropertyChanged;
			callStackSettings.PropertyChanged += CallStackSettings_PropertyChanged;
			debuggerSettings.PropertyChanged += DebuggerSettings_PropertyChanged;
			theDebugger.ProcessRunning += TheDebugger_ProcessRunning;
			classificationFormatMap.ClassificationFormatMappingChanged += ClassificationFormatMap_ClassificationFormatMappingChanged;
		}
Exemple #47
0
		public ThreadContext(IImageManager imageManager, ITheDebugger theDebugger, IDebuggerSettings debuggerSettings) {
			this.ImageManager = imageManager;
			this.TheDebugger = theDebugger;
			this.DebuggerSettings = debuggerSettings;
		}
Exemple #48
0
		DebugManager(IAppWindow appWindow, IFileTabManager fileTabManager, IMessageBoxManager messageBoxManager, IDebuggerSettings debuggerSettings, ITheDebugger theDebugger, IStackFrameManager stackFrameManager, Lazy<IModuleLoader> moduleLoader, Lazy<IInMemoryModuleManager> inMemoryModuleManager, ISerializedDnModuleCreator serializedDnModuleCreator) {
			this.appWindow = appWindow;
			this.fileTabManager = fileTabManager;
			this.messageBoxManager = messageBoxManager;
			this.debuggerSettings = debuggerSettings;
			this.theDebugger = theDebugger;
			this.stackFrameManager = stackFrameManager;
			this.moduleLoader = moduleLoader;
			this.inMemoryModuleManager = inMemoryModuleManager;
			this.serializedDnModuleCreator = serializedDnModuleCreator;
			stackFrameManager.PropertyChanged += StackFrameManager_PropertyChanged;
			theDebugger.ProcessRunning += TheDebugger_ProcessRunning;
			theDebugger.OnProcessStateChanged += TheDebugger_OnProcessStateChanged;
			appWindow.MainWindowClosing += AppWindow_MainWindowClosing;
			debuggerSettings.PropertyChanged += DebuggerSettings_PropertyChanged;
		}
Exemple #49
0
		ExceptionsVM(IDebuggerSettings debuggerSettings, IExceptionService exceptionService, IExceptionListSettings exceptionListSettings, IGetNewExceptionName getNewExceptionName, IClassificationFormatMapService classificationFormatMapService, ITextElementProvider textElementProvider) {
			var classificationFormatMap = classificationFormatMapService.GetClassificationFormatMap(AppearanceCategoryConstants.UIMisc);
			this.debuggerSettings = debuggerSettings;
			this.exceptionService = exceptionService;
			this.exceptionListSettings = exceptionListSettings;
			this.getNewExceptionName = getNewExceptionName;
			exceptionContext = new ExceptionContext(exceptionService, classificationFormatMap, textElementProvider) {
				SyntaxHighlight = debuggerSettings.SyntaxHighlightExceptions,
			};
			exceptionsList = new ObservableCollection<ExceptionVM>();
			CollectionView = CollectionViewSource.GetDefaultView(exceptionsList);
			debuggerSettings.PropertyChanged += DebuggerSettings_PropertyChanged;
			exceptionService.Changed += ExceptionService_Changed;
			classificationFormatMap.ClassificationFormatMappingChanged += ClassificationFormatMap_ClassificationFormatMappingChanged;
			InitializeDefaultExceptions();
		}