[Soot-list] Bug in coloring source code

Emma emma4ever86 at hotmail.com
Fri Jul 11 06:19:35 EDT 2014


I?ve noticed that all the tags that are colored on Jimple code are for 
the temp vars.
Therefore, it?s logical that source code doesn?t get any tags.

So, maybe my question has to change to how I can get the vars of source code
when the analyzed code is the jimple code.

Plus, I would like to ask how the tags on source code lines work.
I found that there are tags named: LineNumberTag, SourceLnPosTag, 
SourceLineNumberTag.
Which of them can I use in order to get the lines of the local vars?
Now my code is:

private static int getSourceLineNumber(Stmt s) {
         ArrayList<Tag> tags = (ArrayList<Tag>) s.getTags();

         int ln = -1;
         Iterator<Tag> it = tags.iterator();

         while ( it.hasNext() && ln == -1 ) {
             Tag tag = (Tag) it.next();

             if (tag instanceof LineNumberTag ) {
                 ln = ((LineNumberTag) tag).getLineNumber();
                 G.v().out.println("LineNumberTag "+ln);
             }
             if (tag instanceof SourceLnPosTag) {
                 ln = ((SourceLnPosTag) tag).startLn();
                 G.v().out.println("SourceLnPosTag"+ln);
             }
             if (tag instanceof SourceLineNumberTag) {
                 ln = ((SourceLineNumberTag) tag).getStartLineNumber();
                 G.v().out.println("SourceLineNumberTag"+ln);
             }
         }
         return ln;
     }


Thanks in advance,

--Emmanuelo




On 10/07/2014 13:27, emma wrote:
> Hi everyone,
>
> I deal with a problem in coloring the source code, while I get the 
> correct tags on jimple code.
>
> I'm adding the tags on ValueBoxes that I want depending on the analysis
> /        ((ValueBox) b).addTag(new MyTag(p1));//
> //        ((ValueBox) b).addTag(new 
> ColorTag(ColorTag.GREEN,true,"MyTag"));/
> (I would appreciate any explaination on how these tags color exactly 
> the variable that I want...
> I expected in the beginning that they would color all the box)
>
> and I remove all the other tags:
>                o.removeAllTags();
>
> This works fine for jimple code, but doesn't work for source code.
> For some reason, on the XML file for the source code, the tag that I 
> get is:
>             <srcPos sline="0" eline="0" spos="0" epos="0"/>
> but the tags on jmpPos are correct !
>
>
> I have this problem for quite a long period and cannot find the reason 
> why it happens.
> I would reallyy appreciate any help on that.
>
> Thanks in advance,
>
> Emmanuelo
>
>
> _______________________________________________
> Soot-list mailing list
> Soot-list at CS.McGill.CA
> https://mailman.CS.McGill.CA/mailman/listinfo/soot-list

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.CS.McGill.CA/pipermail/soot-list/attachments/20140711/d0efda4f/attachment.html 


More information about the Soot-list mailing list