secure-software-engineering / FlowDroid

FlowDroid Static Data Flow Tracker
GNU Lesser General Public License v2.1
1.02k stars 293 forks source link

How to get line number of the source code? #561

Open ZephyrusZhang opened 1 year ago

ZephyrusZhang commented 1 year ago

Hi Steven. I'm currently trying to use flowdroid to analyze android apk and give some useful feedback to user. But now I'm having difficult in getting the line number of a certain (jimple) statement. I have tried the code below

Options.v().set_keep_line_number(true); // soot option

val unit: Unit = /*certain statement*/
val lineno: Int = (unit.getTag("LineNumberTag") as LineNumberTag).lineNumber

However, the getTag("LineNumberTag") above just return null. So I wonder is the way to get line number in source right? Or you can just offer some examples to get line number of source. Thanks!

limerick1718 commented 1 year ago

For me, I just count the position of the unit in the unit chain. Maybe this is the easiest way to get the line number of the Jimple code?