protected void LoadSession(XPathNavigator nav) { XPathNodeIterator session_iter = nav.Select( "/DebuggerConfiguration/DebuggerSession[@name='" + Name + "']"); if (!session_iter.MoveNext()) { throw new InternalError(); } XPathNodeIterator group_iter = nav.Select( "/DebuggerConfiguration/ModuleGroups/ModuleGroup"); while (group_iter.MoveNext()) { string name = group_iter.Current.GetAttribute("name", ""); ModuleGroup group = Config.CreateModuleGroup(name); group.SetSessionData(group_iter); } XPathNodeIterator modules_iter = session_iter.Current.Select("Modules/*"); while (modules_iter.MoveNext()) { string name = modules_iter.Current.GetAttribute("name", ""); string group = modules_iter.Current.GetAttribute("group", ""); Module module = (Module)modules [name]; if (module == null) { ModuleGroup mgroup = Config.GetModuleGroup(group); module = new Module(mgroup, name, null); modules.Add(name, module); } module.SetSessionData(modules_iter); } XPathNodeIterator event_iter = session_iter.Current.Select("Events/*"); LoadEvents(event_iter); XPathNodeIterator display_iter = session_iter.Current.Select("Displays/*"); LoadDisplays(display_iter); }
void LoadConfigurationFromStream(Stream stream) { XmlReaderSettings settings = new XmlReaderSettings(); Assembly ass = Assembly.GetExecutingAssembly(); using (Stream schema = ass.GetManifestResourceStream("DebuggerConfiguration")) settings.Schemas.Add(null, new XmlTextReader(schema)); XmlReader reader = XmlReader.Create(stream, settings); XPathDocument doc = new XPathDocument(reader); XPathNavigator nav = doc.CreateNavigator(); XPathNodeIterator iter = nav.Select("/DebuggerConfiguration/Configuration/*"); while (iter.MoveNext()) { if (iter.Current.Name == "LoadNativeSymtabs") { LoadNativeSymtabs = Boolean.Parse(iter.Current.Value); } else if (iter.Current.Name == "StayInThread") { ; // ignore, this is no longer in use. } else if (iter.Current.Name == "FollowFork") { FollowFork = Boolean.Parse(iter.Current.Value); } else if (iter.Current.Name == "OpaqueFileNames") { OpaqueFileNames = Boolean.Parse(iter.Current.Value); } else if (iter.Current.Name == "StopOnManagedSignals") { StopOnManagedSignals = Boolean.Parse(iter.Current.Value); } else if (iter.Current.Name == "NestedBreakStates") { NestedBreakStates = Boolean.Parse(iter.Current.Value); } else if (iter.Current.Name == "RedirectOutput") { RedirectOutput = Boolean.Parse(iter.Current.Value); } else if (iter.Current.Name == "Martin_Boston_07102008") { ; // ignore, this is no longer in use. } else if (iter.Current.Name == "BrokenThreading") { ; // ignore, this is no longer in use. } else if (iter.Current.Name == "StopDaemonThreads") { if (Boolean.Parse(iter.Current.Value)) { threading_model |= ThreadingModel.StopDaemonThreads; } else { threading_model &= ~ThreadingModel.StopDaemonThreads; } } else if (iter.Current.Name == "StopImmutableThreads") { if (Boolean.Parse(iter.Current.Value)) { threading_model |= ThreadingModel.StopImmutableThreads; } else { threading_model &= ~ThreadingModel.StopImmutableThreads; } } else if (iter.Current.Name == "ThreadingModel") { switch (iter.Current.Value.ToLower()) { case "single": threading_model |= ThreadingModel.Single; break; case "process": threading_model |= ThreadingModel.Process; break; case "global": threading_model |= ThreadingModel.Global; break; case "default": break; default: Report.Error("Invalid value `{0}' in 'ThreadingModel'", iter.Current.Value); break; } } else if (iter.Current.Name == "UserNotifications") { switch (iter.Current.Value.ToLower()) { case "+threads": case "threads": user_notifications |= UserNotificationType.Threads; break; case "-threads": user_notifications &= ~UserNotificationType.Threads; break; default: Report.Error("Invalid value `{0}' in 'UserNotifications'", iter.Current.Value); break; } } else { Report.Error("Invalid configuration item `{0}'", iter.Current.Name); } } iter = nav.Select("/DebuggerConfiguration/ModuleGroups/ModuleGroup"); while (iter.MoveNext()) { string name = iter.Current.GetAttribute("name", ""); ModuleGroup group = CreateModuleGroup(name); group.SetSessionData(iter); } iter = nav.Select("/DebuggerConfiguration/DirectoryMap/Map"); while (iter.MoveNext()) { string from = iter.Current.GetAttribute("from", ""); string to = iter.Current.GetAttribute("to", ""); directory_maps.Add(from, to); } }