[Soot-list] Pretty print

Cristiane Queiroz criscq at gmail.com
Tue Jun 30 09:46:22 EDT 2009


Hi Eric,

As I said before, I'm developing a tool to extract Java exception handling
to AspectJ aspects using abc.

But now, I have a question.
I have the information available by trap, but this information is in
bytecode, and I wanted this information in Java source.

With this, I would like to know how I make the relationship between the
bytecode and the corresponding source, considering that I already have both.
This relationship is the position of the source to bytecode.


Kind regards, Cristiane Queiroz



2009/6/17 Eric Bodden <eric.bodden at mail.mcgill.ca>

> That should be quite straightforward. Simply add the following line to
> your extension's ExtensionInfo class (within the "passes" method):
>
> l.add(new PrettyPrintPass(INSPECT_AST,job,new
> CodeWriter(System.out,70),new PrettyPrinter()));
>
> You can see abc.aspectj.ExtensionInfo for an example.
>
> Eric
>
>
> 2009/6/17 Cristiane Queiroz <criscq at gmail.com>:
> > Yes, I want to print Java/AspectJ before the weaving.
> > What's the easiest way for me to do that?
> >
> >
> > 2009/6/15 Eric Bodden <eric.bodden at mail.mcgill.ca>
> >>
> >> Hi Christiane.
> >>
> >> Depending on what you are trying to do, this may be hard to
> >> impossible. abc works by (1) transforming Java classes into Jimple and
> >> AspectJ aspects into something called an AspectInfo. Then, abc (2)
> >> weaves the Jimple code according to the AspectInfo and (3) produces
> >> bytecode from the woven Jimple.
> >>
> >> Therefore you can only print out Java or AspectJ code before step (2),
> >> i.e. before the weaving because no Java/AspectJ representation of the
> >> woven program exists. If you want to print the un-woven Java/AspecTJ
> >> code, I can tell you how to do that, but I fear that you are trying to
> >> accomplish something else.
> >>
> >> If you want to convert the woven Jimple code back to Java you can try
> >> to do so using the command line options "+soot -f dava -soot" to abc.
> >> This is known to be buggy, though, and it will only produce plain Java
> >> code. In other words, the generated code contains no pieces of advice
> >> or pointcuts etc. but only appropriate advice methods.
> >>
> >> Eric
> >>
> >> 2009/6/15 Cristiane Queiroz <criscq at gmail.com>:
> >> > Hi,
> >> >
> >> > I'm developing a tool to extract Java exception handling to AspectJ
> >> > aspects,
> >> > and I decided to implement this tool as an abc extension. I have
> studied
> >> > a
> >> > little bit about the inner workings of abc and its main components
> (Soot
> >> > and
> >> > Polyglot), and noticed that it is easy to change the internal
> structure
> >> > of a
> >> > class through Jimple. However, my tool needs to output Java and
> AspectJ
> >> > code
> >> > and I couldn't find any example of how to do that. All the examples
> >> > focus on
> >> > producing Java bytecode.
> >> >
> >> >  I would like to know if there is any way to pretty print the Jimple
> >> > code in
> >> > Java and/or AspectJ. Thanks in advance.
> >> >
> >> >
> >> >
> >> > Kind regards,
> >> >
> >> > Cristiane
> >> >
> >> > _______________________________________________
> >> > 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
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.cs.mcgill.ca/pipermail/soot-list/attachments/20090630/963e0178/attachment.html 


More information about the Soot-list mailing list