diff options
Diffstat (limited to 'sdks')
-rw-r--r-- | sdks/ios/Makefile | 13 | ||||
-rw-r--r-- | sdks/ios/app/runtime.m | 12 | ||||
-rw-r--r-- | sdks/ios/appbuilder/appbuilder.cs | 19 | ||||
-rw-r--r-- | sdks/ios/harness/harness.cs | 2 |
4 files changed, 36 insertions, 10 deletions
diff --git a/sdks/ios/Makefile b/sdks/ios/Makefile index bd9ffe170fc..5386edbb656 100644 --- a/sdks/ios/Makefile +++ b/sdks/ios/Makefile @@ -140,14 +140,19 @@ clean-ios-sim-%: clean-ios-dev-%: $(RM) -rf obj/ios-dev/test-$*.app bin/ios-dev/test-$*.app -# Install and run % on the simulator with args $(ARGS) %_ARGS +ifdef DEBUG +APP_ARGS += --wait-for-debugger +APPBUILDER_ARGS += --debug +endif + +# Install and run % on the simulator with args $(APP_ARGS) %_ARGS run-ios-sim-%: harness.exe mono harness.exe --start-sim xcrun simctl install $(SIM_NAME) bin/ios-sim/test-$*.app - mono harness.exe --run-sim --logfile ios-sim-$*.log --bundle-id com.xamarin.mono.ios.test-$* --bundle-dir bin/ios-sim/test-$*.app $(ARGS) $($*_ARGS) + mono harness.exe --run-sim --logfile ios-sim-$*.log --bundle-id com.xamarin.mono.ios.test-$* --bundle-dir bin/ios-sim/test-$*.app $(APP_ARGS) $($*_ARGS) run-ios-dev-%: harness.exe - mono harness.exe --run-dev --logfile ios-dev-$*.log --bundle-id com.xamarin.mono.ios.test-$* --bundle-dir bin/ios-dev/test-$*.app $(ARGS) $($*_ARGS) + mono harness.exe --run-dev --logfile ios-dev-$*.log --bundle-id com.xamarin.mono.ios.test-$* --bundle-dir bin/ios-dev/test-$*.app $(APP_ARGS) $($*_ARGS) clean: $(MAKE) -C app clean @@ -187,7 +192,7 @@ install-ios-sim-%: run-ios-sim-direct-%: xcrun simctl terminate $(SIM_NAME) com.xamarin.mono.ios.test-$* - xcrun simctl launch $(SIM_NAME) com.xamarin.mono.ios.test-$* $(ARGS) $($*_ARGS) + xcrun simctl launch $(SIM_NAME) com.xamarin.mono.ios.test-$* $(APP_ARGS) $($*_ARGS) log stream --level debug --predicate 'senderImagePath contains "$*"' --style compact create-sim: diff --git a/sdks/ios/app/runtime.m b/sdks/ios/app/runtime.m index 05165e7858a..472ccf96209 100644 --- a/sdks/ios/app/runtime.m +++ b/sdks/ios/app/runtime.m @@ -283,6 +283,7 @@ mono_ios_runtime_init (void) } int aindex = 1; + bool wait_for_debugger = FALSE; while (aindex < nargs) { char *arg = args [aindex]; if (!(arg [0] == '-' && arg [1] == '-')) @@ -297,6 +298,9 @@ mono_ios_runtime_init (void) os_log_info (OS_LOG_DEFAULT, "%s=%s.", name, val); setenv (name, val, TRUE); } + else if (strstr (arg, "--wait-for-debugger") == arg) { + wait_for_debugger = TRUE; + } aindex ++; } if (aindex == nargs) { @@ -325,6 +329,14 @@ mono_ios_runtime_init (void) mono_set_signal_chaining (TRUE); mono_set_crash_chaining (TRUE); + if (wait_for_debugger) { + char* options[] = { "--debugger-agent=transport=dt_socket,server=y,address=0.0.0.0:55555" }; + mono_jit_parse_options (1, options); + } else { + //char* options[] = { "--trace=N:nothing" }; + //mono_jit_parse_options (1, options); + } + mono_jit_init_version ("Mono.ios", "mobile"); MonoAssembly *assembly = load_assembly (executable, NULL); diff --git a/sdks/ios/appbuilder/appbuilder.cs b/sdks/ios/appbuilder/appbuilder.cs index 0df8c031903..92020047291 100644 --- a/sdks/ios/appbuilder/appbuilder.cs +++ b/sdks/ios/appbuilder/appbuilder.cs @@ -98,7 +98,7 @@ public class AppBuilder string team_identifier = null; bool isnetcore = false; bool isdev = false; - bool isrelease = false; + bool isdebug = false; bool isllvm = false; bool isinterponly = false; bool isinterpmixed = false; @@ -119,6 +119,7 @@ public class AppBuilder { "team-identifier=", s => team_identifier = s }, { "llvm", s => isllvm = true }, { "netcore", s => isnetcore = true }, + { "debug", s => isdebug = true }, { "interp-only", s => isinterponly = true }, { "interp-mixed", s => isinterpmixed = true }, { "exe=", s => exe = s }, @@ -148,9 +149,6 @@ public class AppBuilder break; } - if (isllvm) - isrelease = true; - string runtime = isnetcore ? "ios-netcore_target64-release" : "ios-target64-release"; string cross_runtime = isnetcore ? "ios-netcore_cross64-release" : "ios-cross64-release"; @@ -167,11 +165,16 @@ public class AppBuilder aot_args = "full"; } - if (!isrelease) + if (isdebug) aot_args += ",soft-debug"; if (isllvm) { cross_runtime_args = "--llvm"; aot_args += ",llvm-path=$mono_sdkdir/llvm-llvm64/bin,llvm-outfile=$llvm_outfile"; + + if (isdebug) { + Console.WriteLine ("--debug can't be used together with --llvm"); + Environment.Exit (1); + } } Directory.CreateDirectory (builddir); @@ -264,6 +267,12 @@ public class AppBuilder ninja.WriteLine ($"build $appdir/{filename}: cpifdiff $builddir/{filename}"); + string pdb = Path.ChangeExtension (assembly, ".pdb"); + if (isdebug && File.Exists (pdb)) { + File.Copy (pdb, Path.Combine (builddir, filename_noext + ".pdb"), true); + ninja.WriteLine ($"build $appdir/{filename_noext}.pdb: cpifdiff $builddir/{filename_noext}.pdb"); + } + var assembly_dir = Path.GetDirectoryName (assembly); var resource_filename = filename.Replace (".dll", ".resources.dll"); foreach (var culture in cultures) { diff --git a/sdks/ios/harness/harness.cs b/sdks/ios/harness/harness.cs index 741b2959b2f..f46fafd6d51 100644 --- a/sdks/ios/harness/harness.cs +++ b/sdks/ios/harness/harness.cs @@ -274,7 +274,7 @@ public class Harness int wait_time = 0; while (!server.Pending ()) { wait_time += 100; - if (wait_time == 10 * 1000) { + if (wait_time == 30 * 1000) { Console.Error.WriteLine ("Timed out waiting for test runner to connect."); Environment.Exit (1); } |