[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Fwd: CFG, Dominator Tree, Threads and Java input Questions
Hi,
> Robert Mittermayr <robert.mittermayr@gmx.at> wrote:
>> > I suspect that you need to be subscribed to the soot list to be able
>> > to send messages to it. If you still need me to send your mail, let
>> > me know.
>>
>> Yes i'm subscribed and i get everyday some messages but i can't post
>> some!
>> So please could you post this message for me?
>
> Here you go!
>
> Cheers,
> Navin.
> -------------
>
> Hi Everybody!
>
> I want to perform static analysis on a graph called DJ-Graph. Therefore i
> need to add this graph to SOOT. It's a combination from Dominator Tree
> (D-edges) with Control Flow Graph (CFG) (just the join edges are needed).
> So
> it's actually just a copy of the dominator tree plus some edges from the
> CFG
> (join edges). I think i will manage to build this graph with soot but:
>
> Would be very kind if you could answer some of the following questions:
>
> My questions:
> - I want to perform static analysis with multithread programs(busy wait
> ....). Therefore i need for example to find a variable in one thread that
> an
> other thread
> needs to be changed to go on with work (like Producer /Consumer).
> Is it Possible to do that with SOOT?
Currently, Soot does not provide this function directly. But you may
develop some client analysis to get it. I am not quite sure about what
exact information you want. If you want to find datarace in multithreaded
programs, you can use MHP information. Generally, you can find the
informaiton about read/writer of variables in threads by yourself.
First of all, you need use Jimple IR and find the target run() method body
for started threads. To find out the started threads, you need scan each
Jimple statement, if you find a method invocation statement, where the
called method name is start() or run() and the class defined start()/run()
implements java.lang.Runnable, the target method body of the
start()/run() is the started thread. You can use CallGraph to find the
target methods. (But currently, if a program starts thread in loops and
uses an array to store threads, you may not get the target methods you
need.)
Then use Spark, you can find the target or alias of a variable. Checking
the variables that you are interested in of each thread, you can find out
the read/write information of the variables. Please note that sometimes,
the number of target started threads may more than one. You should think
about this situation and how to handle it.
> - Could You give me some code how to find one variable that is used in two
> threads?
It is not easy to do it just in a chunk code in a single program. I don't
know how well you know Soot. If you never use Soot before, I suggest you
read the Soot tutorial first. To get preciser results, you need Spark to
get points-to analysis. And do you want to find one variable that is used
in TWO threads or more than one thread? I think you can get some hints
from my answer of your last question.
> - The names of the variables are lost in the Bytecode, so is it possible
> to
> use soot.dava to find that?
Please refer to Jennifer's email which has the answer of this.
> - How would look the "synchronized" in java in the intermediate
> language(jimple or shimple)?
If you want to find if a SootMethod is "synchronized" or not, use
isSynchronized() method of SootMethod. Please find all the API of Soot at
http://www.sable.mcgill.ca/soot/doc/index.html
>
> thank you very much in advance
> Robert
>
>
>
Hope this can help.
Lin