Program slicing is one of those software technologies where there is much more activity in the research community than in the industry community. Does anybody outside of the research community using slicing tools on production code to help with debugging or other tasks? If so, what tools did you use?
closed as too broad by user40980, Matthew Flynn, gnat Nov 10 '15 at 19:56
Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer. Avoid asking multiple distinct questions at once. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.
The following Chrome screenshot shows the trace output from an XSLT 2.0 processor running in the browser:
The XSLT program is 'sliced' so every instruction records in the trace output when it was executed. The nesting of the output XML explains the execution hierarchy.
The above sample helps show the actual template that was executed as a result of the xsl:apply-templates instruction. Thus the trace shows the same information that you would get from an IDE debugger - but without having to step through each line of code.
If an exception is thrown within the executing code, then the trace terminates at that point, showing exactly where the code failed, providing more information that a typical call-stack.
Also, additional trace instructions can be embedded in the XSLT (in the form of a fn:trace function call) to provide extra diagnostics for a specific part of the code.
An online XPath Tracer performs slicing, but it might not meet your definition because it's for an expression language, XPath 2.0, rather than a full-blown programming language.
Currently, this permits specific parts of the expression to be selected; the 'path' for that part of the expression is then resolved and displayed. In this case, XSLT 2.0 is being used to perform a partial parse of the expression.
This tracer has 2 objectives for when it's complete:
- It will allow an auto-complete list to show available nodes for a specific path (for a chosen source file) - when a part of the expression is being edited.
- When an expression doesn't behave as expected, different expression parts can be evaluated to narrow down the area of interest.