[Soot-list] Line numbers in Grimp

Eric Bodden eric.bodden at mail.mcgill.ca
Thu Dec 11 14:57:47 EST 2008


P.S. I have not yet commited this patch because I am not sure how
useful line numbers are in Grimp in general but I could commit it if
needed.

Eric

2008/12/11 Eric Bodden <eric.bodden at mail.mcgill.ca>:
> Hi Mario.
>
> I just checked on that. It's true that line numbers are nor preserved
> in Grimp. The patch below propagates line numbers from Jimple to
> Grimp, *however* as soon as the Aggregator is run (in the gop pack),
> these line numbers can of course be lost again. In general, every
> transformation that is performed on the Grimp code needs to take care
> to not mess up the line numbers.
>
> ### Eclipse Workspace Patch 1.0
> #P soot
> Index: src/soot/grimp/GrimpBody.java
> ===================================================================
> --- src/soot/grimp/GrimpBody.java       (revision 3287)
> +++ src/soot/grimp/GrimpBody.java       (working copy)
> @@ -173,6 +173,12 @@
>             oldToNew.put(oldStmt, newStmt);
>             if (updateStmtBox.getUnit() != null)
>                 updates.add(updateStmtBox.getUnit());
> +            if(oldStmt.hasTag("LineNumberTag")) {
> +               newStmt.addTag(oldStmt.getTag("LineNumberTag"));
> +            }
> +            if(oldStmt.hasTag("SourceLnPosTag")) {
> +               newStmt.addTag(oldStmt.getTag("SourceLnPosTag"));
> +            }
>         }
>
>         /* fixup stmt's which have had moved targets */
>
>
> Eric
>
>
>
> 2008/12/10 Mario Mendez-Lojo <mario at cs.unm.edu>:
>> Hi,
>>
>> I noticed that the line number information is lost when the bytecode output
>> is obtained via grimp, instead of via jimple. Is this a bug, or is this the
>> expected behavior given that the grimple transformation pipeline does not go
>> through the 'tag' phase? It would be really useful to keep the line numbers,
>> because in the presence of a runtime exception it's always easier to take a
>> look at the Grimp to see what's wrong with our transformation than to take a
>> look at the Jimple.
>>
>> Thank you guys!
>> _______________________________________________
>> Soot-list mailing list
>> Soot-list at sable.mcgill.ca
>> http://mailman.cs.mcgill.ca/mailman/listinfo/soot-list
>>
>
>
>
> --
> Eric Bodden
> Sable Research Group, McGill University
> Montréal, Québec, Canada
>



-- 
Eric Bodden
Sable Research Group, McGill University
Montréal, Québec, Canada


More information about the Soot-list mailing list