[Soot-list] Problem of getting line number with keep-line-number option set

ningge weiguangningtian at gmail.com
Fri Apr 6 08:43:48 EDT 2018


I am using soot-3.0.0-20180323.172654-300-jar-with-dependencies.jar 
<https://soot-build.cs.uni-paderborn.de/nexus/#browse/browse/components:soot-snapshot:36e3dec8de528c9b6cfdffcf3fb2aa61:4b378653591c6722ff30b8e564412bd7> and  
trying to get line number from unit using code blow:

UnitGraph g = new BriefUnitGraph(jimpleBody); 

List<Unit> heads = g.getHeads() ; 

Stmt head = (Stmt) heads.get(0); 

LineNumberTag lineNumberTag = (LineNumberTag)head.getTag("LineNumberTag"); 

int start = lineNumberTag.getLineNumber();


running above code at phase *wjtp*

and set options by 
 

>  String argsString = "-cp .;" + path + " -pp -validate --keep-line-number 
> -w -main-class " + mainClass + " " + mainClass;



However, *lineNumberTag.getLineNumber()* *throw NullPointerException,   *in 
other words, lineNumberTag is null.

By the way, unit.getJavaSourceStartLineNumber()  always return -1, and give 
me on help.


So, How can i get original line number? Is there any wrong in my code?

Please help!

Thanks



-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.CS.McGill.CA/pipermail/soot-list/attachments/20180406/74f834d4/attachment.html>


More information about the Soot-list mailing list