Class PDFSlice
java.lang.Object
com.ibm.wala.examples.drivers.PDFSlice
This simple example WALA application computes a slice (see
Slicer
) and fires off the PDF
viewer to view a dot-ted representation of the slice.
This is an example program on how to use the slicer.
See the 'PDFSlice' launcher included in the 'launchers' directory.
- Author:
- sfink
- See Also:
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic Statement
If s is a call statement, return the statement representing the normal return from sstatic void
Usage: PDFSlice -appJar [jar file name] -mainClass [main class] -srcCaller [method name] -srcCallee [method name] -dd [data dependence options] -cd [control dependence options] -dir [forward|backward] "jar file name" should be something like "c:/temp/testdata/java_cup.jar" "main class" should beshould be something like "c:/temp/testdata/java_cup.jar" "method name" should be the name of a method.static NodeDecorator
<Statement> pruneSDG
(SDG<InstanceKey> sdg, Collection<Statement> slice) return a view of the sdg restricted to the statements in the slicestatic Process
seemain(String[])
for command-line argumentsstatic Process
run
(String appJar, String mainClass, String srcCaller, String srcCallee, boolean goBackward, Slicer.DataDependenceOptions dOptions, Slicer.ControlDependenceOptions cOptions) Compute a slice from a call statements, dot it, and fire off the PDF viewer to visualize the result
-
Constructor Details
-
PDFSlice
public PDFSlice()
-
-
Method Details
-
main
public static void main(String[] args) throws IllegalArgumentException, CancelException, IOException Usage: PDFSlice -appJar [jar file name] -mainClass [main class] -srcCaller [method name] -srcCallee [method name] -dd [data dependence options] -cd [control dependence options] -dir [forward|backward]- "jar file name" should be something like "c:/temp/testdata/java_cup.jar"
- "main class" should beshould be something like "c:/temp/testdata/java_cup.jar"
- "method name" should be the name of a method. This takes a slice from the statement that calls "srcCallee" from "srcCaller"
- "data dependence options" can be one of "-full", "-no_base_ptrs", "-no_base_no_heap", "-no_heap", "-no_base_no_heap_no_cast", or "-none".
- "control dependence options" can be "-full" or "-none"
- the -dir argument tells whether to compute a forwards or backwards slice.
- Throws:
IllegalArgumentException
CancelException
IOException
- See Also:
-
run
public static Process run(String[] args) throws IllegalArgumentException, CancelException, IOException seemain(String[])
for command-line arguments -
run
public static Process run(String appJar, String mainClass, String srcCaller, String srcCallee, boolean goBackward, Slicer.DataDependenceOptions dOptions, Slicer.ControlDependenceOptions cOptions) throws IllegalArgumentException, CancelException, IOException Compute a slice from a call statements, dot it, and fire off the PDF viewer to visualize the result- Parameters:
appJar
- should be something like "c:/temp/testdata/java_cup.jar"mainClass
- should be something like "c:/temp/testdata/java_cup.jar"srcCaller
- name of the method containing the statement of interestsrcCallee
- name of the method called by the statement of interestgoBackward
- do a backward slice?dOptions
- options controlling data dependencecOptions
- options controlling control dependence- Returns:
- a Process running the PDF viewer to visualize the dot'ted representation of the slice
- Throws:
IllegalArgumentException
CancelException
IOException
-
getReturnStatementForCall
-
pruneSDG
return a view of the sdg restricted to the statements in the slice -
makeNodeDecorator
- Returns:
- a NodeDecorator that decorates statements in a slice for a dot-ted representation
-