You've already forked linux-packaging-mono
Imported Upstream version 5.2.0.175
Former-commit-id: bb0468d0f257ff100aa895eb5fe583fb5dfbf900
This commit is contained in:
parent
4bdbaf4a88
commit
966bba02bb
3
external/linker/cecil/symbols/pdb/Microsoft.Cci.Pdb/.editorconfig
vendored
Normal file
3
external/linker/cecil/symbols/pdb/Microsoft.Cci.Pdb/.editorconfig
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
[*.cs]
|
||||
indent_style = space
|
||||
indent_size = 2
|
||||
@@ -9,10 +9,10 @@
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
using System;
|
||||
using System.Collections;
|
||||
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Diagnostics.SymbolStore;
|
||||
using Mono.Cecil.Cil;
|
||||
|
||||
namespace Microsoft.Cci.Pdb {
|
||||
internal class PdbFile {
|
||||
@@ -254,7 +254,7 @@ namespace Microsoft.Cci.Pdb {
|
||||
static void LoadFuncsFromDbiModule(BitAccess bits,
|
||||
DbiModuleInfo info,
|
||||
IntHashTable names,
|
||||
ArrayList funcList,
|
||||
List<PdbFunction> funcList,
|
||||
bool readStrings,
|
||||
MsfDirectory dir,
|
||||
Dictionary<string, int> nameIndex,
|
||||
@@ -297,7 +297,7 @@ namespace Microsoft.Cci.Pdb {
|
||||
//}
|
||||
|
||||
// Read gpmod section.
|
||||
ArrayList modList = new ArrayList();
|
||||
List<DbiModuleInfo> modList = new List<DbiModuleInfo>();
|
||||
int end = bits.Position + dh.gpmodiSize;
|
||||
while (bits.Position < end) {
|
||||
DbiModuleInfo mod = new DbiModuleInfo(bits, readStrings);
|
||||
@@ -309,7 +309,7 @@ namespace Microsoft.Cci.Pdb {
|
||||
}
|
||||
|
||||
if (modList.Count > 0) {
|
||||
modules = (DbiModuleInfo[])modList.ToArray(typeof(DbiModuleInfo));
|
||||
modules = modList.ToArray();
|
||||
} else {
|
||||
modules = null;
|
||||
}
|
||||
@@ -368,7 +368,7 @@ namespace Microsoft.Cci.Pdb {
|
||||
dir.streams[3].Read(reader, bits);
|
||||
LoadDbiStream(bits, out modules, out header, true);
|
||||
|
||||
ArrayList funcList = new ArrayList();
|
||||
List<PdbFunction> funcList = new List<PdbFunction>();
|
||||
|
||||
if (modules != null) {
|
||||
for (int m = 0; m < modules.Length; m++) {
|
||||
@@ -384,7 +384,7 @@ namespace Microsoft.Cci.Pdb {
|
||||
}
|
||||
}
|
||||
|
||||
PdbFunction[] funcs = (PdbFunction[])funcList.ToArray(typeof(PdbFunction));
|
||||
PdbFunction[] funcs = funcList.ToArray();
|
||||
|
||||
// After reading the functions, apply the token remapping table if it exists.
|
||||
if (header.snTokenRidMap != 0 && header.snTokenRidMap != 0xffff) {
|
||||
@@ -509,7 +509,7 @@ namespace Microsoft.Cci.Pdb {
|
||||
|
||||
string name = (string)names[(int)chk.name];
|
||||
int guidStream;
|
||||
Guid doctypeGuid = SymDocumentType.Text;
|
||||
Guid doctypeGuid = DocumentType.Text.ToGuid();
|
||||
Guid languageGuid = Guid.Empty;
|
||||
Guid vendorGuid = Guid.Empty;
|
||||
if (nameIndex.TryGetValue("/SRC/FILES/"+name.ToUpperInvariant(), out guidStream)) {
|
||||
|
||||
@@ -29,7 +29,7 @@ namespace Microsoft.Cci.Pdb {
|
||||
|
||||
internal uint segment;
|
||||
internal uint address;
|
||||
//internal uint length;
|
||||
internal uint length;
|
||||
|
||||
//internal byte[] metadata;
|
||||
internal PdbScope[] scopes;
|
||||
@@ -208,7 +208,7 @@ namespace Microsoft.Cci.Pdb {
|
||||
//this.flags = proc.flags;
|
||||
this.segment = proc.seg;
|
||||
this.address = proc.off;
|
||||
//this.length = proc.len;
|
||||
this.length = proc.len;
|
||||
|
||||
if (proc.seg != 1) {
|
||||
throw new PdbDebugException("Segment is {0}, not 1.", proc.seg);
|
||||
|
||||
@@ -9,7 +9,6 @@ using System.IO;
|
||||
using Microsoft.Cci;
|
||||
using Microsoft.Cci.Pdb;
|
||||
using System.Text;
|
||||
using System.Diagnostics.SymbolStore;
|
||||
|
||||
namespace Microsoft.Cci {
|
||||
|
||||
|
||||
@@ -18,5 +18,5 @@
|
||||
<Compile Include="Mono.Cecil.Pdb\*.cs" />
|
||||
</ItemGroup>
|
||||
<Import Project="..\..\Mono.Cecil.props" />
|
||||
<Import Project="$(MSBuildCSharpTargets)" />
|
||||
</Project>
|
||||
<Import Project="$(MSBuildCSharpTargets)" Condition=" ! $(NetStandard) " />
|
||||
</Project>
|
||||
|
||||
@@ -8,7 +8,6 @@
|
||||
//
|
||||
|
||||
using System;
|
||||
using System.Diagnostics.SymbolStore;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Runtime.InteropServices.ComTypes;
|
||||
|
||||
@@ -29,8 +28,8 @@ namespace Mono.Cecil.Pdb {
|
||||
[In] ref Guid languageVendor,
|
||||
[In] ref Guid documentType,
|
||||
[Out, MarshalAs (UnmanagedType.Interface)] out ISymUnmanagedDocumentWriter pRetVal);
|
||||
void SetUserEntryPoint ([In] SymbolToken method);
|
||||
void OpenMethod ([In] SymbolToken method);
|
||||
void SetUserEntryPoint ([In] int methodToken);
|
||||
void OpenMethod ([In] int methodToken);
|
||||
void CloseMethod ();
|
||||
void OpenScope ([In] int startOffset, [Out] out int pRetVal);
|
||||
void CloseScope ([In] int endOffset);
|
||||
@@ -40,7 +39,7 @@ namespace Mono.Cecil.Pdb {
|
||||
void DefineField_Placeholder ();
|
||||
void DefineGlobalVariable_Placeholder ();
|
||||
void Close ();
|
||||
void SetSymAttribute_Placeholder ();
|
||||
void SetSymAttribute (uint parent, string name, uint data, IntPtr signature);
|
||||
void OpenNamespace ([In, MarshalAs (UnmanagedType.LPWStr)] string name);
|
||||
void CloseNamespace ();
|
||||
void UsingNamespace ([In, MarshalAs (UnmanagedType.LPWStr)] string fullName);
|
||||
@@ -71,13 +70,20 @@ namespace Mono.Cecil.Pdb {
|
||||
void DefineLocalVariable2 (
|
||||
[In, MarshalAs (UnmanagedType.LPWStr)] string name,
|
||||
[In] int attributes,
|
||||
[In] SymbolToken sigToken,
|
||||
[In] int sigToken,
|
||||
[In] int addrKind,
|
||||
[In] int addr1,
|
||||
[In] int addr2,
|
||||
[In] int addr3,
|
||||
[In] int startOffset,
|
||||
[In] int endOffset);
|
||||
|
||||
void DefineGlobalVariable2_Placeholder ();
|
||||
|
||||
void DefineConstant2 (
|
||||
[In, MarshalAs (UnmanagedType.LPWStr)] string name,
|
||||
[In, MarshalAs (UnmanagedType.Struct)] object variant,
|
||||
[In] int sigToken);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
352
external/linker/cecil/symbols/pdb/Mono.Cecil.Pdb/NativePdbReader.cs
vendored
Normal file
352
external/linker/cecil/symbols/pdb/Mono.Cecil.Pdb/NativePdbReader.cs
vendored
Normal file
@@ -0,0 +1,352 @@
|
||||
//
|
||||
// Author:
|
||||
// Jb Evain (jbevain@gmail.com)
|
||||
//
|
||||
// Copyright (c) 2008 - 2015 Jb Evain
|
||||
// Copyright (c) 2008 - 2011 Novell, Inc.
|
||||
//
|
||||
// Licensed under the MIT/X11 license.
|
||||
//
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
|
||||
using Mono.Collections.Generic;
|
||||
|
||||
using Microsoft.Cci.Pdb;
|
||||
|
||||
using Mono.Cecil.Cil;
|
||||
|
||||
namespace Mono.Cecil.Pdb {
|
||||
|
||||
public class NativePdbReader : ISymbolReader {
|
||||
|
||||
int age;
|
||||
Guid guid;
|
||||
|
||||
readonly Disposable<Stream> pdb_file;
|
||||
readonly Dictionary<string, Document> documents = new Dictionary<string, Document> ();
|
||||
readonly Dictionary<uint, PdbFunction> functions = new Dictionary<uint, PdbFunction> ();
|
||||
readonly Dictionary<PdbScope, ImportDebugInformation> imports = new Dictionary<PdbScope, ImportDebugInformation> ();
|
||||
|
||||
internal NativePdbReader (Disposable<Stream> file)
|
||||
{
|
||||
this.pdb_file = file;
|
||||
}
|
||||
|
||||
public ISymbolWriterProvider GetWriterProvider ()
|
||||
{
|
||||
return new NativePdbWriterProvider ();
|
||||
}
|
||||
|
||||
/*
|
||||
uint Magic = 0x53445352;
|
||||
Guid Signature;
|
||||
uint Age;
|
||||
string FileName;
|
||||
*/
|
||||
|
||||
public bool ProcessDebugHeader (ImageDebugHeader header)
|
||||
{
|
||||
if (!header.HasEntries)
|
||||
return false;
|
||||
|
||||
var entry = header.GetCodeViewEntry ();
|
||||
if (entry == null)
|
||||
return false;
|
||||
|
||||
var directory = entry.Directory;
|
||||
|
||||
if (directory.Type != ImageDebugType.CodeView)
|
||||
return false;
|
||||
if (directory.MajorVersion != 0 || directory.MinorVersion != 0)
|
||||
return false;
|
||||
|
||||
var data = entry.Data;
|
||||
|
||||
if (data.Length < 24)
|
||||
return false;
|
||||
|
||||
var magic = ReadInt32 (data, 0);
|
||||
if (magic != 0x53445352)
|
||||
return false;
|
||||
|
||||
var guid_bytes = new byte [16];
|
||||
Buffer.BlockCopy (data, 4, guid_bytes, 0, 16);
|
||||
|
||||
this.guid = new Guid (guid_bytes);
|
||||
this.age = ReadInt32 (data, 20);
|
||||
|
||||
return PopulateFunctions ();
|
||||
}
|
||||
|
||||
static int ReadInt32 (byte [] bytes, int start)
|
||||
{
|
||||
return (bytes [start]
|
||||
| (bytes [start + 1] << 8)
|
||||
| (bytes [start + 2] << 16)
|
||||
| (bytes [start + 3] << 24));
|
||||
}
|
||||
|
||||
bool PopulateFunctions ()
|
||||
{
|
||||
using (pdb_file) {
|
||||
Dictionary<uint, PdbTokenLine> tokenToSourceMapping;
|
||||
string sourceServerData;
|
||||
int age;
|
||||
Guid guid;
|
||||
|
||||
var funcs = PdbFile.LoadFunctions (pdb_file.value, out tokenToSourceMapping, out sourceServerData, out age, out guid);
|
||||
|
||||
if (this.guid != guid)
|
||||
return false;
|
||||
|
||||
foreach (PdbFunction function in funcs)
|
||||
functions.Add (function.token, function);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public MethodDebugInformation Read (MethodDefinition method)
|
||||
{
|
||||
var method_token = method.MetadataToken;
|
||||
|
||||
PdbFunction function;
|
||||
if (!functions.TryGetValue (method_token.ToUInt32 (), out function))
|
||||
return null;
|
||||
|
||||
var symbol = new MethodDebugInformation (method);
|
||||
|
||||
ReadSequencePoints (function, symbol);
|
||||
|
||||
symbol.scope = !function.scopes.IsNullOrEmpty ()
|
||||
? ReadScopeAndLocals (function.scopes [0], symbol)
|
||||
: new ScopeDebugInformation { Start = new InstructionOffset (0), End = new InstructionOffset ((int) function.length) };
|
||||
|
||||
if (function.tokenOfMethodWhoseUsingInfoAppliesToThisMethod != method.MetadataToken.ToUInt32 () && function.tokenOfMethodWhoseUsingInfoAppliesToThisMethod != 0)
|
||||
symbol.scope.import = GetImport (function.tokenOfMethodWhoseUsingInfoAppliesToThisMethod, method.Module);
|
||||
|
||||
if (function.scopes.Length > 1) {
|
||||
for (int i = 1; i < function.scopes.Length; i++) {
|
||||
var s = ReadScopeAndLocals (function.scopes [i], symbol);
|
||||
if (!AddScope (symbol.scope.Scopes, s))
|
||||
symbol.scope.Scopes.Add (s);
|
||||
}
|
||||
}
|
||||
|
||||
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.synchronizationInformation != null) {
|
||||
var async_debug_info = new AsyncMethodBodyDebugInformation ((int) function.synchronizationInformation.GeneratedCatchHandlerOffset);
|
||||
|
||||
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));
|
||||
}
|
||||
|
||||
symbol.CustomDebugInformations.Add (async_debug_info);
|
||||
|
||||
async_debug_info.MoveNextMethod = method;
|
||||
symbol.StateMachineKickOffMethod = (MethodDefinition) method.Module.LookupToken ((int) function.synchronizationInformation.kickoffMethodToken);
|
||||
}
|
||||
|
||||
return symbol;
|
||||
}
|
||||
|
||||
Collection<ScopeDebugInformation> ReadScopeAndLocals (PdbScope [] scopes, MethodDebugInformation info)
|
||||
{
|
||||
var symbols = new Collection<ScopeDebugInformation> (scopes.Length);
|
||||
|
||||
foreach (PdbScope scope in scopes)
|
||||
if (scope != null)
|
||||
symbols.Add (ReadScopeAndLocals (scope, info));
|
||||
|
||||
return symbols;
|
||||
}
|
||||
|
||||
ScopeDebugInformation ReadScopeAndLocals (PdbScope scope, MethodDebugInformation info)
|
||||
{
|
||||
var parent = new ScopeDebugInformation ();
|
||||
parent.Start = new InstructionOffset ((int) scope.offset);
|
||||
parent.End = new InstructionOffset ((int) (scope.offset + scope.length));
|
||||
|
||||
if (!scope.slots.IsNullOrEmpty ()) {
|
||||
parent.variables = new Collection<VariableDebugInformation> (scope.slots.Length);
|
||||
|
||||
foreach (PdbSlot slot in scope.slots) {
|
||||
if (slot.flags == 1) // parameter names
|
||||
continue;
|
||||
|
||||
var index = (int) slot.slot;
|
||||
var variable = new VariableDebugInformation (index, slot.name);
|
||||
if (slot.flags == 4)
|
||||
variable.IsDebuggerHidden = true;
|
||||
parent.variables.Add (variable);
|
||||
}
|
||||
}
|
||||
|
||||
if (!scope.constants.IsNullOrEmpty ()) {
|
||||
parent.constants = new Collection<ConstantDebugInformation> (scope.constants.Length);
|
||||
|
||||
foreach (var constant in scope.constants) {
|
||||
var type = info.Method.Module.Read (constant, (c, r) => r.ReadConstantSignature (new MetadataToken (c.token)));
|
||||
var value = constant.value;
|
||||
|
||||
// Object "null" is encoded as integer
|
||||
if (type != null && !type.IsValueType && value is int && (int) value == 0)
|
||||
value = null;
|
||||
|
||||
parent.constants.Add (new ConstantDebugInformation (constant.name, type, value));
|
||||
}
|
||||
}
|
||||
|
||||
if (!scope.usedNamespaces.IsNullOrEmpty ()) {
|
||||
ImportDebugInformation import;
|
||||
if (imports.TryGetValue (scope, out import)) {
|
||||
parent.import = import;
|
||||
} else {
|
||||
import = GetImport (scope, info.Method.Module);
|
||||
imports.Add (scope, import);
|
||||
}
|
||||
}
|
||||
|
||||
parent.scopes = ReadScopeAndLocals (scope.scopes, info);
|
||||
|
||||
return parent;
|
||||
}
|
||||
|
||||
static bool AddScope (Collection<ScopeDebugInformation> scopes, ScopeDebugInformation scope)
|
||||
{
|
||||
foreach (var sub_scope in scopes) {
|
||||
if (sub_scope.HasScopes && AddScope (sub_scope.Scopes, scope))
|
||||
return true;
|
||||
|
||||
if (scope.Start.Offset >= sub_scope.Start.Offset && scope.End.Offset <= sub_scope.End.Offset) {
|
||||
sub_scope.Scopes.Add (scope);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
ImportDebugInformation GetImport (uint token, ModuleDefinition module)
|
||||
{
|
||||
PdbFunction function;
|
||||
if (!functions.TryGetValue (token, out function))
|
||||
return null;
|
||||
|
||||
if (function.scopes.Length != 1)
|
||||
return null;
|
||||
|
||||
var scope = function.scopes [0];
|
||||
|
||||
ImportDebugInformation import;
|
||||
if (imports.TryGetValue (scope, out import))
|
||||
return import;
|
||||
|
||||
import = GetImport (scope, module);
|
||||
imports.Add (scope, import);
|
||||
return import;
|
||||
}
|
||||
|
||||
static ImportDebugInformation GetImport (PdbScope scope, ModuleDefinition module)
|
||||
{
|
||||
if (scope.usedNamespaces.IsNullOrEmpty ())
|
||||
return null;
|
||||
|
||||
var import = new ImportDebugInformation ();
|
||||
|
||||
foreach (var used_namespace in scope.usedNamespaces) {
|
||||
ImportTarget target = null;
|
||||
var value = used_namespace.Substring (1);
|
||||
switch (used_namespace [0]) {
|
||||
case 'U':
|
||||
target = new ImportTarget (ImportTargetKind.ImportNamespace) { @namespace = value };
|
||||
break;
|
||||
case 'T': {
|
||||
var type = module.GetType (value, runtimeName: true);
|
||||
if (type != null)
|
||||
target = new ImportTarget (ImportTargetKind.ImportType) { type = type };
|
||||
break;
|
||||
}
|
||||
case 'A':
|
||||
var index = used_namespace.IndexOf(' ');
|
||||
var alias_value = used_namespace.Substring (1, index - 1);
|
||||
var alias_target_value = used_namespace.Substring (index + 2);
|
||||
switch (used_namespace [index + 1]) {
|
||||
case 'U':
|
||||
target = new ImportTarget (ImportTargetKind.DefineNamespaceAlias) { alias = alias_value, @namespace = alias_target_value };
|
||||
break;
|
||||
case 'T':
|
||||
var type = module.GetType (alias_target_value, runtimeName: true);
|
||||
if (type != null)
|
||||
target = new ImportTarget (ImportTargetKind.DefineTypeAlias) { alias = alias_value, type = type };
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
if (target != null)
|
||||
import.Targets.Add (target);
|
||||
}
|
||||
|
||||
return import;
|
||||
}
|
||||
|
||||
void ReadSequencePoints (PdbFunction function, MethodDebugInformation info)
|
||||
{
|
||||
if (function.lines == null)
|
||||
return;
|
||||
|
||||
info.sequence_points = new Collection<SequencePoint> ();
|
||||
|
||||
foreach (PdbLines lines in function.lines)
|
||||
ReadLines (lines, info);
|
||||
}
|
||||
|
||||
void ReadLines (PdbLines lines, MethodDebugInformation info)
|
||||
{
|
||||
var document = GetDocument (lines.file);
|
||||
|
||||
foreach (var line in lines.lines)
|
||||
ReadLine (line, document, info);
|
||||
}
|
||||
|
||||
static void ReadLine (PdbLine line, Document document, MethodDebugInformation info)
|
||||
{
|
||||
var sequence_point = new SequencePoint ((int) line.offset, document);
|
||||
sequence_point.StartLine = (int) line.lineBegin;
|
||||
sequence_point.StartColumn = (int) line.colBegin;
|
||||
sequence_point.EndLine = (int) line.lineEnd;
|
||||
sequence_point.EndColumn = (int) line.colEnd;
|
||||
|
||||
info.sequence_points.Add (sequence_point);
|
||||
}
|
||||
|
||||
Document GetDocument (PdbSource source)
|
||||
{
|
||||
string name = source.name;
|
||||
Document document;
|
||||
if (documents.TryGetValue (name, out document))
|
||||
return document;
|
||||
|
||||
document = new Document (name) {
|
||||
Language = source.language.ToLanguage (),
|
||||
LanguageVendor = source.vendor.ToVendor (),
|
||||
Type = source.doctype.ToType (),
|
||||
};
|
||||
documents.Add (name, document);
|
||||
return document;
|
||||
}
|
||||
|
||||
public void Dispose ()
|
||||
{
|
||||
pdb_file.Dispose ();
|
||||
}
|
||||
}
|
||||
}
|
||||
370
external/linker/cecil/symbols/pdb/Mono.Cecil.Pdb/NativePdbWriter.cs
vendored
Normal file
370
external/linker/cecil/symbols/pdb/Mono.Cecil.Pdb/NativePdbWriter.cs
vendored
Normal file
@@ -0,0 +1,370 @@
|
||||
//
|
||||
// Author:
|
||||
// Jb Evain (jbevain@gmail.com)
|
||||
//
|
||||
// Copyright (c) 2008 - 2015 Jb Evain
|
||||
// Copyright (c) 2008 - 2011 Novell, Inc.
|
||||
//
|
||||
// Licensed under the MIT/X11 license.
|
||||
//
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
using Mono.Cecil.Cil;
|
||||
using Mono.Cecil.PE;
|
||||
using Mono.Collections.Generic;
|
||||
|
||||
#if !READ_ONLY
|
||||
|
||||
namespace Mono.Cecil.Pdb {
|
||||
|
||||
public class NativePdbWriter : ISymbolWriter, IMetadataSymbolWriter {
|
||||
|
||||
readonly ModuleDefinition module;
|
||||
readonly SymWriter writer;
|
||||
readonly Dictionary<string, SymDocumentWriter> documents;
|
||||
readonly Dictionary<ImportDebugInformation, MetadataToken> import_info_to_parent;
|
||||
|
||||
MetadataBuilder metadata;
|
||||
|
||||
internal NativePdbWriter (ModuleDefinition module, SymWriter writer)
|
||||
{
|
||||
this.module = module;
|
||||
this.writer = writer;
|
||||
this.documents = new Dictionary<string, SymDocumentWriter> ();
|
||||
this.import_info_to_parent = new Dictionary<ImportDebugInformation, MetadataToken> ();
|
||||
}
|
||||
|
||||
public ISymbolReaderProvider GetReaderProvider ()
|
||||
{
|
||||
return new NativePdbReaderProvider ();
|
||||
}
|
||||
|
||||
public ImageDebugHeader GetDebugHeader ()
|
||||
{
|
||||
ImageDebugDirectory directory;
|
||||
var data = writer.GetDebugInfo (out directory);
|
||||
directory.TimeDateStamp = (int) module.timestamp;
|
||||
return new ImageDebugHeader (new ImageDebugHeaderEntry (directory, data));
|
||||
}
|
||||
|
||||
public void Write (MethodDebugInformation info)
|
||||
{
|
||||
var method_token = info.method.MetadataToken;
|
||||
var sym_token = method_token.ToInt32 ();
|
||||
|
||||
if (!info.HasSequencePoints && info.scope == null && !info.HasCustomDebugInformations && info.StateMachineKickOffMethod == null)
|
||||
return;
|
||||
|
||||
writer.OpenMethod (sym_token);
|
||||
|
||||
if (!info.sequence_points.IsNullOrEmpty ())
|
||||
DefineSequencePoints (info.sequence_points);
|
||||
|
||||
var import_parent = new MetadataToken ();
|
||||
|
||||
if (info.scope != null)
|
||||
DefineScope (info.scope, info, out import_parent);
|
||||
|
||||
DefineCustomMetadata (info, import_parent);
|
||||
|
||||
writer.CloseMethod ();
|
||||
}
|
||||
|
||||
void IMetadataSymbolWriter.SetMetadata (MetadataBuilder metadata)
|
||||
{
|
||||
this.metadata = metadata;
|
||||
}
|
||||
|
||||
void DefineCustomMetadata (MethodDebugInformation info, MetadataToken import_parent)
|
||||
{
|
||||
var metadata = new CustomMetadataWriter (this.writer);
|
||||
|
||||
if (import_parent.RID != 0) {
|
||||
metadata.WriteForwardInfo (import_parent);
|
||||
} else if (info.scope != null && info.scope.Import != null && info.scope.Import.HasTargets) {
|
||||
metadata.WriteUsingInfo (info.scope.Import);
|
||||
}
|
||||
|
||||
if (info.Method.HasCustomAttributes) {
|
||||
foreach (var attribute in info.Method.CustomAttributes) {
|
||||
const string compiler_services = "System.Runtime.CompilerServices";
|
||||
var attribute_type = attribute.AttributeType;
|
||||
|
||||
if (!attribute_type.IsTypeOf (compiler_services, "IteratorStateMachineAttribute") && !attribute_type.IsTypeOf (compiler_services, "AsyncStateMachineAttribute"))
|
||||
continue;
|
||||
|
||||
var type = attribute.ConstructorArguments [0].Value as TypeReference;
|
||||
if (type == null)
|
||||
continue;
|
||||
|
||||
metadata.WriteForwardIterator (type);
|
||||
}
|
||||
}
|
||||
|
||||
if (info.HasCustomDebugInformations) {
|
||||
var scopes = info.CustomDebugInformations.OfType<StateMachineScopeDebugInformation> ().ToArray ();
|
||||
|
||||
if (scopes.Length > 0)
|
||||
metadata.WriteIteratorScopes (scopes, info);
|
||||
}
|
||||
|
||||
metadata.WriteCustomMetadata ();
|
||||
|
||||
DefineAsyncCustomMetadata (info);
|
||||
}
|
||||
|
||||
void DefineAsyncCustomMetadata (MethodDebugInformation info)
|
||||
{
|
||||
if (!info.HasCustomDebugInformations)
|
||||
return;
|
||||
|
||||
foreach (var custom_info in info.CustomDebugInformations) {
|
||||
var async_debug_info = custom_info as AsyncMethodBodyDebugInformation;
|
||||
if (async_debug_info == null)
|
||||
continue;
|
||||
|
||||
using (var stream = new MemoryStream ()) {
|
||||
var async_metadata = new BinaryStreamWriter (stream);
|
||||
async_metadata.WriteUInt32 (info.StateMachineKickOffMethod != null ? info.StateMachineKickOffMethod.MetadataToken.ToUInt32 () : 0);
|
||||
async_metadata.WriteUInt32 ((uint) async_debug_info.CatchHandler.Offset);
|
||||
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 ((uint) async_debug_info.Resumes [i].Offset);
|
||||
}
|
||||
|
||||
writer.DefineCustomMetadata ("asyncMethodInfo", stream.ToArray ());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void DefineScope (ScopeDebugInformation scope, MethodDebugInformation info, out MetadataToken import_parent)
|
||||
{
|
||||
var start_offset = scope.Start.Offset;
|
||||
var end_offset = scope.End.IsEndOfMethod
|
||||
? info.code_size
|
||||
: scope.End.Offset;
|
||||
|
||||
import_parent = new MetadataToken (0u);
|
||||
|
||||
writer.OpenScope (start_offset);
|
||||
|
||||
if (scope.Import != null && scope.Import.HasTargets && !import_info_to_parent.TryGetValue (info.scope.Import, out import_parent)) {
|
||||
foreach (var target in scope.Import.Targets) {
|
||||
switch (target.Kind) {
|
||||
case ImportTargetKind.ImportNamespace:
|
||||
writer.UsingNamespace ("U" + target.@namespace);
|
||||
break;
|
||||
case ImportTargetKind.ImportType:
|
||||
writer.UsingNamespace ("T" + TypeParser.ToParseable (target.type));
|
||||
break;
|
||||
case ImportTargetKind.DefineNamespaceAlias:
|
||||
writer.UsingNamespace ("A" + target.Alias + " U" + target.@namespace);
|
||||
break;
|
||||
case ImportTargetKind.DefineTypeAlias:
|
||||
writer.UsingNamespace ("A" + target.Alias + " T" + TypeParser.ToParseable (target.type));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
import_info_to_parent.Add (info.scope.Import, info.method.MetadataToken);
|
||||
}
|
||||
|
||||
var sym_token = info.local_var_token.ToInt32 ();
|
||||
|
||||
if (!scope.variables.IsNullOrEmpty ()) {
|
||||
for (int i = 0; i < scope.variables.Count; i++) {
|
||||
var variable = scope.variables [i];
|
||||
DefineLocalVariable (variable, sym_token, start_offset, end_offset);
|
||||
}
|
||||
}
|
||||
|
||||
if (!scope.constants.IsNullOrEmpty ()) {
|
||||
for (int i = 0; i < scope.constants.Count; i++) {
|
||||
var constant = scope.constants [i];
|
||||
DefineConstant (constant);
|
||||
}
|
||||
}
|
||||
|
||||
if (!scope.scopes.IsNullOrEmpty ()) {
|
||||
for (int i = 0; i < scope.scopes.Count; i++) {
|
||||
MetadataToken _;
|
||||
DefineScope (scope.scopes [i], info, out _);
|
||||
}
|
||||
}
|
||||
|
||||
writer.CloseScope (end_offset);
|
||||
}
|
||||
|
||||
void DefineSequencePoints (Collection<SequencePoint> sequence_points)
|
||||
{
|
||||
for (int i = 0; i < sequence_points.Count; i++) {
|
||||
var sequence_point = sequence_points [i];
|
||||
|
||||
writer.DefineSequencePoints (
|
||||
GetDocument (sequence_point.Document),
|
||||
new [] { sequence_point.Offset },
|
||||
new [] { sequence_point.StartLine },
|
||||
new [] { sequence_point.StartColumn },
|
||||
new [] { sequence_point.EndLine },
|
||||
new [] { sequence_point.EndColumn });
|
||||
}
|
||||
}
|
||||
|
||||
void DefineLocalVariable (VariableDebugInformation variable, int local_var_token, int start_offset, int end_offset)
|
||||
{
|
||||
writer.DefineLocalVariable2 (
|
||||
variable.Name,
|
||||
variable.Attributes,
|
||||
local_var_token,
|
||||
variable.Index,
|
||||
0,
|
||||
0,
|
||||
start_offset,
|
||||
end_offset);
|
||||
}
|
||||
|
||||
void DefineConstant (ConstantDebugInformation constant)
|
||||
{
|
||||
var row = metadata.AddStandAloneSignature (metadata.GetConstantTypeBlobIndex (constant.ConstantType));
|
||||
var token = new MetadataToken (TokenType.Signature, row);
|
||||
|
||||
writer.DefineConstant2 (constant.Name, constant.Value, token.ToInt32 ());
|
||||
}
|
||||
|
||||
SymDocumentWriter GetDocument (Document document)
|
||||
{
|
||||
if (document == null)
|
||||
return null;
|
||||
|
||||
SymDocumentWriter doc_writer;
|
||||
if (documents.TryGetValue (document.Url, out doc_writer))
|
||||
return doc_writer;
|
||||
|
||||
doc_writer = writer.DefineDocument (
|
||||
document.Url,
|
||||
document.Language.ToGuid (),
|
||||
document.LanguageVendor.ToGuid (),
|
||||
document.Type.ToGuid ());
|
||||
|
||||
documents [document.Url] = doc_writer;
|
||||
return doc_writer;
|
||||
}
|
||||
|
||||
public void Dispose ()
|
||||
{
|
||||
var entry_point = module.EntryPoint;
|
||||
if (entry_point != null)
|
||||
writer.SetUserEntryPoint (entry_point.MetadataToken.ToInt32 ());
|
||||
|
||||
writer.Close ();
|
||||
}
|
||||
}
|
||||
|
||||
enum CustomMetadataType : byte {
|
||||
UsingInfo = 0,
|
||||
ForwardInfo = 1,
|
||||
IteratorScopes = 3,
|
||||
ForwardIterator = 4,
|
||||
}
|
||||
|
||||
class CustomMetadataWriter : IDisposable {
|
||||
|
||||
readonly SymWriter sym_writer;
|
||||
readonly MemoryStream stream;
|
||||
readonly BinaryStreamWriter writer;
|
||||
|
||||
int count;
|
||||
|
||||
const byte version = 4;
|
||||
|
||||
public CustomMetadataWriter (SymWriter sym_writer)
|
||||
{
|
||||
this.sym_writer = sym_writer;
|
||||
this.stream = new MemoryStream ();
|
||||
this.writer = new BinaryStreamWriter (stream);
|
||||
|
||||
writer.WriteByte (version);
|
||||
writer.WriteByte (0); // count
|
||||
writer.Align (4);
|
||||
}
|
||||
|
||||
public void WriteUsingInfo (ImportDebugInformation import_info)
|
||||
{
|
||||
Write (CustomMetadataType.UsingInfo, () => {
|
||||
writer.WriteUInt16 ((ushort) 1);
|
||||
writer.WriteUInt16 ((ushort) import_info.Targets.Count);
|
||||
});
|
||||
}
|
||||
|
||||
public void WriteForwardInfo (MetadataToken import_parent)
|
||||
{
|
||||
Write (CustomMetadataType.ForwardInfo, () => writer.WriteUInt32 (import_parent.ToUInt32 ()));
|
||||
}
|
||||
|
||||
public void WriteIteratorScopes (StateMachineScopeDebugInformation [] scopes, MethodDebugInformation debug_info)
|
||||
{
|
||||
Write (CustomMetadataType.IteratorScopes, () => {
|
||||
writer.WriteInt32 (scopes.Length);
|
||||
foreach (var scope in scopes) {
|
||||
var start = scope.Start.Offset;
|
||||
var end = scope.End.IsEndOfMethod ? debug_info.code_size : scope.End.Offset;
|
||||
writer.WriteInt32 (start);
|
||||
writer.WriteInt32 (end - 1);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void WriteForwardIterator (TypeReference type)
|
||||
{
|
||||
Write (CustomMetadataType.ForwardIterator, () => writer.WriteBytes(Encoding.Unicode.GetBytes(type.Name)));
|
||||
}
|
||||
|
||||
void Write (CustomMetadataType type, Action write)
|
||||
{
|
||||
count++;
|
||||
writer.WriteByte (version);
|
||||
writer.WriteByte ((byte) type);
|
||||
writer.Align (4);
|
||||
|
||||
var length_position = writer.Position;
|
||||
writer.WriteUInt32 (0);
|
||||
|
||||
write ();
|
||||
writer.Align (4);
|
||||
|
||||
var end = writer.Position;
|
||||
var length = end - length_position + 4; // header is 4 bytes long
|
||||
|
||||
writer.Position = length_position;
|
||||
writer.WriteInt32 (length);
|
||||
|
||||
writer.Position = end;
|
||||
}
|
||||
|
||||
public void WriteCustomMetadata ()
|
||||
{
|
||||
if (count == 0)
|
||||
return;
|
||||
|
||||
writer.BaseStream.Position = 1;
|
||||
writer.WriteByte ((byte) count);
|
||||
writer.Flush ();
|
||||
|
||||
sym_writer.DefineCustomMetadata ("MD2", stream.ToArray ());
|
||||
}
|
||||
|
||||
public void Dispose ()
|
||||
{
|
||||
stream.Dispose ();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -22,7 +22,7 @@ namespace Mono.Cecil.Pdb {
|
||||
Mixin.CheckModule (module);
|
||||
Mixin.CheckFileName (fileName);
|
||||
|
||||
return new PdbReader (Disposable.Owned (File.OpenRead (Mixin.GetPdbFileName (fileName)) as Stream));
|
||||
return new NativePdbReader (Disposable.Owned (File.OpenRead (Mixin.GetPdbFileName (fileName)) as Stream));
|
||||
}
|
||||
|
||||
public ISymbolReader GetSymbolReader (ModuleDefinition module, Stream symbolStream)
|
||||
@@ -30,7 +30,7 @@ namespace Mono.Cecil.Pdb {
|
||||
Mixin.CheckModule (module);
|
||||
Mixin.CheckStream (symbolStream);
|
||||
|
||||
return new PdbReader (Disposable.NotOwned (symbolStream));
|
||||
return new NativePdbReader (Disposable.NotOwned (symbolStream));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -41,7 +41,14 @@ namespace Mono.Cecil.Pdb {
|
||||
Mixin.CheckModule (module);
|
||||
Mixin.CheckFileName (fileName);
|
||||
|
||||
return IsPortablePdb (Mixin.GetPdbFileName (fileName))
|
||||
if (module.HasDebugHeader) {
|
||||
var header = module.GetDebugHeader ();
|
||||
var entry = header.GetEmbeddedPortablePdbEntry ();
|
||||
if (entry != null)
|
||||
return new EmbeddedPortablePdbReaderProvider ().GetSymbolReader (module, fileName);
|
||||
}
|
||||
|
||||
return Mixin.IsPortablePdb (Mixin.GetPdbFileName (fileName))
|
||||
? new PortablePdbReaderProvider ().GetSymbolReader (module, fileName)
|
||||
: new NativePdbReaderProvider ().GetSymbolReader (module, fileName);
|
||||
}
|
||||
@@ -52,29 +59,10 @@ namespace Mono.Cecil.Pdb {
|
||||
Mixin.CheckStream (symbolStream);
|
||||
Mixin.CheckReadSeek (symbolStream);
|
||||
|
||||
return IsPortablePdb (symbolStream)
|
||||
return Mixin.IsPortablePdb (symbolStream)
|
||||
? new PortablePdbReaderProvider ().GetSymbolReader (module, symbolStream)
|
||||
: new NativePdbReaderProvider ().GetSymbolReader (module, symbolStream);
|
||||
}
|
||||
|
||||
static bool IsPortablePdb (string fileName)
|
||||
{
|
||||
using (var file = new FileStream (fileName, FileMode.Open, FileAccess.Read, FileShare.None))
|
||||
return IsPortablePdb (file);
|
||||
}
|
||||
|
||||
static bool IsPortablePdb (Stream stream)
|
||||
{
|
||||
const uint ppdb_signature = 0x424a5342;
|
||||
|
||||
var position = stream.Position;
|
||||
try {
|
||||
var reader = new BinaryReader (stream);
|
||||
return reader.ReadUInt32 () == ppdb_signature;
|
||||
} finally {
|
||||
stream.Position = position;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#if !READ_ONLY
|
||||
@@ -86,7 +74,7 @@ namespace Mono.Cecil.Pdb {
|
||||
Mixin.CheckModule (module);
|
||||
Mixin.CheckFileName (fileName);
|
||||
|
||||
return new PdbWriter (module, CreateWriter (module, Mixin.GetPdbFileName (fileName)));
|
||||
return new NativePdbWriter (module, CreateWriter (module, Mixin.GetPdbFileName (fileName)));
|
||||
}
|
||||
|
||||
static SymWriter CreateWriter (ModuleDefinition module, string pdb)
|
||||
|
||||
@@ -1,211 +0,0 @@
|
||||
//
|
||||
// Author:
|
||||
// Jb Evain (jbevain@gmail.com)
|
||||
//
|
||||
// Copyright (c) 2008 - 2015 Jb Evain
|
||||
// Copyright (c) 2008 - 2011 Novell, Inc.
|
||||
//
|
||||
// Licensed under the MIT/X11 license.
|
||||
//
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
|
||||
using Mono.Collections.Generic;
|
||||
|
||||
using Microsoft.Cci.Pdb;
|
||||
|
||||
using Mono.Cecil.Cil;
|
||||
|
||||
namespace Mono.Cecil.Pdb {
|
||||
|
||||
public class PdbReader : ISymbolReader {
|
||||
|
||||
int age;
|
||||
Guid guid;
|
||||
|
||||
readonly Disposable<Stream> pdb_file;
|
||||
readonly Dictionary<string, Document> documents = new Dictionary<string, Document> ();
|
||||
readonly Dictionary<uint, PdbFunction> functions = new Dictionary<uint, PdbFunction> ();
|
||||
|
||||
internal PdbReader (Disposable<Stream> file)
|
||||
{
|
||||
this.pdb_file = file;
|
||||
}
|
||||
|
||||
/*
|
||||
uint Magic = 0x53445352;
|
||||
Guid Signature;
|
||||
uint Age;
|
||||
string FileName;
|
||||
*/
|
||||
|
||||
public bool ProcessDebugHeader (ImageDebugDirectory directory, byte [] header)
|
||||
{
|
||||
if (directory.Type != 2) //IMAGE_DEBUG_TYPE_CODEVIEW
|
||||
return false;
|
||||
if (directory.MajorVersion != 0 || directory.MinorVersion != 0)
|
||||
return false;
|
||||
|
||||
if (header.Length < 24)
|
||||
return false;
|
||||
|
||||
var magic = ReadInt32 (header, 0);
|
||||
if (magic != 0x53445352)
|
||||
return false;
|
||||
|
||||
var guid_bytes = new byte [16];
|
||||
Buffer.BlockCopy (header, 4, guid_bytes, 0, 16);
|
||||
|
||||
this.guid = new Guid (guid_bytes);
|
||||
this.age = ReadInt32 (header, 20);
|
||||
|
||||
return PopulateFunctions ();
|
||||
}
|
||||
|
||||
static int ReadInt32 (byte [] bytes, int start)
|
||||
{
|
||||
return (bytes [start]
|
||||
| (bytes [start + 1] << 8)
|
||||
| (bytes [start + 2] << 16)
|
||||
| (bytes [start + 3] << 24));
|
||||
}
|
||||
|
||||
bool PopulateFunctions ()
|
||||
{
|
||||
using (pdb_file) {
|
||||
Dictionary<uint, PdbTokenLine> tokenToSourceMapping;
|
||||
string sourceServerData;
|
||||
int age;
|
||||
Guid guid;
|
||||
|
||||
var funcs = PdbFile.LoadFunctions (pdb_file.value, out tokenToSourceMapping, out sourceServerData, out age, out guid);
|
||||
|
||||
if (this.guid != guid)
|
||||
return false;
|
||||
|
||||
foreach (PdbFunction function in funcs)
|
||||
functions.Add (function.token, function);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public MethodDebugInformation Read (MethodDefinition method)
|
||||
{
|
||||
var method_token = method.MetadataToken;
|
||||
|
||||
PdbFunction function;
|
||||
if (!functions.TryGetValue (method_token.ToUInt32 (), out function))
|
||||
return null;
|
||||
|
||||
var symbol = new MethodDebugInformation (method);
|
||||
|
||||
ReadSequencePoints (function, symbol);
|
||||
|
||||
if (function.scopes.Length > 1)
|
||||
throw new NotSupportedException ();
|
||||
else if (function.scopes.Length == 1)
|
||||
symbol.scope = ReadScopeAndLocals (function.scopes [0], symbol);
|
||||
|
||||
return symbol;
|
||||
}
|
||||
|
||||
static Collection<ScopeDebugInformation> ReadScopeAndLocals (PdbScope [] scopes, MethodDebugInformation info)
|
||||
{
|
||||
var symbols = new Collection<ScopeDebugInformation> (scopes.Length);
|
||||
|
||||
foreach (PdbScope scope in scopes)
|
||||
if (scope != null)
|
||||
symbols.Add (ReadScopeAndLocals (scope, info));
|
||||
|
||||
return symbols;
|
||||
}
|
||||
|
||||
static ScopeDebugInformation ReadScopeAndLocals (PdbScope scope, MethodDebugInformation info)
|
||||
{
|
||||
var parent = new ScopeDebugInformation ();
|
||||
parent.Start = new InstructionOffset ((int) scope.offset);
|
||||
parent.End = new InstructionOffset ((int) (scope.offset + scope.length));
|
||||
|
||||
if (!scope.slots.IsNullOrEmpty()) {
|
||||
parent.variables = new Collection<VariableDebugInformation> (scope.slots.Length);
|
||||
|
||||
foreach (PdbSlot slot in scope.slots) {
|
||||
var index = (int) slot.slot;
|
||||
var variable = new VariableDebugInformation (index, slot.name);
|
||||
if (slot.flags == 4)
|
||||
variable.IsDebuggerHidden = true;
|
||||
parent.variables.Add (variable);
|
||||
}
|
||||
}
|
||||
|
||||
if (!scope.constants.IsNullOrEmpty ()) {
|
||||
parent.constants = new Collection<ConstantDebugInformation> (scope.constants.Length);
|
||||
|
||||
foreach (var constant in scope.constants) {
|
||||
parent.constants.Add (new ConstantDebugInformation (
|
||||
constant.name,
|
||||
(TypeReference) info.method.Module.LookupToken ((int) constant.token),
|
||||
constant.value));
|
||||
}
|
||||
}
|
||||
|
||||
parent.scopes = ReadScopeAndLocals (scope.scopes, info);
|
||||
|
||||
return parent;
|
||||
}
|
||||
|
||||
void ReadSequencePoints (PdbFunction function, MethodDebugInformation info)
|
||||
{
|
||||
if (function.lines == null)
|
||||
return;
|
||||
|
||||
info.sequence_points = new Collection<SequencePoint> ();
|
||||
|
||||
foreach (PdbLines lines in function.lines)
|
||||
ReadLines (lines, info);
|
||||
}
|
||||
|
||||
void ReadLines (PdbLines lines, MethodDebugInformation info)
|
||||
{
|
||||
var document = GetDocument (lines.file);
|
||||
|
||||
foreach (var line in lines.lines)
|
||||
ReadLine (line, document, info);
|
||||
}
|
||||
|
||||
static void ReadLine (PdbLine line, Document document, MethodDebugInformation info)
|
||||
{
|
||||
var sequence_point = new SequencePoint ((int) line.offset, document);
|
||||
sequence_point.StartLine = (int) line.lineBegin;
|
||||
sequence_point.StartColumn = (int) line.colBegin;
|
||||
sequence_point.EndLine = (int) line.lineEnd;
|
||||
sequence_point.EndColumn = (int) line.colEnd;
|
||||
|
||||
info.sequence_points.Add (sequence_point);
|
||||
}
|
||||
|
||||
Document GetDocument (PdbSource source)
|
||||
{
|
||||
string name = source.name;
|
||||
Document document;
|
||||
if (documents.TryGetValue (name, out document))
|
||||
return document;
|
||||
|
||||
document = new Document (name) {
|
||||
Language = source.language.ToLanguage (),
|
||||
LanguageVendor = source.vendor.ToVendor (),
|
||||
Type = source.doctype.ToType (),
|
||||
};
|
||||
documents.Add (name, document);
|
||||
return document;
|
||||
}
|
||||
|
||||
public void Dispose ()
|
||||
{
|
||||
pdb_file.Dispose ();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,141 +0,0 @@
|
||||
//
|
||||
// Author:
|
||||
// Jb Evain (jbevain@gmail.com)
|
||||
//
|
||||
// Copyright (c) 2008 - 2015 Jb Evain
|
||||
// Copyright (c) 2008 - 2011 Novell, Inc.
|
||||
//
|
||||
// Licensed under the MIT/X11 license.
|
||||
//
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.SymbolStore;
|
||||
|
||||
using Mono.Cecil.Cil;
|
||||
using Mono.Collections.Generic;
|
||||
|
||||
#if !READ_ONLY
|
||||
|
||||
namespace Mono.Cecil.Pdb {
|
||||
|
||||
public class PdbWriter : Cil.ISymbolWriter {
|
||||
|
||||
readonly ModuleDefinition module;
|
||||
readonly SymWriter writer;
|
||||
readonly Dictionary<string, SymDocumentWriter> documents;
|
||||
|
||||
internal PdbWriter (ModuleDefinition module, SymWriter writer)
|
||||
{
|
||||
this.module = module;
|
||||
this.writer = writer;
|
||||
this.documents = new Dictionary<string, SymDocumentWriter> ();
|
||||
}
|
||||
|
||||
public bool GetDebugHeader (out ImageDebugDirectory directory, out byte [] header)
|
||||
{
|
||||
header = writer.GetDebugInfo (out directory);
|
||||
return true;
|
||||
}
|
||||
|
||||
public void Write (MethodDebugInformation info)
|
||||
{
|
||||
var method_token = info.method.MetadataToken;
|
||||
var sym_token = new SymbolToken (method_token.ToInt32 ());
|
||||
|
||||
writer.OpenMethod (sym_token);
|
||||
|
||||
DefineSequencePoints (info.sequence_points);
|
||||
|
||||
if (info.scope != null)
|
||||
DefineScope (info.scope, info);
|
||||
|
||||
writer.CloseMethod ();
|
||||
}
|
||||
|
||||
void DefineScope (ScopeDebugInformation scope, MethodDebugInformation info)
|
||||
{
|
||||
var start_offset = scope.Start.Offset;
|
||||
var end_offset = scope.End.IsEndOfMethod
|
||||
? info.code_size
|
||||
: scope.End.Offset;
|
||||
|
||||
writer.OpenScope (start_offset);
|
||||
|
||||
var sym_token = new SymbolToken (info.local_var_token.ToInt32 ());
|
||||
|
||||
if (!scope.variables.IsNullOrEmpty ()) {
|
||||
for (int i = 0; i < scope.variables.Count; i++) {
|
||||
var variable = scope.variables [i];
|
||||
CreateLocalVariable (variable, sym_token, start_offset, end_offset);
|
||||
}
|
||||
}
|
||||
|
||||
if (!scope.scopes.IsNullOrEmpty ()) {
|
||||
for (int i = 0; i < scope.scopes.Count; i++)
|
||||
DefineScope (scope.scopes [i], info);
|
||||
}
|
||||
|
||||
writer.CloseScope (end_offset);
|
||||
}
|
||||
|
||||
void DefineSequencePoints (Collection<SequencePoint> sequence_points)
|
||||
{
|
||||
for (int i = 0; i < sequence_points.Count; i++) {
|
||||
var sequence_point = sequence_points [i];
|
||||
|
||||
writer.DefineSequencePoints (
|
||||
GetDocument (sequence_point.Document),
|
||||
new [] { sequence_point.Offset },
|
||||
new [] { sequence_point.StartLine },
|
||||
new [] { sequence_point.StartColumn },
|
||||
new [] { sequence_point.EndLine },
|
||||
new [] { sequence_point.EndColumn });
|
||||
}
|
||||
}
|
||||
|
||||
void CreateLocalVariable (VariableDebugInformation variable, SymbolToken local_var_token, int start_offset, int end_offset)
|
||||
{
|
||||
writer.DefineLocalVariable2 (
|
||||
variable.Name,
|
||||
variable.Attributes,
|
||||
local_var_token,
|
||||
SymAddressKind.ILOffset,
|
||||
variable.Index,
|
||||
0,
|
||||
0,
|
||||
start_offset,
|
||||
end_offset);
|
||||
}
|
||||
|
||||
SymDocumentWriter GetDocument (Document document)
|
||||
{
|
||||
if (document == null)
|
||||
return null;
|
||||
|
||||
SymDocumentWriter doc_writer;
|
||||
if (documents.TryGetValue (document.Url, out doc_writer))
|
||||
return doc_writer;
|
||||
|
||||
doc_writer = writer.DefineDocument (
|
||||
document.Url,
|
||||
document.Language.ToGuid (),
|
||||
document.LanguageVendor.ToGuid (),
|
||||
document.Type.ToGuid ());
|
||||
|
||||
documents [document.Url] = doc_writer;
|
||||
return doc_writer;
|
||||
}
|
||||
|
||||
public void Dispose ()
|
||||
{
|
||||
var entry_point = module.EntryPoint;
|
||||
if (entry_point != null)
|
||||
writer.SetUserEntryPoint (new SymbolToken (entry_point.MetadataToken.ToInt32 ()));
|
||||
|
||||
writer.Close ();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -8,8 +8,6 @@
|
||||
//
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.SymbolStore;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
using Mono.Cecil.Cil;
|
||||
@@ -60,15 +58,24 @@ namespace Mono.Cecil.Pdb
|
||||
public void DefineLocalVariable2 (
|
||||
string name,
|
||||
VariableAttributes attributes,
|
||||
SymbolToken sigToken,
|
||||
SymAddressKind addrKind,
|
||||
int sigToken,
|
||||
int addr1,
|
||||
int addr2,
|
||||
int addr3,
|
||||
int startOffset,
|
||||
int endOffset)
|
||||
{
|
||||
m_writer.DefineLocalVariable2 (name, (int)attributes, sigToken, (int)addrKind, addr1, addr2, addr3, startOffset, endOffset);
|
||||
m_writer.DefineLocalVariable2 (name, (int)attributes, sigToken, 1 /* ILOffset*/, addr1, addr2, addr3, startOffset, endOffset);
|
||||
}
|
||||
|
||||
public void DefineConstant2 (string name, object value, int sigToken)
|
||||
{
|
||||
if (value == null) {
|
||||
m_writer.DefineConstant2 (name, 0, sigToken);
|
||||
return;
|
||||
}
|
||||
|
||||
m_writer.DefineConstant2 (name, value, sigToken);
|
||||
}
|
||||
|
||||
public void Close ()
|
||||
@@ -104,11 +111,6 @@ namespace Mono.Cecil.Pdb
|
||||
return new SymDocumentWriter (unmanagedDocumentWriter);
|
||||
}
|
||||
|
||||
public void DefineParameter (string name, ParameterAttributes attributes, int sequence, SymAddressKind addrKind, int addr1, int addr2, int addr3)
|
||||
{
|
||||
throw new Exception ("The method or operation is not implemented.");
|
||||
}
|
||||
|
||||
public void DefineSequencePoints (SymDocumentWriter document, int[] offsets, int[] lines, int[] columns, int[] endLines, int[] endColumns)
|
||||
{
|
||||
m_writer.DefineSequencePoints (document.GetUnmanaged(), offsets.Length, offsets, lines, columns, endLines, endColumns);
|
||||
@@ -119,14 +121,14 @@ namespace Mono.Cecil.Pdb
|
||||
m_writer.Initialize (emitter, filename, null, fFullBuild);
|
||||
}
|
||||
|
||||
public void SetUserEntryPoint (SymbolToken method)
|
||||
public void SetUserEntryPoint (int methodToken)
|
||||
{
|
||||
m_writer.SetUserEntryPoint (method);
|
||||
m_writer.SetUserEntryPoint (methodToken);
|
||||
}
|
||||
|
||||
public void OpenMethod (SymbolToken method)
|
||||
public void OpenMethod (int methodToken)
|
||||
{
|
||||
m_writer.OpenMethod (method);
|
||||
m_writer.OpenMethod (methodToken);
|
||||
}
|
||||
|
||||
public void OpenNamespace (string name)
|
||||
@@ -145,6 +147,13 @@ namespace Mono.Cecil.Pdb
|
||||
{
|
||||
m_writer.UsingNamespace (fullName);
|
||||
}
|
||||
|
||||
public void DefineCustomMetadata (string name, byte [] metadata)
|
||||
{
|
||||
var handle = GCHandle.Alloc (metadata, GCHandleType.Pinned);
|
||||
m_writer.SetSymAttribute (0, name, (uint) metadata.Length, handle.AddrOfPinnedObject ());
|
||||
handle.Free ();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -26,7 +26,7 @@ namespace Mono.Cecil.Tests {
|
||||
.line 7,7:8,18 'c:\sources\cecil\symbols\Mono.Cecil.Pdb\Test\Resources\assemblies\test.cs'
|
||||
IL_0001: ldc.i4.0
|
||||
IL_0002: stloc.0
|
||||
.line 16707566,16707566:0,0 'c:\sources\cecil\symbols\Mono.Cecil.Pdb\Test\Resources\assemblies\test.cs'
|
||||
.line hidden 'c:\sources\cecil\symbols\Mono.Cecil.Pdb\Test\Resources\assemblies\test.cs'
|
||||
IL_0003: br.s IL_0012
|
||||
.line 8,8:4,21 'c:\sources\cecil\symbols\Mono.Cecil.Pdb\Test\Resources\assemblies\test.cs'
|
||||
IL_0005: ldarg.0
|
||||
@@ -46,7 +46,7 @@ namespace Mono.Cecil.Tests {
|
||||
IL_0015: conv.i4
|
||||
IL_0016: clt
|
||||
IL_0018: stloc.2
|
||||
.line 16707566,16707566:0,0 'c:\sources\cecil\symbols\Mono.Cecil.Pdb\Test\Resources\assemblies\test.cs'
|
||||
.line hidden 'c:\sources\cecil\symbols\Mono.Cecil.Pdb\Test\Resources\assemblies\test.cs'
|
||||
IL_0019: ldloc.2
|
||||
IL_001a: brtrue.s IL_0005
|
||||
.line 10,10:3,12 'c:\sources\cecil\symbols\Mono.Cecil.Pdb\Test\Resources\assemblies\test.cs'
|
||||
@@ -86,7 +86,6 @@ namespace Mono.Cecil.Tests {
|
||||
}, readOnly: Platform.OnMono, symbolReaderProvider: typeof(PdbReaderProvider), symbolWriterProvider: typeof(PdbWriterProvider));
|
||||
}
|
||||
|
||||
|
||||
[Test]
|
||||
public void Document ()
|
||||
{
|
||||
@@ -147,6 +146,218 @@ namespace Mono.Cecil.Tests {
|
||||
}, readOnly: Platform.OnMono, symbolReaderProvider: typeof(PdbReaderProvider), symbolWriterProvider: typeof(PdbWriterProvider));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void EmptyEnumerable ()
|
||||
{
|
||||
TestModule ("empty-iterator.dll", module => {
|
||||
}, readOnly: Platform.OnMono, symbolReaderProvider: typeof (PdbReaderProvider), symbolWriterProvider: typeof (PdbWriterProvider));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void LocalVariables ()
|
||||
{
|
||||
TestModule ("ComplexPdb.dll", module => {
|
||||
var type = module.GetType ("ComplexPdb.Program");
|
||||
var method = type.GetMethod ("Bar");
|
||||
var debug_info = method.DebugInformation;
|
||||
|
||||
Assert.IsNotNull (debug_info.Scope);
|
||||
Assert.IsTrue (debug_info.Scope.HasScopes);
|
||||
Assert.AreEqual (2, debug_info.Scope.Scopes.Count);
|
||||
|
||||
var scope = debug_info.Scope.Scopes [0];
|
||||
|
||||
Assert.IsNotNull (scope);
|
||||
Assert.IsTrue (scope.HasVariables);
|
||||
Assert.AreEqual (1, scope.Variables.Count);
|
||||
|
||||
var variable = scope.Variables [0];
|
||||
|
||||
Assert.AreEqual ("s", variable.Name);
|
||||
Assert.IsFalse (variable.IsDebuggerHidden);
|
||||
Assert.AreEqual (2, variable.Index);
|
||||
|
||||
scope = debug_info.Scope.Scopes [1];
|
||||
|
||||
Assert.IsNotNull (scope);
|
||||
Assert.IsTrue (scope.HasVariables);
|
||||
Assert.AreEqual (1, scope.Variables.Count);
|
||||
|
||||
variable = scope.Variables [0];
|
||||
|
||||
Assert.AreEqual ("s", variable.Name);
|
||||
Assert.IsFalse (variable.IsDebuggerHidden);
|
||||
Assert.AreEqual (3, variable.Index);
|
||||
|
||||
Assert.IsTrue (scope.HasScopes);
|
||||
Assert.AreEqual (1, scope.Scopes.Count);
|
||||
|
||||
scope = scope.Scopes [0];
|
||||
|
||||
Assert.IsNotNull (scope);
|
||||
Assert.IsTrue (scope.HasVariables);
|
||||
Assert.AreEqual (1, scope.Variables.Count);
|
||||
|
||||
variable = scope.Variables [0];
|
||||
|
||||
Assert.AreEqual ("u", variable.Name);
|
||||
Assert.IsFalse (variable.IsDebuggerHidden);
|
||||
Assert.AreEqual (5, variable.Index);
|
||||
}, readOnly: Platform.OnMono, symbolReaderProvider: typeof (PdbReaderProvider), symbolWriterProvider: typeof (PdbWriterProvider));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void LocalConstants ()
|
||||
{
|
||||
TestModule ("ComplexPdb.dll", module => {
|
||||
var type = module.GetType ("ComplexPdb.Program");
|
||||
var method = type.GetMethod ("Bar");
|
||||
var debug_info = method.DebugInformation;
|
||||
|
||||
Assert.IsNotNull (debug_info.Scope);
|
||||
Assert.IsTrue (debug_info.Scope.HasScopes);
|
||||
Assert.AreEqual (2, debug_info.Scope.Scopes.Count);
|
||||
|
||||
var scope = debug_info.Scope.Scopes [1];
|
||||
|
||||
Assert.IsNotNull (scope);
|
||||
Assert.IsTrue (scope.HasConstants);
|
||||
Assert.AreEqual (2, scope.Constants.Count);
|
||||
|
||||
var constant = scope.Constants [0];
|
||||
|
||||
Assert.AreEqual ("b", constant.Name);
|
||||
Assert.AreEqual (12, constant.Value);
|
||||
Assert.AreEqual (MetadataType.Int32, constant.ConstantType.MetadataType);
|
||||
|
||||
constant = scope.Constants [1];
|
||||
Assert.AreEqual ("c", constant.Name);
|
||||
Assert.AreEqual ((decimal) 74, constant.Value);
|
||||
Assert.AreEqual (MetadataType.ValueType, constant.ConstantType.MetadataType);
|
||||
|
||||
method = type.GetMethod ("Foo");
|
||||
debug_info = method.DebugInformation;
|
||||
|
||||
Assert.IsNotNull (debug_info.Scope);
|
||||
Assert.IsTrue (debug_info.Scope.HasConstants);
|
||||
Assert.AreEqual (4, debug_info.Scope.Constants.Count);
|
||||
|
||||
constant = debug_info.Scope.Constants [0];
|
||||
Assert.AreEqual ("s", constant.Name);
|
||||
Assert.AreEqual ("const string", constant.Value);
|
||||
Assert.AreEqual (MetadataType.String, constant.ConstantType.MetadataType);
|
||||
|
||||
constant = debug_info.Scope.Constants [1];
|
||||
Assert.AreEqual ("f", constant.Name);
|
||||
Assert.AreEqual (1, constant.Value);
|
||||
Assert.AreEqual (MetadataType.Int32, constant.ConstantType.MetadataType);
|
||||
|
||||
constant = debug_info.Scope.Constants [2];
|
||||
Assert.AreEqual ("o", constant.Name);
|
||||
Assert.AreEqual (null, constant.Value);
|
||||
Assert.AreEqual (MetadataType.Object, constant.ConstantType.MetadataType);
|
||||
|
||||
constant = debug_info.Scope.Constants [3];
|
||||
Assert.AreEqual ("u", constant.Name);
|
||||
Assert.AreEqual (null, constant.Value);
|
||||
Assert.AreEqual (MetadataType.String, constant.ConstantType.MetadataType);
|
||||
}, readOnly: Platform.OnMono, symbolReaderProvider: typeof (PdbReaderProvider), symbolWriterProvider: typeof (PdbWriterProvider));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void ImportScope ()
|
||||
{
|
||||
TestModule ("ComplexPdb.dll", module => {
|
||||
var type = module.GetType ("ComplexPdb.Program");
|
||||
var method = type.GetMethod ("Bar");
|
||||
var debug_info = method.DebugInformation;
|
||||
|
||||
Assert.IsNotNull (debug_info.Scope);
|
||||
|
||||
var import = debug_info.Scope.Import;
|
||||
Assert.IsNotNull (import);
|
||||
|
||||
Assert.IsTrue (import.HasTargets);
|
||||
Assert.AreEqual (6, import.Targets.Count);
|
||||
var target = import.Targets [0];
|
||||
|
||||
Assert.AreEqual (ImportTargetKind.ImportNamespace, target.Kind);
|
||||
Assert.AreEqual ("System", target.Namespace);
|
||||
|
||||
target = import.Targets [1];
|
||||
|
||||
Assert.AreEqual (ImportTargetKind.ImportNamespace, target.Kind);
|
||||
Assert.AreEqual ("System.Collections.Generic", target.Namespace);
|
||||
|
||||
target = import.Targets [2];
|
||||
|
||||
Assert.AreEqual (ImportTargetKind.ImportNamespace, target.Kind);
|
||||
Assert.AreEqual ("System.Threading.Tasks", target.Namespace);
|
||||
|
||||
target = import.Targets [3];
|
||||
|
||||
Assert.AreEqual (ImportTargetKind.ImportType, target.Kind);
|
||||
Assert.AreEqual ("System.Console", target.Type.FullName);
|
||||
|
||||
target = import.Targets [4];
|
||||
|
||||
Assert.AreEqual (ImportTargetKind.DefineTypeAlias, target.Kind);
|
||||
Assert.AreEqual ("Foo1", target.Alias);
|
||||
Assert.AreEqual ("System.Console", target.Type.FullName);
|
||||
|
||||
target = import.Targets [5];
|
||||
|
||||
Assert.AreEqual (ImportTargetKind.DefineNamespaceAlias, target.Kind);
|
||||
Assert.AreEqual ("Foo2", target.Alias);
|
||||
Assert.AreEqual ("System.Reflection", target.Namespace);
|
||||
}, readOnly: Platform.OnMono, symbolReaderProvider: typeof (PdbReaderProvider), symbolWriterProvider: typeof (PdbWriterProvider));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void StateMachineKickOff ()
|
||||
{
|
||||
TestModule ("ComplexPdb.dll", module => {
|
||||
var state_machine = module.GetType ("ComplexPdb.Program/<TestAsync>d__2");
|
||||
var move_next = state_machine.GetMethod ("MoveNext");
|
||||
var symbol = move_next.DebugInformation;
|
||||
|
||||
Assert.IsNotNull (symbol);
|
||||
Assert.IsNotNull (symbol.StateMachineKickOffMethod);
|
||||
Assert.AreEqual ("System.Threading.Tasks.Task ComplexPdb.Program::TestAsync()", symbol.StateMachineKickOffMethod.FullName);
|
||||
}, readOnly: Platform.OnMono, symbolReaderProvider: typeof (PdbReaderProvider), symbolWriterProvider: typeof (PdbWriterProvider));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Iterators ()
|
||||
{
|
||||
TestModule ("ComplexPdb.dll", module => {
|
||||
var state_machine = module.GetType ("ComplexPdb.Program/<TestAsync>d__2");
|
||||
var move_next = state_machine.GetMethod ("MoveNext");
|
||||
|
||||
Assert.IsTrue (move_next.DebugInformation.HasCustomDebugInformations);
|
||||
Assert.AreEqual (2, move_next.DebugInformation.CustomDebugInformations.Count);
|
||||
|
||||
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);
|
||||
|
||||
var async_body = move_next.DebugInformation.CustomDebugInformations [1] as AsyncMethodBodyDebugInformation;
|
||||
Assert.IsNotNull (async_body);
|
||||
Assert.AreEqual (-1, async_body.CatchHandler.Offset);
|
||||
|
||||
Assert.AreEqual (2, async_body.Yields.Count);
|
||||
Assert.AreEqual (68, async_body.Yields [0].Offset);
|
||||
Assert.AreEqual (197, async_body.Yields [1].Offset);
|
||||
|
||||
Assert.AreEqual (2, async_body.Resumes.Count);
|
||||
Assert.AreEqual (98, async_body.Resumes [0].Offset);
|
||||
Assert.AreEqual (227, async_body.Resumes [1].Offset);
|
||||
|
||||
Assert.AreEqual (move_next, async_body.MoveNextMethod);
|
||||
}, readOnly: Platform.OnMono, symbolReaderProvider: typeof (PdbReaderProvider), symbolWriterProvider: typeof (PdbWriterProvider));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void CreateMethodFromScratch ()
|
||||
{
|
||||
|
||||
71
external/linker/cecil/symbols/pdb/Test/Resources/assemblies/ComplexPdb.cs
vendored
Normal file
71
external/linker/cecil/symbols/pdb/Test/Resources/assemblies/ComplexPdb.cs
vendored
Normal file
@@ -0,0 +1,71 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
using static System.Console;
|
||||
using Foo1 = System.Console;
|
||||
using Foo2 = System.Reflection;
|
||||
|
||||
namespace ComplexPdb
|
||||
{
|
||||
public class Program
|
||||
{
|
||||
private static void Foo()
|
||||
{
|
||||
const string s = "const string";
|
||||
const int f = 1;
|
||||
const object o = null;
|
||||
const string u = null;
|
||||
WriteLine(s);
|
||||
WriteLine(2);
|
||||
}
|
||||
|
||||
private static void Bar(int i)
|
||||
{
|
||||
int result;
|
||||
if (i < 0)
|
||||
{
|
||||
int s = 1;
|
||||
result = s;
|
||||
}
|
||||
else
|
||||
{
|
||||
const int b = 12;
|
||||
const decimal c = 74;
|
||||
int s = -1;
|
||||
result = s + b + (int)c;
|
||||
if (result > b)
|
||||
{
|
||||
int u = result * b;
|
||||
Console.WriteLine(u);
|
||||
}
|
||||
}
|
||||
WriteLine(result);
|
||||
}
|
||||
|
||||
public async Task TestAsync()
|
||||
{
|
||||
WriteLine("Hello1");
|
||||
await Task.Delay(100);
|
||||
|
||||
for (int i = 0; i < 4; ++i)
|
||||
{
|
||||
WriteLine("Hello2");
|
||||
await Task.Delay(100);
|
||||
WriteLine("Hello3");
|
||||
}
|
||||
}
|
||||
|
||||
public IEnumerable<string> TestIterator()
|
||||
{
|
||||
WriteLine("Hello1");
|
||||
yield return "Hello1";
|
||||
|
||||
for (int i = 0; i < 4; ++i)
|
||||
{
|
||||
WriteLine("Hello1");
|
||||
yield return "Hello2";
|
||||
WriteLine("Hello3");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
BIN
external/linker/cecil/symbols/pdb/Test/Resources/assemblies/ComplexPdb.pdb
vendored
Normal file
BIN
external/linker/cecil/symbols/pdb/Test/Resources/assemblies/ComplexPdb.pdb
vendored
Normal file
Binary file not shown.
BIN
external/linker/cecil/symbols/pdb/Test/Resources/assemblies/empty-iterator.pdb
vendored
Normal file
BIN
external/linker/cecil/symbols/pdb/Test/Resources/assemblies/empty-iterator.pdb
vendored
Normal file
Binary file not shown.
Reference in New Issue
Block a user