[Soot-list] Unable to fetch line numbers for units from a .dex file

Samit Anwer samit1274 at iiitd.ac.in
Sun Sep 3 06:32:08 EDT 2017


Thanks Linghui for your response.

I have the keep-line-number option turned on.

I checked the class files generated for the original Android application in
the bin folder, they do contain the LineNumberTable attribute. I am using
dex as the output format for Soot. The next thing to check is whether the
line numbers are preserved in the classes.dex file, is there a way to
verify this?

On Sun, Sep 3, 2017 at 2:07 PM, Linghui Luo <linghui.luo at uni-paderborn.de>
wrote:

> Hello Samit,
>
>
>
> I have tried your code to my test classes and I didn’t get just “has no
> Line Number”. Your code is totally fine.
>
> If you have turned on the soot option “-keep-line-number”, I think there
> maybe one reason:
>
> The java bytecodes didn’t included the line numbers. You should check your
> java complier options.
>
> Line number is debug information and you can look your .class file if it
> contains LineNumberTable.
>
>
>
> Best regards,
>
> Linghui Luo
>
>
>
> *Von:* Soot-list [mailto:soot-list-bounces at CS.McGill.CA] *Im Auftrag von *Samit
> Anwer
> *Gesendet:* Freitag, 25. August 2017 16:14
> *An:* soot-list at sable.mcgill.ca
> *Betreff:* [Soot-list] Unable to fetch line numbers for units from a .dex
> file
>
>
>
> Hi
>
>
>
> I am trying to retrieve line number for a unit  referred by variable "u".
>
>
>
> Here is my code:
>
>
>
>  if (u.hasTag("SourceLineNumberTag")) {
>
>
> SourceLineNumberTag l = (SourceLineNumberTag) u.getTag("SourceLineNumberTag"
> );
>
>
> System.out.println("Line No. is: "+l.getLineNumber());
>
>                                                             }
>
>
>
>                                                             else if
> (u.hasTag("LineNumberTag")) { // see if a LineNumberTag exists (it will if
> you use -keep-line-number)
>
>
>  LineNumberTag tag = (LineNumberTag)u.getTag(("LineNumberTag"));
>
>
>  System.out.println(u + " has Line Number: " + tag.getLineNumber()); //
> print out the unit and line number
>
>                                                                }
>
>                                                             else if
> (u.hasTag("SourceLnPosTag")){
>
>
>
>
>  System.out.println(u + " has Line Number: " + ((SourceLnPosTag)
> u.getTag("SourceLnPosTag")).startLn());
>
>                                                              }
>
>                                                              else {
>
>
>  System.out.println(u + " has no Line Number");
>
>                                                                }
>
>
>
> For some reason, I am always getting "has no Line Number". I am using the
> nightly build soot-trunk.jar from https://soot-build.cs.
> uni-paderborn.de/nightly/soot/.
>
>
>
> Could somebody please help out?
>
>
>
> --
>
> *Regards,*
>
>
>
> *Samit Anwer MT12074 MTech-MUC IIIT Delhi*
> *http://about.me/samitanwer <http://about.me/samitanwer>*
>



-- 
*Regards,*
*Samit Anwer*


*MT12074MTech-MUCIIIT Delhi*
*http://about.me/samitanwer <http://about.me/samitanwer>*
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.CS.McGill.CA/pipermail/soot-list/attachments/20170903/c3a21aaf/attachment-0001.html>


More information about the Soot-list mailing list