Soot之BackwardFlowAnalysis Example
来源:互联网 发布:苹果测评电池软件 编辑:程序博客网 时间:2024/06/05 20:21
创建类extends BackwardFlowAnalysis
package Test;import soot.*;import soot.util.*;import java.util.*;import soot.jimple.*;import soot.toolkits.graph.*;import soot.toolkits.scalar.*;public class FlowAnalysisDemo extends BackwardFlowAnalysis {protected void copy(Object src, Object dest) {FlowSet srcSet = (FlowSet) src;FlowSet destSet = (FlowSet) dest;srcSet.copy(destSet);}protected void merge(Object src1, Object src2, Object dest) {FlowSet srcSet1 = (FlowSet) src1;FlowSet srcSet2 = (FlowSet) src2;FlowSet destSet = (FlowSet) dest;srcSet1.union(srcSet2, destSet);}protected void flowThrough(Object srcValue, Object unit, Object destValue) {FlowSet dest = (FlowSet) destValue;FlowSet src = (FlowSet) srcValue;Unit s = (Unit) unit;src.copy(dest);// Take out kill setIterator boxIt = s.getDefBoxes().iterator();while (boxIt.hasNext()) {ValueBox box = (ValueBox) boxIt.next();Value value = box.getValue();if (value instanceof Local)dest.remove(value);}// Add gen setboxIt = s.getUseBoxes().iterator();while (boxIt.hasNext()) {ValueBox box = (ValueBox) boxIt.next();Value value = box.getValue();if (value instanceof Local)dest.add(value);}}protected Object entryInitialFlow() {return new ArraySparseSet();}protected Object newInitialFlow() {return new ArraySparseSet();}public FlowAnalysisDemo(DirectedGraph g) {super(g);doAnalysis();}}
使用
g:UnitGraph
u:Unit
FlowAnalysisDemo fa = new FlowAnalysisDemo(g);FlowSet hsB = (FlowSet) fa.getFlowBefore(u);Iterator itb = hsB.iterator();while (itb.hasNext()) {System.out.println("Before: " + itb.next());}FlowSet hsA = (FlowSet) fa.getFlowAfter(u);Iterator ita = hsA.iterator();while (ita.hasNext()) {System.out.println("After: " + ita.next());}
1 0
- Soot之BackwardFlowAnalysis Example
- soot之Eclipse插件
- soot
- Soot之 遍历Control Flow Graph
- osworkflow example之请假
- soot相关
- soot-1
- soot-2
- Qt example之随机joke
- Qt example之随机笑话
- Qt example之 network joke
- Qt example 之 简易字典
- osworkflow example 之split&join
- Hibernate查询之Example查询
- go example之旅(上)
- go example之旅(中)
- go example之旅(下)
- Extjs4.1文档example学习之 Array Grid Example
- #define的用法
- 交通灯管理系统-1
- 设置oracle10g-解决开机启动慢 问题
- R语言基本函数集合
- SDUT 期末考试之排名次
- Soot之BackwardFlowAnalysis Example
- ubuntu截屏软件scrot
- Nyoj 488 素数环
- 微信开发调试,当通过其他工具(不经过手机微信,直接填写好XML)调试没有问题,而通过手机无响应
- 实例详解$_SERVER函数中QUERY_STRING和REQUEST_URI等四个变量区别
- Hibernate+DWR无刷新三级联动
- POJ-1251 Jungle Roads 最小生成树 两种算法的简单模板
- hdu1212 Big Number
- sql for xml path