Presentation is loading. Please wait.

Presentation is loading. Please wait.

Using IBM Wala’s Slicer for CSCI578 HW3

Similar presentations


Presentation on theme: "Using IBM Wala’s Slicer for CSCI578 HW3"— Presentation transcript:

1 Using IBM Wala’s Slicer for CSCI578 HW3
By Joshua Garcia

2 Some Requirements Eclipse IDE
SVN or Git Plugin for Eclipse (e.g. Subclipse at

3 Getting the IBM Wala code
Check out all com.ibm.wala* projects form the trunk of the repository EXCEPT for com.ibm.wala.core.tests Import com.ibm.wala.core.tests from the zip file we provide Reference A more general guide to starting with Wala:

4 Possible Building Problems
Some of the projects will have errors. I have errors in the following Wala projects: com.ibm.wala.cast.js.rhino.test com.ibm.wala.cast.js.test com.ibm.wala.ide.jsdt com.ibm.wala.ide.tests However, you won’t be using all the code so it shouldn’t be a problem However, you should set your JDK compiler compliance level to 1.6 Click Window -> Preferences Java -> Compiler Set Compiler compliance level to 1.6

5 Configuring Properties Files
Go to this page: Follow the section called “Configuring WALA properties” Wait there’s more and it’s IMPORTANT – You need to set some properties in dat/wala.examples.properties as well Just copy the wala.example.properties.sample file and rename it

6 A Little About Slicing Before We Continue
Given a statement and a subset of its variables, you can perform forward or backward slicing A slice is a set of statements that affect or are affected by the selected statement Forward slicing gives you the statements affected by your selected statement Backward slicing gives you the statements that affect the given statement

7 More on slicing, If You Are Interested

8 Time To Slice Some Programs
You should be able to run our customized PDFSliceMod drivers There are three launcher configuration you can modify and run as needed (one for each DEB application): PDFSliceMod KLAX PDFSliceMod specjms from stmts file PDFSliceMod stoxx Simple way to get to these launcher configurations Click Run -> Run Configurations Under Java Application select the appropriate launcher configuration

9 Customizing the launcher configuration
The launcher configuration takes a few arguments You can see these arguments from the Arguments tab of the launcher configuration For example, for PDFSliceMod KLAX, here are the arguments -appJar ${workspace_loc}/com.ibm.wala.core.tests/apps/c2fw-original.jar -sliceCritFiles "${workspace_loc}/com.ibm.wala.core.tests/c2fw-mda-task0-search-deps-stmts.txt" -dd "no_base_no_heap" -cd "none" -dir "backwards" -pkgIncludes "Lc2/apps/klax" The arguments and what they do appJar, the jar of the DEB application (no need to change it) srcCaller, the method you will create the slice from sliceCritFiles, file name of the file containing the input statements to the slicer dir, “forward” or “backward” slice pkgIncludes, which packages to analyze and show for output For the remaining options take a look at You may not need to change dd or cd, unless you think it will give you more accurate results Changing dd or cd can make your program running for a very long time A slicer on our DEB applications can take minutes to run

10 Understanding the console output
The slicer’s analysis starts from entry points in your program, which are set to all the methods of your selected class One statement can be broken up into multiple IR statements. For example line 70 of KLAX’s ChuteArtist class is made up of these statements (and some null statements): 70 18 = invokevirtual < Application, Lc2/fw/Notification, getParameter(Ljava/lang/String;)Ljava/lang/Object; > exception:17 70 19 = checkcast <Application,Ljava/lang/Integer>18 <Application,Ljava/lang/Integer> 70 21 = invokevirtual < Application, Ljava/lang/Integer, intValue()I > exception:20

11 More on console output You get the statements of the slice and corresponding line numbers (if applicable): Printing slice with node number and line number: SLICE: 1, -1 NORMAL_RET_CALLER:Node: < Application, Lc2/apps/klax/comp/ChuteArtist, handle(Lc2/fw/Notification;)V > Context: Everywhere[1]5 = invokevirtual < Application, Lc2/fw/Notification, name()Ljava/lang/String; > exception:4 2, 66 NORMAL handle:8 = invokevirtual < Application, Ljava/lang/String, equals(Ljava/lang/Object;)Z > exception:7 Node: < Application, Lc2/apps/klax/comp/ChuteArtist, handle(Lc2/fw/Notification;)V > Context: Everywhere 3, -1 PARAM_CALLER:Node: < Application, Lc2/apps/klax/comp/ChuteArtist, handle(Lc2/fw/Notification;)V > Context: Everywhere[5]8 = invokevirtual < Application, Ljava/lang/String, equals(Ljava/lang/Object;)Z > exception:7 v5 4, 74 NORMAL handle:12 = invokevirtual < Application, Ljava/lang/String, equals(Ljava/lang/Object;)Z > exception:11 Node: < Application, Lc2/apps/klax/comp/ChuteArtist, handle(Lc2/fw/Notification;)V > Context: Everywhere 5, -1 PARAM_CALLER:Node: < Application, Lc2/apps/klax/comp/ChuteArtist, handle(Lc2/fw/Notification;)V > Context: Everywhere[29]12 = invokevirtual < Application, Ljava/lang/String, equals(Ljava/lang/Object;)Z > exception:11 v5 Node 2 corresponds to line 66 of ChuteArtist Some IR statements have no corresponding line number Node Numbers

12 How to read your slice Class Name Line No.
Printing slice with selected statements only: Lorg/spec/jms/eventhandler/sp/SP_CallForOffersEH:306 NORMAL handleMessage:4 = instanceof 2 <Application,Ljavax/jms/TextMessage> Node: < Application, Log/spec/jms/eventhandler/sp/SP_CallForOffersEH, handleMessage(Ljavax/jms/Message;)V > Context: Everywhere Lorg/spec/jms/eventhandler/sp/SP_CallForOffersEH:306 NORMAL handleMessage:conditional branch(eq) 4,5 Node: < Application, Lorg/spec/jms/eventhandler/sp/SP_CallForOffersEH, handleMessage(Ljavax/jms/Message;)V > Context: Everywhere Lorg/spec/jms/eventhandler/sp/SP_CallForOffersEH:308 NORMAL handleMessage:19 = checkcast <Application,Ljavax/jms/TextMessage>2 <Application,Ljavax/jms/TextMessage> Node: < Application, Lorg/spec/jms/eventhandler/sp/SP_CallForOffersEH, handleMessage(Ljavax/jms/Message;)V > Context: Everywhere Lorg/spec/jms/eventhandler/sp/SP_CallForOffersEH:308 NORMAL handleMessage:21 = invokeinterface < Application, Ljavax/jms/TextMessage, getText()Ljava/lang/String; > exception:20 Node: < Application, Lorg/spec/jms/eventhandler/sp/SP_CallForOffersEH, handleMessage(Ljavax/jms/Message;)V > Context: Everywhere Lorg/spec/jms/eventhandler/sp/SP_CallForOffersEH:308 NORMAL handleMessage:invokevirtual < Application, Lorg/spec/jms/eventhandler/sp/SP_CallForOffersEH, parseMessage(Ljava/lang/String;)V > exception:22 Node: < Application, Lorg/spec/jms/eventhandler/sp/SP_CallForOffersEH, handleMessage(Ljavax/jms/Message;)V > Context: Everywhere Class Name Line No.

13 More Stuff You Might Need to Know
How slices map to line numbers: Understanding the IR:

14 Eclipse’s Reference-finding Feature
Right click on method, variable, class, etc. Select References -> Project, Hierarchy, Workspace, or Working Set You get list of references to your selection Or simply highlight the method, variable, class etc. Press Ctrl+Shift+G


Download ppt "Using IBM Wala’s Slicer for CSCI578 HW3"

Similar presentations


Ads by Google