X-Git-Url: http://wien.tomnetworks.com/gitweb/?a=blobdiff_plain;f=mcs%2Fmcs%2Fassembly.cs;h=6c99245480b93f6766af3adb8b86f5beddb78c0c;hb=96edd46e16619fe64e26ea017330c22bf893f0dd;hp=3a7cb71aaa8172736a13af9dd9ea5ad1e413bfec;hpb=cfbd05ca34178ccd56370a66a8888bd270a798a8;p=mono.git diff --git a/mcs/mcs/assembly.cs b/mcs/mcs/assembly.cs index 3a7cb71aaa8..6c99245480b 100644 --- a/mcs/mcs/assembly.cs +++ b/mcs/mcs/assembly.cs @@ -54,6 +54,7 @@ namespace Mono.CSharp bool is_cls_compliant; bool wrap_non_exception_throws; bool wrap_non_exception_throws_custom; + bool has_user_debuggable; protected ModuleContainer module; readonly string name; @@ -366,6 +367,8 @@ namespace Mono.CSharp vi_copyright = a.GetString (); } else if (a.Type == pa.AssemblyTrademark) { vi_trademark = a.GetString (); + } else if (a.Type == pa.Debuggable) { + has_user_debuggable = true; } SetCustomAttribute (ctor, cdata); @@ -473,6 +476,17 @@ namespace Mono.CSharp } if (!IsSatelliteAssembly) { + if (!has_user_debuggable && Compiler.Settings.GenerateDebugInfo) { + var pa = module.PredefinedAttributes.Debuggable; + if (pa.IsDefined) { + var modes = System.Diagnostics.DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints; + if (!Compiler.Settings.Optimize) + modes |= System.Diagnostics.DebuggableAttribute.DebuggingModes.DisableOptimizations; + + pa.EmitAttribute (Builder, modes); + } + } + if (!wrap_non_exception_throws_custom) { PredefinedAttribute pa = module.PredefinedAttributes.RuntimeCompatibility; if (pa.IsDefined && pa.ResolveBuilder ()) { @@ -919,7 +933,7 @@ namespace Mono.CSharp return; } - var mtype = texpr.Type.MemberDefinition as ClassOrStruct; + var mtype = texpr.MemberDefinition as ClassOrStruct; if (mtype == null) { Report.Error (1556, "`{0}' specified for Main method must be a valid class or struct", main_class); return; @@ -1110,13 +1124,13 @@ namespace Mono.CSharp } } - abstract class AssemblyReferencesLoader + abstract class AssemblyReferencesLoader where T : class { protected readonly CompilerContext compiler; protected readonly List paths; - public AssemblyReferencesLoader (CompilerContext compiler) + protected AssemblyReferencesLoader (CompilerContext compiler) { this.compiler = compiler; @@ -1179,15 +1193,27 @@ namespace Mono.CSharp if (loaded.Contains (key)) continue; - // A corlib assembly is the first assembly which contains System.Object - if (corlib_assembly == null && HasObjectType (a)) { - corlib_assembly = a; - continue; - } - loaded.Add (key); } + if (corlib_assembly == null) { + // + // Requires second pass because HasObjectType can trigger assembly load event + // + for (int i = 0; i < loaded.Count; ++i) { + var assembly = loaded [i]; + + // + // corlib assembly is the first referenced assembly which contains System.Object + // + if (HasObjectType (assembly.Item2)) { + corlib_assembly = assembly.Item2; + loaded.RemoveAt (i); + break; + } + } + } + foreach (var entry in module.Compiler.Settings.AssemblyReferencesAliases) { a = LoadAssemblyFile (entry.Item2, false); if (a == null)