[runtime] It's spring cleaning in MonoInternalThread. Remove 8 (yes, eight) unused...
[mono.git] / mono / metadata / pedump.c
index 496c3c7f5ff9e66909157c08f3c7dd0a5c381ce6..2615373e1223cdeb1f892e92aaae3507ad4ea57a 100644 (file)
@@ -27,6 +27,7 @@
 #include <mono/metadata/marshal.h>
 #include "mono/utils/mono-digest.h"
 #include <mono/utils/mono-mmap.h>
+#include <mono/utils/mono-counters.h>
 #include <sys/types.h>
 #include <sys/stat.h>
 #ifdef HAVE_UNISTD_H
@@ -359,11 +360,13 @@ dump_verify_info (MonoImage *image, int flags)
 
                for (i = 0; i < m->rows; ++i) {
                        MonoMethod *method;
+                       MonoError error;
                        mono_loader_clear_error ();
 
-                       method = mono_get_method (image, MONO_TOKEN_METHOD_DEF | (i+1), NULL);
+                       method = mono_get_method_checked (image, MONO_TOKEN_METHOD_DEF | (i+1), NULL, NULL, &error);
                        if (!method) {
-                               g_print ("Warning: Cannot lookup method with token 0x%08x\n", i + 1);
+                               g_print ("Warning: Cannot lookup method with token 0x%08x due to %s\n", i + 1, mono_error_get_message (&error));
+                               mono_error_cleanup (&error);
                                continue;
                        }
                        errors = mono_method_verify (method, flags);
@@ -473,10 +476,12 @@ verify_image_file (const char *fname)
 
        table = &image->tables [MONO_TABLE_TYPEDEF];
        for (i = 1; i <= table->rows; ++i) {
+               MonoError error;
                guint32 token = i | MONO_TOKEN_TYPE_DEF;
-               MonoClass *class = mono_class_get (image, token);
+               MonoClass *class = mono_class_get_checked (image, token, &error);
                if (!class) {
-                       printf ("Could not load class with token %x\n", token);
+                       printf ("Could not load class with token %x due to %s\n", token, mono_error_get_message (&error));
+                       mono_error_cleanup (&error);
                        continue;
                }
                mono_class_init (class);
@@ -653,6 +658,7 @@ main (int argc, char *argv [])
 #ifndef DISABLE_PERFCOUNTERS
        mono_perfcounters_init ();
 #endif
+       mono_counters_init ();
        mono_metadata_init ();
        mono_images_init ();
        mono_assemblies_init ();