[Soot-list] Help with transformation task

Per perhje at gmail.com
Fri Jul 28 08:58:34 EDT 2017


Hi,

I am interested in transforming a series of classes A,B,C,D,... that all
implement a simple interface foo:
public interface foo
{
void bar(final baz b);
}
The baz class contains a single method:
public void squirt(Final string s)
Which causes some side-effect based on the input string (for example, might
print it to the console or do something else)

so if I have a sample class:

public class A implements foo
{
static String q = "something something"
@Override
public void bar(Final baz b)
{
StringBuffer sb = new StringBuffer();
sb.append("hello");
sb.append("goodbye");
b.squirt("delete this invokation to squirt");
b.squirt(q);
b.squirt("delete this too" + q)
b.squirt(sb.toString());
//let's say someMethod is defined in some other class and returns a string
value
b.squirt(someMethod() + "don't delete this");
//let's say B implements interface foo, but also implements a function
B.returnSomeString that just returns some string
b.squirt(B.returnSomeString());
}
}

I am interested in transforming this class in the following way:

1) Delete all invocations to squirt that only reference some string
constant, or a static field, is the result of a series of StringBuffer
concatenations of constants, etc. So ideally all first 4 of the squirt:s
above should be removed, and the fifth invocation should be kept as-is, and
the last invocation should also be kept (except the B.returnSomeString
method should also be transformed)
2) Keep invocations where the string constant is concatenated with the
output of some other method (like someMethod() in the example above)
3) Also want to transform the B.execute and B.returnSomeString() method
according to the above rules

Can anyone give me some hints in the right direction? I am having trouble
getting started. What should be my next step after transforming the .class
files to Grimple?

Thanks,
Per
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.CS.McGill.CA/pipermail/soot-list/attachments/20170728/42f01761/attachment.html>


More information about the Soot-list mailing list