Don't run test-318 with gmcs.
[mono.git] / mono / mini / helpers.c
index 6c50613e7e86c1760fae758a13de0d71e9022922..778a3b3b08a9ded3cb82c284499310a0573c8473 100644 (file)
@@ -12,7 +12,7 @@
 #endif
 #define MINI_OP(a,b) b,
 /* keep in sync with the enum in mini.h */
-static const char* 
+static const char* const
 opnames[] = {
 #include "mini-ops.h"
 };
@@ -23,7 +23,7 @@ mono_inst_name (int op) {
        if (op >= OP_LOAD && op <= OP_LAST)
                return opnames [op - OP_LOAD];
        if (op < OP_LOAD)
-               return mono_opcode_names [op];
+               return mono_opcode_name (op);
        g_error ("unknown opcode name for %d", op);
        return NULL;
 }
@@ -58,13 +58,12 @@ mono_disassemble_code (guint8 *code, int size, char *id)
 {
        int i;
        FILE *ofd;
-       const char *tmp = getenv("TMP");
+       const char *tmp = g_get_tmp_dir ();
+       const char *objdump_args = g_getenv ("MONO_OBJDUMP_ARGS");
        char *as_file;
        char *o_file;
        char *cmd;
-
-       if (tmp == NULL)
-               tmp = "/tmp";
+       
        as_file = g_strdup_printf ("%s/test.s", tmp);    
 
        if (!(ofd = fopen (as_file, "w")))
@@ -83,7 +82,7 @@ mono_disassemble_code (guint8 *code, int size, char *id)
 
        fclose (ofd);
 #ifdef __APPLE__
-#define DIS_CMD "otool -V -v -t"
+#define DIS_CMD "otool -v -t"
 #else
 #if defined(sparc) && !defined(__GNUC__)
 #define DIS_CMD "dis"
@@ -91,17 +90,23 @@ mono_disassemble_code (guint8 *code, int size, char *id)
 #define DIS_CMD "objdump -d"
 #endif
 #endif
+#if defined(sparc)
+#define AS_CMD "as -xarch=v9"
+#else
+#define AS_CMD "as"
+#endif
+
        o_file = g_strdup_printf ("%s/test.o", tmp);    
-       cmd = g_strdup_printf ("as %s -o %s", as_file, o_file);
+       cmd = g_strdup_printf (AS_CMD " %s -o %s", as_file, o_file);
        system (cmd); 
        g_free (cmd);
-       cmd = g_strdup_printf (DIS_CMD " %s", o_file);
-       system (cmd);
-       g_free (cmd);
-
-       cmd = g_strdup_printf ("objdump -d %s", o_file);
+       if (!objdump_args)
+               objdump_args = "";
+       
+       cmd = g_strdup_printf (DIS_CMD " %s %s", objdump_args, o_file);
        system (cmd);
        g_free (cmd);
+       
        g_free (o_file);
        g_free (as_file);
 }