Imported Upstream version 5.8.0.88

Former-commit-id: 4b7216ffda08448e562271ce733688e761120fc5
This commit is contained in:
Xamarin Public Jenkins (auto-signing)
2017-11-28 19:36:51 +00:00
parent 7d05485754
commit 6123a772ed
277 changed files with 4817 additions and 941 deletions

View File

@@ -137,9 +137,15 @@ namespace Mono.Cecil.Pdb {
}
}
if (function.iteratorScopes != null)
foreach (var iterator_scope in function.iteratorScopes)
symbol.CustomDebugInformations.Add (new StateMachineScopeDebugInformation ((int) iterator_scope.Offset, (int) (iterator_scope.Offset + iterator_scope.Length + 1)));
if (function.iteratorScopes != null) {
var state_machine = new StateMachineScopeDebugInformation ();
foreach (var iterator_scope in function.iteratorScopes) {
state_machine.Scopes.Add (new StateMachineScope ((int) iterator_scope.Offset, (int) (iterator_scope.Offset + iterator_scope.Length + 1)));
}
symbol.CustomDebugInformations.Add (state_machine);
}
if (function.synchronizationInformation != null) {
var async_debug_info = new AsyncMethodBodyDebugInformation ((int) function.synchronizationInformation.GeneratedCatchHandlerOffset);
@@ -147,11 +153,11 @@ namespace Mono.Cecil.Pdb {
foreach (var synchronization_point in function.synchronizationInformation.synchronizationPoints) {
async_debug_info.Yields.Add (new InstructionOffset ((int) synchronization_point.SynchronizeOffset));
async_debug_info.Resumes.Add (new InstructionOffset ((int) synchronization_point.ContinuationOffset));
async_debug_info.ResumeMethods.Add (method);
}
symbol.CustomDebugInformations.Add (async_debug_info);
async_debug_info.MoveNextMethod = method;
symbol.StateMachineKickOffMethod = (MethodDefinition) method.Module.LookupToken ((int) function.synchronizationInformation.kickoffMethodToken);
}
@@ -280,7 +286,11 @@ namespace Mono.Cecil.Pdb {
break;
}
case 'A':
var index = used_namespace.IndexOf(' ');
var index = used_namespace.IndexOf (' ');
if (index < 0) {
target = new ImportTarget (ImportTargetKind.ImportNamespace) { @namespace = used_namespace };
break;
}
var alias_value = used_namespace.Substring (1, index - 1);
var alias_target_value = used_namespace.Substring (index + 2);
switch (used_namespace [index + 1]) {
@@ -294,6 +304,15 @@ namespace Mono.Cecil.Pdb {
break;
}
break;
case '*':
target = new ImportTarget (ImportTargetKind.ImportNamespace) { @namespace = value };
break;
case '@':
if (!value.StartsWith ("P:"))
continue;
target = new ImportTarget (ImportTargetKind.ImportNamespace) { @namespace = value.Substring (2) };
break;
}
if (target != null)

View File

@@ -111,10 +111,10 @@ namespace Mono.Cecil.Pdb {
}
if (info.HasCustomDebugInformations) {
var scopes = info.CustomDebugInformations.OfType<StateMachineScopeDebugInformation> ().ToArray ();
var state_machine = info.CustomDebugInformations.FirstOrDefault (cdi => cdi.Kind == CustomDebugInformationKind.StateMachineScope) as StateMachineScopeDebugInformation;
if (scopes.Length > 0)
metadata.WriteIteratorScopes (scopes, info);
if (state_machine != null)
metadata.WriteIteratorScopes (state_machine, info);
}
metadata.WriteCustomMetadata ();
@@ -139,7 +139,7 @@ namespace Mono.Cecil.Pdb {
async_metadata.WriteUInt32 ((uint) async_debug_info.Resumes.Count);
for (int i = 0; i < async_debug_info.Resumes.Count; ++i) {
async_metadata.WriteUInt32 ((uint) async_debug_info.Yields [i].Offset);
async_metadata.WriteUInt32 (async_debug_info.MoveNextMethod != null ? async_debug_info.MoveNextMethod.MetadataToken.ToUInt32 () : 0);
async_metadata.WriteUInt32 (async_debug_info.resume_methods [i].MetadataToken.ToUInt32 ());
async_metadata.WriteUInt32 ((uint) async_debug_info.Resumes [i].Offset);
}
@@ -312,10 +312,11 @@ namespace Mono.Cecil.Pdb {
Write (CustomMetadataType.ForwardInfo, () => writer.WriteUInt32 (import_parent.ToUInt32 ()));
}
public void WriteIteratorScopes (StateMachineScopeDebugInformation [] scopes, MethodDebugInformation debug_info)
public void WriteIteratorScopes (StateMachineScopeDebugInformation state_machine, MethodDebugInformation debug_info)
{
Write (CustomMetadataType.IteratorScopes, () => {
writer.WriteInt32 (scopes.Length);
var scopes = state_machine.Scopes;
writer.WriteInt32 (scopes.Count);
foreach (var scope in scopes) {
var start = scope.Start.Offset;
var end = scope.End.IsEndOfMethod ? debug_info.code_size : scope.End.Offset;

View File

@@ -143,7 +143,7 @@ namespace Mono.Cecil.Tests {
Assert.AreEqual (DocumentHashAlgorithm.None, document.HashAlgorithm);
Assert.AreEqual (DocumentLanguage.FSharp, document.Language);
Assert.AreEqual (DocumentLanguageVendor.Microsoft, document.LanguageVendor);
}, readOnly: Platform.OnMono, symbolReaderProvider: typeof(PdbReaderProvider), symbolWriterProvider: typeof(PdbWriterProvider));
}, readOnly: Platform.OnMono, symbolReaderProvider: typeof (PdbReaderProvider), symbolWriterProvider: typeof (PdbWriterProvider));
}
[Test]
@@ -157,7 +157,15 @@ namespace Mono.Cecil.Tests {
public void EmptyRootNamespace ()
{
TestModule ("EmptyRootNamespace.dll", module => {
}, readOnly: Platform.OnMono, symbolReaderProvider: typeof(PdbReaderProvider), symbolWriterProvider: typeof(PdbWriterProvider));
}, readOnly: Platform.OnMono, symbolReaderProvider: typeof (PdbReaderProvider), symbolWriterProvider: typeof (PdbWriterProvider));
}
[Test]
public void VisualBasicNamespace ()
{
TestModule ("AVbTest.exe", module => {
}, readOnly: Platform.OnMono, symbolReaderProvider: typeof (PdbReaderProvider), symbolWriterProvider: typeof (PdbWriterProvider));
}
[Test]
@@ -346,8 +354,9 @@ namespace Mono.Cecil.Tests {
var state_machine_scope = move_next.DebugInformation.CustomDebugInformations [0] as StateMachineScopeDebugInformation;
Assert.IsNotNull (state_machine_scope);
Assert.AreEqual (142, state_machine_scope.Start.Offset);
Assert.AreEqual (319, state_machine_scope.End.Offset);
Assert.AreEqual (1, state_machine_scope.Scopes.Count);
Assert.AreEqual (142, state_machine_scope.Scopes [0].Start.Offset);
Assert.AreEqual (319, state_machine_scope.Scopes [0].End.Offset);
var async_body = move_next.DebugInformation.CustomDebugInformations [1] as AsyncMethodBodyDebugInformation;
Assert.IsNotNull (async_body);
@@ -361,7 +370,8 @@ namespace Mono.Cecil.Tests {
Assert.AreEqual (98, async_body.Resumes [0].Offset);
Assert.AreEqual (227, async_body.Resumes [1].Offset);
Assert.AreEqual (move_next, async_body.MoveNextMethod);
Assert.AreEqual (move_next, async_body.ResumeMethods [0]);
Assert.AreEqual (move_next, async_body.ResumeMethods [1]);
}, readOnly: Platform.OnMono, symbolReaderProvider: typeof (PdbReaderProvider), symbolWriterProvider: typeof (PdbWriterProvider));
}

Binary file not shown.