[profiler] Fix code coverage support.
[mono.git] / mono / metadata / profiler.c
index 23f65469c81d412832909bd5b1f3d080072a1d74..b10423120d43a649f8fd9a0c160a0fb3f307523f 100644 (file)
@@ -181,7 +181,7 @@ mono_profiler_enable_coverage (void)
        if (!mono_debug_enabled ())
                mono_debug_init (MONO_DEBUG_FORMAT_MONO);
 
-       return TRUE;
+       return mono_profiler_state.code_coverage = TRUE;
 }
 
 static void
@@ -218,7 +218,7 @@ mono_profiler_get_coverage_data (MonoProfilerHandle handle, MonoMethod *method,
        guint32 size;
 
        const unsigned char *start = mono_method_header_get_code (header, &size, NULL);
-       const unsigned char *end = start - size;
+       const unsigned char *end = start + size;
        MonoDebugMethodInfo *minfo = mono_debug_lookup_method (method);
 
        for (guint32 i = 0; i < info->entries; i++) {