[Soot-list] Fwd: Support for Thread.start()

Ondřej Lhoták olhotak at uwaterloo.ca
Tue Feb 12 11:42:56 EST 2013


I was going to say the same thing that Tony Yan just said. The only
magic that the VM (or native code in the library) does is that
Thread.start calls Thread.run on a new thread. Therefore, this
is the only behaviour that Soot handles specially. If the Thread object
has a Runnable that was passed into its constructor, it is then the
Thread.run method that calls run on that Runnable. That method is
just Java, so Soot does not need to have any special handling
for it.

Isn't this the same issue that ASHISH MISHRA is just asking about on
another thread on this list?

Ondřej

On Tue, Feb 12, 2013 at 12:46:30PM +0100, Eric Bodden wrote:
> Hi Salim.
> 
> I guess the best person to answer this would be Ondrej.
> 
> I have cc'ed him in this message.
> 
> Eric
> 
> On 11 February 2013 22:14, salim bansal <salim.bansal at gmail.com> wrote:
> >
> > Thanks a lot for reply Eric.
> > Yes I don't have these edges in my call graph.
> > My understanding is(please correct me if I am wrong)
> > edges are getting added in "private void findReceivers(SootMethod m, Body
> > b)" method of
> > OnFlyCallGraphBuilder.java. There is an "if" statement which checks if
> > method signature is "void start()" and
> > if it is then add a call to run() method of the receiver class. I think
> > which is perfectly fine for threads that are
> > created by extending the thread class and overriding the run() method but
> > would not work(wrong?) if the thread is created by passing a Runnable to
> > Thread constructor as the run() method is inside the argument class that
> > implements Runnable.
> > The code that I am trying to analyze looks like this
> >
> > Thread p_thread ; //Class variable
> >
> > ...
> > ...
> > ...
> >
> > void method1(){
> >
> > p_thread = new Thread(new Worker());
> >
> > }
> >
> > void method2(){
> >
> > p_thread.start()
> >
> > }
> >
> > ...
> > ...
> >
> > Worker implements Runnable{
> >
> > public void run(){
> >
> > ...
> > ...
> >
> > }
> >
> > }
> >
> > now I need the call "p_thread.start()" to get "directed" to Worker.run()
> > method but with the above mentioned settings this is not working.
> >
> >
> > Thanks
> > Salim
> >
> > On Mon, Feb 11, 2013 at 3:53 AM, Eric Bodden <eric.bodden at ec-spride.de>
> > wrote:
> >>
> >> Hi Salim.
> >>
> >> Are you saying your call graph is missing those edges? Normally they
> >> should just be there....
> >>
> >> Eric
> >>
> >> On 10 February 2013 23:34, salim bansal <salim.bansal at gmail.com> wrote:
> >> > Hi,
> >> >
> >> > I am trying to build call graph with spark and cs-demand set to true.
> >> > When a statement such as following:
> >> >          Thread t = new Thread (new Worker());
> >> >
> >> > ...
> >> > ...
> >> > t.start()
> >> >
> >> > is encountered.
> >> > I need  the call graph to have edge from t.start() to run method of
> >> > Worker
> >> > class, assuming Worker class implements Runnable.
> >> > How can I get this working I am using Soot 2.3.0.
> >> > My soot options  are
> >> >         opt.put("enabled","true");
> >> >         opt.put("verbose","true");
> >> >         opt.put("propagator","worklist");
> >> >         opt.put("set-impl","double");
> >> >         opt.put("double-set-old","hybrid");
> >> >         opt.put("double-set-new","hybrid");
> >> >         opt.put("cs-demand","true");
> >> >         opt.put("on-fly-cg","true");
> >> >         opt.put("ignore-types","false");
> >> >         opt.put("passes","10");
> >> >
> >> > Thanks
> >> > Salim
> >> >
> >> >
> >> > _______________________________________________
> >> > Soot-list mailing list
> >> > Soot-list at sable.mcgill.ca
> >> > http://mailman.cs.mcgill.ca/mailman/listinfo/soot-list
> >> >
> >>
> >>
> >>
> >> --
> >> Eric Bodden, Ph.D., http://sse.ec-spride.de/ http://bodden.de/
> >> Head of Secure Software Engineering Group at EC SPRIDE
> >> Tel: +49 6151 16-75422    Fax: +49 6151 16-72051
> >> Room 3.2.14, Mornewegstr. 30, 64293 Darmstadt
> >
> >
> >
> >
> > _______________________________________________
> > Soot-list mailing list
> > Soot-list at sable.mcgill.ca
> > http://mailman.cs.mcgill.ca/mailman/listinfo/soot-list
> >
> 
> 
> 
> -- 
> Eric Bodden, Ph.D., http://sse.ec-spride.de/ http://bodden.de/
> Head of Secure Software Engineering Group at EC SPRIDE
> Tel: +49 6151 16-75422    Fax: +49 6151 16-72051
> Room 3.2.14, Mornewegstr. 30, 64293 Darmstadt
> 


More information about the Soot-list mailing list