[Soot-list] Private methods are not being

Eric Bodden eric.bodden at ec-spride.de
Mon Mar 19 02:56:07 EDT 2012


The problem is here in your code:

        java.awt.EventQueue.invokeLater(new Runnable() {

            public void run() {
                new Addition2().setVisible(true);
            }
        });

The constructor is called if/when run() is called. But run() is called
only from within the JDK, by the awt EventQueue. When you exclude the
JDK, this call will never be recognized by Soot. This is a classical
example of where you *cannot* exclude the JDK. In other words, Soot is
just doing what you told it to do. The solution is not to use
-no-bodies-for-excluded.

Eric

On 18 March 2012 19:37, Clarissa Grixti <clarissa_14_4 at hotmail.com> wrote:
> Hey eric,
>
> The thing is that when I remove the exclude, the methods called within the
> private methods are infact being outputted. I just tried another example
> having 2 private methods and it worked. The initComponents is being called
> from the constructor and since this is not actually a method, and that why
> it is not being included.
>
> Thanks a lot for your help
>
>> From: eric.bodden at ec-spride.de
>> Date: Sun, 18 Mar 2012 18:07:34 +0100
>
>> Subject: Re: [Soot-list] Private methods are not being
>> To: clarissa_14_4 at hotmail.com
>> CC: soot-list at sable.mcgill.ca
>>
>> Hi Clarissa.
>>
>> In your code, who is calling those private methods? To me it seems
>> that they are never actually called. For instance, who is calling
>> initComponents, who is calling jButton1?
>>
>> If those methods are not called then it's only natural that there are
>> no call edges...
>>
>> Eric
>>
>>
>>
>> On 18 March 2012 16:12, Clarissa Grixti <clarissa_14_4 at hotmail.com> wrote:
>> > Hi eric,
>> >
>> > kindly find attached the source code for the 2 classes being used for
>> > the
>> > call graph. Ive other simpler classes with simple methods and the same
>> > thing
>> > is happenening
>> >
>> > Thanks and regards
>> >
>> >> From: eric.bodden at ec-spride.de
>> >> Date: Sun, 18 Mar 2012 15:58:50 +0100
>> >> Subject: Re: [Soot-list] Private methods are not being
>> >> To: clarissa_14_4 at hotmail.com
>> >> CC: soot-list at sable.mcgill.ca
>> >
>> >>
>> >> Hi Clarissa.
>> >>
>> >> What does your class Addition2 look like? Can you attach it?
>> >>
>> >> Eric
>> >>
>> >>
>> >>
>> >> On 18 March 2012 13:40, Clarissa Grixti <clarissa_14_4 at hotmail.com>
>> >> wrote:
>> >> > Hi all,
>> >> >
>> >> > I'm using SOOT to be able to generate a call graph and then get the
>> >> > target
>> >> > nodes according to the methods that I need. The problem is that when
>> >> > I
>> >> > input
>> >> > a method name which is private, the target nodes are not being
>> >> > returned.
>> >> >
>> >> > What's weird is that I am using the exclude
>> >> > and "-no-bodies-for-excluded" so
>> >> > that methods in the java. package will not be included in the Call
>> >> > graph.
>> >> > And in this case when I try to get the  nodes for a private method,
>> >> > nothing
>> >> > is returned. However when I remove the exclude and
>> >> > the "-no-bodies-for-excluded", then the target nodes are being
>> >> > returned.
>> >> > However I still want to be able to use the the exclude as it is
>> >> > taking a
>> >> > lot
>> >> > of time to give me a result and I don't need any information
>> >> > regarding
>> >> > these
>> >> > methods.
>> >> >
>> >> > I have the following code:
>> >> >
>> >> > public static void main(String[] args) {
>> >> >   List<String> argsList = new ArrayList<String>();
>> >> >   argsList.addAll(Arrays.asList(new String[]{
>> >> >   "-w",
>> >> >   "-main-class",
>> >> >   "Addition2",//main-class
>> >> >   "Addition2",//argument classes
>> >> >                            "edu.calc.Calculator",
>> >
>> >> >   "-exclude",
>> >> >   "java.",
>> >> >   "-no-bodies-for-excluded"
>> >> >   //
>> >> >   }));
>> >> >
>> >> >   PackManager.v().getPack("wjtp").add(new Transform("wjtp.myTrans",
>> >> > new
>> >> > SceneTransformer() {
>> >> >
>> >> > @Override
>> >> > protected void internalTransform(String phaseName, Map options) {
>> >> >       CHATransformer.v().transform();
>> >> >                        getTargets();
>> >> > }
>> >> >
>> >> >   }));
>> >> >
>> >> >            args = argsList.toArray(new String[0]);
>> >> >
>> >> >            soot.Main.main(args);
>> >> > }
>> >> > public static void getTargets() {
>> >> > SootMethod src =
>> >> > Scene.v().getMainClass().getMethodByName("jButton1ActionPerformed");
>> >> > //
>> >> > this
>> >> > is a private method in the main Class: Addition2
>> >> >                 CallGraph cg = Scene.v().getCallGraph();
>> >> >
>> >> >                 Iterator<MethodOrMethodContext> targets = new
>> >> > Targets(cg.edgesOutOf(src));
>> >> >                 while (targets.hasNext()) {
>> >> >
>> >> >                     SootMethod tgt = (SootMethod)targets.next();
>> >> >                     CG.method.add(tgt);
>> >> >                     System.out.println("Target: " + tgt.getName());
>> >> >
>> >> >                 }
>> >> > }
>> >> > This is when no targets for private methods are being outputted. I
>> >> > have
>> >> > tried it with other private methods in other classes and no targets
>> >> > were
>> >> > outputted. Does someone maybe know why this is happening please?
>> >> >
>> >> > Thanks for your help and regards
>> >> >
>> >> > _______________________________________________
>> >> > Soot-list mailing list
>> >> > Soot-list at sable.mcgill.ca
>> >> > http://mailman.cs.mcgill.ca/mailman/listinfo/soot-list
>> >> >
>> >>
>> >>
>> >>
>> >> --
>> >> Eric Bodden, Ph.D., http://bodden.de/
>> >> Head of Secure Software Engineering Group at EC SPRIDE
>> >> Principal Investigator in Secure Services at CASED
>> >> Tel: +49 6151 16-75422    Fax: +49 6151 16-72051
>> >> Room 3.2.14, Mornewegstr. 30, 64293 Darmstadt
>>
>>
>>
>> --
>> Eric Bodden, Ph.D., http://bodden.de/
>> Head of Secure Software Engineering Group at EC SPRIDE
>> Principal Investigator in Secure Services at CASED
>> Tel: +49 6151 16-75422    Fax: +49 6151 16-72051
>> Room 3.2.14, Mornewegstr. 30, 64293 Darmstadt



-- 
Eric Bodden, Ph.D., http://bodden.de/
Head of Secure Software Engineering Group at EC SPRIDE
Principal Investigator in Secure Services at CASED
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