예제 #1
0
 BreakpointsVM(IDecompilerManager decompilerManager, IImageManager imageManager, IThemeManager themeManager, IDebuggerSettings debuggerSettings, ITheDebugger theDebugger, IBreakpointManager breakpointManager, IBreakpointSettings breakpointSettings, Lazy <IModuleLoader> moduleLoader, IInMemoryModuleManager inMemoryModuleManager)
 {
     this.breakpointContext = new BreakpointContext(imageManager, moduleLoader)
     {
         Decompiler         = decompilerManager.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.breakpointManager                      = breakpointManager;
     this.theDebugger                            = theDebugger;
     this.breakpointList                         = new ObservableCollection <BreakpointVM>();
     breakpointSettings.PropertyChanged         += BreakpointSettings_PropertyChanged;
     breakpointManager.BreakpointsAdded         += BreakpointManager_BreakpointsAdded;
     breakpointManager.BreakpointsRemoved       += BreakpointManager_BreakpointsRemoved;
     debuggerSettings.PropertyChanged           += DebuggerSettings_PropertyChanged;
     theDebugger.OnProcessStateChanged          += TheDebugger_OnProcessStateChanged;
     themeManager.ThemeChanged                  += ThemeManager_ThemeChanged;
     decompilerManager.DecompilerChanged        += DecompilerManager_DecompilerChanged;
     inMemoryModuleManager.DynamicModulesLoaded += InMemoryModuleManager_DynamicModulesLoaded;
     foreach (var bp in breakpointManager.GetBreakpoints())
     {
         AddBreakpoint(bp);
     }
 }
        void Save()
        {
            saveId++;
            // Prevent Load() from saving the settings every time a new BP is added
            if (disableSaveCounter != 0)
            {
                return;
            }

            var section = settingsManager.RecreateSection(SETTINGS_GUID);

            foreach (var bp in breakpointManager.GetBreakpoints())
            {
                var ilbp = bp as ILCodeBreakpoint;
                if (ilbp != null)
                {
                    if (string.IsNullOrEmpty(ilbp.MethodToken.Module.ModuleName))
                    {
                        continue;
                    }
                    if (string.IsNullOrEmpty(ilbp.MethodToken.Module.AssemblyFullName) && !ilbp.MethodToken.Module.ModuleNameOnly)
                    {
                        continue;
                    }

                    var bpx = section.CreateSection("Breakpoint");
                    bpx.Attribute("Token", ilbp.MethodToken.Token);
                    bpx.Attribute("AssemblyFullName", ilbp.MethodToken.Module.AssemblyFullName);
                    bpx.Attribute("ModuleName", ilbp.MethodToken.Module.ModuleName);
                    bpx.Attribute("IsDynamic", ilbp.MethodToken.Module.IsDynamic);
                    bpx.Attribute("IsInMemory", ilbp.MethodToken.Module.IsInMemory);
                    if (ilbp.MethodToken.Module.ModuleNameOnly)
                    {
                        bpx.Attribute("ModuleNameOnly", ilbp.MethodToken.Module.ModuleNameOnly);
                    }
                    bpx.Attribute("ILOffset", ilbp.ILOffset);
                    bpx.Attribute("IsEnabled", ilbp.IsEnabled);
                    if (!ilbp.MethodToken.Module.IsInMemory && !ilbp.MethodToken.Module.IsDynamic)
                    {
                        var s = GetMethodAsString(ilbp.MethodToken);
                        if (s == null)
                        {
                            continue;
                        }
                        bpx.Attribute("Method", s);
                    }
                    continue;
                }

                var debp = bp as DebugEventBreakpoint;
                if (debp != null)
                {
                    //TODO:
                    continue;
                }
            }
        }