From 52f2f55184d58452db262894eb14bfe1f57f2163 Mon Sep 17 00:00:00 2001 From: Rolf Bjarne Kvinge Date: Wed, 8 Mar 2017 15:07:18 +0100 Subject: [PATCH 1/2] Bump maccore to get fix for launching the simulator for app extensions. --- mk/xamarin.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mk/xamarin.mk b/mk/xamarin.mk index 6109da682bdc..2afb51ab039d 100644 --- a/mk/xamarin.mk +++ b/mk/xamarin.mk @@ -1,5 +1,5 @@ ifdef ENABLE_XAMARIN -NEEDED_MACCORE_VERSION := 494c6288cdf7756dcc794755c29ffad98f61b193 +NEEDED_MACCORE_VERSION := d576fd8274e3fea113171bf7586175735b6dd42c NEEDED_MACCORE_BRANCH := master MACCORE_DIRECTORY := maccore From 28b196be77d3fe4d8fa629736d381528f3ac45ac Mon Sep 17 00:00:00 2001 From: Rolf Bjarne Kvinge Date: Wed, 8 Mar 2017 15:08:36 +0100 Subject: [PATCH 2/2] [runtime] Don't look in shared memory for debug data in normal apps. Don't look in shared memory for debug data in normal apps, because it interferes when debugging extensions from the same solution as a container app: Example, for a keyboard extension: 1. Run extension in XS. 2. Manually launch the extension's container app (which contains a textbox that can be used to launch the keyboard). 3. The container app reads the debug data in shared memory which was intented for the extension, and takes over the debugger. 4. Launch keyboard, which will not be able to connect to the IDE because the container app already connected to the IDE. --- runtime/launcher.m | 2 ++ runtime/monotouch-debug.m | 7 +++++-- runtime/monotouch-main.m | 2 ++ runtime/runtime.m | 1 + runtime/xamarin/main.h | 1 + 5 files changed, 11 insertions(+), 2 deletions(-) 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;