diff --git a/runtime/launcher.m b/runtime/launcher.m index e2d3229da274..d0f2a9cc4b07 100644 --- a/runtime/launcher.m +++ b/runtime/launcher.m @@ -368,6 +368,8 @@ // The launch code here is publicly documented in xamarin/launch.h // The numbers in the comments refer to numbers in xamarin/launch.h. + xamarin_is_extension = is_extension; + #ifndef SYSTEM_LAUNCHER if (xammac_setup ()) { data->exit_code = -1; diff --git a/runtime/monotouch-debug.m b/runtime/monotouch-debug.m index 16afb8ec09fc..77114a642a86 100644 --- a/runtime/monotouch-debug.m +++ b/runtime/monotouch-debug.m @@ -561,8 +561,11 @@ void monotouch_configure_debugging () #if MONOTOUCH && (defined(__i386__) || defined (__x86_64__)) // Try to read shared memory as well - key_t shmkey = ftok ("/Library/Frameworks/Xamarin.iOS.framework/Versions/Current/bin/mtouch", 0); - if (shmkey == -1) { + key_t shmkey; + if (!xamarin_is_extension) { + // Don't read shared memory in normal apps, because we're always able to pass + // the debug data (host/port) using either command-line arguments or environment variables + } else if ((shmkey = ftok ("/Library/Frameworks/Xamarin.iOS.framework/Versions/Current/bin/mtouch", 0)) == -1) { LOG (PRODUCT ": Could not create shared memory key: %s\n", strerror (errno)); } else { int shmsize = 1024; diff --git a/runtime/monotouch-main.m b/runtime/monotouch-main.m index ce486e410f12..81c679bba088 100644 --- a/runtime/monotouch-main.m +++ b/runtime/monotouch-main.m @@ -239,6 +239,8 @@ - (void) memoryWarning: (NSNotification *) sender patch_sigaction (); #endif + xamarin_is_extension = is_extension; + memset (managed_argv, 0, sizeof (char*) * (argc + 2)); managed_argv [0] = "monotouch"; diff --git a/runtime/runtime.m b/runtime/runtime.m index cf777cf19600..facae8b32e1e 100644 --- a/runtime/runtime.m +++ b/runtime/runtime.m @@ -76,6 +76,7 @@ #endif enum MarshalObjectiveCExceptionMode xamarin_marshal_objectivec_exception_mode = MarshalObjectiveCExceptionModeDefault; enum MarshalManagedExceptionMode xamarin_marshal_managed_exception_mode = MarshalManagedExceptionModeDefault; +bool xamarin_is_extension = false; /* Callbacks */ diff --git a/runtime/xamarin/main.h b/runtime/xamarin/main.h index 2ef4c7fa83bb..f61b7ab2458c 100644 --- a/runtime/xamarin/main.h +++ b/runtime/xamarin/main.h @@ -57,6 +57,7 @@ extern const char *xamarin_arch_name; extern bool xamarin_is_gc_coop; extern enum MarshalObjectiveCExceptionMode xamarin_marshal_objectivec_exception_mode; extern enum MarshalManagedExceptionMode xamarin_marshal_managed_exception_mode; +extern bool xamarin_is_extension; #ifdef MONOTOUCH extern NSString* xamarin_crashlytics_api_key;