X-Git-Url: http://wien.tomnetworks.com/gitweb/?a=blobdiff_plain;f=mono%2Fprofiler%2Fmono-profiler-iomap.c;h=15baec017ac03cd4dc6a5451303577f73ab1433e;hb=68be3904cf770be9f98a6ce0e8d71899cb94f189;hp=0dff9e980880e9e276e33182ceb53ea43ff693e4;hpb=88dbb8625b735a08dbd36c9fa1a48bfb67073272;p=mono.git diff --git a/mono/profiler/mono-profiler-iomap.c b/mono/profiler/mono-profiler-iomap.c index 0dff9e98088..15baec017ac 100644 --- a/mono/profiler/mono-profiler-iomap.c +++ b/mono/profiler/mono-profiler-iomap.c @@ -8,6 +8,7 @@ * * Note: this profiler is completely unsafe wrt handling managed objects, * don't use and don't copy code from here. + * Licensed under the MIT license. See LICENSE file in the project root for full license information. */ #include "config.h" @@ -17,6 +18,7 @@ #include #include #include +#include #include #include #include @@ -184,6 +186,7 @@ static inline guint32 calc_strings_hash (const gchar *str1, const gchar *str2, g static inline void print_report (const gchar *format, ...) { + MonoError error; MonoClass *klass; MonoProperty *prop; MonoString *str; @@ -195,11 +198,13 @@ static inline void print_report (const gchar *format, ...) vfprintf (stdout, format, ap); fprintf (stdout, "\n"); va_end (ap); - klass = mono_class_from_name (mono_get_corlib (), "System", "Environment"); + klass = mono_class_load_from_name (mono_get_corlib (), "System", "Environment"); mono_class_init (klass); prop = mono_class_get_property_from_name (klass, "StackTrace"); - str = (MonoString*)mono_property_get_value (prop, NULL, NULL, NULL); - stack_trace = mono_string_to_utf8 (str); + str = (MonoString*)mono_property_get_value_checked (prop, NULL, NULL, &error); + mono_error_assert_ok (&error); + stack_trace = mono_string_to_utf8_checked (str, &error); + mono_error_assert_ok (&error); fprintf (stdout, "-= Stack Trace =-\n%s\n\n", stack_trace); g_free (stack_trace); @@ -208,7 +213,6 @@ static inline void print_report (const gchar *format, ...) static inline void append_report (GString **report, const gchar *format, ...) { -#if defined (_EGLIB_MAJOR) || GLIB_CHECK_VERSION(2,14,0) va_list ap; if (!*report) *report = g_string_new (""); @@ -216,13 +220,11 @@ static inline void append_report (GString **report, const gchar *format, ...) va_start (ap, format); g_string_append_vprintf (*report, format, ap); va_end (ap); -#else - g_assert_not_reached (); -#endif } static gboolean saved_strings_find_func (gpointer key, gpointer value, gpointer user_data) { + MonoError error; SavedStringFindInfo *info = (SavedStringFindInfo*)user_data; SavedString *saved = (SavedString*)value; gchar *utf_str; @@ -231,7 +233,8 @@ static gboolean saved_strings_find_func (gpointer key, gpointer value, gpointer if (!info || !saved || mono_string_length (saved->string) != info->len) return FALSE; - utf_str = mono_string_to_utf8 (saved->string); + utf_str = mono_string_to_utf8_checked (saved->string, &error); + mono_error_assert_ok (&error); hash = do_calc_string_hash (0, utf_str); g_free (utf_str);