#NEWLINE# def requested_mem_size( ) : #NEWLINE# #INDENT# possible_bp_syms = [ 'calloc' , 'malloc' , 'realloc' ] #NEWLINE# sym = None #NEWLINE# for line in pykd . dbgCommand ( 'kb' ) . splitlines ( ) [ 1 : ] : #NEWLINE# #INDENT# try : #NEWLINE# #INDENT# ( _ , _ , arg0 , arg1 , _ , sym ) = line . split ( ) #NEWLINE# arg0 = int ( arg0 , 16 ) #NEWLINE# arg1 = int ( arg1 , 16 ) #NEWLINE# sym = sym . split ( '!' ) [ 1 ] . strip ( ) #NEWLINE# #UNINDENT# except ( ValueError , IndexError ) : #NEWLINE# #INDENT# continue #NEWLINE# #UNINDENT# if ( sym in possible_bp_syms ) : #NEWLINE# #INDENT# break #NEWLINE# #UNINDENT# sym = None #NEWLINE# #UNINDENT# if ( ret_val == 'calloc' ) : #NEWLINE# #INDENT# ret_val = ( arg0 * arg1 ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( sym == 'malloc' ) : #NEWLINE# #INDENT# ret_val = arg0 #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( sym == 'realloc' ) : #NEWLINE# #INDENT# ret_val = arg1 #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# ret_val = 0 #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# return ret_val