How to print out the values of variables in a valuebox in soot?

472 views Asked by At

This is the related code fragment where I can't print out the values from valuebox. May I know what's the problem?

public GuaranteedDefsAnalysis(UnitGraph graph)
{
    super(graph);
    DominatorsFinder df = new MHGDominatorsFinder(graph);
    unitToGenerateSet = new HashMap<Unit, FlowSet>(graph.size() * 2 + 1, 0.7f);

    // pre-compute generate sets
    for(Iterator unitIt = graph.iterator(); unitIt.hasNext();){
        Unit s = (Unit) unitIt.next();
        FlowSet genSet = emptySet.clone();

        for(Iterator domsIt = df.getDominators(s).iterator(); domsIt.hasNext();){
            Unit dom = (Unit) domsIt.next();
            for(Iterator boxIt = dom.getDefBoxes().iterator(); boxIt.hasNext();){
                ValueBox box = (ValueBox) boxIt.next();
                box.getValue().toString(); // simply using toString does not work
                if(box.getValue() instanceof Local)
                    genSet.add(box.getValue(), genSet);
            }
        }

        unitToGenerateSet.put(s, genSet);
    }

    doAnalysis();
}
1

There are 1 answers

1
Eric On

Can you maybe rephrase your question? What do you mean by "does not work"? Did you forget to add the println statement maybe?