Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

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?

share|improve this question
add comment

2 Answers

up vote 0 down vote accepted

The following Chrome screenshot shows the trace output from an XSLT 2.0 processor running in the browser:

enter image description here

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.

share|improve this answer
    
I've added this as a separate answer because it's different from my earlier attempt, but a related technology. Still not quite sure if this is what is meant by slicing - but it's closer, I think. –  pgfearo Apr 15 '12 at 7:43
add comment

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:

  1. 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.
  2. When an expression doesn't behave as expected, different expression parts can be evaluated to narrow down the area of interest.
share|improve this answer
    
Not quite what I had in mind, but interesting nonetheless –  Lorin Hochstein Apr 15 '12 at 1:47
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.