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

Linghui Luo linghui.luo at uni-paderborn.de
Sun Sep 3 04:37:47 EDT 2017


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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.CS.McGill.CA/pipermail/soot-list/attachments/20170903/15d68b03/attachment.html>


More information about the Soot-list mailing list