[Soot-list] Output of source line annotations in jimple JasminClass

Eric Bodden bodden at st.informatik.tu-darmstadt.de
Mon Aug 30 11:54:40 EDT 2010


Hi Hal.

Sorry about the late response. I have now patched the other
JasminClass too, as follows:

@@ -1236,6 +1237,8 @@
     void emitStmt(Stmt stmt)
     {
+    	LineNumberTag lnTag = (LineNumberTag) stmt.getTag("LineNumberTag");
+    	if(lnTag != null) emit(".line " + lnTag.getLineNumber());
         stmt.apply(new AbstractStmtSwitch()
         {
             public void caseAssignStmt(AssignStmt s)

I think this should work.

Eric

--
Dr. Eric Bodden
Software Technology Group, Technische Universität Darmstadt, Germany
Tel: +49 6151 16-5478    Fax: +49 6151 16-5410
Mailing Address: S2|02 A209, Hochschulstraße 10, 64289 Darmstadt



On 16 August 2010 04:32, Hal Hildebrand <hal.hildebrand at gmail.com> wrote:
> I'm finding that the recently discussed modification to the baf JasminClass to output source line attributes is not sufficient in all scenarios.  The problem comes about from these lines in the PackManager:
>
>
>            case Options.output_format_class :
>            case Options.output_format_jasmin :
>                if (c.containsBafBody())
>                    new soot.baf.JasminClass(c).print(writerOut);
>                else
>                    new soot.jimple.JasminClass(c).print(writerOut);
>                break;
>
> As you can see, it's only if the class has a baf body will the baf.JasminClass patch actually work.  In my case, I'm doing transformations in the JTP phase which produce classes with jimple bodies for the methods.  Consequently, the classfile output takes the else branch and completely by passes the patch to output source line annotations.
>
> Thus, my question is how to go about patching jimple.JasminClass in the same fashion such that source line annotations are emitted correctly...
>
> Thanks,
>
> Hal
>
> _______________________________________________
> Soot-list mailing list
> Soot-list at sable.mcgill.ca
> http://mailman.cs.mcgill.ca/mailman/listinfo/soot-list
>


More information about the Soot-list mailing list