[Soot-list] Transformation capablilities of Soot

Almo aaloanmiftah at yahoo.com
Mon May 13 15:25:52 EDT 2013


Hey,

1. Java has no support for string operators. The compiler simplifies string concatenation to using string buffer's append. So in soot's Jimple it'd translate to:
stack0 = new StringBuffer();
stack0 = stack0.append("....");
stack0 = stack0.append(v);
stack0 = stack0.append("..");
v1 = stack0.toString();

or in grimple:
v1 = new StringBuffer().append("....").append(v).append("..").toString();

2. You could either use grimple or jimple. Grimple is aggregated whereas jimple is 3ac.

3. Patching chain updates links between branch units, rifk.

Al


________________________________
 From: Zeinab Lashkaripour <lashkaripour at yahoo.com>
To: Marc-André Laverdière-Papineau <marc-andre.laverdiere-papineau at polymtl.ca> 
Cc: "soot-list at sable.mcgill.ca" <soot-list at sable.mcgill.ca> 
Sent: Monday, May 13, 2013 1:18 PM
Subject: Re: [Soot-list] Transformation capablilities of Soot
 


Hi Marc-André,

Thanks for your reply.

> That is the reason why Bernhard and I have used templates to generate Jimple.

Could you please open up what you have done a little bit. Can we use these templates or not? 


> 1. That looks like you want to do syntax-directed translation in order to determine the constant parts of that string concatenation. Am I right?
I don't know what you mean. 

The result of my analysis can be in the form of   (v1 = "...." + v + "..") which means that the value of the LHS variable (v1) can contain variables and constants. I wanted to know in order to insert this statement in my code do I have to perform the actions that are done in a Jimple code (using a StringBuilder and virtualinvoke) or is there a way to give such a value to a variable at once?


> 2. I have no idea what you want to ask...
In this question I want to add a value to the list that I have added to my locals and insert "list.add(value)" in my code. How can I do that?

> 3. Yes, very easy. You just have to use the PatchingChain API.
What is the difference between PatchingChain and Chain. Can I not use the chain and add a statement before or after it? Or is this implementation of chain suitable for the condition that I'm looking for?

Regards,
Zeinab


________________________________
 From: Marc-André Laverdière-Papineau <marc-andre.laverdiere-papineau at polymtl.ca>
To: soot-list at sable.mcgill.ca 
Sent: Monday, May 13, 2013 10:49 PM
Subject: Re: [Soot-list] Transformation capablilities of Soot
 

Hello Zeinab,

As a general thing, Soot can do whatever transformations you want. The 
only thing is that it is relatively tedious to do so programatically. 
That is the reason why Bernhard and I have
 used templates to generate 
Jimple.

Answering your questions
1. That looks like you want to do syntax-directed translation in order 
to determine the constant parts of that string concatenation. Am I right?

2. I have no idea what you want to ask...
3. Yes, very easy. You just have to use the PatchingChain API.

Marc-André Laverdière-Papineau
Doctorant - PhD Candidate

On 11/05/13 04:21 PM, Zeinab Lashkaripour wrote:
> Hi every one,
>
> I'm trying to perform some transformations that I'm not sure I can use
> Soot for them therefore I would be grateful if any one could guide me.
>
> 1. I have some strings that their value a concatenation of string
> variables and values. For example after processing I get:
> v1 = "...." + v + "..";
> In this example I don't know the value of v till runtime and what I have
> from my processing is the RHS of the
 assignment. I have the RHS as a
> value and I am not aware of the variables until I traverse it.
> Can I use Soot for this and give the RHS at once to v1?
> Or do I have to separate values and variables in order to use Soot?
>
> 2. I also want to add some code in the form of:
> list.add(value);
> Can I do that too?
>
> 3. If I have the following form in code:
> if (condition)  v2 = ".." + y;
> If I want to add a statement before or after "v2 = ".." + y"
>      if (condition) { v2 = ".." + y; new statement; }
> does soot support this or do I have to do it by myself?
>
> I think the answer to the first two is yes but, I'm not sure how to do it.
> And for the last question I have no clue.
>
> Thanks in advance,
> Zeinab
>
>
> _______________________________________________
> Soot-list mailing
 list
> Soot-list at sable.mcgill.ca
> http://mailman.cs.mcgill.ca/mailman/listinfo/soot-list
>
_______________________________________________
Soot-list mailing list
Soot-list at sable.mcgill.ca
http://mailman.cs.mcgill.ca/mailman/listinfo/soot-list


_______________________________________________
Soot-list mailing list
Soot-list at sable.mcgill.ca
http://mailman.cs.mcgill.ca/mailman/listinfo/soot-list
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.cs.mcgill.ca/pipermail/soot-list/attachments/20130513/d9282945/attachment-0001.html 


More information about the Soot-list mailing list