<div dir="ltr">Thanks Linghui for your response.<div><br></div><div>I have the keep-line-number option turned on.<br><div><br></div><div>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? </div></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Sun, Sep 3, 2017 at 2:07 PM, Linghui Luo <span dir="ltr"><<a href="mailto:linghui.luo@uni-paderborn.de" target="_blank">linghui.luo@uni-paderborn.de</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div lang="EN-US" link="blue" vlink="purple">
<div class="m_-4334411113670323588WordSection1">
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1f497d">Hello Samit,<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1f497d"><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1f497d">I have tried your code to my test classes and I didn’t get just “has no Line Number”. Your code is totally fine.<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1f497d">If you have turned on the soot option “-keep-line-number”, I think there maybe one reason:<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1f497d">The java bytecodes didn’t included the line numbers. You should check your java complier options.<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1f497d">Line number is debug information and you can look your .class file if it contains LineNumberTable.<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1f497d"><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1f497d">Best regards,<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1f497d">Linghui Luo<u></u><u></u></span></p>
<p class="MsoNormal"><a name="m_-4334411113670323588__MailEndCompose"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1f497d"><u></u> <u></u></span></a></p>
<p class="MsoNormal"><b><span lang="DE" style="font-size:11.0pt;font-family:"Calibri",sans-serif">Von:</span></b><span lang="DE" style="font-size:11.0pt;font-family:"Calibri",sans-serif"> Soot-list [mailto:<a href="mailto:soot-list-bounces@CS.McGill.CA" target="_blank">soot-list-bounces@CS.<wbr>McGill.CA</a>]
<b>Im Auftrag von </b>Samit Anwer<br>
<b>Gesendet:</b> Freitag, 25. August 2017 16:14<br>
<b>An:</b> <a href="mailto:soot-list@sable.mcgill.ca" target="_blank">soot-list@sable.mcgill.ca</a><br>
<b>Betreff:</b> [Soot-list] Unable to fetch line numbers for units from a .dex file<u></u><u></u></span></p><div><div class="h5">
<p class="MsoNormal"><u></u> <u></u></p>
<div>
<p class="MsoNormal">Hi <u></u><u></u></p>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
<div>
<p class="MsoNormal">I am trying to retrieve line number for a unit referred by variable "u".<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
<div>
<p class="MsoNormal">Here is my code:<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
<div>
<div>
<p class="MsoNormal"> if (u.hasTag("<wbr>SourceLineNumberTag")) {<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"> <wbr> SourceLineNumberTag l = (SourceLineNumberTag) u.getTag("SourceLineNumberTag"<wbr>);<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"> <wbr> System.out.println("Line No. is: "+l.getLineNumber());<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"> <wbr> }<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"> <wbr> <u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"> <wbr> else if (u.hasTag("LineNumberTag")) { // see if a LineNumberTag exists (it will if you use -keep-line-number)<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"> <wbr> LineNumberTag tag = (LineNumberTag)u.getTag(("<wbr>LineNumberTag"));<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"> <wbr> System.out.println(u + " has Line Number: " + tag.getLineNumber()); // print out the unit and line number<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"> <wbr> } <u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"> <wbr> else if (u.hasTag("SourceLnPosTag")){<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"> <wbr> <wbr>
<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"> <wbr> <wbr> System.out.println(u + " has Line Number: " + ((SourceLnPosTag) u.getTag("SourceLnPosTag")).<wbr>startLn());<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"> <wbr> }<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"> <wbr> else {<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"> <wbr> System.out.println(u + " has no Line Number");<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"> <wbr> }<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"> <wbr> <u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">For some reason, I am always getting "has no Line Number". I am using the nightly build soot-trunk.jar from <a href="https://soot-build.cs.uni-paderborn.de/nightly/soot/" target="_blank">https://soot-build.cs.<wbr>uni-paderborn.de/nightly/soot/</a><wbr>.<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
<div>
<p class="MsoNormal">Could somebody please help out?<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
<p class="MsoNormal">-- <u></u><u></u></p>
<div>
<div>
<p class="MsoNormal" style="margin-bottom:12.0pt"><b><i><span style="color:#073763">Regards,</span></i></b><br>
<b><i><span style="color:#073763">Samit Anwer<br>
MT12074<br>
MTech-MUC<br>
IIIT Delhi</span></i></b><br>
<b><i><span style="color:#073763"><a href="http://about.me/samitanwer" target="_blank">http://about.me/samitanwer</a></span></i></b><u></u><u></u></p>
</div>
</div>
</div>
</div>
</div></div></div>
</div>
</blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><span style="color:rgb(7,55,99)"><b><i>Regards,</i></b></span><br><span style="color:rgb(7,55,99)"><i><b>Samit Anwer</b></i></span><span style="color:rgb(7,55,99)"><i><b><span style="color:rgb(7,55,99)"></span><br>MT12074<br>MTech-MUC<br>IIIT Delhi</b></i></span><br><span style="color:rgb(7,55,99)"><i><b><span style="color:rgb(7,55,99)"><i><b><a href="http://about.me/samitanwer" target="_blank">http://about.me/samitanwer</a></b></i></span></b></i></span><br><br></div></div>
</div>