[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
getBoxesPointingToThis()
Hi Venkatesh,
> It is my understanding that q.getBoxesPointingToThis(), where q is a
> Stmt, should return a list of UnitBoxes which may transfer control to
> the statement, q. Is this correct?
This is not quite correct. getBoxesPointingToThis returns a list of
UnitBoxes of statements which *jump* to this statement and need a pointer
in order to make this jump. So the target $t$ of the IfStmt or GotoStmt
$s$ returns $s$ in $t$.getBoxesPointingToThis. In particular,
getBoxesPointingToThis never contains predecessors of a statement;
statements are unaware of where they live in the chain of statements and
the control-flow graph.
getBoxesPointingToThis is used to do fixups when we remove statements.
> for (Iterator i =
> ((Stmt)v.getDefaultTarget()).getBoxesPointingToThis().iterator();
> i.hasNext();)
The code which you wrote iterates on the default: target of the switch's
getBoxesPointingToThis. That's probably not what you want. In fact I'm
surprised that the default target has more than one box pointing to it.
I think that what you actually want is to construct
a soot.toolkits.graph.CompleteUnitGraph from your JimpleBody and to use
that to navigate around the control-flow graph.
By the way, soot 1.0.0 is quite old. I recommend a newer version of Soot,
although that doesn't change anything in the above.
pat