[Mono-dev] mono_signature_get_desc segfaults

Greg Young gregoryyoung1 at gmail.com
Sat Jan 24 18:54:17 UTC 2015


  0 static char *
  1 get_method_name(MonoProfiler *profiler, MonoMethod *method) {
  2     MonoClass *klass = mono_method_get_class (method);
  3     if(klass == NULL) return NULL;
  4     char *signature = (char*) mono_signature_get_desc
(mono_method_signature (method), 0);
  5     if(signature == NULL) return NULL;
  6     const char *namespace = mono_class_get_namespace (klass);
  7     const char *klassname = mono_class_get_name (klass);
  8     const char *methodname = mono_method_get_class (method);
  9     //g_free (signature);
 10     char *name = g_strdup_printf ("%s.%s:%s (%s)",
 11                                  mono_class_get_namespace (klass),
 12                                  mono_class_get_name (klass),
 13                                  mono_method_get_name (method),
 14                                  signature);
 15     return name;
 16 }

I have been able to get it to happen rather reliably that I appear to
get back something that is a bad pointer from mono_signature_get_desc.
I am not seeing anything obviously wrong in how I am calling it but
will get a segv occasionally on the strdup_printf here. Not using the
signature makes issue go away but isnt much help:)

Am I missing something in how I should be calling get_desc? The
MonoMethod was handed to me by the runtime...

Cheers,

Greg

-- 
Studying for the Turing test


More information about the Mono-devel-list mailing list