[runtime] Expose trampoline jit infos that have unwind info to the runtime
[mono.git] / mono / mini / genmdesc.c
index d00a24b54558c9f617a646f4b9768014bd53a6bd..0cd3f3b5c815699c87ccd4a2beb6e9e55f633102 100644 (file)
@@ -140,8 +140,12 @@ load_file (const char *name) {
                                */
                        } else if (strncmp (p, "len:", 4) == 0) {
                                unsigned long size;
+                               char* endptr;
                                p += 4;
-                               size = strtoul (p, &p, 10);
+                               size = strtoul (p, &endptr, 10);
+                               if (size == 0 && p == endptr)
+                                       g_error ("Invalid length '%s' at line %d in %s\n", p, line, name);
+                               p = endptr;
                                if (!nacl_length_set) {
                                        desc->spec [MONO_INST_LEN] = size;
                                }
@@ -219,7 +223,7 @@ output_char (FILE *f, char c) {
        if (isalnum (c))
                fprintf (f, "%c", c);
        else
-               fprintf (f, "\\x%x\" \"", c);
+               fprintf (f, "\\x%x\" \"", (guint8)c);
 }
 
 static void
@@ -234,13 +238,13 @@ build_table (const char *fname, const char *name) {
        if (!(f = fopen (fname, "w")))
                g_error ("Cannot open file '%s'", fname);
        fprintf (f, "/* File automatically generated by genmdesc, don't change */\n\n");
-       fprintf (f, "const char %s [] = {\n", name);
+       fprintf (f, "const char mono_%s [] = {\n", name);
        fprintf (f, "\t\"");
        for (j = 0; j < MONO_INST_MAX; ++j)
                fprintf (f, "\\x0");
        fprintf (f, "\"\t/* null entry */\n");
        idx = 1;
-       g_string_append_printf (idx_array, "const guint16 %s_idx [] = {\n", name);
+       g_string_append_printf (idx_array, "const guint16 mono_%s_idx [] = {\n", name);
 
        for (i = OP_LOAD; i < OP_LAST; ++i) {
                desc = opcodes + i;