[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Printing Jimple



That seems like the correct way to print the body. One thing that
strikes me is that for printing the dashes, which you say do get
printed, you use some "print" method, rather than the usual
System.out.println(). What does this "print" method do? Does the code
still print the dashes if you print them to System.out? If not, you'll
have to figure out what PrintWriter this "print" method is using, and
get the Soot Printer to print to that.

Ondrej

On Sun, Jul 20, 2003 at 12:13:50AM -0500, Venkatesh Prasad Ranganath wrote:
> Hi,
> 
> I am using the inlined script in beanshell and it fails to print the body of the given class.
> 
> > void printInfo(sc) {
> >     for(Iterator i = sc.getMethods().iterator(); i.hasNext();) 
> >         try {
> >             SootMethod sm = (SootMethod)i.next();
> >             sm.retrieveActiveBody();
> >         } catch (RuntimeException e) {
> >             e.printStackTrace();
> >         }
> >     print("-------------------------------");
> >     t = Printer.v();
> >     t.setOption(Integer.MAX_VALUE);
> >     t.printTo(sc, new java.io.PrintWriter(System.out));
> >     print("===============================================");
> > }
> 
> t.printTo() does nothing.  In fact this is all it prints.
> 
> -------------------------------
> ===============================================
> 
> Can anybody enlighten me how does one print a JimpleBody in Soot?  Also, is there a way to print only the selected methods 
> instead of printing the whole class?
> 
> waiting for reply,
> 
> -- 
> 
> Venkatesh Prasad Ranganath,
> Dept. Computing and Information Science,
> Kansas State University, US.
> web: http://www.cis.ksu.edu/~rvprasad