[Soot-list] Program Dependency Graphs in Soot

Hossein Sadat-Mohtasham shmohtasham at gmail.com
Tue Jun 21 18:35:08 EDT 2011


  Hi,

Below, you can see one way of using the PDG (Note that you may use any  
of the the CFG types in Soot but to work around problems with  
exception handling constructs, I added an EnhancedUnitGraph.) This is  
from an appendix in my thesis where I have more details on the  
construction of the PDG. Also, you can find my thesis here:

http://repository.library.ualberta.ca/dspace/handle/10048/1669

I hope this will be helpful. Feel free to ask any questions.

Cheers,

--Hossein


2 / ∗ B o d y 	b o d y = . . .
3
4 	b o d y r e p r e s e n t s t h e b o d y o f a n y m e t h o d
5 	w h o s e PDG i s d e s i r e d . I t may b e a c q u i r e d t h r  
o u g h
6 	d i f f e r e n t w a y s ( e . g . i n t e r n a l T r a n s f o r  
m m e t h o d , e t c . ) .
7 ∗ /
8
9 	/ / C r e a t e 	t h e 	CFG 	o f 	t h e 	m e t h o d
10 	E n h a n c e d U n i t G r a p h 	c f g = new 	E n h a n c e d U  
n i t G r a p h ( b o d y ) ;
11
12 	/ / C r e a t e 	t h e 	PDG 	f o r 	t h e 	g i v e n	 CFG
13 	P r o g r a m D e p e n d e n c e G r a p h 	p d g = new 	Ha s h  
Mu t a b l e P D G ( c f g ) ;
14
15 	/ / P r i n t 	a 	t e x t u a l 	r e p r e s e n t a t i o n 	o f 	 
t h e	 g r a p h .
16 	S y s t e m . o u t . p r i n t l n ( p d g ) ;
17
18 	/ / G e t 	a	 l i s t 	o f 	t h e 	r e g i o n s 	i n 	t h e	 PDG
19	 L i s t <PDGRegi on> 	p d g R e g i o n s = ( ( H a s h Mu t a b l  
e P D G 2 ) p d g ) . g e t P D G R e g i o n s ( ) ;
20
21 	// T hen 	get 	a l l  t h e dependents  o f  t h e  t o p −l e v  
e l  r e g i o n
22 	PDGNode 	h e a d = p d g . G e t S t a r t N o d e ( ) ;
23 	L i s t <PDGNode> 	d e p s = p d g . g e t D e p e n d e n t s ( h  
e a d ) ;

On 22-Jun-11, at 1:00 AM, soot-list-request at sable.mcgill.ca wrote:

> Date: Mon, 20 Jun 2011 18:53:10 +0100
> From: John Dee <jdsoot at hotmail.com>
> Subject: [Soot-list] Program Dependency Graphs in Soot
> To: <soot-list at sable.mcgill.ca>
> Message-ID: <SNT134-w412BF14414A222BDC87CA8C66E0 at phx.gbl>
> Content-Type: text/plain; charset="iso-8859-1"
>
>
> Hi there.
>
> I saw from the following post on Eric Bodden's blog (here - http://www.bodden.de/2010/03/29/soot-2-4-0-released/#comment-35555)
> and also here (http://www.sable.mcgill.ca/soot/CHANGES) that in  
> March 2010, the soot 2.4.0 release included the ability to build  
> program
> dependency graphs using the interface 'ProgramDependenceGraph' from  
> package 'soot.toolkits.graph.pdg'. There is also a concrete  
> implementation
> in class 'HashMutablePDG' (http://www.sable.mcgill.ca/soot/doc/soot/toolkits/graph/pdg/HashMutablePDG.html 
> ).
>
> This is really exciting stuff! However, I really don't know where to  
> begin using this class and was wondering if anyone has a working  
> example I
> could take a look at? Or perhaps some tips on how to use this class?
>
> Many thanks
> JD
> 		 	   		

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.cs.mcgill.ca/pipermail/soot-list/attachments/20110622/3ec347c6/attachment.html 


More information about the Soot-list mailing list