[Soot-list] Inconsistent Line Number

Steven Arzt Steven.Arzt at cased.de
Fri Apr 10 03:43:35 EDT 2015


Hi Nishant,

 

These lines are occasions on which a single Java line was split into multiple Jimple lines. If condition in your Java code accesses a field which is not directly possible in Jimple. Therefore, Soot creates two lines from it: We first read the field value and then compare it. Apparently, only the first line gets the corresponding line number tag, whereas the second one does not. This in turn is quite strange as we have code that propagates on line numbers (see lines 425ff in class soot.dexpler.DexBody. My guess therefore is that some transformer kills the line number tag for some reason.

 

Can you send me a minimal working example with which I can reproduce the issue?

 

Best regards,

  Steven

 

Von: soot-list-bounces at CS.McGill.CA [mailto:soot-list-bounces at CS.McGill.CA] Im Auftrag von Nishant Budhdev
Gesendet: Freitag, 10. April 2015 09:37
An: soot-list at cs.mcgill.ca
Betreff: Re: [Soot-list] Inconsistent Line Number

 

 public boolean onOptionsItemSelected(android.view.MenuItem)

   {

        com.example.dcsnsb.testapplicationcp9.MainActivity $r0;

        android.view.MenuItem $r1;

        int $i0;

        boolean $z0;

        $r0 := @this: com.example.dcsnsb.testapplicationcp9.MainActivity;

        $r1 := @parameter0: android.view.MenuItem;

        $i0 = interfaceinvoke $r1.<android.view.MenuItem: int getItemId()>();

        if $i0 != 2131230787 goto label1;                                                                  // <--

        return 1;

     label1:

        $z0 = specialinvoke $r0.<android.support.v7.app.ActionBarActivity: boolean onOptionsItemSelected(android.view.MenuItem)>($r1);

 

        return $z0;                                                                                                 // <--

   }

 

On Fri, Apr 10, 2015 at 3:31 PM, Nishant Budhdev <nishant.budhdev at gmail.com> wrote:

Hi,

 

I have the following method in my android app's main class:

     public boolean onOptionsItemSelected(MenuItem item) {

      

        int id = item.getItemId();

        if (id == R.id.action_settings) {

            return true;

        }

        return super.onOptionsItemSelected(item);

    }

 

The Jimple conversion for the same is:

   public boolean onOptionsItemSelected(android.view.MenuItem)

   {

        com.example.dcsnsb.testapplicationcp9.MainActivity $r0;

        android.view.MenuItem $r1;

        int $i0;

        boolean $z0;

        $r0 := @this: com.example.dcsnsb.testapplicationcp9.MainActivity;

        $r1 := @parameter0: android.view.MenuItem;

        $i0 = interfaceinvoke $r1.<android.view.MenuItem: int getItemId()>();

        if $i0 != 2131230787 goto label1;

        return 1;

     label1:

        $z0 = specialinvoke $r0.<android.support.v7.app.ActionBarActivity: boolean onOptionsItemSelected(android.view.MenuItem)>($r1);

 

        return $z0;

   }

 

I am trying to get source line numbers for refactoring purposes. Usually I have been using getJavaSourceStartLineNumber() for this and it has worked well. However, in this scenario the line number for the lines marked with "// <--" are shown as -1. I tried using tags and trying to go into further debugging but couldn't find anything other than null associated with those lines for line number related attributes. Is there a way in which I could all the line numbers ?

 

Thanks,

Nishant

 

Das Bild wurde vom Absender entfernt.





 

-- 

Nishant Shyamal Budhdev

 

Research Assistant

Embedded Systems and Networking Lab

School Of Computing

National University of Singapore

 

Contact : +65 9050 6084

-------------- next part --------------
An HTML attachment was scrubbed...
URL: https://mailman.CS.McGill.CA/pipermail/soot-list/attachments/20150410/e1eff62f/attachment-0001.html 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: image/jpeg
Size: 332 bytes
Desc: not available
Url : https://mailman.CS.McGill.CA/pipermail/soot-list/attachments/20150410/e1eff62f/attachment-0001.jpe 


More information about the Soot-list mailing list