Merge pull request #2521 from rolfbjarne/bug58778-d15-4

[d15-4][mtouch] Put 'mono_profiler_startup_log' in the symbol list. Fixes #58778. (#2501)
This commit is contained in:
Luis Aguilera 2017-08-23 11:29:52 -04:00 коммит произвёл GitHub
Родитель b1ff1c54e0 0cfd71744b
Коммит 43c281b483
5 изменённых файлов: 66 добавлений и 10 удалений

Просмотреть файл

@ -33,6 +33,59 @@ namespace Xamarin
[TestFixture]
public class MTouch
{
[Test]
//[TestCase (Profile.iOS)] // tested as part of the watchOS case below, since that builds both for iOS and watchOS.
[TestCase (Profile.tvOS)]
[TestCase (Profile.watchOS)]
public void Profiling (Profile profile)
{
using (var mtouch = new MTouchTool ()) {
var tmpdir = mtouch.CreateTemporaryDirectory ();
MTouchTool ext = null;
if (profile == Profile.watchOS) {
mtouch.Profile = Profile.iOS;
ext = new MTouchTool ();
ext.Profile = profile;
ext.Profiling = true;
ext.SymbolList = Path.Combine (tmpdir, "extsymbollist.txt");
ext.CreateTemporaryWatchKitExtension ();
ext.CreateTemporaryDirectory ();
mtouch.AppExtensions.Add (ext);
ext.AssertExecute (MTouchAction.BuildDev, "ext build");
} else {
mtouch.Profile = profile;
}
mtouch.CreateTemporaryApp ();
mtouch.CreateTemporaryCacheDirectory ();
mtouch.DSym = false; // faster test
mtouch.MSym = false; // faster test
mtouch.NoStrip = true; // faster test
mtouch.Profiling = true;
mtouch.SymbolList = Path.Combine (tmpdir, "symbollist.txt");
mtouch.AssertExecute (MTouchAction.BuildDev, "build");
var profiler_symbol = "_mono_profiler_startup_log";
var symbols = File.ReadAllLines (mtouch.SymbolList);
Assert.That (symbols, Contains.Item (profiler_symbol), profiler_symbol);
symbols = ExecutionHelper.Execute ("nm", StringUtils.Quote (mtouch.NativeExecutablePath), hide_output: true).Split ('\n');
Assert.That (symbols, Has.Some.EndsWith (" T " + profiler_symbol), $"{profiler_symbol} nm");
if (ext != null) {
symbols = File.ReadAllLines (ext.SymbolList);
Assert.That (symbols, Contains.Item (profiler_symbol), $"{profiler_symbol} - extension");
symbols = ExecutionHelper.Execute ("nm", StringUtils.Quote (ext.NativeExecutablePath), hide_output: true).Split ('\n');
Assert.That (symbols, Has.Some.EndsWith (" T " + profiler_symbol), $"{profiler_symbol} extension nm");
}
}
}
[Test]
public void ExceptionMarshaling ()
{

Просмотреть файл

@ -120,6 +120,8 @@ namespace Xamarin
public string AotOtherArguments;
public string [] LinkSkip;
public string [] XmlDefinitions;
public bool? Profiling;
public string SymbolList;
#pragma warning restore 649
@ -307,6 +309,12 @@ namespace Xamarin
}
}
if (Profiling.HasValue)
sb.Append (" --profiling:").Append (Profiling.Value ? "true" : "false");
if (!string.IsNullOrEmpty (SymbolList))
sb.Append (" --symbollist=").Append (StringUtils.Quote (SymbolList));
if (MSym.HasValue)
sb.Append (" --msym:").Append (MSym.Value ? "true" : "false");

Просмотреть файл

@ -45,14 +45,6 @@ namespace Xamarin.Utils
}
}
public void ReferenceSymbol (string symbol)
{
if (UnresolvedSymbols == null)
UnresolvedSymbols = new HashSet<string> ();
UnresolvedSymbols.Add (symbol);
}
public void ReferenceSymbols (IEnumerable<Symbol> symbols)
{
if (UnresolvedSymbols == null)

Просмотреть файл

@ -238,6 +238,11 @@ namespace Xamarin.Bundler {
dynamic_symbols.AddFunction ("xamarin_dyn_objc_msgSendSuper_stret");
}
#if MONOTOUCH
if (App.EnableProfiling && App.LibProfilerLinkMode == AssemblyBuildTarget.StaticObject)
dynamic_symbols.AddFunction ("mono_profiler_startup_log");
#endif
dynamic_symbols.Save (cache_location);
}

Просмотреть файл

@ -1396,8 +1396,6 @@ namespace Xamarin.Bundler
case AssemblyBuildTarget.StaticObject:
libprofiler = Path.Combine (libdir, "libmono-profiler-log.a");
linker_flags.AddLinkWith (libprofiler);
if (!App.EnableBitCode)
linker_flags.ReferenceSymbol ("mono_profiler_startup_log");
break;
case AssemblyBuildTarget.Framework: // We don't ship the profiler as a framework, so this should be impossible.
default: