File tree 2 files changed +6
-3
lines changed
2 files changed +6
-3
lines changed Original file line number Diff line number Diff line change @@ -280,6 +280,7 @@ static void test_snapshot(void)
280
280
uc_engine * uc ;
281
281
uc_context * c0 , * c1 ;
282
282
uint32_t mem ;
283
+ uint8_t code_data ;
283
284
// mov eax, [0x2020]; inc eax; mov [0x2020], eax
284
285
char code [] = "\xa1\x20\x20\x00\x00\x00\x00\x00\x00\xff\xc0\xa3\x20\x20\x00"
285
286
"\x00\x00\x00\x00\x00" ;
@@ -302,13 +303,15 @@ static void test_snapshot(void)
302
303
OK (uc_mem_read (uc , 0x2020 , & mem , sizeof (mem )));
303
304
TEST_CHECK (mem == 2 );
304
305
OK (uc_context_restore (uc , c1 ));
305
- // TODO check mem
306
+
306
307
OK (uc_mem_read (uc , 0x2020 , & mem , sizeof (mem )));
307
308
TEST_CHECK (mem == 1 );
308
309
OK (uc_context_restore (uc , c0 ));
309
310
OK (uc_mem_read (uc , 0x2020 , & mem , sizeof (mem )));
310
311
TEST_CHECK (mem == 0 );
311
- // TODO check mem
312
+
313
+ OK (uc_mem_read (uc , 0x1000 , & code_data , sizeof (code_data )));
314
+ TEST_CHECK (code_data == 0xa1 );
312
315
313
316
OK (uc_context_free (c0 ));
314
317
OK (uc_context_free (c1 ));
Original file line number Diff line number Diff line change @@ -2837,7 +2837,7 @@ static uc_err uc_restore_latest_snapshot(struct uc_struct *uc)
2837
2837
subregions_link , subregion_next )
2838
2838
{
2839
2839
uc -> memory_filter_subregions (subregion , uc -> snapshot_level );
2840
- if (QTAILQ_EMPTY (& subregion -> subregions )) {
2840
+ if (subregion -> priority >= uc -> snapshot_level || (! subregion -> terminates && QTAILQ_EMPTY (& subregion -> subregions ) )) {
2841
2841
uc -> memory_unmap (uc , subregion );
2842
2842
}
2843
2843
}
You can’t perform that action at this time.
0 commit comments