本文整理了Java中soot.options.Options.verbose()
方法的一些代码示例,展示了Options.verbose()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Options.verbose()
方法的具体详情如下:
包路径:soot.options.Options
类名称:Options
方法名:verbose
暂无
代码示例来源:origin: Sable/soot
public PDGRegion(int id, List<PDGNode> nodes, SootMethod m, SootClass c, UnitGraph ug, PDGNode node) {
this.m_nodes = nodes;
this.m_id = id;
this.m_method = m;
this.m_class = c;
this.m_unitGraph = ug;
this.m_units = null;
this.m_corrspondingPDGNode = node;
if (Options.v().verbose()) {
logger.debug("New pdg region create: " + id);
}
}
代码示例来源:origin: Sable/soot
public static void printDbg(String s, Object... objects) {
TODEX_DEBUG = Options.v().verbose();
if (TODEX_DEBUG) {
for (Object o : objects) {
s += o.toString();
}
System.out.println(s);
}
}
代码示例来源:origin: Sable/soot
/**
* Checks if {@link IJbcoTransform jbco transformer} can log extra information.
*
* @return {@code true} when {@link IJbcoTransform jbco transformer} can log extra information; {@code false} otherwise
*/
default boolean isVerbose() {
return G.v().soot_options_Options().verbose() || soot.jbco.Main.jbcoVerbose;
}
代码示例来源:origin: Sable/soot
/**
* Resolve dependencies of class.
*
* @param sc
* The SootClass to resolve into.
* @return Dependencies of class (Strings or Types referenced).
*/
public Dependencies resolve(SootClass sc) {
if (Options.v().verbose()) {
logger.debug("resolving " + className + " from file " + path.getPath());
}
return DexResolver.v().resolveFromFile(path, className, sc);
}
}
代码示例来源:origin: Sable/soot
/**
* Performs the work that is required to construct any sort of <tt>UnitGraph</tt>.
*
* @param body
* The body of the method for which to construct a control flow graph.
*/
protected UnitGraph(Body body) {
this.body = body;
unitChain = body.getUnits();
method = body.getMethod();
if (Options.v().verbose()) {
logger.debug("[" + method.getName() + "] Constructing " + this.getClass().getName() + "...");
}
}
代码示例来源:origin: Sable/soot
public RegionAnalysis(UnitGraph cfg, SootMethod m, SootClass c) {
this.m_methodBody = cfg.getBody();
this.m_cfg = cfg;
this.m_method = m;
this.m_class = c;
if (Options.v().verbose()) {
logger.debug(
"[RegionAnalysis]~~~~~~~~~~~~~~~ Begin Region Analsis for method: " + m.getName() + " ~~~~~~~~~~~~~~~~~~~~");
}
this.findWeakRegions();
if (Options.v().verbose()) {
logger.debug("[RegionAnalysis]~~~~~~~~~~~~~~~ End:" + m.getName() + " ~~~~~~~~~~~~~~~~~~~~");
}
}
代码示例来源:origin: Sable/soot
/**
* performs critical edge-removing.
*/
protected void internalTransform(Body b, String phaseName, Map<String, String> options) {
if (Options.v().verbose()) {
logger.debug("[" + b.getMethod().getName() + "] Removing Critical Edges...");
}
removeCriticalEdges(b);
if (Options.v().verbose()) {
logger.debug("[" + b.getMethod().getName() + "] Removing Critical Edges done.");
}
}
代码示例来源:origin: Sable/soot
private void printStatementsInBody(Body body, java.io.PrintWriter out) {
if (Options.v().verbose()) {
System.out.println("Printing " + body.getMethod().getName());
}
Chain<Unit> units = ((DavaBody) body).getUnits();
if (units.size() != 1) {
throw new RuntimeException("DavaBody AST doesn't have single root.");
}
UnitPrinter up = new DavaUnitPrinter((DavaBody) body);
((ASTNode) units.getFirst()).toString(up);
out.print(up.toString());
}
代码示例来源:origin: Sable/soot
public Dependencies resolve(SootClass sc) {
if (Options.v().verbose()) {
logger.debug("resolving [from .class]: " + className);
}
List<Type> references = new ArrayList<Type>();
try {
soot.coffi.Util.v().resolveFromClassFile(sc, classFile, fileName, references);
} finally {
close();
}
addSourceFileTag(sc);
IInitialResolver.Dependencies deps = new IInitialResolver.Dependencies();
deps.typesToSignature.addAll(references);
return deps;
}
代码示例来源:origin: Sable/soot
public GuaranteedDefs(UnitGraph graph) {
if (Options.v().verbose()) {
logger.debug("[" + graph.getBody().getMethod().getName() + "] Constructing GuaranteedDefs...");
}
GuaranteedDefsAnalysis analysis = new GuaranteedDefsAnalysis(graph);
// build map
{
unitToGuaranteedDefs = new HashMap<Unit, List>(graph.size() * 2 + 1, 0.7f);
Iterator<Unit> unitIt = graph.iterator();
while (unitIt.hasNext()) {
Unit s = (Unit) unitIt.next();
FlowSet set = (FlowSet) analysis.getFlowBefore(s);
unitToGuaranteedDefs.put(s, Collections.unmodifiableList(set.toList()));
}
}
}
代码示例来源:origin: Sable/soot
public void loadDynamicClasses() {
dynamicClasses = new ArrayList<SootClass>();
HashSet<String> dynClasses = new HashSet<String>();
dynClasses.addAll(Options.v().dynamic_class());
for (Iterator<String> pathIt = Options.v().dynamic_dir().iterator(); pathIt.hasNext();) {
final String path = pathIt.next();
dynClasses.addAll(SourceLocator.v().getClassesUnder(path));
}
for (Iterator<String> pkgIt = Options.v().dynamic_package().iterator(); pkgIt.hasNext();) {
final String pkg = pkgIt.next();
dynClasses.addAll(SourceLocator.v().classesInDynamicPackage(pkg));
}
for (String className : dynClasses) {
dynamicClasses.add(loadClassAndSupport(className));
}
// remove non-concrete classes that may accidentally have been loaded
for (Iterator<SootClass> iterator = dynamicClasses.iterator(); iterator.hasNext();) {
SootClass c = iterator.next();
if (!c.isConcrete()) {
if (Options.v().verbose()) {
logger.warn("dynamic class " + c.getName() + " is abstract or an interface, and it will not be considered.");
}
iterator.remove();
}
}
}
代码示例来源:origin: Sable/soot
public Body getBody(SootMethod m, String phaseName) {
JimpleBody jb = (JimpleBody) mJimpleAST.getBody(m);
if (jb == null) {
throw new RuntimeException("Could not load body for method " + m.getSignature());
}
if (Options.v().verbose()) {
logger.debug("[" + m.getName() + "] Retrieving JimpleBody from AST...");
}
PackManager.v().getPack("jb").apply(jb);
return jb;
}
}
代码示例来源:origin: Sable/soot
/**
* unrolls conditions.
*/
/*
* this implementation still fails in finding all possible while-loops, but does a good job.
*/
protected void internalTransform(Body body, String phaseName, Map<String, String> options) {
if (Options.v().verbose()) {
logger.debug("[" + body.getMethod().getName() + "] Unrolling Loop Conditions...");
}
visitingSuccs = new HashSet<Block>();
visitedBlocks = new HashSet<Block>();
this.body = body;
this.maxSize = PhaseOptions.getInt(options, "maxSize");
BlockGraph bg = new BriefBlockGraph(body);
for (Block b : bg.getHeads()) {
unrollConditions(b);
}
if (Options.v().verbose()) {
logger.debug("[" + body.getMethod().getName() + "] Unrolling Loop Conditions done.");
}
}
代码示例来源:origin: Sable/soot
/** The method that drives the optimizations. */
/* This is the public interface to LoadStoreOptimizer */
protected void internalTransform(Body body, String phaseName, Map<String, String> options) {
gOptions = options;
Instance instance = new Instance();
instance.mBody = body;
instance.mUnits = body.getUnits();
debug = PhaseOptions.getBoolean(gOptions, "debug");
if (Options.v().verbose()) {
logger.debug("[" + body.getMethod().getName() + "] Performing LoadStore optimizations...");
}
if (debug) {
logger.debug("\n\nOptimizing Method: " + body.getMethod().getName());
}
instance.go();
}
代码示例来源:origin: Sable/soot
public void apply() {
Map<String, String> options = PhaseOptions.v().getPhaseOptions(phaseName);
if (PhaseOptions.getBoolean(options, "enabled")) {
if (Options.v().verbose()) {
logger.debug("" + "Applying phase " + phaseName + " to the scene.");
}
}
if (DEBUG) {
PhaseDumper.v().dumpBefore(getPhaseName());
}
((SceneTransformer) t).transform(phaseName, options);
if (DEBUG) {
PhaseDumper.v().dumpAfter(getPhaseName());
}
}
代码示例来源:origin: Sable/soot
/**
* Constructs a ShimpleBody from the given Body and options.
*
* <p>
* Currently available option is "naive-phi-elimination", typically in the "shimple" phase (eg, -p shimple
* naive-phi-elimination) which can be useful for understanding the effect of analyses.
**/
ShimpleBody(Body body, Map options) {
super(body.getMethod());
if (!(body instanceof JimpleBody || body instanceof ShimpleBody)) {
throw new RuntimeException("Cannot construct ShimpleBody from given Body type.");
}
if (Options.v().verbose()) {
logger.debug("[" + getMethod().getName() + "] Constructing ShimpleBody...");
}
// must happen before SPatchingChain gets created
this.options = new ShimpleOptions(options);
unitChain = new SPatchingChain(this, new HashChain());
importBodyContentsFrom(body);
/* Shimplise body */
sbb = new ShimpleBodyBuilder(this);
if (body instanceof ShimpleBody) {
rebuild(true);
} else {
rebuild(false);
}
}
代码示例来源:origin: Sable/soot
public void apply(Body b) {
Map<String, String> options = PhaseOptions.v().getPhaseOptions(phaseName);
if (PhaseOptions.getBoolean(options, "enabled")) {
if (Options.v().verbose()) {
logger.debug("" + "Applying phase " + phaseName + " to " + b.getMethod() + ".");
}
}
if (DEBUG) {
PhaseDumper.v().dumpBefore(b, getPhaseName());
}
((BodyTransformer) t).transform(b, phaseName, options);
if (DEBUG) {
PhaseDumper.v().dumpAfter(b, getPhaseName());
}
}
代码示例来源:origin: Sable/soot
protected void internalTransform(Body b, String phaseName, Map<String, String> options) {
if (!(b instanceof ShimpleBody)) {
throw new RuntimeException("SConstantPropagatorAndFolder requires a ShimpleBody.");
}
this.sb = (ShimpleBody) b;
if (!sb.isSSA()) {
throw new RuntimeException("ShimpleBody is not in proper SSA form as required by SConstantPropagatorAndFolder."
+ "You may need to rebuild it or use ConstantPropagatorAndFolder instead.");
}
boolean pruneCFG = PhaseOptions.getBoolean(options, "prune-cfg");
debug = Options.v().debug();
debug |= sb.getOptions().debug();
if (Options.v().verbose()) {
logger.debug("[" + sb.getMethod().getName() + "] Propagating and folding constants (SSA)...");
}
// *** FIXME: What happens when Shimple is built with another UnitGraph?
SCPFAnalysis scpf = new SCPFAnalysis(new ExceptionalUnitGraph(sb));
propagateResults(scpf.getResults());
if (pruneCFG) {
removeStmts(scpf.getDeadStmts());
replaceStmts(scpf.getStmtsToReplace());
}
}
代码示例来源:origin: Sable/soot
public void writeOutput() {
setupJAR();
if (Options.v().verbose()) {
PhaseDumper.v().dumpBefore("output");
}
if (Options.v().output_format() == Options.output_format_dava) {
postProcessDAVA();
outputDava();
} else if (Options.v().output_format() == Options.output_format_dex
|| Options.v().output_format() == Options.output_format_force_dex) {
writeDexOutput();
} else {
writeOutput(reachableClasses());
tearDownJAR();
}
postProcessXML(reachableClasses());
if (!Options.v().no_writeout_body_releasing()) {
releaseBodies(reachableClasses());
}
if (Options.v().verbose()) {
PhaseDumper.v().dumpAfter("output");
}
}
代码示例来源:origin: Sable/soot
/**
* Computes the analysis given a UnitGraph computed from a method body. It is recommended that a ExceptionalUnitGraph (or
* similar) be provided for correct results in the case of exceptional control flow.
*
* @param graph
* a graph on which to compute the analysis.
*
* @see ExceptionalUnitGraph
*/
public SimpleLiveLocals(UnitGraph graph) {
if (Options.v().time()) {
Timers.v().liveTimer.start();
}
if (Options.v().verbose()) {
logger.debug("[" + graph.getBody().getMethod().getName() + "] Constructing SimpleLiveLocals...");
}
analysis = new Analysis(graph);
if (Options.v().time()) {
Timers.v().liveAnalysisTimer.start();
}
analysis.doAnalysis();
if (Options.v().time()) {
Timers.v().liveAnalysisTimer.end();
}
if (Options.v().time()) {
Timers.v().liveTimer.end();
}
}
内容来源于网络,如有侵权,请联系作者删除!