#NEWLINE# def dbg_draw( self , filename ) : #NEWLINE# #INDENT# '\n        Draw the graph and save it to a PNG file.\n        ' #NEWLINE# import matplotlib.pyplot as pyplot #NEWLINE# tmp_graph = networkx . DiGraph ( ) #NEWLINE# for ( from_block , to_block ) in self . transition_graph . edges ( ) : #NEWLINE# #INDENT# node_a = ( '%#08x' % from_block . addr ) #NEWLINE# node_b = ( '%#08x' % to_block . addr ) #NEWLINE# if ( node_b in self . _ret_sites ) : #NEWLINE# #INDENT# node_b += '[Ret]' #NEWLINE# #UNINDENT# if ( node_a in self . _call_sites ) : #NEWLINE# #INDENT# node_a += '[Call]' #NEWLINE# #UNINDENT# tmp_graph . add_edge ( node_a , node_b ) #NEWLINE# #UNINDENT# pos = networkx . graphviz_layout ( tmp_graph , prog = 'fdp' ) #NEWLINE# networkx . draw ( tmp_graph , pos , node_size = 1200 ) #NEWLINE# pyplot . savefig ( filename )