Browse Source

2007-06-28 Atsushi Enomoto <[email protected]>

	Yes, it is Hack Week, I had to start delayed though.

	* System.Xml.dll.sources : added XsltDebuggerWrapper.cs, as initial
	  attempt to support external debugger.

	* XslText.cs XslMessage.cs XslVariable.cs XslNotSupportedOperation.cs
	  XslNumber.cs XslElement.cs XslIf.cs XslCopyOf.cs XslFallback.cs
	  XslValueOf.cs XslComment.cs XslAttribute.cs XslApplyImports.cs
	  XslApplyTemplates.cs XslLiteralElement.cs XslCompiledElement.cs
	  XslTemplateContent.cs XslForEach.cs XslCallTemplate.cs
	  XslCopy.cs XslProcessingInstruction.cs XslChoose.cs :
	  minimum required injection for debugger.

	initial attempt to hook debuggers.
	* XsltDebuggerWrapper.cs : new.
	* XslTransformProcessor.cs Compiler.cs : use above.

	* XslCompiledTransform.cs XslTransform.cs : initial attempt to
	  support external debugger.


svn path=/trunk/mcs/; revision=80984
Atsushi Eno 18 years ago
parent
commit
19308b4ef0
32 changed files with 267 additions and 8 deletions
  1. 5 0
      mcs/class/System.XML/ChangeLog
  2. 10 0
      mcs/class/System.XML/Mono.Xml.Xsl.Operations/ChangeLog
  3. 5 0
      mcs/class/System.XML/Mono.Xml.Xsl.Operations/XslApplyImports.cs
  4. 6 0
      mcs/class/System.XML/Mono.Xml.Xsl.Operations/XslApplyTemplates.cs
  5. 6 0
      mcs/class/System.XML/Mono.Xml.Xsl.Operations/XslAttribute.cs
  6. 6 0
      mcs/class/System.XML/Mono.Xml.Xsl.Operations/XslCallTemplate.cs
  7. 6 0
      mcs/class/System.XML/Mono.Xml.Xsl.Operations/XslChoose.cs
  8. 6 0
      mcs/class/System.XML/Mono.Xml.Xsl.Operations/XslComment.cs
  9. 8 0
      mcs/class/System.XML/Mono.Xml.Xsl.Operations/XslCompiledElement.cs
  10. 6 0
      mcs/class/System.XML/Mono.Xml.Xsl.Operations/XslCopy.cs
  11. 6 0
      mcs/class/System.XML/Mono.Xml.Xsl.Operations/XslCopyOf.cs
  12. 6 0
      mcs/class/System.XML/Mono.Xml.Xsl.Operations/XslElement.cs
  13. 6 0
      mcs/class/System.XML/Mono.Xml.Xsl.Operations/XslFallback.cs
  14. 6 0
      mcs/class/System.XML/Mono.Xml.Xsl.Operations/XslForEach.cs
  15. 6 0
      mcs/class/System.XML/Mono.Xml.Xsl.Operations/XslIf.cs
  16. 6 0
      mcs/class/System.XML/Mono.Xml.Xsl.Operations/XslLiteralElement.cs
  17. 6 0
      mcs/class/System.XML/Mono.Xml.Xsl.Operations/XslMessage.cs
  18. 6 0
      mcs/class/System.XML/Mono.Xml.Xsl.Operations/XslNotSupportedOperation.cs
  19. 6 0
      mcs/class/System.XML/Mono.Xml.Xsl.Operations/XslNumber.cs
  20. 6 0
      mcs/class/System.XML/Mono.Xml.Xsl.Operations/XslProcessingInstruction.cs
  21. 6 0
      mcs/class/System.XML/Mono.Xml.Xsl.Operations/XslTemplateContent.cs
  22. 6 0
      mcs/class/System.XML/Mono.Xml.Xsl.Operations/XslText.cs
  23. 6 0
      mcs/class/System.XML/Mono.Xml.Xsl.Operations/XslValueOf.cs
  24. 12 0
      mcs/class/System.XML/Mono.Xml.Xsl.Operations/XslVariable.cs
  25. 6 0
      mcs/class/System.XML/Mono.Xml.Xsl/ChangeLog
  26. 11 0
      mcs/class/System.XML/Mono.Xml.Xsl/Compiler.cs
  27. 10 2
      mcs/class/System.XML/Mono.Xml.Xsl/XslTransformProcessor.cs
  28. 64 0
      mcs/class/System.XML/Mono.Xml.Xsl/XsltDebuggerWrapper.cs
  29. 5 0
      mcs/class/System.XML/System.Xml.Xsl/ChangeLog
  30. 3 3
      mcs/class/System.XML/System.Xml.Xsl/XslCompiledTransform.cs
  31. 13 3
      mcs/class/System.XML/System.Xml.Xsl/XslTransform.cs
  32. 1 0
      mcs/class/System.XML/System.Xml.dll.sources

+ 5 - 0
mcs/class/System.XML/ChangeLog

@@ -1,3 +1,8 @@
+2007-06-28  Atsushi Enomoto  <[email protected]>
+
+	* System.Xml.dll.sources : added XsltDebuggerWrapper.cs, as initial
+	  attempt to support external debugger.
+
 2007-04-24  Atsushi Enomoto  <[email protected]>
 
 	* Makefile : added distfiles.

+ 10 - 0
mcs/class/System.XML/Mono.Xml.Xsl.Operations/ChangeLog

@@ -1,3 +1,13 @@
+2007-06-28  Atsushi Enomoto  <[email protected]>
+
+	* XslText.cs XslMessage.cs XslVariable.cs XslNotSupportedOperation.cs
+	  XslNumber.cs XslElement.cs XslIf.cs XslCopyOf.cs XslFallback.cs
+	  XslValueOf.cs XslComment.cs XslAttribute.cs XslApplyImports.cs
+	  XslApplyTemplates.cs XslLiteralElement.cs XslCompiledElement.cs
+	  XslTemplateContent.cs XslForEach.cs XslCallTemplate.cs
+	  XslCopy.cs XslProcessingInstruction.cs XslChoose.cs :
+	  minimum required injection for debugger.
+
 2007-01-09  Atsushi Enomoto  <[email protected]>
 
 	* XslMessage.cs : added MONO_XSLT_MESSAGE_OUTPUT environment

+ 5 - 0
mcs/class/System.XML/Mono.Xml.Xsl.Operations/XslApplyImports.cs

@@ -41,10 +41,15 @@ namespace Mono.Xml.Xsl.Operations {
 		public XslApplyImports (Compiler c) : base (c) {}
 		protected override void Compile (Compiler c)
 		{
+			if (c.Debugger != null)
+				c.Debugger.DebugCompile (c.Input);
 		}
 		
 		public override void Evaluate (XslTransformProcessor p)
 		{
+			if (p.Debugger != null)
+				p.Debugger.DebugExecute (p, this.DebugInput);
+
 			p.ApplyImports ();
 		}
 	}

+ 6 - 0
mcs/class/System.XML/Mono.Xml.Xsl.Operations/XslApplyTemplates.cs

@@ -48,6 +48,9 @@ namespace Mono.Xml.Xsl.Operations {
 		
 		protected override void Compile (Compiler c)
 		{
+			if (c.Debugger != null)
+				c.Debugger.DebugCompile (c.Input);
+
 			select = c.CompileExpression (c.GetAttribute ("select"));
 			mode = c.ParseQNameAttribute ("mode");
 			ArrayList sorterList = null;
@@ -96,6 +99,9 @@ namespace Mono.Xml.Xsl.Operations {
 		
 		public override void Evaluate (XslTransformProcessor p)
 		{		
+			if (p.Debugger != null)
+				p.Debugger.DebugExecute (p, this.DebugInput);
+
 			if (select == null)	
 				p.ApplyTemplates (p.CurrentNode.SelectChildren (XPathNodeType.All), mode, withParams);
 			else {

+ 6 - 0
mcs/class/System.XML/Mono.Xml.Xsl.Operations/XslAttribute.cs

@@ -51,6 +51,9 @@ namespace Mono.Xml.Xsl.Operations {
 		
 		protected override void Compile (Compiler c)
 		{
+			if (c.Debugger != null)
+				c.Debugger.DebugCompile (c.Input);
+
 			XPathNavigator nav = c.Input.Clone ();
 			nsDecls = c.GetNamespacesToCopy ();
 			name = c.ParseAvtAttribute ("name");
@@ -94,6 +97,9 @@ namespace Mono.Xml.Xsl.Operations {
 
 		public override void Evaluate (XslTransformProcessor p)
 		{
+			if (p.Debugger != null)
+				p.Debugger.DebugExecute (p, this.DebugInput);
+
 			string nm, nmsp, prefix;
 			
 			nm = calcName != null ? calcName : name.Evaluate (p);

+ 6 - 0
mcs/class/System.XML/Mono.Xml.Xsl.Operations/XslCallTemplate.cs

@@ -44,6 +44,9 @@ namespace Mono.Xml.Xsl.Operations {
 		
 		protected override void Compile (Compiler c)
 		{
+			if (c.Debugger != null)
+				c.Debugger.DebugCompile (c.Input);
+
 			c.AssertAttribute ("name");
 			name = c.ParseQNameAttribute ("name");
 			
@@ -78,6 +81,9 @@ namespace Mono.Xml.Xsl.Operations {
 		
 		public override void Evaluate (XslTransformProcessor p)
 		{			
+			if (p.Debugger != null)
+				p.Debugger.DebugExecute (p, this.DebugInput);
+
 			p.CallTemplate (name, withParams);
 		}
 	}

+ 6 - 0
mcs/class/System.XML/Mono.Xml.Xsl.Operations/XslChoose.cs

@@ -45,6 +45,9 @@ namespace Mono.Xml.Xsl.Operations {
 		
 		protected override void Compile (Compiler c)
 		{
+			if (c.Debugger != null)
+				c.Debugger.DebugCompile (c.Input);
+
 			if (!c.Input.MoveToFirstChild ())
 				throw new XsltCompileException ("Expecting non-empty element", null, c.Input);
 			
@@ -82,6 +85,9 @@ namespace Mono.Xml.Xsl.Operations {
 
 		public override void Evaluate (XslTransformProcessor p)
 		{
+			if (p.Debugger != null)
+				p.Debugger.DebugExecute (p, this.DebugInput);
+
 			int len = conditions.Count;
 			for (int i = 0; i < len; i++) {
 				if (((XslIf)conditions [i]).EvaluateIfTrue (p))

+ 6 - 0
mcs/class/System.XML/Mono.Xml.Xsl.Operations/XslComment.cs

@@ -45,6 +45,9 @@ namespace Mono.Xml.Xsl.Operations {
 
 		protected override void Compile (Compiler c)
 		{
+			if (c.Debugger != null)
+				c.Debugger.DebugCompile (c.Input);
+
 			if (c.Input.MoveToFirstAttribute ()) {
 				do {
 					if (c.Input.NamespaceURI == String.Empty)
@@ -61,6 +64,9 @@ namespace Mono.Xml.Xsl.Operations {
 		
 		public override void Evaluate (XslTransformProcessor p)
 		{
+			if (p.Debugger != null)
+				p.Debugger.DebugExecute (p, this.DebugInput);
+
 			p.Out.WriteComment (value == null ? String.Empty :
 				value.EvaluateAsString (p));
 		}

+ 8 - 0
mcs/class/System.XML/Mono.Xml.Xsl.Operations/XslCompiledElement.cs

@@ -44,6 +44,7 @@ namespace Mono.Xml.Xsl.Operations
 	{
 		int lineNumber;
 		int linePosition;
+		XPathNavigator debugInput;
 
 		// It does not automatically invoke Compile() in .ctor()
 		public XslCompiledElementBase (Compiler c)
@@ -53,6 +54,13 @@ namespace Mono.Xml.Xsl.Operations
 				lineNumber = li.LineNumber;
 				linePosition = li.LinePosition;
 			}
+			// store input only when the debugger is enabled
+			if (c.Debugger != null)
+				debugInput = c.Input.Clone ();
+		}
+
+		public XPathNavigator DebugInput {
+			get { return debugInput; }
 		}
 
 		public int LineNumber {

+ 6 - 0
mcs/class/System.XML/Mono.Xml.Xsl.Operations/XslCopy.cs

@@ -46,6 +46,9 @@ namespace Mono.Xml.Xsl.Operations {
 		
 		protected override void Compile (Compiler c)
 		{
+			if (c.Debugger != null)
+				c.Debugger.DebugCompile (c.Input);
+
 			this.nsDecls = c.GetNamespacesToCopy ();
 			if (nsDecls.Count == 0)
 				nsDecls = null;
@@ -68,6 +71,9 @@ namespace Mono.Xml.Xsl.Operations {
 
 		public override void Evaluate (XslTransformProcessor p)
 		{
+			if (p.Debugger != null)
+				p.Debugger.DebugExecute (p, this.DebugInput);
+
 			switch (p.CurrentNode.NodeType)
 			{
 			case XPathNodeType.Root:

+ 6 - 0
mcs/class/System.XML/Mono.Xml.Xsl.Operations/XslCopyOf.cs

@@ -42,6 +42,9 @@ namespace Mono.Xml.Xsl.Operations {
 		public XslCopyOf (Compiler c) : base (c) {}
 		protected override void Compile (Compiler c)
 		{
+			if (c.Debugger != null)
+				c.Debugger.DebugCompile (c.Input);
+
 			c.AssertAttribute ("select");
 			select = c.CompileExpression (c.GetAttribute ("select"));
 		}
@@ -127,6 +130,9 @@ namespace Mono.Xml.Xsl.Operations {
 	
 		public override void Evaluate (XslTransformProcessor p)
 		{
+			if (p.Debugger != null)
+				p.Debugger.DebugExecute (p, this.DebugInput);
+
 			object o = p.Evaluate (select);
 			XPathNodeIterator itr = o as XPathNodeIterator;
 			if (itr == null) {

+ 6 - 0
mcs/class/System.XML/Mono.Xml.Xsl.Operations/XslElement.cs

@@ -51,6 +51,9 @@ namespace Mono.Xml.Xsl.Operations {
 		public XslElement (Compiler c) : base (c) {}
 		protected override void Compile (Compiler c)
 		{
+			if (c.Debugger != null)
+				c.Debugger.DebugCompile (c.Input);
+
 			name = c.ParseAvtAttribute ("name");
 			ns = c.ParseAvtAttribute ("namespace");
 			nsDecls = c.GetNamespacesToCopy ();
@@ -92,6 +95,9 @@ namespace Mono.Xml.Xsl.Operations {
 		
 		public override void Evaluate (XslTransformProcessor p)
 		{
+			if (p.Debugger != null)
+				p.Debugger.DebugExecute (p, this.DebugInput);
+
 			string nm, nmsp, localName, prefix;
 			
 			localName = nm = calcName != null ? calcName : name.Evaluate (p);

+ 6 - 0
mcs/class/System.XML/Mono.Xml.Xsl.Operations/XslFallback.cs

@@ -45,6 +45,9 @@ namespace Mono.Xml.Xsl.Operations {
 		
 		protected override void Compile (Compiler c)
 		{
+			if (c.Debugger != null)
+				c.Debugger.DebugCompile (c.Input);
+
 			if (!c.Input.MoveToFirstChild ()) return;
 			children = c.CompileTemplateContent ();
 			c.Input.MoveToParent ();
@@ -52,6 +55,9 @@ namespace Mono.Xml.Xsl.Operations {
 		
 		public override void Evaluate (XslTransformProcessor p)
 		{
+			if (p.Debugger != null)
+				p.Debugger.DebugExecute (p, this.DebugInput);
+
 			children.Evaluate (p);
 		}
 	}

+ 6 - 0
mcs/class/System.XML/Mono.Xml.Xsl.Operations/XslForEach.cs

@@ -46,6 +46,9 @@ namespace Mono.Xml.Xsl.Operations {
 		
 		protected override void Compile (Compiler c)
 		{
+			if (c.Debugger != null)
+				c.Debugger.DebugCompile (c.Input);
+
 			c.AssertAttribute ("select");
 			select = c.CompileExpression (c.GetAttribute ("select"));
 			ArrayList sorterList = null;
@@ -78,6 +81,9 @@ namespace Mono.Xml.Xsl.Operations {
 		
 		public override void Evaluate (XslTransformProcessor p)
 		{
+			if (p.Debugger != null)
+				p.Debugger.DebugExecute (p, this.DebugInput);
+
 			if (children == null)
 				return;
 

+ 6 - 0
mcs/class/System.XML/Mono.Xml.Xsl.Operations/XslIf.cs

@@ -46,6 +46,9 @@ namespace Mono.Xml.Xsl.Operations {
 		
 		protected override void Compile (Compiler c)
 		{
+			if (c.Debugger != null)
+				c.Debugger.DebugCompile (c.Input);
+
 			c.AssertAttribute ("test");
 			c.Input.MoveToFirstAttribute ();
 			do {
@@ -78,6 +81,9 @@ namespace Mono.Xml.Xsl.Operations {
 
 		public override void Evaluate (XslTransformProcessor p)
 		{
+			if (p.Debugger != null)
+				p.Debugger.DebugExecute (p, this.DebugInput);
+
 			EvaluateIfTrue (p);
 		}
 	}

+ 6 - 0
mcs/class/System.XML/Mono.Xml.Xsl.Operations/XslLiteralElement.cs

@@ -81,6 +81,9 @@ namespace Mono.Xml.Xsl.Operations {
 		
 		protected override void Compile (Compiler c)
 		{
+			if (c.Debugger != null)
+				c.Debugger.DebugCompile (this.DebugInput);
+
 			prefix = c.Input.Prefix;
 			string alias = c.CurrentStylesheet.GetActualPrefix (prefix);
 			if (alias != prefix) {
@@ -114,6 +117,9 @@ namespace Mono.Xml.Xsl.Operations {
 
 		public override void Evaluate (XslTransformProcessor p)
 		{
+			if (p.Debugger != null)
+				p.Debugger.DebugExecute (p, this.DebugInput);
+
 			// Since namespace-alias might be determined after compilation
 			// of import-ing stylesheets, this must be determined later.
 			bool isCData = p.InsideCDataElement;

+ 6 - 0
mcs/class/System.XML/Mono.Xml.Xsl.Operations/XslMessage.cs

@@ -65,6 +65,9 @@ namespace Mono.Xml.Xsl.Operations
 		
 		protected override void Compile (Compiler c)
 		{
+			if (c.Debugger != null)
+				c.Debugger.DebugCompile (this.DebugInput);
+
 			terminate = c.ParseYesNoAttribute ("terminate", false);
 			
 			if (!c.Input.MoveToFirstChild ()) return;
@@ -74,6 +77,9 @@ namespace Mono.Xml.Xsl.Operations
 		
 		public override void Evaluate (XslTransformProcessor p)
 		{
+			if (p.Debugger != null)
+				p.Debugger.DebugExecute (p, this.DebugInput);
+
 			if (children != null)
 				output.Write (children.EvaluateAsString (p));
 			if (terminate)

+ 6 - 0
mcs/class/System.XML/Mono.Xml.Xsl.Operations/XslNotSupportedOperation.cs

@@ -51,6 +51,9 @@ namespace Mono.Xml.Xsl.Operations
 
 		protected override void Compile (Compiler c)
 		{
+			if (c.Debugger != null)
+				c.Debugger.DebugCompile (this.DebugInput);
+
 			name = c.Input.LocalName;
 			if (c.Input.MoveToFirstChild ()) {
 				do {
@@ -68,6 +71,9 @@ namespace Mono.Xml.Xsl.Operations
 
 		public override void Evaluate (XslTransformProcessor p)
 		{
+			if (p.Debugger != null)
+				p.Debugger.DebugExecute (p, this.DebugInput);
+
 			if (fallbacks != null) {
 				foreach (XslFallback f in fallbacks)
 					f.Evaluate (p);

+ 6 - 0
mcs/class/System.XML/Mono.Xml.Xsl.Operations/XslNumber.cs

@@ -74,6 +74,9 @@ namespace Mono.Xml.Xsl.Operations {
 
 		protected override void Compile (Compiler c)
 		{
+			if (c.Debugger != null)
+				c.Debugger.DebugCompile (this.DebugInput);
+
 			switch (c.GetAttribute ("level"))
 			{
 			case "single":
@@ -105,6 +108,9 @@ namespace Mono.Xml.Xsl.Operations {
 
 		public override void Evaluate (XslTransformProcessor p)
 		{
+			if (p.Debugger != null)
+				p.Debugger.DebugExecute (p, this.DebugInput);
+
 			string formatted = GetFormat (p);
 			if (formatted != String.Empty)
 				p.Out.WriteString (formatted);

+ 6 - 0
mcs/class/System.XML/Mono.Xml.Xsl.Operations/XslProcessingInstruction.cs

@@ -47,6 +47,9 @@ namespace Mono.Xml.Xsl.Operations {
 		
 		protected override void Compile (Compiler c)
 		{
+			if (c.Debugger != null)
+				c.Debugger.DebugCompile (this.DebugInput);
+
 			name = c.ParseAvtAttribute ("name");
 
 			if (c.Input.MoveToFirstAttribute ()) {
@@ -65,6 +68,9 @@ namespace Mono.Xml.Xsl.Operations {
 
 		public override void Evaluate (XslTransformProcessor p)
 		{
+			if (p.Debugger != null)
+				p.Debugger.DebugExecute (p, this.DebugInput);
+
 			string actualName = name.Evaluate (p);
 			if (String.Compare (actualName, "xml", true, CultureInfo.InvariantCulture) == 0)
 				throw new XsltException ("Processing instruction name was evaluated to \"xml\"", null, p.CurrentNode);

+ 6 - 0
mcs/class/System.XML/Mono.Xml.Xsl.Operations/XslTemplateContent.cs

@@ -62,6 +62,9 @@ namespace Mono.Xml.Xsl.Operations
 
 		protected override void Compile (Compiler c)
 		{
+			if (c.Debugger != null)
+				c.Debugger.DebugCompile (this.DebugInput);
+
 			hasStack = (c.CurrentVariableScope == null);
 			c.PushScope ();
 			do {	
@@ -185,6 +188,9 @@ namespace Mono.Xml.Xsl.Operations
 		
 		public override void Evaluate (XslTransformProcessor p)
 		{
+			if (p.Debugger != null)
+				p.Debugger.DebugExecute (p, this.DebugInput);
+
 			if (hasStack)
 				p.PushStack (stackSize);
 			

+ 6 - 0
mcs/class/System.XML/Mono.Xml.Xsl.Operations/XslText.cs

@@ -49,6 +49,9 @@ namespace Mono.Xml.Xsl.Operations {
 
 		protected override void Compile (Compiler c)
 		{
+			if (c.Debugger != null)
+				c.Debugger.DebugCompile (this.DebugInput);
+
 			this.text = c.Input.Value;
 			
 			if (c.Input.NodeType == XPathNodeType.Element)
@@ -58,6 +61,9 @@ namespace Mono.Xml.Xsl.Operations {
 
 		public override void Evaluate (XslTransformProcessor p)
 		{
+			if (p.Debugger != null)
+				p.Debugger.DebugExecute (p, this.DebugInput);
+
 			if (!disableOutputEscaping) {
 				if (isWhitespace)
 					p.Out.WriteWhitespace (text);

+ 6 - 0
mcs/class/System.XML/Mono.Xml.Xsl.Operations/XslValueOf.cs

@@ -45,6 +45,9 @@ namespace Mono.Xml.Xsl.Operations {
 
 		protected override void Compile (Compiler c)
 		{
+			if (c.Debugger != null)
+				c.Debugger.DebugCompile (this.DebugInput);
+
 			c.AssertAttribute ("select");
 			select = c.CompileExpression (c.GetAttribute ("select"));
 			disableOutputEscaping = c.ParseYesNoAttribute ("disable-output-escaping", false);
@@ -54,6 +57,9 @@ namespace Mono.Xml.Xsl.Operations {
 		
 		public override void Evaluate (XslTransformProcessor p)
 		{
+			if (p.Debugger != null)
+				p.Debugger.DebugExecute (p, this.DebugInput);
+
 			if (!disableOutputEscaping)
 				p.Out.WriteString (p.EvaluateString (select));
 			else

+ 12 - 0
mcs/class/System.XML/Mono.Xml.Xsl.Operations/XslVariable.cs

@@ -133,6 +133,9 @@ namespace Mono.Xml.Xsl.Operations {
 		
 		protected override void Compile (Compiler c)
 		{
+			if (c.Debugger != null)
+				c.Debugger.DebugCompile (this.DebugInput);
+
 			this.var = new XslVariableInformation (c);
 		}
 		
@@ -163,6 +166,9 @@ namespace Mono.Xml.Xsl.Operations {
 			
 		public override void Evaluate (XslTransformProcessor p)
 		{
+			if (p.Debugger != null)
+				p.Debugger.DebugExecute (p, this.DebugInput);
+
 			Hashtable varInfo = p.globalVariableTable;
 			
 			if (varInfo.Contains (this)) {
@@ -210,6 +216,9 @@ namespace Mono.Xml.Xsl.Operations {
 		
 		public override void Evaluate (XslTransformProcessor p)
 		{	
+			if (p.Debugger != null)
+				p.Debugger.DebugExecute (p, this.DebugInput);
+
 			p.SetStackItem (slot, var.Evaluate (p));
 		}
 		
@@ -233,6 +242,9 @@ namespace Mono.Xml.Xsl.Operations {
 		
 		public override void Evaluate (XslTransformProcessor p)
 		{
+			if (p.Debugger != null)
+				p.Debugger.DebugExecute (p, this.DebugInput);
+
 			if (p.GetStackItem (slot) != null)
 				return; // evaluated already
 

+ 6 - 0
mcs/class/System.XML/Mono.Xml.Xsl/ChangeLog

@@ -1,3 +1,9 @@
+2007-06-28  Atsushi Enomoto  <[email protected]>
+
+	initial attempt to hook debuggers.
+	* XsltDebuggerWrapper.cs : new.
+	* XslTransformProcessor.cs Compiler.cs : use above.
+
 2007-01-09  Atsushi Enomoto  <[email protected]>
 
 	* XslKey.cs : keep keytables per instance document and do not share

+ 11 - 0
mcs/class/System.XML/Mono.Xml.Xsl/Compiler.cs

@@ -124,6 +124,17 @@ namespace Mono.Xml.Xsl
 		Hashtable outputs = new Hashtable ();
 		bool keyCompilationMode;	
 		string stylesheetVersion;
+		XsltDebuggerWrapper debugger;
+
+		public Compiler (object debugger)
+		{
+			if (debugger != null)
+				this.debugger = new XsltDebuggerWrapper (debugger);
+		}
+
+		public XsltDebuggerWrapper Debugger {
+			get { return debugger; }
+		}
 
 		public CompiledStylesheet Compile (XPathNavigator nav, XmlResolver res, Evidence evidence)
 		{

+ 10 - 2
mcs/class/System.XML/Mono.Xml.Xsl/XslTransformProcessor.cs

@@ -44,6 +44,8 @@ using QName = System.Xml.XmlQualifiedName;
 
 namespace Mono.Xml.Xsl {
 	internal class XslTransformProcessor {
+		XsltDebuggerWrapper debugger;
+		
 		CompiledStylesheet compiledStyle;
 		
 		XslStylesheet style;
@@ -61,11 +63,13 @@ namespace Mono.Xml.Xsl {
 		// Store the values of global params
 		internal Hashtable globalVariableTable = new Hashtable ();
 		
-		public XslTransformProcessor (CompiledStylesheet style)
+		public XslTransformProcessor (CompiledStylesheet style, object debugger)
 		{
 			this.XPathContext = new XsltCompiledContext (this);
 			this.compiledStyle = style;
 			this.style = style.Style;
+			if (debugger != null)
+				this.debugger = new XsltDebuggerWrapper (debugger);
 		}
 
 		public void Process (XPathNavigator root, Outputter outputtter, XsltArgumentList args, XmlResolver resolver)
@@ -108,7 +112,11 @@ namespace Mono.Xml.Xsl {
 			this.ApplyTemplates (root.Select (exp, this.XPathContext), QName.Empty, null);
 			this.PopOutput ();
 		}
-		
+
+		public XsltDebuggerWrapper Debugger {
+			get { return debugger; }
+		}
+
 		public CompiledStylesheet CompiledStyle { get { return compiledStyle; }}
 		public XsltArgumentList Arguments {get{return args;}}
 		

+ 64 - 0
mcs/class/System.XML/Mono.Xml.Xsl/XsltDebuggerWrapper.cs

@@ -0,0 +1,64 @@
+//
+// XsltDebuggerWrapper.cs
+//
+// Author:
+//	Atsushi Enomoto  <[email protected]>
+//	
+// Copyright (C) 2007 Novell, Inc.
+//
+
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using System;
+using System.Reflection;
+using System.Xml;
+using System.Xml.XPath;
+
+namespace Mono.Xml.Xsl 
+{
+	internal class XsltDebuggerWrapper
+	{
+		readonly MethodInfo on_compile, on_execute;
+		readonly object impl;
+
+		public XsltDebuggerWrapper (object impl)
+		{
+			this.impl = impl;
+			on_compile = impl.GetType ().GetMethod ("OnCompile", BindingFlags.NonPublic | BindingFlags.Instance);
+			if (on_compile == null)
+				throw new InvalidOperationException ("INTERNAL ERROR: the debugger does not look like what System.Xml.dll expects. OnCompile method was not found");
+			on_execute = impl.GetType ().GetMethod ("OnExecute", BindingFlags.NonPublic | BindingFlags.Instance);
+			if (on_execute == null)
+				throw new InvalidOperationException ("INTERNAL ERROR: the debugger does not look like what System.Xml.dll expects. OnExecute method was not found");
+		}
+
+		public void DebugCompile (XPathNavigator style)
+		{
+			on_compile.Invoke (impl, new object [] {style.Clone ()});
+		}
+
+		public void DebugExecute (XslTransformProcessor p, XPathNavigator style)
+		{
+			on_execute.Invoke (impl, new object [] {p.CurrentNodeset.Clone (), style.Clone (), p.XPathContext});
+		}
+	}
+}

+ 5 - 0
mcs/class/System.XML/System.Xml.Xsl/ChangeLog

@@ -1,3 +1,8 @@
+2007-06-28  Atsushi Enomoto  <[email protected]>
+
+	* XslCompiledTransform.cs XslTransform.cs : initial attempt to
+	  support external debugger.
+
 2006-11-30  Atsushi Enomoto  <[email protected]>
 
 	* XslTransform.cs, XsltException.cs : added XSLT stack frame debug

+ 3 - 3
mcs/class/System.XML/System.Xml.Xsl/XslCompiledTransform.cs

@@ -157,7 +157,7 @@ namespace System.Xml.Xsl
 				throw new XsltException ("No stylesheet was loaded.", null);
 
 			Outputter outputter = new GenericOutputter (output, s.Outputs, null);
-			new XslTransformProcessor (s).Process (input, outputter, args, resolver);
+			new XslTransformProcessor (s, null).Process (input, outputter, args, resolver);
 			output.Flush ();
 		}
 
@@ -173,7 +173,7 @@ namespace System.Xml.Xsl
 				throw new XsltException ("No stylesheet was loaded.", null);
 
 			Outputter outputter = new GenericOutputter(output, s.Outputs, output.Encoding);
-			new XslTransformProcessor (s).Process (input, outputter, args, null);
+			new XslTransformProcessor (s, null).Process (input, outputter, args, null);
 			outputter.Done ();
 			output.Flush ();
 		}
@@ -230,7 +230,7 @@ namespace System.Xml.Xsl
 		private void Load (XPathNavigator stylesheet,
 			XsltSettings settings, XmlResolver resolver)
 		{
-			s = new Compiler ().Compile (stylesheet, resolver, null);
+			s = new Compiler (null).Compile (stylesheet, resolver, null);
 		}
 
 		#endregion

+ 13 - 3
mcs/class/System.XML/System.Xml.Xsl/XslTransform.cs

@@ -61,6 +61,16 @@ namespace System.Xml.Xsl {
 			}
 		}
 
+		public XslTransform ()
+		{
+		}
+
+		internal XslTransform (object debugger)
+		{
+			this.debugger = debugger;
+		}
+
+		object debugger;
 		CompiledStylesheet s;
 		XmlResolver xmlResolver = new XmlUrlResolver ();
 
@@ -184,7 +194,7 @@ namespace System.Xml.Xsl {
 				throw new XsltException ("No stylesheet was loaded.", null);
 
 			Outputter outputter = new GenericOutputter (output, s.Outputs, null);
-			new XslTransformProcessor (s).Process (input, outputter, args, resolver);
+			new XslTransformProcessor (s, debugger).Process (input, outputter, args, resolver);
 			output.Flush ();
 		}
 
@@ -224,7 +234,7 @@ namespace System.Xml.Xsl {
 				throw new XsltException ("No stylesheet was loaded.", null);
 
 			Outputter outputter = new GenericOutputter(output, s.Outputs, output.Encoding);			
-			new XslTransformProcessor (s).Process (input, outputter, args, resolver);
+			new XslTransformProcessor (s, debugger).Process (input, outputter, args, resolver);
 			outputter.Done ();
 			output.Flush ();
 		}
@@ -342,7 +352,7 @@ namespace System.Xml.Xsl {
 		internal void Load (XPathNavigator stylesheet, XmlResolver resolver, Evidence evidence)
 #endif
 		{
-			s = new Compiler ().Compile (stylesheet, resolver, evidence);
+			s = new Compiler (debugger).Compile (stylesheet, resolver, evidence);
 		}
 
 #if NET_1_1

+ 1 - 0
mcs/class/System.XML/System.Xml.dll.sources

@@ -70,6 +70,7 @@ Mono.Xml.Xsl/XslStylesheet.cs
 Mono.Xml.Xsl/XslTemplate.cs
 Mono.Xml.Xsl/XslTransformProcessor.cs
 Mono.Xml.Xsl/XsltCompiledContext.cs
+Mono.Xml.Xsl/XsltDebuggerWrapper.cs
 Mono.Xml.Xsl/XslFunctions.cs
 Mono.Xml/IHasXmlParserContext.cs
 Mono.Xml/IHasXmlSchemaInfo.cs