@@ -359,7 +359,6 @@ def fini_enclave_debug(self):
359
359
# Delete the dumped enclave if any
360
360
global DUMPED_ENCLAVE
361
361
if self .enclave_path in DUMPED_ENCLAVE :
362
- print ("Free-ing pointer {0}" .format (DUMPED_ENCLAVE [self .enclave_path ]))
363
362
gdb .execute ("call (void)free({0})" .format (DUMPED_ENCLAVE [self .enclave_path ]))
364
363
os .remove (self .enclave_path )
365
364
del DUMPED_ENCLAVE [self .enclave_path ]
@@ -396,7 +395,7 @@ def retrieve_enclave_info(info_addr = 0):
396
395
if name_str == None :
397
396
return None
398
397
fmt = str (info_tuple [4 ]) + 's'
399
- enclave_path = struct .unpack_from (fmt , name_str )[0 ].decode (encoding = 'UTF-8' )
398
+ enclave_path = struct .unpack_from (fmt , name_str )[0 ].decode (encoding = 'UTF-8' )
400
399
# get the stack addr list
401
400
stack_addr_list = []
402
401
tcs_addr_list = []
@@ -706,12 +705,11 @@ def __init__(self):
706
705
def stop (self ):
707
706
bp_in_urts = is_bp_in_urts ()
708
707
if bp_in_urts == True :
709
- print ("_create_enclave_from_buffer_ex" )
710
708
# Get se_file_t pointer (4th parameter)
711
709
file_addr = gdb .parse_and_eval ("$rcx" )
712
710
file_str = read_from_memory (file_addr , 8 + 2 * 4 )
713
711
file_tuple = struct .unpack_from ("QII" , file_str )
714
- print ( "File: " + str ( file_tuple [ 1 ]))
712
+
715
713
if file_tuple [1 ] == 0 :
716
714
# If it is null, then it does not have a file. So we dump the buffer
717
715
@@ -723,24 +721,20 @@ def stop(self):
723
721
f = open (dump_name , "wb" )
724
722
f .write (bytearray (enclave_bin ))
725
723
f .close ()
726
- print ("Done dumping" )
727
724
728
725
# patch the file to malloc'ed buffer
729
726
str_filepath_buf = gdb .execute ("call (void*)malloc({0})" .format (len (dump_name ) + 1 ), False , True )
730
727
str_filepath_buf = int (re .search (r"0x[0-9a-f]+" , str_filepath_buf ).group (), 16 )
731
- print ("Got malloc {0}" .format (str_filepath_buf ))
732
728
filepath_bytes = bytearray ()
733
729
filepath_bytes .extend (map (ord , dump_name ))
734
730
filepath_bytes .extend (bytes (0 ))
735
731
write_to_memory (str_filepath_buf , filepath_bytes )
736
- print ("Done writing filename" )
737
732
write_to_memory (file_addr , struct .pack ('QII' , str_filepath_buf , len (dump_name ), 0 ))
738
733
739
734
# Store the malloc-ed pointer
740
735
global DUMPED_ENCLAVE
741
736
DUMPED_ENCLAVE [dump_name ] = str_filepath_buf
742
737
743
- print ("Done patching" )
744
738
return False
745
739
746
740
def sgx_debugger_init ():
0 commit comments