Imported Upstream version 5.4.0.199

Former-commit-id: f4d318e4b2f128fa9f4d31b37bb3839a3fc0dfb2
This commit is contained in:
Xamarin Public Jenkins (auto-signing)
2017-09-25 16:57:44 +00:00
parent 536cd135cc
commit 5924117973
223 changed files with 3826 additions and 487 deletions

View File

@@ -11,6 +11,7 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.IO.Compression;
using System.Text;
using Mono.Collections.Generic;
@@ -2856,12 +2857,22 @@ namespace Mono.Cecil {
if (signature == 0)
return new Collection<SequencePoint> (0);
var document = metadata.GetDocument (document_index);
var document = GetDocument (document_index);
var reader = ReadSignature (signature);
return reader.ReadSequencePoints (document);
}
public Document GetDocument (uint rid)
{
var document = metadata.GetDocument (rid);
if (document == null)
return null;
document.custom_infos = GetCustomDebugInformation (document);
return document;
}
void InitializeLocalScopes ()
{
if (metadata.LocalScopes != null)
@@ -2943,14 +2954,20 @@ namespace Mono.Cecil {
if (record.Col2.Length > 0) {
scope.variables = new Collection<VariableDebugInformation> ((int) record.Col2.Length);
for (uint i = 0; i < record.Col2.Length; i++)
scope.variables.Add (ReadLocalVariable (record.Col2.Start + i));
for (uint i = 0; i < record.Col2.Length; i++) {
var variable = ReadLocalVariable (record.Col2.Start + i);
if (variable != null)
scope.variables.Add (variable);
}
}
if (record.Col3.Length > 0) {
scope.constants = new Collection<ConstantDebugInformation> ((int) record.Col3.Length);
for (uint i = 0; i < record.Col3.Length; i++)
scope.constants.Add (ReadLocalConstant (record.Col3.Start + i));
for (uint i = 0; i < record.Col3.Length; i++) {
var constant = ReadLocalConstant (record.Col3.Start + i);
if (constant != null)
scope.constants.Add (constant);
}
}
return scope;
@@ -3187,6 +3204,31 @@ namespace Mono.Cecil {
async_body.move_next = GetMethodDefinition (move_next_rid);
infos.Add (async_body);
} else if (rows [i].Col1 == EmbeddedSourceDebugInformation.KindIdentifier) {
var signature = ReadSignature (rows [i].Col2);
var format = signature.ReadInt32 ();
var length = signature.sig_length - 4;
var info = null as CustomDebugInformation;
if (format == 0) {
info = new EmbeddedSourceDebugInformation (signature.ReadBytes ((int) length), compress: false);
} else if (format > 0) {
var compressed_stream = new MemoryStream (signature.ReadBytes ((int) length));
var decompressed_document = new byte [format]; // if positive, format is the decompressed length of the document
var decompressed_stream = new MemoryStream (decompressed_document);
using (var deflate_stream = new DeflateStream (compressed_stream, CompressionMode.Decompress, leaveOpen: true))
deflate_stream.CopyTo (decompressed_stream);
info = new EmbeddedSourceDebugInformation (decompressed_document, compress: true);
} else if (format < 0) {
info = new BinaryCustomDebugInformation (rows [i].Col1, ReadBlob (rows [i].Col2));
}
infos.Add (info);
} else if (rows [i].Col1 == SourceLinkDebugInformation.KindIdentifier) {
infos.Add (new SourceLinkDebugInformation (Encoding.UTF8.GetString (ReadBlob (rows [i].Col2))));
} else {
infos.Add (new BinaryCustomDebugInformation (rows [i].Col1, ReadBlob (rows [i].Col2)));
}
@@ -3759,7 +3801,7 @@ namespace Mono.Cecil {
ReadCompressedUInt32 (); // local_sig_token
if (document == null)
document = reader.metadata.GetDocument (ReadCompressedUInt32 ());
document = reader.GetDocument (ReadCompressedUInt32 ());
var offset = 0;
var start_line = 0;
@@ -3769,7 +3811,7 @@ namespace Mono.Cecil {
for (var i = 0; CanReadMore (); i++) {
var delta_il = (int) ReadCompressedUInt32 ();
if (i > 0 && delta_il == 0) {
document = reader.metadata.GetDocument (ReadCompressedUInt32 ());
document = reader.GetDocument (ReadCompressedUInt32 ());
continue;
}