Fixed MacOS proxy support for proxies requiring authentication
[mono.git] / mono / mini / helpers.c
index af1235e317512555450b1e21e15e82fb1756237e..2a0b7d9e0e1d826125da9451cad191f441d99ec8 100644 (file)
@@ -11,6 +11,8 @@
 #include <unistd.h>
 #endif
 
+#ifndef DISABLE_LOGGING
+
 #ifdef MINI_OP
 #undef MINI_OP
 #endif
@@ -56,17 +58,27 @@ opnames[] = {
 
 #endif
 
+#endif /* DISABLE_LOGGING */
+
 #if defined(__i386__) || defined(__x86_64__)
 #define emit_debug_info  TRUE
 #else
 #define emit_debug_info  FALSE
 #endif
 
+/*This enables us to use the right tooling when building the cross compiler for iOS.*/
+#if defined (__APPLE__) && defined (TARGET_ARM) && (defined(__i386__) || defined(__x86_64__))
+
+#define ARCH_PREFIX "/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/"
+
+#endif
+
 #define ARCH_PREFIX ""
 //#define ARCH_PREFIX "powerpc64-linux-gnu-"
 
 const char*
 mono_inst_name (int op) {
+#ifndef DISABLE_LOGGING
        if (op >= OP_LOAD && op <= OP_LAST)
 #ifdef HAVE_ARRAY_ELEM_INIT
                return (const char*)&opstr + opidx [op - OP_LOAD];
@@ -77,6 +89,9 @@ mono_inst_name (int op) {
                return mono_opcode_name (op);
        g_error ("unknown opcode name for %d", op);
        return NULL;
+#else
+       g_assert_not_reached ();
+#endif
 }
 
 void
@@ -121,6 +136,7 @@ mono_disassemble_code (MonoCompile *cfg, guint8 *code, int size, char *id)
        char *as_file;
        char *o_file;
        char *cmd;
+       int unused;
 
 #ifdef HOST_WIN32
        as_file = g_strdup_printf ("%s/test.s", tmp);    
@@ -195,12 +211,24 @@ mono_disassemble_code (MonoCompile *cfg, guint8 *code, int size, char *id)
 
 #if defined(sparc)
 #define AS_CMD "as -xarch=v9"
-#elif defined(__i386__) || defined(__x86_64__)
+#elif defined (TARGET_X86)
 #  if defined(__APPLE__)
-#    define AS_CMD "as"
+#    define AS_CMD "as -arch i386"
 #  else
 #    define AS_CMD "as -gstabs"
-#endif
+#  endif
+#elif defined (TARGET_AMD64)
+#  if defined (__APPLE__)
+#    define AS_CMD "as -arch x86_64"
+#  else
+#    define AS_CMD "as -gstabs"
+#  endif
+#elif defined (TARGET_ARM)
+#  if defined (__APPLE__)
+#    define AS_CMD "as -arch arm"
+#  else
+#    define AS_CMD "as -gstabs"
+#  endif
 #elif defined(__mips__) && (_MIPS_SIM == _ABIO32)
 #define AS_CMD "as -mips32"
 #elif defined(__ppc64__)
@@ -219,23 +247,25 @@ mono_disassemble_code (MonoCompile *cfg, guint8 *code, int size, char *id)
 #endif
 
        cmd = g_strdup_printf (ARCH_PREFIX AS_CMD " %s -o %s", as_file, o_file);
-       system (cmd); 
+       unused = system (cmd); 
        g_free (cmd);
        if (!objdump_args)
                objdump_args = "";
 
+       fflush (stdout);
+
 #ifdef __arm__
        /* 
         * The arm assembler inserts ELF directives instructing objdump to display 
         * everything as data.
         */
        cmd = g_strdup_printf (ARCH_PREFIX "strip -x %s", o_file);
-       system (cmd);
+       unused = system (cmd);
        g_free (cmd);
 #endif
        
        cmd = g_strdup_printf (ARCH_PREFIX DIS_CMD " %s %s", objdump_args, o_file);
-       system (cmd);
+       unused = system (cmd);
        g_free (cmd);
        
 #ifndef HOST_WIN32