[Soot-list] Getting the java source line number in FlowDroid

Ashish Mishra ashish123.mishragkp at gmail.com
Tue Jan 6 02:24:45 EST 2015


HI All,

I looked more into the issue and apparently* I am getting line number
information for some Units and not for others.*

I took a dexdump and the Android app has the line number associated with it
-  here is the dexdump output,

*  Virtual methods   -*
*    #0              : (in Lcom/example/simpleicc/SimpleMain;)*
*      name          : 'onCreate'*
*      type          : '(Landroid/os/Bundle;)V'*
*      access        : 0x0004 (PROTECTED)*
*      code          -*
*      registers     : 7*
*      ins           : 2*
*      outs          : 3*
*      insns size    : 43 16-bit code units*
*0703a0:                                        |[0703a0]
com.example.simpleicc.SimpleMain.onCreate:(Landroid/os/Bundle;)V*
*0703b0: 6f20 6200 6500                         |0000: invoke-super {v5,
v6}, Landroid/app/Activity;.onCreate:(Landroid/os/Bundle;)V // method at 0062*
*0703b6: 1403 1800 037f                         |0003: const v3, #float
174129354225654466990488899630756003840.000000 // #7f030018*
*0703bc: 6e20 f420 3500                         |0006: invoke-virtual {v5,
v3}, Lcom/example/simpleicc/SimpleMain;.setContentView:(I)V // method at 20f4*
*0703c2: 1a03 b417                              |0009: const-string v3,
"location" // string at 17b4*
*0703c6: 6e20 f220 3500                         |000b: invoke-virtual {v5,
v3},
Lcom/example/simpleicc/SimpleMain;.getSystemService:(Ljava/lang/String;)Ljava/lang/Object;
// method at 20f2*
*0703cc: 0c01                                   |000e: move-result-object
v1*
*0703ce: 1f01 5e00                              |000f: check-cast v1,
Landroid/location/LocationManager; // type at 005e*
*0703d2: 1a03 3e1c                              |0011: const-string v3,
"network" // string at 1c3e*
*0703d6: 6e20 f301 3100                         |0013: invoke-virtual {v1,
v3},
Landroid/location/LocationManager;.getLastKnownLocation:(Ljava/lang/String;)Landroid/location/Location;
// method at 01f3*
*0703dc: 0c02                                   |0016: move-result-object
v2*
*0703de: 2200 2900                              |0017: new-instance v0,
Landroid/content/Intent; // type at 0029*
*0703e2: 1c03 fd03                              |0019: const-class v3,
Lcom/example/simpleicc/Target; // type at 03fd*
*0703e6: 7030 0e01 5003                         |001b: invoke-direct {v0,
v5, v3},
Landroid/content/Intent;.<init>:(Landroid/content/Context;Ljava/lang/Class;)V
// method at 010e*
*0703ec: 1a03 b917                              |001e: const-string v3,
"loctaion " // string at 17b9*
*0703f0: 6e10 f201 0200                         |0020: invoke-virtual {v2},
Landroid/location/Location;.toString:()Ljava/lang/String; // method at 01f2*
*0703f6: 0c04                                   |0023: move-result-object
v4*
*0703f8: 6e30 2a01 3004                         |0024: invoke-virtual {v0,
v3, v4},
Landroid/content/Intent;.putExtra:(Ljava/lang/String;Ljava/lang/String;)Landroid/content/Intent;
// method at 012a*
*0703fe: 6e20 f520 0500                         |0027: invoke-virtual {v5,
v0},
Lcom/example/simpleicc/SimpleMain;.startActivity:(Landroid/content/Intent;)V
// method at 20f5*
*070404: 0e00                                   |002a: return-void*
*      catches       : (none)*
*      positions     : *
*        0x0000 line=22*
*        0x0003 line=23*
*        0x0009 line=25*
*        0x0011 line=26*
*        0x0017 line=28*
*        0x001e line=29*
*        0x0027 line=31*
*        0x002a line=33*
*      locals        : *
*        0x001e - 0x002b reg=0 in Landroid/content/Intent; *
*        0x0011 - 0x002b reg=1 lm Landroid/location/LocationManager; *
*        0x0017 - 0x002b reg=2 loc Landroid/location/Location; *
*        0x0000 - 0x002b reg=5 this Lcom/example/simpleicc/SimpleMain; *
*        0x0000 - 0x002b reg=6 savedInstanceState Landroid/os/Bundle; *

*  source_file_idx   : 2880 (SimpleMain.java)*


*I got a similar issue on the soot list *
https://github.com/Sable/soot/issues/91

Is the issue resolved , sorry but i am lost and couldnt follow the
discussion about where the patch is needed.

Please help



On Tue, Jan 6, 2015 at 11:52 AM, Ashish Mishra <
ashish123.mishragkp at gmail.com> wrote:

> Hi Steven,
>
> AFAIK ASM is the default java front end for soot. I am not sure how i can
> test with COFFI in FlowDroid. As said i am adding the keep_line_number
> option before the dummyMain is generated and if I am not wrong line numbers
> should be available.
>
> I have a doubt about the "tag" pack , Do i need to apply this pack to get
> the line (I think NO) number and why i get an exception "Wrong pack" when
> doing that.
>
> regards
>
>
>
>
> On Mon, Jan 5, 2015 at 9:51 PM, Steven Arzt <Steven.Arzt at cased.de> wrote:
>
>> Hi Ashish,
>>
>>
>>
>> The source line numbers should be available with both the COFFI and the
>> ASM frontend. You may want to try the –coffi command-line option to
>> double-check, though. I am however not aware of any issues in that
>> direction in the ASM frontend.
>>
>>
>>
>> Best regards,
>>
>>   Steven
>>
>>
>>
>> *Von:* soot-list-bounces at CS.McGill.CA [mailto:
>> soot-list-bounces at CS.McGill.CA] *Im Auftrag von *Ashish Mishra
>> *Gesendet:* Montag, 5. Januar 2015 11:50
>> *An:* Bodden, Eric
>> *Cc:* Soot list
>> *Betreff:* Re: [Soot-list] Getting the java source line number in
>> FlowDroid
>>
>>
>>
>> Hi Eric,
>>
>> Sorry for the late response,
>>
>>
>>
>> I "think" the class files are compiled with debug symbols as i can print
>> the Local variable and line number table using *javap.*
>>
>>
>>
>> *Thanks *
>>
>>
>>
>>
>>
>>
>>
>> On Fri, Jan 2, 2015 at 9:00 PM, Bodden, Eric <
>> eric.bodden at sit.fraunhofer.de> wrote:
>>
>> Hi Ashish.
>>
>> Hmm, ok then it seems that line numbers are really missing. Was the
>> bytecode you are analyzing compiled with debug symbols?
>>
>> Cheers,
>> Eric
>>
>>
>> > On 01.01.2015, at 18:20, Ashish Mishra <ashish123.mishragkp at gmail.com>
>> wrote:
>> >
>> > Hi Eric,
>> > Using unit.getJavaSourceStartLineNumber() returns -1 , I looked that
>> tagging occurs in a separate phase "tag" and tried explicit
>> >
>> > packManager.v().getPack("tag").apply()
>> >
>> > But "tag" phase is not recognized in the options.
>> >
>> > On Thu, Jan 1, 2015 at 6:30 PM, Bodden, Eric <
>> eric.bodden at sit.fraunhofer.de> wrote:
>> > Hi Ashish.
>> >
>> > I think you might be using the wrong tag. Please just try calling
>> unit.getJavaSourceStartLineNumber()
>> >
>> > Cheers,
>> > Eric
>> >
>> >
>> > > On 01.01.2015, at 06:42, Ashish Mishra <ashish123.mishragkp at gmail.com>
>> wrote:
>> > >
>> > > Hi List,
>> > >
>> > > I am trying to get the line number tag in flowFroid by setting
>> Options.v().set_keep_line_number(true), in the InfoFlow.java in the
>> soot.jimple.infoflow package  but the tag list associated with the Units is
>> empty.
>> > >
>> > >
>> > > I am trying to access the tag as follows
>> > >
>> > > LineNumberTag tag = (LineNumberTag)unit.getTag("LineNumberTag");
>> > >
>> > > but the tag is null as i mentioned
>> > >
>> > > Where am i mistaken? How can i get the line number in FlowDroid.. i
>> can get it easily when creating my own Transformer in Soot and calling
>> soot.Main by setting proper option.
>> > >
>> > > Please help!
>> > >
>> > > Thanks
>> > >
>> > > --
>> > > Regards,
>> > > Ashish Mishra
>> > > Graduate Student,
>> > > Computer Science and Automation Department,IISc
>> > > Cell : +91-9611194714
>> > > Mailto : ashishmishra at csa.iisc.ernet.in
>> > >
>> > > _______________________________________________
>> > > Soot-list mailing list
>> > > Soot-list at CS.McGill.CA
>> > > https://mailman.CS.McGill.CA/mailman/listinfo/soot-list
>> >
>> >
>> >
>> >
>> > --
>> > Regards,
>> > Ashish Mishra
>> > Graduate Student,
>> > Computer Science and Automation Department,IISc
>> > Cell : +91-9611194714
>> > Mailto : ashishmishra at csa.iisc.ernet.in
>>
>>
>>
>>
>>
>> --
>>
>> Regards,
>> Ashish Mishra
>> Graduate Student,
>> Computer Science and Automation Department,IISc
>> Cell : +91-9611194714
>> Mailto : ashishmishra at csa.iisc.ernet.in
>>
>
>
>
> --
> Regards,
> Ashish Mishra
> Graduate Student,
> Computer Science and Automation Department,IISc
> Cell : +91-9611194714
> Mailto : ashishmishra at csa.iisc.ernet.in
>
>


-- 
Regards,
Ashish Mishra
Graduate Student,
Computer Science and Automation Department,IISc
Cell : +91-9611194714
Mailto : ashishmishra at csa.iisc.ernet.in
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.CS.McGill.CA/pipermail/soot-list/attachments/20150106/f154b9e0/attachment-0001.html 


More information about the Soot-list mailing list