[Soot-list] Jimple Statement --> Java Source Line Number

Archie Cobbs archie at dellroad.org
Thu Dec 15 15:05:40 EST 2005


Ananta Tiwari wrote:
> Given a Jimple Statement, how can you find find its associated line 
> number in the java source file? I looked into the mailing list archives 
> for the answer. There were couple of threads relating to this, but no 
> answers were provided.

Like this:

   LineNumberTag tag = (LineNumberTag)unit.getTag("LineNumberTag");
   if (tag != null)
     lineNumber = tag.getLineNumber();

You also need to:

   PhaseOptions.v().setPhaseOption("tag.ln", "on");

in order to get the tags added in the first place.

-Archie

__________________________________________________________________________
Archie Cobbs      *        CTO, Awarix        *      http://www.awarix.com


More information about the Soot-list mailing list