Project

Profile

Help

Feature #4067

Enhanced stack trace after dynamic errors: show values of variables

Added by Michael Kay almost 3 years ago. Updated over 2 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
Diagnostics
Sprint/Milestone:
-
Start date:
2018-12-13
Due date:
% Done:

100%

Estimated time:
Legacy ID:
Applies to branch:
9.9, trunk
Fix Committed on Branch:
9.9, trunk
Fixed in Maintenance Release:
Platforms:

Description

In my own debugging I have found it would be very useful in the stack trace that occurs on dynamic errors to be able to see the values of variables on the stack frame. This information is available and it's not difficult to add it to the output.

The main question is whether this should be enabled/disabled by default and how/whether it should be possible to switch it on or off.

History

#1 Updated by Michael Kay almost 3 years ago

Here is an example of the output:

Error evaluating ((attr{name=...}, ...)) on line 1497 column 77 of XSLT-SEF-compiler.xsl:
  XTDE0700: No value supplied for required parameter $uniform-namespaces. A value is
  required because the default value is not a valid instance of the required type
  at xsl:apply-templates (file:/Users/mike/repo/src/xslt/constructs/select-sequence.xsl#16)
     processing xsl:stylesheet/xsl:param[1]/@select
     Local parameters
        $attr = ()
     Tunnel parameters
        $options = map{}
        $exclude-prefixes =  ("X", "#all", "xsl") 
        $expand-text = true()
        $static-context = map{"backward-compatibility":false(), "namespace-aliases":map{"X":"xsl", }, "exclude-prefixes":("X", "#all", "xsl"), "location":@module, "xsl-version":3}
        $location = @module
        $backward-compatibility = false()
        $namespace-aliases = map{"X":"xsl", }
        $named-template-signatures = map{(:size 24:)}
        $defined-attribute-sets = ()
        $ns = "xml=~ xsl=~ xs=http://www.w3.org/20..."
     Local variables
        $xpath-default-namespace = ()
        $default-collation = ()
        $backward-compatibility = false()
        $uniform-namespaces = (*null*)
        $role = (*null*)
        $attr = (*null*)
        $type = (*null*)
        $surroundFunction = (*null*)
        $errorCode = (*null*)
        $node = (*null*)
  at xsl:apply-templates (file:/Users/mike/repo/src/xslt/XSLT-SEF-compiler.xsl#1373)
     processing xsl:stylesheet/xsl:param[1]
     Tunnel parameters
        $options = map{}
        $exclude-prefixes =  ("X", "#all", "xsl") 
        $expand-text = true()
        $static-context = map{"backward-compatibility":false(), "namespace-aliases":map{"X":"xsl", }, "exclude-prefixes":("X", "#all", "xsl"), "location":@module, "xsl-version":3}
        $location = @module
        $backward-compatibility = false()
        $namespace-aliases = map{"X":"xsl", }
        $named-template-signatures = map{(:size 24:)}
        $defined-attribute-sets = ()
        $ns = "xml=~ xsl=~ xs=http://www.w3.org/20..."
     Local variables
        $attr = ()
  at xsl:apply-templates (file:/Users/mike/repo/src/xslt/XSLT-SEF-compiler.xsl#833)
     processing xsl:stylesheet/xsl:param[1]
     Tunnel parameters
        $options = map{}
        $exclude-prefixes =  ("X", "#all", "xsl") 
        $expand-text = true()
        $static-context = map{"backward-compatibility":false(), "namespace-aliases":map{"X":"xsl", }, "exclude-prefixes":("X", "#all", "xsl"), "location":@module, "xsl-version":3}
        $location = @module
        $backward-compatibility = false()
        $namespace-aliases = map{"X":"xsl", }
        $named-template-signatures = map{(:size 24:)}
        $defined-attribute-sets = ()
     Local variables
        $attr = (*null*)
  at xsl:apply-templates (file:/Users/mike/repo/src/xslt/XSLT-SEF-compiler.xsl#374)
     processing xsl:stylesheet
     Tunnel parameters
        $options = map{}
     Local variables
        $attr = (*null*)
        $exclude-prefixes = (*null*)
  at xsl:apply-templates (file:/Users/mike/repo/src/xslt/XSLT-SEF-compiler.xsl#269)
     processing /xsl:stylesheet
     Tunnel parameters
        $options = map{}
     Local variables
        $stylesheet-base-uri = "file:/Users/mike/repo/src/xslt/XSLT..."
        $options = map{}
        $static-processed = <xsl:stylesheet>
        $temp = (*null*)
        $normalized = <xsl:stylesheet>

#2 Updated by Michael Kay almost 3 years ago

I decided to make this Saxon-EE only. It is enabled by default, and the level of stack frame detail can be reduced from the default by a setter method on the StandardErrorListener (or the StandardErrorListener can be subclassed).

#3 Updated by Michael Kay almost 3 years ago

This is implemented and working reasonably well. The output is a little misleading in cases where tail-call recursion has been used and stack frames are therefore reused.

#4 Updated by Michael Kay over 2 years ago

  • Status changed from In Progress to Resolved
  • Applies to branch 9.9, trunk added
  • Fix Committed on Branch 9.9, trunk added
  • Fixed in Maintenance Release 9.9.1.1 added

Implemented and shipped in the 9.9.1.1 release.

#5 Updated by O'Neil Delpratt over 2 years ago

  • Status changed from Resolved to Closed
  • % Done changed from 0 to 100

Please register to edit this issue

Also available in: Atom PDF