@@ -408,11 +408,17 @@ mono_profiler_get_coverage_data (MonoProfilerHandle handle, MonoMethod *method,
408
408
return TRUE;
409
409
}
410
410
411
+ struct InvokeCallbackInfo
412
+ {
413
+ MonoProfilerCoverageCallback cb ;
414
+ MonoProfilerHandle handle ;
415
+ };
416
+
411
417
static void invoke_coverage_callback_for_hashtable_entry (gpointer key , gpointer value , gpointer user_data )
412
418
{
419
+ InvokeCallbackInfo * invokeInfo = (InvokeCallbackInfo * ) user_data ;
413
420
MonoMethod * method = (MonoMethod * )key ;
414
421
MonoProfilerCoverageInfo * info = (MonoProfilerCoverageInfo * )value ;
415
- MonoProfilerCoverageCallback cb = (MonoProfilerCoverageCallback )user_data ;
416
422
417
423
MonoError error ;
418
424
MonoMethodHeader * header = mono_method_get_header_checked (method , & error );
@@ -450,7 +456,7 @@ static void invoke_coverage_callback_for_hashtable_entry (gpointer key, gpointer
450
456
}
451
457
}
452
458
453
- cb (handle -> prof , & data );
459
+ invokeInfo -> cb (invokeInfo -> handle -> prof , & data );
454
460
455
461
g_free ((char * ) data .file_name );
456
462
}
@@ -465,23 +471,27 @@ mono_profiler_get_all_coverage_data(MonoProfilerHandle handle, MonoProfilerCover
465
471
if (!mono_profiler_state .code_coverage )
466
472
return FALSE;
467
473
474
+ InvokeCallbackInfo info ;
475
+ info .cb = cb ;
476
+ info .handle = handle ;
477
+
468
478
coverage_lock ();
469
479
470
- g_hash_table_foreach (mono_profiler_state .coverage_hash , invoke_coverage_callback_for_hashtable_entry , cb );
480
+ g_hash_table_foreach (mono_profiler_state .coverage_hash , invoke_coverage_callback_for_hashtable_entry , & info );
471
481
472
482
coverage_unlock ();
473
483
474
484
return TRUE;
475
485
}
476
486
477
- void
487
+ mono_bool
478
488
mono_profiler_reset_coverage (MonoMethod * method )
479
489
{
480
490
if (!mono_profiler_state .code_coverage )
481
- return ;
491
+ return FALSE ;
482
492
483
493
if ((method -> flags & METHOD_ATTRIBUTE_ABSTRACT ) || (method -> iflags & METHOD_IMPL_ATTRIBUTE_RUNTIME ) || (method -> iflags & METHOD_IMPL_ATTRIBUTE_INTERNAL_CALL ) || (method -> flags & METHOD_ATTRIBUTE_PINVOKE_IMPL ))
484
- return ;
494
+ return FALSE ;
485
495
486
496
coverage_lock ();
487
497
@@ -490,10 +500,12 @@ mono_profiler_reset_coverage(MonoMethod* method)
490
500
coverage_unlock ();
491
501
492
502
if (!info )
493
- return ;
503
+ return TRUE ;
494
504
495
505
for (guint32 i = 0 ; i < info -> entries ; i ++ )
496
506
info -> data [i ].count = 0 ;
507
+
508
+ return TRUE;
497
509
}
498
510
499
511
static void reset_coverage_for_hashtable_entry (gpointer key , gpointer value , gpointer user_data )
0 commit comments