diff options
Diffstat (limited to 'src/libraries/System.Runtime.Loader/tests/ApplyUpdateUtil.cs')
-rw-r--r-- | src/libraries/System.Runtime.Loader/tests/ApplyUpdateUtil.cs | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/src/libraries/System.Runtime.Loader/tests/ApplyUpdateUtil.cs b/src/libraries/System.Runtime.Loader/tests/ApplyUpdateUtil.cs index 405afc9f50e..c7953ea59f1 100644 --- a/src/libraries/System.Runtime.Loader/tests/ApplyUpdateUtil.cs +++ b/src/libraries/System.Runtime.Loader/tests/ApplyUpdateUtil.cs @@ -66,7 +66,7 @@ namespace System.Reflection.Metadata private static System.Collections.Generic.Dictionary<Assembly, int> assembly_count = new(); - internal static void ApplyUpdate (System.Reflection.Assembly assm) + internal static void ApplyUpdate (System.Reflection.Assembly assm, bool usePDB = true) { int count; if (!assembly_count.TryGetValue(assm, out count)) @@ -83,9 +83,13 @@ namespace System.Reflection.Metadata string dmeta_name = $"{basename}.{count}.dmeta"; string dil_name = $"{basename}.{count}.dil"; + string dpdb_name = $"{basename}.{count}.dpdb"; byte[] dmeta_data = System.IO.File.ReadAllBytes(dmeta_name); byte[] dil_data = System.IO.File.ReadAllBytes(dil_name); - byte[] dpdb_data = null; // TODO also use the dpdb data + byte[] dpdb_data = null; + + if (usePDB) + dpdb_data = System.IO.File.ReadAllBytes(dpdb_name); MetadataUpdater.ApplyUpdate(assm, dmeta_data, dil_data, dpdb_data); } @@ -94,6 +98,20 @@ namespace System.Reflection.Metadata { options = options ?? new RemoteInvokeOptions(); options.StartInfo.EnvironmentVariables.Add(DotNetModifiableAssembliesSwitch, DotNetModifiableAssembliesValue); + /* Ask mono to use .dpdb data to generate sequence points even without a debugger attached */ + if (IsMonoRuntime) + AppendEnvironmentVariable(options.StartInfo.EnvironmentVariables, "MONO_DEBUG", "gen-seq-points"); + } + + private static void AppendEnvironmentVariable(System.Collections.Specialized.StringDictionary env, string key, string addedValue) + { + if (!env.ContainsKey(key)) + env.Add(key, addedValue); + else + { + string oldValue = env[key]; + env[key] = oldValue + "," + addedValue; + } } /// Run the given test case, which applies updates to the given assembly. |