Author: martin
Date: 2006-07-17 05:53:51 -0400 (Mon, 17 Jul 2006)
New Revision: 62667

Modified:
   trunk/debugger/ChangeLog
   trunk/debugger/build/Makefile.am
   trunk/debugger/classes/Breakpoint.cs
   trunk/debugger/classes/DebuggerConfiguration.cs
   trunk/debugger/classes/DebuggerConfiguration.xsd
   trunk/debugger/classes/DebuggerOptions.cs
   trunk/debugger/classes/DebuggerSession.cs
   trunk/debugger/classes/Event.cs
   trunk/debugger/classes/ExceptionCatchPoint.cs
   trunk/debugger/classes/Module.cs
   trunk/debugger/classes/SourceLocation.cs
Log:
2006-07-17  Martin Baulig  <[EMAIL PROTECTED]>

        Kill the System.Data dependency.

        * classes/DebuggerConfiguration.cs
        (DebuggerConfiguration): Rewrite using System.Xml.

        * classes/DebuggerSession.cs
        (DebuggerSession): Rewrite using System.Xml; use an `XmlDocument'
        instead of a `DataSet'.

        * classes/DebuggerConfiguration.xsd: Update the schema to reflect
        the new XML file format (we're still using the schema with an
        `XmlValidatingReader'). 



Modified: trunk/debugger/ChangeLog
===================================================================
--- trunk/debugger/ChangeLog    2006-07-17 07:35:23 UTC (rev 62666)
+++ trunk/debugger/ChangeLog    2006-07-17 09:53:51 UTC (rev 62667)
@@ -1,3 +1,18 @@
+2006-07-17  Martin Baulig  <[EMAIL PROTECTED]>
+
+       Kill the System.Data dependency.
+
+       * classes/DebuggerConfiguration.cs
+       (DebuggerConfiguration): Rewrite using System.Xml.
+
+       * classes/DebuggerSession.cs
+       (DebuggerSession): Rewrite using System.Xml; use an `XmlDocument'
+       instead of a `DataSet'.
+
+       * classes/DebuggerConfiguration.xsd: Update the schema to reflect
+       the new XML file format (we're still using the schema with an
+       `XmlValidatingReader'). 
+
 2006-07-13  Martin Baulig  <[EMAIL PROTECTED]>
 
        * frontend/Command.cs

Modified: trunk/debugger/build/Makefile.am
===================================================================
--- trunk/debugger/build/Makefile.am    2006-07-17 07:35:23 UTC (rev 62666)
+++ trunk/debugger/build/Makefile.am    2006-07-17 09:53:51 UTC (rev 62667)
@@ -51,7 +51,6 @@
        -r:Mono.GetOptions                              \
        -r:Mono.CompilerServices.SymbolWriter           \
        -r:System.Runtime.Serialization.Formatters.Soap \
-       -r:System.Data                                  \
        -r:$(srcdir)/Mono.Debugger.Cecil.dll
 
 MDB_DEPS = \

Modified: trunk/debugger/classes/Breakpoint.cs
===================================================================
--- trunk/debugger/classes/Breakpoint.cs        2006-07-17 07:35:23 UTC (rev 
62666)
+++ trunk/debugger/classes/Breakpoint.cs        2006-07-17 09:53:51 UTC (rev 
62667)
@@ -1,7 +1,7 @@
 using System;
 using Mono.Debugger.Backends;
 using System.Runtime.Serialization;
-using System.Data;
+using System.Xml;
 
 namespace Mono.Debugger
 {
@@ -123,26 +123,15 @@
                        return String.Format ("{0} ({1}:{2})", GetType (), 
Index, Name);
                }
 
-               internal override void GetSessionData (DataSet ds, 
DebuggerSession session)
+               protected override void GetSessionData (XmlElement root, 
XmlElement element)
                {
-                       DataTable location_table = ds.Tables ["Location"];
-                       DataTable event_table = ds.Tables ["Event"];
+                       XmlElement location_e = 
root.OwnerDocument.CreateElement ("Location");
+                       location_e.SetAttribute ("name", location.Name);
+                       element.AppendChild (location_e);
 
-                       int location_index = location_table.Rows.Count + 1;
+                       location.GetSessionData (location_e);
+               }               
 
-                       DataRow event_row = event_table.NewRow ();
-                       event_row ["session"] = session.Name;
-                       event_row ["location"] = location_index;
-                       GetSessionData (event_row);
-                       event_table.Rows.Add (event_row);
-
-                       DataRow location_row = location_table.NewRow ();
-                       location_row ["session"] = session.Name;
-                       location_row ["id"] = location_index;
-                       location.GetSessionData (location_row);
-                       location_table.Rows.Add (location_row);
-               }
-
                internal Breakpoint (int index, ThreadGroup group, 
SourceLocation location)
                        : base (index, location.Name, group)
                {

Modified: trunk/debugger/classes/DebuggerConfiguration.cs
===================================================================
--- trunk/debugger/classes/DebuggerConfiguration.cs     2006-07-17 07:35:23 UTC 
(rev 62666)
+++ trunk/debugger/classes/DebuggerConfiguration.cs     2006-07-17 09:53:51 UTC 
(rev 62667)
@@ -1,12 +1,13 @@
 using System;
 using System.IO;
-using System.Data;
 using System.Reflection;
 using System.Collections;
 using System.Configuration;
 using System.Runtime.Serialization;
 using System.Text.RegularExpressions;
 using System.Xml;
+using System.Xml.Schema;
+using System.Xml.XPath;
 
 namespace Mono.Debugger
 {
@@ -15,7 +16,7 @@
                internal readonly string ConfigDirectory;
 
                const string ConfigFileName = "MonoDebugger.xml";
-               
+
                public DebuggerConfiguration ()
                {
                        ConfigDirectory = Environment.GetEnvironmentVariable 
("XDG_CONFIG_HOME");
@@ -30,15 +31,12 @@
                        CreateDefaultModuleGroups ();
                }
 
-               internal static DataSet CreateDataSet ()
+               internal static XmlDocument CreateXmlDocument ()
                {
-                       DataSet ds = new DataSet ("DebuggerSession");
-
-                       Assembly ass = Assembly.GetExecutingAssembly ();
-                       using (Stream schema = ass.GetManifestResourceStream 
("DebuggerConfiguration"))
-                               ds.ReadXmlSchema (schema);
-
-                       return ds;
+                       XmlDocument doc = new XmlDocument ();
+                       doc.LoadXml ("<?xml version=\"1.0\"?>\n" +
+                                    "<DebuggerConfiguration fileversion = 
\"1.0\" />");
+                       return doc;
                }
 
                public bool LoadConfiguration()
@@ -49,7 +47,8 @@
 
                                LoadConfigurationFromStream (ConfigDirectory + 
ConfigFileName);
                                return true;
-                       } catch {
+                       } catch (Exception ex) {
+                               Console.WriteLine ("LOAD CONFIG EX: {0}", ex);
                                return false;
                        }
                }
@@ -62,44 +61,65 @@
 
                                SaveConfigurationToStream (ConfigDirectory + 
ConfigFileName);
                                return true;
-                       } catch {
+                       } catch (Exception ex) {
+                               Console.WriteLine ("SAVE CONFIG EX: {0}", ex);
                                return false;
                        }
                }
 
                void LoadConfigurationFromStream (string filename)
                {
-                       DataSet ds = CreateDataSet ();
-                       ds.ReadXml (filename, XmlReadMode.IgnoreSchema);
+                       using (FileStream stream = new FileStream (filename, 
FileMode.Open))
+                               LoadConfigurationFromStream (stream);
+               }
 
-                       DataRow config_row = ds.Tables ["Configuration"].Rows 
[0];
-                       if (!config_row.IsNull ("load-native-symtabs"))
-                               load_native_symtabs = (bool) config_row 
["load-native-symtabs"];
+               void LoadConfigurationFromStream (Stream stream)
+               {
+                       XmlValidatingReader reader = new XmlValidatingReader 
(new XmlTextReader (stream));
+                       Assembly ass = Assembly.GetExecutingAssembly ();
+                       using (Stream schema = ass.GetManifestResourceStream 
("DebuggerConfiguration"))
+                               reader.Schemas.Add ("", new XmlTextReader 
(schema));
 
-                       DataTable group_table = ds.Tables ["ModuleGroup"];
-                       foreach (DataRow row in group_table.Rows) {
-                               ModuleGroup group = CreateModuleGroup ((string) 
row ["name"]);
-                               group.SetSessionData (row);
+                       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
+                                       throw new InvalidOperationException ();
                        }
+
+                       iter = nav.Select 
("/DebuggerConfiguration/ModuleGroups/ModuleGroup");
+                       while (iter.MoveNext ()) {
+                               string name = iter.Current.GetAttribute 
("name", "");
+                               ModuleGroup group = CreateModuleGroup (name);
+
+                               group.SetSessionData (iter);
+                       }
                }
 
                void SaveConfigurationToStream (string filename)
                {
-                       DataSet ds = CreateDataSet ();
+                       using (FileStream stream = new FileStream (filename, 
FileMode.Create)) {
+                               XmlDocument doc = CreateXmlDocument ();
 
-                       DataTable config_table = ds.Tables ["Configuration"];
-                       DataRow config_row = config_table.NewRow ();
-                       config_row ["load-native-symtabs"] = true;
-                       config_table.Rows.Add (config_row);
+                               XmlElement element = doc.CreateElement 
("Configuration");
+                               doc.DocumentElement.AppendChild (element);
 
-                       DataTable group_table = ds.Tables ["ModuleGroup"];
-                       foreach (ModuleGroup group in ModuleGroups) {
-                               DataRow row = group_table.NewRow ();
-                               group.GetSessionData (row);
-                               group_table.Rows.Add (row);
+                               XmlElement load_native_symtabs_e = 
doc.CreateElement ("LoadNativeSymtabs");
+                               load_native_symtabs_e.InnerText = 
LoadNativeSymtabs ? "true" : "false";
+                               element.AppendChild (load_native_symtabs_e);
+
+                               XmlElement module_groups = doc.CreateElement 
("ModuleGroups");
+                               doc.DocumentElement.AppendChild (module_groups);
+
+                               foreach (ModuleGroup group in ModuleGroups)
+                                       group.GetSessionData (module_groups);
+
+                               doc.Save (stream);
                        }
-
-                       ds.WriteXml (filename);
                }
 
                bool load_native_symtabs;
@@ -185,14 +205,9 @@
                //
                // Debugger Configuration
                //
-
                public bool LoadNativeSymtabs {
                        get { return load_native_symtabs; }
                        set { load_native_symtabs = true; }
                }
-
-               public bool Test {
-                       get { return false; }
-               }
        }
 }

Modified: trunk/debugger/classes/DebuggerConfiguration.xsd
===================================================================
--- trunk/debugger/classes/DebuggerConfiguration.xsd    2006-07-17 07:35:23 UTC 
(rev 62666)
+++ trunk/debugger/classes/DebuggerConfiguration.xsd    2006-07-17 09:53:51 UTC 
(rev 62667)
@@ -1,89 +1,99 @@
 <?xml version="1.0" standalone="yes"?>
-<xs:schema id="DebuggerConfiguration" xmlns="" 
xmlns:xs="http://www.w3.org/2001/XMLSchema"; 
xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
+<xs:schema id="DebuggerConfiguration" xmlns="" 
xmlns:xs="http://www.w3.org/2001/XMLSchema";>
   <xs:complexType name="Configuration">
     <xs:sequence>
-      <xs:element name="load-native-symtabs" type="xs:boolean" minOccurs="0" />
+      <xs:element name="LoadNativeSymtabs" type="xs:boolean" minOccurs="0" />
     </xs:sequence>
   </xs:complexType>
   <xs:complexType name="Options">
-    <xs:sequence>
-      <xs:element name="file" type="xs:string" minOccurs="1" />
-      <xs:element name="inferior-args" type="xs:integer" minOccurs="0" />
-      <xs:element name="jit-optimizations" type="xs:string" minOccurs="0" />
-      <xs:element name="jit-arguments" type="xs:integer" minOccurs="0" />
-      <xs:element name="working-directory" type="xs:string" minOccurs="0" />
-      <xs:element name="mono-prefix" type="xs:string" minOccurs="0" />
-      <xs:element name="mono-path" type="xs:string" minOccurs="0" />
-      <xs:element name="StringList" type="StringList" minOccurs="0" 
maxOccurs="unbounded" />
-    </xs:sequence>
-    <xs:attribute name="session" msdata:ReadOnly="true" type="xs:string" 
use="required" />
+    <xs:choice maxOccurs="unbounded">
+      <xs:element name="File" type="xs:string" minOccurs="1" />
+      <xs:element name="InferiorArgs" type="xs:string" minOccurs="0" 
maxOccurs="unbounded" />
+      <xs:element name="JitOptimizations" type="xs:string" minOccurs="0" 
maxOccurs="1" />
+      <xs:element name="JitArguments" type="xs:string" minOccurs="0" 
maxOccurs="unbounded" />
+      <xs:element name="WorkingDirectory" type="xs:string" minOccurs="0" 
maxOccurs="1" />
+      <xs:element name="MonoPrefix" type="xs:string" minOccurs="0" 
maxOccurs="1" />
+      <xs:element name="MonoPath" type="xs:string" minOccurs="0" maxOccurs="1" 
/>
+      <xs:element name="StartTarget" type="xs:bool" minOccurs="0" 
maxOccurs="1" />
+      <xs:element name="IsScript" type="xs:bool" minOccurs="0" maxOccurs="1" />
+      <xs:element name="InEmacs" type="xs:bool" minOccurs="0" maxOccurs="1" />
+    </xs:choice>
   </xs:complexType>
-  <xs:complexType name="StringList">
-    <xs:sequence>
-      <xs:element name="id" type="xs:integer" minOccurs="1" />
-      <xs:element name="text" type="xs:string" minOccurs="1" />
-    </xs:sequence>
-  </xs:complexType>
   <xs:complexType name="ModuleGroup">
-    <xs:sequence>
-      <xs:element name="hide-from-user" type="xs:boolean" minOccurs="0" />
-      <xs:element name="step-into" type="xs:boolean" minOccurs="0" />
-      <xs:element name="load-symbols" type="xs:boolean" minOccurs="0" />
+    <xs:choice maxOccurs="unbounded">
+      <xs:element name="HideFromUser" type="xs:boolean" minOccurs="0" 
maxOccurs="1" />
+      <xs:element name="LoadSymbols" type="xs:boolean" minOccurs="0" 
maxOccurs="1" />
+      <xs:element name="StepInto" type="xs:boolean" minOccurs="0" 
maxOccurs="1" />
+    </xs:choice>
+    <xs:attribute name="name" type="xs:string" use="required" />
+  </xs:complexType>
+  <xs:complexType name="ModuleGroups">
+    <xs:sequence maxOccurs="unbounded">
+      <xs:element name="ModuleGroup" type="ModuleGroup" />
     </xs:sequence>
-    <xs:attribute name="session" msdata:ReadOnly="true" type="xs:string" />
-    <xs:attribute name="name" msdata:ReadOnly="true" type="xs:string" 
use="required" />
   </xs:complexType>
   <xs:complexType name="Module">
-    <xs:sequence>
-      <xs:element name="hide-from-user" type="xs:boolean" minOccurs="0" />
-      <xs:element name="step-into" type="xs:boolean" minOccurs="0" />
-      <xs:element name="load-symbols" type="xs:boolean" minOccurs="0" />
+    <xs:choice maxOccurs="unbounded">
+      <xs:element name="HideFromUser" type="xs:boolean" minOccurs="0" 
maxOccurs="1" />
+      <xs:element name="StepInto" type="xs:boolean" minOccurs="0" 
maxOccurs="1" />
+      <xs:element name="LoadSymbols" type="xs:boolean" minOccurs="0" 
maxOccurs="1" />
+    </xs:choice>
+    <xs:attribute name="name" type="xs:string" use="required" />
+    <xs:attribute name="group" type="xs:string" use="required" />
+  </xs:complexType>
+  <xs:complexType name="Modules">
+    <xs:sequence maxOccurs="unbounded">
+      <xs:element name="Module" type="Module" />
     </xs:sequence>
-    <xs:attribute name="session" msdata:ReadOnly="true" type="xs:string" 
use="required" />
-    <xs:attribute name="name" msdata:ReadOnly="true" type="xs:string" 
use="required" />
-    <xs:attribute name="group" msdata:ReadOnly="true" type="xs:string" 
use="required" />
   </xs:complexType>
   <xs:complexType name="ThreadGroup">
-    <xs:attribute name="session" msdata:ReadOnly="true" type="xs:string" 
use="required" />
-    <xs:attribute name="name" msdata:ReadOnly="true" type="xs:string" 
use="required" />
+    <xs:attribute name="name" type="xs:string" use="required" />
   </xs:complexType>
+  <xs:complexType name="ThreadGroups">
+    <xs:sequence maxOccurs="unbounded">
+      <xs:element name="ThreadGroup" type="ThreadGroup" />
+    </xs:sequence>
+  </xs:complexType>
+  <xs:complexType name="Events">
+    <xs:choice minOccurs="0" maxOccurs="unbounded">
+      <xs:element name="Breakpoint" type="Breakpoint" />
+    </xs:choice>
+  </xs:complexType>
   <xs:complexType name="Location">
+    <xs:choice maxOccurs="unbounded">
+      <xs:element name="Module" type="xs:string" minOccurs="1" />
+      <xs:element name="Method" type="xs:string" minOccurs="0" />
+      <xs:element name="File" type="xs:string" minOccurs="0" />
+      <xs:element name="Line" type="xs:integer" minOccurs="0" />
+    </xs:choice>
+    <xs:attribute name="name" type="xs:string" use="required" />
+  </xs:complexType>
+  <xs:complexType name="Breakpoint">
     <xs:choice>
-      <xs:element name="module" msdata:ReadOnly="true" type="xs:string" 
minOccurs="1" />
-      <xs:element name="method" type="xs:string" minOccurs="0" />
-      <xs:element name="file" type="xs:string" minOccurs="0" />
-      <xs:element name="line" type="xs:integer" minOccurs="0" />
+      <xs:element name="Location" type="Location" />
     </xs:choice>
-    <xs:attribute name="session" msdata:ReadOnly="true" type="xs:string" 
use="required" />
-    <xs:attribute name="id" msdata:ReadOnly="true" type="xs:integer" 
use="required" />
+    <xs:attribute name="index" type="xs:integer" use="required" />
+    <xs:attribute name="name" type="xs:string" use="required" />
+    <xs:attribute name="threadgroup" type="xs:string" use="required" />
+    <xs:attribute name="enabled" type="xs:boolean" use="required" />
   </xs:complexType>
-  <xs:complexType name="Event">
-    <xs:attribute name="session" msdata:ReadOnly="true" type="xs:string" 
use="required" />
-    <xs:attribute name="index" msdata:ReadOnly="true" type="xs:integer" 
use="required" />
-    <xs:attribute name="name" msdata:ReadOnly="true" type="xs:string" 
use="required" />
-    <xs:attribute name="group" msdata:ReadOnly="true" type="xs:string" 
use="required" />
-    <xs:attribute name="type" msdata:ReadOnly="true" type="xs:string" 
use="required" />
-    <xs:attribute name="enabled" msdata:ReadOnly="true" type="xs:boolean" 
use="required" />
-    <xs:attribute name="location" msdata:ReadOnly="true" type="xs:integer" 
use="required" />
-  </xs:complexType>
   <xs:complexType name="DebuggerSession">
-    <xs:choice maxOccurs="unbounded">
+    <xs:sequence>
       <xs:element name="Options" type="Options" />
-      <xs:element name="ModuleGroup" type="ModuleGroup" />
-      <xs:element name="Module" type="Module" />
-      <xs:element name="ThreadGroup" type="ThreadGroup" />
-      <xs:element name="Location" type="Location" />
-      <xs:element name="Event" type="Event" />
-    </xs:choice>
+      <xs:element name="Modules" type="Modules" />
+      <xs:element name="ThreadGroups" type="ThreadGroups" />
+      <xs:element name="Events" type="Events" />
+    </xs:sequence>
     <xs:attribute name="name" type="xs:string" use="required" />
   </xs:complexType>
-  <xs:element name="DebuggerConfiguration" msdata:IsDataSet="true" 
msdata:Locale="en-US">
+  <xs:element name="DebuggerConfiguration">
     <xs:complexType>
-      <xs:choice maxOccurs="unbounded">
-        <xs:element name="Configuration" type="Configuration" />
-        <xs:element name="ModuleGroup" type="ModuleGroup" />
-        <xs:element name="DebuggerSession" type="DebuggerSession" />
-      </xs:choice>
+      <xs:sequence>
+        <xs:element name="Configuration" type="Configuration" minOccurs="0" 
maxOccurs="1" />
+        <xs:element name="ModuleGroups" type="ModuleGroups" minOccurs="0" 
maxOccurs="1" />
+        <xs:element name="DebuggerSession" type="DebuggerSession" 
minOccurs="0" maxOccurs="unbounded" />
+      </xs:sequence>
+      <xs:attribute name="fileversion" type="xs:string" fixed="1.0" />
     </xs:complexType>
     <xs:unique name="ModuleGroup_Constraint">
       <xs:selector xpath=".//ModuleGroup" />
@@ -93,65 +103,17 @@
       <xs:selector xpath=".//Module" />
       <xs:field xpath="@name" />
     </xs:unique>
-    <xs:keyref name="ModuleGroup_Key" refer="ModuleGroup_Constraint">
+    <xs:keyref name="Module_ModuleGroup" refer="ModuleGroup_Constraint">
       <xs:selector xpath=".//Module" />
       <xs:field xpath="@group" />
     </xs:keyref>
     <xs:unique name="Location_Constraint">
       <xs:selector xpath=".//Location" />
-      <xs:field xpath="@id" />
-    </xs:unique>
-    <xs:unique name="Event_Constraint">
-      <xs:selector xpath=".//Event" />
       <xs:field xpath="@index" />
     </xs:unique>
-    <xs:unique name="Event_Location_Constraint">
-      <xs:selector xpath=".//Event" />
-      <xs:field xpath="@location" />
-    </xs:unique>
-    <xs:keyref name="Location_Event" refer="Event_Location_Constraint">
-      <xs:selector xpath=".//Location" />
-      <xs:field xpath="@id" />
-    </xs:keyref>
     <xs:keyref name="Location_Module" refer="Module_Constraint">
       <xs:selector xpath=".//Location" />
-      <xs:field xpath="module" />
+      <xs:field xpath="Module" />
     </xs:keyref>
-    <xs:unique name="InferiorArgs_Constraint">
-      <xs:selector xpath=".//Options" />
-      <xs:field xpath="inferior-args" />
-    </xs:unique>
-    <xs:keyref name="Options_InferiorArgs" refer="InferiorArgs_Constraint" 
msdata:IsNested="true">
-      <xs:selector xpath=".//StringList" />
-      <xs:field xpath="id" />
-    </xs:keyref>
-    <xs:unique name="Session_Constraint">
-      <xs:selector xpath=".//DebuggerSession" />
-      <xs:field xpath="@name" />
-    </xs:unique>
-    <xs:keyref name="Session_ThreadGroup" refer="Session_Constraint" 
msdata:IsNested="true">
-      <xs:selector xpath=".//ThreadGroup" />
-      <xs:field xpath="@session" />
-    </xs:keyref>
-    <xs:keyref name="Session_Options" refer="Session_Constraint" 
msdata:IsNested="true">
-      <xs:selector xpath=".//Options" />
-      <xs:field xpath="@session" />
-    </xs:keyref>
-    <xs:keyref name="Session_ModuleGroup" refer="Session_Constraint" 
msdata:IsNested="true">
-      <xs:selector xpath=".//ModuleGroup" />
-      <xs:field xpath="@session" />
-    </xs:keyref>
-    <xs:keyref name="Session_Module" refer="Session_Constraint" 
msdata:IsNested="true">
-      <xs:selector xpath=".//Module" />
-      <xs:field xpath="@session" />
-    </xs:keyref>
-    <xs:keyref name="Session_Event" refer="Session_Constraint" 
msdata:IsNested="true">
-      <xs:selector xpath=".//Event" />
-      <xs:field xpath="@session" />
-    </xs:keyref>
-    <xs:keyref name="Session_Location" refer="Session_Constraint" 
msdata:IsNested="true">
-      <xs:selector xpath=".//Location" />
-      <xs:field xpath="@session" />
-    </xs:keyref>
   </xs:element>
 </xs:schema>

Modified: trunk/debugger/classes/DebuggerOptions.cs
===================================================================
--- trunk/debugger/classes/DebuggerOptions.cs   2006-07-17 07:35:23 UTC (rev 
62666)
+++ trunk/debugger/classes/DebuggerOptions.cs   2006-07-17 09:53:51 UTC (rev 
62667)
@@ -8,8 +8,6 @@
 using System.Runtime.Serialization.Formatters.Binary;
 using System.Xml;
 using System.Xml.XPath;
-using System.Data;
-using System.Data.Common;
 
 using Mono.Debugger.Languages;
 using Mono.Debugger.Backends;
@@ -21,40 +19,96 @@
                static int next_id = 0;
                public readonly int ID = ++next_id;
 
+               string file;
+               string[] inferior_args;
+               string jit_optimizations;
+               string[] jit_arguments;
+               string working_directory;
+               bool is_script, start_target;
+               bool has_debug_flags;
+               DebugFlags debug_flags = DebugFlags.None;
+               string debug_output;
+               bool in_emacs;
+               string mono_prefix, mono_path;
+
                /* The executable file we're debugging */
-               public string File = null;
+               public string File {
+                       get { return file; }
+                       set { file = value; }
+               }
 
                /* argv[1...n] for the inferior process */
-               public string[] InferiorArgs = null;
+               public string[] InferiorArgs {
+                       get { return inferior_args; }
+                       set { inferior_args = value; }
+               }
 
                /* JIT optimization flags affecting the inferior
                 * process */
-               public string JitOptimizations = null;
-               public string[] JitArguments = null;
+               public string JitOptimizations {
+                       get { return jit_optimizations; }
+                       set { jit_optimizations = value; }
+               }
 
+               public string[] JitArguments {
+                       get { return jit_arguments; }
+                       set { jit_arguments = value; }
+               }
+
                /* The inferior process's working directory */
-               public string WorkingDirectory = null;
+               public string WorkingDirectory {
+                       get { return working_directory; }
+                       set { working_directory = value; }
+               }
 
                /* true if we're running in a script */
-               public bool IsScript = false;
+               public bool IsScript {
+                       get { return is_script; }
+                       set { is_script = value; }
+               }
 
                /* true if we want to start the application immediately */
-               public bool StartTarget = false;
+               public bool StartTarget {
+                       get { return start_target; }
+                       set { start_target = value; }
+               }
          
                /* the value of the -debug-flags: command line argument */
-               public bool HasDebugFlags = false;
-               public DebugFlags DebugFlags = DebugFlags.None;
-               public string DebugOutput = null;
+               public DebugFlags DebugFlags {
+                       get { return debug_flags; }
+                       set {
+                               debug_flags = value;
+                               has_debug_flags = true;
+                       }
+               }
 
+               public bool HasDebugFlags {
+                       get { return has_debug_flags; }
+               }
+
+               public string DebugOutput {
+                       get { return debug_output; }
+                       set { debug_output = value; }
+               }
+
                /* true if -f/-fullname is specified on the command line */
-               public bool InEmacs = false;
+               public bool InEmacs {
+                       get { return in_emacs; }
+                       set { in_emacs = value; }
+               }
 
                /* non-null if the user specified the -mono-prefix
                 * command line argument */
-               public string MonoPrefix = null;
+               public string MonoPrefix {
+                       get { return mono_prefix; }
+                       set { mono_prefix = value; }
+               }
 
                /* non-null if the user specified the -mono command line 
argument */
-               public string MonoPath = null;
+               public string MonoPath {
+                       get { return mono_path; }
+                       set { mono_path = value; }
+               }
 
                Hashtable user_environment;
 
@@ -80,19 +134,19 @@
                public DebuggerOptions Clone ()
                {
                        DebuggerOptions options = new DebuggerOptions ();
-                       options.File = File;
-                       options.InferiorArgs = clone (InferiorArgs);
-                       options.JitOptimizations = JitOptimizations;
-                       options.JitArguments = clone (JitArguments);
-                       options.WorkingDirectory = WorkingDirectory;
-                       options.IsScript = IsScript;
-                       options.StartTarget = StartTarget;
-                       options.HasDebugFlags = HasDebugFlags;
-                       options.DebugFlags = DebugFlags;
-                       options.DebugOutput = DebugOutput;
-                       options.InEmacs = InEmacs;
-                       options.MonoPrefix = MonoPrefix;
-                       options.MonoPath = MonoPath;
+                       options.file = file;
+                       options.inferior_args = clone (inferior_args);
+                       options.jit_optimizations = jit_optimizations;
+                       options.jit_arguments = clone (jit_arguments);
+                       options.working_directory = working_directory;
+                       options.is_script = is_script;
+                       options.start_target = start_target;
+                       options.debug_flags = debug_flags;
+                       options.has_debug_flags = has_debug_flags;
+                       options.debug_output = debug_output;
+                       options.in_emacs = in_emacs;
+                       options.mono_prefix = mono_prefix;
+                       options.mono_path = mono_path;
                        options.user_environment = clone (user_environment);
                        return options;
                }
@@ -115,84 +169,92 @@
                                user_environment.Add (name, value);
                }
 
-               internal void GetSessionData (DataSet ds, DebuggerSession 
session)
+               internal void GetSessionData (XmlElement root)
                {
-                       DataTable options_table = ds.Tables ["Options"];
-                       DataTable list_table = ds.Tables ["StringList"];
+                       XmlElement file_e = root.OwnerDocument.CreateElement 
("File");
+                       file_e.InnerText = file;
+                       root.AppendChild (file_e);
 
-                       int stringlist_idx = 0;
-
-                       DataRow options_row = options_table.NewRow ();
-                       options_row ["session"] = session.Name;
-                       options_row ["file"] = File;
-                       if ((InferiorArgs != null) && (InferiorArgs.Length > 0))
-                               options_row ["inferior-args"] = 
++stringlist_idx;
-                       if ((JitArguments != null) && (JitArguments.Length > 0))
-                               options_row ["jit-arguments"] = 
++stringlist_idx;
-                       if (JitOptimizations != null)
-                               options_row ["jit-optimizations"] = 
JitOptimizations;
-                       if (WorkingDirectory != null)
-                               options_row ["working-directory"] = 
WorkingDirectory;
-                       if (MonoPrefix != null)
-                               options_row ["mono-prefix"] = MonoPrefix;
-                       if (MonoPath != null)
-                               options_row ["mono-path"] = MonoPath;
-                       options_table.Rows.Add (options_row);
-
-                       if ((InferiorArgs != null) && (InferiorArgs.Length > 
0)) {
+                       if (InferiorArgs != null) {
                                foreach (string arg in InferiorArgs) {
-                                       DataRow row = list_table.NewRow ();
-                                       row ["id"] = (long) options_row 
["inferior-args"];
-                                       row ["text"] = arg;
-                                       list_table.Rows.Add (row);
+                                       XmlElement arg_e = 
root.OwnerDocument.CreateElement ("InferiorArgs");
+                                       arg_e.InnerText = arg;
+                                       root.AppendChild (arg_e);
                                }
                        }
 
-                       if ((JitArguments != null) && (JitArguments.Length > 
0)) {
+                       if (JitArguments != null) {
                                foreach (string arg in JitArguments) {
-                                       DataRow row = list_table.NewRow ();
-                                       row ["id"] = (long) options_row 
["jit-arguments"];
-                                       row ["text"] = arg;
-                                       list_table.Rows.Add (row);
+                                       XmlElement arg_e = 
root.OwnerDocument.CreateElement ("JitArguments");
+                                       arg_e.InnerText = arg;
+                                       root.AppendChild (arg_e);
                                }
                        }
+
+                       if (JitOptimizations != null) {
+                               XmlElement opt_e = 
root.OwnerDocument.CreateElement ("JitOptimizations");
+                               opt_e.InnerText = JitOptimizations;
+                               root.AppendChild (opt_e);
+                       }
+                       if (WorkingDirectory != null) {
+                               XmlElement cwd_e = 
root.OwnerDocument.CreateElement ("WorkingDirectory");
+                               cwd_e.InnerText = WorkingDirectory;
+                               root.AppendChild (cwd_e);
+                       }
+                       if (MonoPrefix != null) {
+                               XmlElement prefix_e = 
root.OwnerDocument.CreateElement ("MonoPrefix");
+                               prefix_e.InnerText = MonoPrefix;
+                               root.AppendChild (prefix_e);
+                       }
+                       if (MonoPath != null) {
+                               XmlElement path_e = 
root.OwnerDocument.CreateElement ("MonoPath");
+                               path_e.InnerText = MonoPath;
+                               root.AppendChild (path_e);
+                       }
                }
 
                private DebuggerOptions ()
                { }
 
-               internal DebuggerOptions (DataSet ds)
+               void append_array (ref string[] array, string value)
                {
-                       DataTable options_table = ds.Tables ["Options"];
-                       DataTable list_table = ds.Tables ["StringList"];
-
-                       DataRow options_row = options_table.Rows [0];
-
-                       File = (string) options_row ["file"];
-                       if (!options_row.IsNull ("inferior-args")) {
-                               long index = (long) options_row 
["inferior-args"];
-                               DataRow[] rows = list_table.Select ("id=" + 
index);
-                               InferiorArgs = new string [rows.Length];
-                               for (int i = 0; i < rows.Length; i++)
-                                       InferiorArgs [i] = (string) rows [i] 
["text"];
+                       if (array == null) {
+                               array = new string [1];
+                               array [0] = value;
                        } else {
-                               InferiorArgs = new string [0];
+                               string[] new_array = new string [array.Length + 
1];
+                               array.CopyTo (new_array, 0);
+                               new_array [array.Length] = value;
+                               array = new_array;
                        }
-                       if (!options_row.IsNull ("jit-arguments")) {
-                               long index = (long) options_row 
["jit-arguments"];
-                               DataRow[] rows = list_table.Select ("id=" + 
index);
-                               JitArguments = new string [rows.Length];
-                               for (int i = 0; i < rows.Length; i++)
-                                       JitArguments [i] = (string) rows [i] 
["text"];
+               }
+
+               internal DebuggerOptions (XPathNodeIterator iter)
+               {
+                       while (iter.MoveNext ()) {
+                               switch (iter.Current.Name) {
+                               case "File":
+                                       file = iter.Current.Value;
+                                       break;
+                               case "InferiorArgs":
+                                       append_array (ref inferior_args, 
iter.Current.Value);
+                                       break;
+                               case "JitArguments":
+                                       append_array (ref jit_arguments, 
iter.Current.Value);
+                                       break;
+                               case "WorkingDirectory":
+                                       working_directory = iter.Current.Value;
+                                       break;
+                               case "MonoPrefix":
+                                       mono_prefix = iter.Current.Value;
+                                       break;
+                               case "MonoPath":
+                                       mono_path = iter.Current.Value;
+                                       break;
+                               default:
+                                       throw new InternalError ();
+                               }
                        }
-                       if (!options_row.IsNull ("jit-optimizations"))
-                               JitOptimizations = (string) options_row 
["jit-optimizations"];
-                       if (!options_row.IsNull ("working-directory"))
-                               WorkingDirectory = (string) options_row 
["working-directory"];
-                       if (!options_row.IsNull ("mono-prefix"))
-                               MonoPrefix = (string) options_row 
["mono-prefix"];
-                       if (!options_row.IsNull ("mono-path"))
-                               MonoPath = (string) options_row ["mono-path"];
                }
 
                static void About ()
@@ -301,7 +363,6 @@
                        } catch {
                                return false;
                        }
-                       options.HasDebugFlags = true;
                        return true;
                }
 

Modified: trunk/debugger/classes/DebuggerSession.cs
===================================================================
--- trunk/debugger/classes/DebuggerSession.cs   2006-07-17 07:35:23 UTC (rev 
62666)
+++ trunk/debugger/classes/DebuggerSession.cs   2006-07-17 09:53:51 UTC (rev 
62667)
@@ -8,8 +8,6 @@
 using System.Runtime.Serialization.Formatters.Binary;
 using System.Xml;
 using System.Xml.XPath;
-using System.Data;
-using System.Data.Common;
 
 using Mono.Debugger.Languages;
 using Mono.Debugger.Backends;
@@ -25,7 +23,7 @@
                public readonly DebuggerConfiguration Config;
                public readonly DebuggerOptions Options;
 
-               DataSet saved_session;
+               XmlDocument saved_session;
                SessionData data;
 
                private DebuggerSession (DebuggerConfiguration config, string 
name)
@@ -40,15 +38,6 @@
                        this.Options = options;
                }
 
-               public DebuggerSession (DebuggerConfiguration config, Stream 
stream)
-                       : this (config, "main")
-               {
-                       saved_session = DebuggerConfiguration.CreateDataSet ();
-                       saved_session.ReadXml (stream, 
XmlReadMode.IgnoreSchema);
-
-                       Options = new DebuggerOptions (saved_session);
-               }
-
                protected SessionData Data {
                        get {
                                if (data == null)
@@ -63,6 +52,82 @@
                        return new DebuggerSession (Config, new_options, 
new_name);
                }
 
+               public void SaveSession (Stream stream)
+               {
+                       saved_session = SaveSession ();
+                       saved_session.Save (stream);
+               }
+
+               protected XmlDocument SaveSession ()
+               {
+                       XmlDocument doc = 
DebuggerConfiguration.CreateXmlDocument ();
+
+                       XmlElement module_groups = doc.CreateElement 
("ModuleGroups");
+                       doc.DocumentElement.AppendChild (module_groups);
+
+                       foreach (ModuleGroup group in Config.ModuleGroups)
+                               group.GetSessionData (module_groups);
+
+                       XmlElement root = doc.CreateElement ("DebuggerSession");
+                       root.SetAttribute ("name", Name);
+                       doc.DocumentElement.AppendChild (root);
+
+                       XmlElement options = doc.CreateElement ("Options");
+                       Options.GetSessionData (options);
+                       root.AppendChild (options);
+
+                       XmlElement modules = root.OwnerDocument.CreateElement 
("Modules");
+                       root.AppendChild (modules);
+
+                       foreach (Module module in Modules)
+                               module.GetSessionData (modules);
+
+                       XmlElement thread_groups = 
root.OwnerDocument.CreateElement ("ThreadGroups");
+                       root.AppendChild (thread_groups);
+
+                       foreach (ThreadGroup group in ThreadGroups)
+                               AddThreadGroup (thread_groups, group);
+
+                       XmlElement event_list = 
root.OwnerDocument.CreateElement ("Events");
+                       root.AppendChild (event_list);
+
+                       foreach (Event e in Events)
+                               e.GetSessionData (event_list);
+
+                       return doc;
+               }
+
+               public DebuggerSession (DebuggerConfiguration config, Stream 
stream)
+                       : this (config, "main")
+               {
+                       XmlValidatingReader reader = new XmlValidatingReader 
(new XmlTextReader (stream));
+                       Assembly ass = Assembly.GetExecutingAssembly ();
+                       using (Stream schema = ass.GetManifestResourceStream 
("DebuggerConfiguration"))
+                               reader.Schemas.Add ("", new XmlTextReader 
(schema));
+
+                       saved_session = new XmlDocument ();
+                       saved_session.Load (reader);
+                       reader.Close ();
+
+                       XPathNavigator nav = saved_session.CreateNavigator ();
+
+                       XPathNodeIterator session_iter = nav.Select (
+                               "/DebuggerConfiguration/[EMAIL PROTECTED]'" + 
Name + "']");
+                       if (!session_iter.MoveNext ())
+                               throw new InternalError ();
+
+                       XPathNodeIterator options_iter = 
session_iter.Current.Select ("Options/*");
+                       Options = new DebuggerOptions (options_iter);
+               }
+
+               void AddThreadGroup (XmlElement root, ThreadGroup group)
+               {
+                       XmlElement element = root.OwnerDocument.CreateElement 
("ThreadGroup");
+                       element.SetAttribute ("name", group.Name);
+
+                       root.AppendChild (element);
+               }
+
                //
                // Modules.
                //
@@ -211,18 +276,12 @@
                internal void OnProcessExited (Process process)
                {
                        try {
-                               saved_session = Data.SaveSession ();
+                               saved_session = SaveSession ();
                        } finally {
                                data = null;
                        }
                }
 
-               public void SaveSession (Stream stream)
-               {
-                       saved_session = Data.SaveSession ();
-                       saved_session.WriteXml (stream);
-               }
-
                protected class SessionData
                {
                        public readonly DebuggerSession Session;
@@ -242,38 +301,49 @@
                                main_thread_group = CreateThreadGroup ("main");
                        }
 
-                       public void LoadSession (Process process, DataSet ds)
+                       public void LoadSession (Process process, XmlDocument 
doc)
                        {
-                               string query = String.Format ("name='{0}'", 
Session.Name);
-                               DataRow session_row = ds.Tables 
["DebuggerSession"].Select (query) [0];
+                               XPathNavigator nav = doc.CreateNavigator ();
 
-                               DataRow[] group_rows = session_row.GetChildRows 
("Session_ModuleGroup");
-                               foreach (DataRow row in group_rows) {
-                                       string name = (string) row ["name"];
+                               XPathNodeIterator session_iter = nav.Select (
+                                       "/DebuggerConfiguration/[EMAIL 
PROTECTED]'" + Session.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 = 
Session.Config.CreateModuleGroup (name);
-                                       group.SetSessionData (row);
+
+                                       group.SetSessionData (group_iter);
                                }
 
-                               DataRow[] module_rows = 
session_row.GetChildRows ("Session_Module");
-                               foreach (DataRow row in module_rows) {
-                                       string name = (string) row ["name"];
+                               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) {
-                                               string gname = (string) row 
["group"];
-                                               ModuleGroup group = 
Session.Config.GetModuleGroup (gname);
-                                               module = new Module (group, 
name, null);
+                                               ModuleGroup mgroup = 
Session.Config.GetModuleGroup (group);
+                                               module = new Module (mgroup, 
name, null);
                                                modules.Add (name, module);
                                        }
 
-                                       module.SetSessionData (row);
+                                       module.SetSessionData (modules_iter);
                                }
 
-                               DataRow[] event_rows = session_row.GetChildRows 
("Session_Event");
-                               foreach (DataRow row in event_rows) {
-                                       if ((string) row ["type"] != 
"Mono.Debugger.Breakpoint")
-                                               continue;
+                               XPathNodeIterator event_iter = 
session_iter.Current.Select ("Events/*");
+                               while (event_iter.MoveNext ()) {
+                                       if (event_iter.Current.Name != 
"Breakpoint")
+                                               throw new InternalError ();
 
-                                       string gname = (string) row ["group"];
+                                       string name = 
event_iter.Current.GetAttribute ("name", "");
+                                       int index = Int32.Parse 
(event_iter.Current.GetAttribute ("index", ""));
+                                       bool enabled = Boolean.Parse 
(event_iter.Current.GetAttribute ("enabled", ""));
+
+                                       string gname = 
event_iter.Current.GetAttribute ("threadgroup", "");
                                        ThreadGroup group;
                                        if (gname == "system")
                                                group = ThreadGroup.System;
@@ -282,59 +352,25 @@
                                        else
                                                group = CreateThreadGroup 
(gname);
 
-                                       int index = (int) (long) row ["index"];
-                                       DataRow[] location_rows = 
row.GetChildRows ("Location_Event");
-                                       SourceLocation location = new 
SourceLocation (Session, location_rows [0]);
+                                       SourceLocation location = null;
 
+                                       XPathNodeIterator children = 
event_iter.Current.SelectChildren (
+                                               XPathNodeType.Element);
+                                       while (children.MoveNext ()) {
+                                               if (children.Current.Name == 
"Location")
+                                                       location = new 
SourceLocation (Session, children.Current);
+                                               else
+                                                       throw new InternalError 
();
+                                       }
+
                                        Breakpoint bpt = new Breakpoint (index, 
group, location);
                                        AddEvent (bpt);
-                                       bpt.Enable (process.MainThread);
+                                       if (enabled)
+                                               bpt.Enable (process.MainThread);
                                }
                        }
 
-                       public DataSet SaveSession ()
-                       {
-                               DataSet ds = 
DebuggerConfiguration.CreateDataSet ();
 
-                               {
-                                       DataTable session_table = ds.Tables 
["DebuggerSession"];
-                                       DataRow row = session_table.NewRow ();
-                                       row ["name"] = Session.Name;
-                                       session_table.Rows.Add (row);
-                               }
-
-                               Session.Options.GetSessionData (ds, Session);
-
-                               DataTable group_table = ds.Tables 
["ModuleGroup"];
-                               foreach (ModuleGroup group in 
Session.Config.ModuleGroups) {
-                                       DataRow row = group_table.NewRow ();
-                                       row ["session"] = Session.Name;
-                                       group.GetSessionData (row);
-                                       group_table.Rows.Add (row);
-                               }
-
-                               DataTable module_table = ds.Tables ["Module"];
-                               foreach (Module module in Modules) {
-                                       DataRow row = module_table.NewRow ();
-                                       row ["session"] = Session.Name;
-                                       module.GetSessionData (row);
-                                       module_table.Rows.Add (row);
-                               }
-
-                               DataTable thread_group_table = ds.Tables 
["ThreadGroup"];
-                               foreach (ThreadGroup group in ThreadGroups) {
-                                       DataRow row = thread_group_table.NewRow 
();
-                                       row ["session"] = Session.Name;
-                                       row ["name"] = group.Name;
-                                       thread_group_table.Rows.Add (row);
-                               }
-
-                               foreach (Event e in Events)
-                                       e.GetSessionData (ds, Session);
-
-                               return ds;
-                       }
-
                        //
                        // Modules.
                        //

Modified: trunk/debugger/classes/Event.cs
===================================================================
--- trunk/debugger/classes/Event.cs     2006-07-17 07:35:23 UTC (rev 62666)
+++ trunk/debugger/classes/Event.cs     2006-07-17 09:53:51 UTC (rev 62667)
@@ -1,7 +1,7 @@
 using System;
 using Mono.Debugger.Backends;
 using System.Runtime.Serialization;
-using System.Data;
+using System.Xml;
 
 namespace Mono.Debugger
 {
@@ -65,16 +65,20 @@
                // Session handling.
                //
 
-               protected virtual void GetSessionData (DataRow row)
+               internal virtual void GetSessionData (XmlElement root)
                {
-                       row ["index"] = index;
-                       row ["name"] = name;
-                       row ["group"] = group.Name;
-                       row ["type"] = GetType ();
-                       row ["enabled"] = IsEnabled;
+                       XmlElement element = root.OwnerDocument.CreateElement 
(GetType ().Name);
+                       root.AppendChild (element);
+
+                       element.SetAttribute ("index", Index.ToString ());
+                       element.SetAttribute ("name", Name);
+                       element.SetAttribute ("threadgroup", ThreadGroup.Name);
+                       element.SetAttribute ("enabled", IsEnabled ? "true" : 
"false");
+
+                       GetSessionData (root, element);
                }
 
-               internal abstract void GetSessionData (DataSet ds, 
DebuggerSession session);
+               protected abstract void GetSessionData (XmlElement root, 
XmlElement element);
 
                //
                // Everything below is private.

Modified: trunk/debugger/classes/ExceptionCatchPoint.cs
===================================================================
--- trunk/debugger/classes/ExceptionCatchPoint.cs       2006-07-17 07:35:23 UTC 
(rev 62666)
+++ trunk/debugger/classes/ExceptionCatchPoint.cs       2006-07-17 09:53:51 UTC 
(rev 62667)
@@ -1,5 +1,5 @@
 using System;
-using System.Data;
+using System.Xml;
 using Mono.Debugger.Backends;
 using System.Runtime.Serialization;
 
@@ -91,7 +91,7 @@
                        return IsSubclassOf (exc.Type, exception);
                }
 
-               internal override void GetSessionData (DataSet ds, 
DebuggerSession session)
+               protected override void GetSessionData (XmlElement element, 
XmlElement root)
                { }
 
                TargetType exception;

Modified: trunk/debugger/classes/Module.cs
===================================================================
--- trunk/debugger/classes/Module.cs    2006-07-17 07:35:23 UTC (rev 62666)
+++ trunk/debugger/classes/Module.cs    2006-07-17 09:53:51 UTC (rev 62667)
@@ -4,8 +4,8 @@
 using System.Collections;
 using System.Runtime.InteropServices;
 using System.Runtime.Serialization;
-using System.Data;
 using System.Xml;
+using System.Xml.XPath;
 
 using Mono.Debugger.Languages;
 using Mono.Debugger.Backends;
@@ -155,6 +155,43 @@
                        get; set;
                }
 
+               internal void GetSessionData (XmlElement root)
+               {
+                       XmlElement element = root.OwnerDocument.CreateElement 
(GetType ().Name);
+                       root.AppendChild (element);
+
+                       if (this is Module)
+                               element.SetAttribute ("group", ((Module) 
this).ModuleGroup.Name);
+                       element.SetAttribute ("name", Name);
+
+                       XmlElement hide = root.OwnerDocument.CreateElement 
("HideFromUser");
+                       hide.InnerText = HideFromUser ? "true" : "false";
+                       element.AppendChild (hide);
+
+                       XmlElement step = root.OwnerDocument.CreateElement 
("StepInto");
+                       step.InnerText = StepInto ? "true" : "false";
+                       element.AppendChild (step);
+
+                       XmlElement load = root.OwnerDocument.CreateElement 
("LoadSymbols");
+                       load.InnerText = LoadSymbols ? "true" : "false";
+                       element.AppendChild (load);
+               }
+
+               internal void SetSessionData (XPathNodeIterator iter)
+               {
+                       XPathNodeIterator children = 
iter.Current.SelectChildren (XPathNodeType.Element);
+                       while (children.MoveNext ()) {
+                               if (children.Current.Name == "HideFromUser")
+                                       HideFromUser = Boolean.Parse 
(children.Current.Value);
+                               else if (children.Current.Name == "LoadSymbols")
+                                       LoadSymbols = Boolean.Parse 
(children.Current.Value);
+                               else if (children.Current.Name == "StepInto")
+                                       StepInto = Boolean.Parse 
(children.Current.Value);
+                               else
+                                       throw new InternalError ();
+                       }
+               }
+
                protected virtual string MyToString ()
                {
                        return "";
@@ -196,21 +233,6 @@
                        set { step_into = value; }
                }
 
-               internal void GetSessionData (DataRow row)
-               {
-                       row ["name"] = Name;
-                       row ["hide-from-user"] = hide_from_user;
-                       row ["load-symbols"] = load_symbols;
-                       row ["step-into"] = step_into;
-               }
-
-               internal void SetSessionData (DataRow row)
-               {
-                       hide_from_user = (bool) row ["hide-from-user"];
-                       load_symbols = (bool) row ["load-symbols"];
-                       step_into = (bool) row ["step-into"];
-               }
-
                internal ModuleGroup (string name)
                        : this (name, false, false, false)
                {
@@ -470,34 +492,5 @@
                {
                        return String.Format (":{0}:{1}", IsLoaded, 
SymbolsLoaded);
                }
-
-               internal void GetSessionData (DataRow row)
-               {
-                       row ["name"] = Name;
-                       row ["group"] = ModuleGroup.Name;
-
-                       if (has_hide_from_user)
-                               row ["hide-from-user"] = hide_from_user;
-                       if (has_load_symbols)
-                               row ["load-symbols"] = load_symbols;
-                       if (has_step_into)
-                               row ["step-into"] = step_into;
-               }
-
-               internal void SetSessionData (DataRow row)
-               {
-                       if (!row.IsNull ("hide-from-user")) {
-                               hide_from_user = (bool) row ["hide-from-user"];
-                               has_hide_from_user = true;
-                       }
-                       if (!row.IsNull ("load-symbols")) {
-                               load_symbols = (bool) row ["load-symbols"];
-                               has_load_symbols = true;
-                       }
-                       if (!row.IsNull ("step-into")) {
-                               step_into = (bool) row ["step-into"];
-                               has_step_into = true;
-                       }
-               }
        }
 }

Modified: trunk/debugger/classes/SourceLocation.cs
===================================================================
--- trunk/debugger/classes/SourceLocation.cs    2006-07-17 07:35:23 UTC (rev 
62666)
+++ trunk/debugger/classes/SourceLocation.cs    2006-07-17 09:53:51 UTC (rev 
62667)
@@ -1,6 +1,6 @@
 using System;
 using System.Xml;
-using System.Data;
+using System.Xml.XPath;
 using System.Runtime.Serialization;
 
 using Mono.Debugger.Languages;
@@ -126,16 +126,21 @@
                        this.line = -1;
                }
 
-               internal SourceLocation (DebuggerSession session, DataRow row)
+               internal SourceLocation (DebuggerSession session, 
XPathNavigator navigator)
                {
-                       module = session.GetModule ((string) row ["module"]);
+                       this.line = -1;
 
-                       if (!row.IsNull ("method"))
-                               method = (string) row ["method"];
-                       if (!row.IsNull ("line"))
-                               line = (int) (long) row ["line"];
-                       else
-                               line = -1;
+                       XPathNodeIterator children = navigator.SelectChildren 
(XPathNodeType.Element);
+                       while (children.MoveNext ()) {
+                               if (children.Current.Name == "Module")
+                                       module = session.GetModule 
(children.Current.Value);
+                               else if (children.Current.Name == "Method")
+                                       method = children.Current.Value;
+                               else if (children.Current.Name == "Line")
+                                       line = Int32.Parse 
(children.Current.Value);
+                               else
+                                       throw new InvalidOperationException ();
+                       }
                }
 
                internal BreakpointHandle InsertBreakpoint (Thread target, 
Breakpoint breakpoint,
@@ -215,31 +220,54 @@
                // Session handling.
                //
 
-               internal void GetSessionData (DataRow row)
+               internal void GetSessionData (XmlElement root)
                {
                        if (function != null) {
-                               row ["module"] = function.Module.Name;
-                               row ["method"] = function.DeclaringType.Name + 
':' + function.Name;
+                               XmlElement module = 
root.OwnerDocument.CreateElement ("Module");
+                               module.InnerText = function.Module.Name;
+                               root.AppendChild (module);
+
+                               XmlElement method_e = 
root.OwnerDocument.CreateElement ("Method");
+                               method_e.InnerText = 
function.DeclaringType.Name + ':' + function.Name;
+                               root.AppendChild (method_e);
                        } else if (source != null) {
-                               row ["module"] = source.SourceFile.Module.Name;
+                               XmlElement module = 
root.OwnerDocument.CreateElement ("Module");
+                               module.InnerText = 
source.SourceFile.Module.Name;
+                               root.AppendChild (module);
+
+                               XmlElement method_e = 
root.OwnerDocument.CreateElement ("Method");
+                               root.AppendChild (method_e);
+
                                if (source.ClassName != null) {
                                        string klass = source.ClassName;
                                        string name = source.Name.Substring 
(klass.Length + 1);
-                                       row ["method"] = klass + ':' + name;
+                                       method_e.InnerText = klass + ':' + name;
                                } else
-                                       row ["method"] = source.Name;
+                                       method_e.InnerText = source.Name;
                        } else if (file != null) {
-                               row ["module"] = file.Module.Name;
-                               row ["file"] = file.Name + ":" + line;
+                               XmlElement module = 
root.OwnerDocument.CreateElement ("Module");
+                               module.InnerText = file.Module.Name;
+                               root.AppendChild (module);
+
+                               XmlElement file_e = 
root.OwnerDocument.CreateElement ("File");
+                               file_e.InnerText = file.Name + ":" + line;
+                               root.AppendChild (file_e);
                        } else if (method != null) {
-                               row ["module"] = module.Name;
-                               row ["method"] = method;
+                               XmlElement module = 
root.OwnerDocument.CreateElement ("Module");
+                               module.InnerText = module.Name;
+                               root.AppendChild (module);
+
+                               XmlElement method_e = 
root.OwnerDocument.CreateElement ("Method");
+                               method_e.InnerText = method;
+                               root.AppendChild (method_e);
                        } else {
                                throw new InternalError ();
                        }
 
                        if (line > 0) {
-                               row ["line"] = line;
+                               XmlElement line_e = 
root.OwnerDocument.CreateElement ("Line");
+                               line_e.InnerText = line.ToString ();
+                               root.AppendChild (line_e);
                        }
                }
 

_______________________________________________
Mono-patches maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches

Reply via email to