Imported Upstream version 3.6.0

Former-commit-id: da6be194a6b1221998fc28233f2503bd61dd9d14
This commit is contained in:
Jo Shields
2014-08-13 10:39:27 +01:00
commit a575963da9
50588 changed files with 8155799 additions and 0 deletions

4
external/cecil/symbols/mdb/.gitignore vendored Normal file
View File

@@ -0,0 +1,4 @@
bin
obj
*.xml
*.user

View File

@@ -0,0 +1,103 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">net_4_0_Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProductVersion>9.0.30729</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{8559DD7F-A16F-46D0-A05A-9139FAEBA8FD}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Mono.Cecil.Mdb</RootNamespace>
<AssemblyName>Mono.Cecil.Mdb</AssemblyName>
<FileAlignment>512</FileAlignment>
<SignAssembly>true</SignAssembly>
<AssemblyOriginatorKeyFile>..\..\mono.snk</AssemblyOriginatorKeyFile>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'net_2_0_Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>..\..\bin\net_2_0_Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE;CECIL</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<TargetFrameworkVersion>v2.0</TargetFrameworkVersion>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'net_2_0_Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>..\..\bin\net_2_0_Release\</OutputPath>
<DefineConstants>TRACE;CECIL</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<TargetFrameworkVersion>v2.0</TargetFrameworkVersion>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'net_3_5_Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>..\..\bin\net_3_5_Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE;CECIL;NET_3_5</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'net_3_5_Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>..\..\bin\net_3_5_Release\</OutputPath>
<DefineConstants>TRACE;CECIL;NET_3_5</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'net_4_0_Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>..\..\bin\net_4_0_Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE;CECIL;NET_3_5;NET_4_0</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'net_4_0_Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>..\..\bin\net_4_0_Release\</OutputPath>
<DefineConstants>TRACE;CECIL;NET_3_5;NET_4_0</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
</PropertyGroup>
<ItemGroup Condition=" '$(TargetFrameworkVersion)' != 'v2.0' ">
<Reference Include="System.Core" />
</ItemGroup>
<ItemGroup>
<Reference Include="System" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\Mono.Cecil.csproj">
<Project>{D68133BD-1E63-496E-9EDE-4FBDBF77B486}</Project>
<Name>Mono.Cecil</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<Compile Include="Mono.Cecil.Mdb\AssemblyInfo.cs" />
<Compile Include="Mono.Cecil.Mdb\MdbReader.cs" />
<Compile Include="Mono.Cecil.Mdb\MdbWriter.cs" />
<Compile Include="Mono.CompilerServices.SymbolWriter\MonoSymbolFile.cs" />
<Compile Include="Mono.CompilerServices.SymbolWriter\MonoSymbolTable.cs" />
<Compile Include="Mono.CompilerServices.SymbolWriter\MonoSymbolWriter.cs" />
<Compile Include="Mono.CompilerServices.SymbolWriter\SymbolWriterImpl.cs" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>

View File

@@ -0,0 +1,41 @@
//
// AssemblyInfo.cs
//
// Author:
// Jb Evain (jbevain@gmail.com)
//
// Copyright (c) 2008 - 2011 Jb Evain
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System;
using System.Reflection;
using System.Runtime.InteropServices;
[assembly: AssemblyTitle ("Mono.Cecil.Mdb")]
[assembly: AssemblyProduct ("Mono.Cecil")]
[assembly: AssemblyCopyright ("Copyright <20> 2008 - 2011 Jb Evain")]
[assembly: CLSCompliant (false)]
[assembly: ComVisible (false)]
[assembly: AssemblyVersion ("0.9.5.0")]
[assembly: AssemblyFileVersion ("0.9.5.0")]

View File

@@ -0,0 +1,222 @@
//
// MdbReader.cs
//
// Author:
// Jb Evain (jbevain@gmail.com)
//
// Copyright (c) 2008 - 2011 Jb Evain
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System;
using System.Collections.Generic;
using System.IO;
using Mono.Cecil.Cil;
using Mono.Collections.Generic;
using Mono.CompilerServices.SymbolWriter;
namespace Mono.Cecil.Mdb {
public class MdbReaderProvider : ISymbolReaderProvider {
public ISymbolReader GetSymbolReader (ModuleDefinition module, string fileName)
{
return new MdbReader (module, MonoSymbolFile.ReadSymbolFile (module, fileName));
}
public ISymbolReader GetSymbolReader (ModuleDefinition module, Stream symbolStream)
{
throw new NotImplementedException ();
}
}
public class MdbReader : ISymbolReader {
readonly ModuleDefinition module;
readonly MonoSymbolFile symbol_file;
readonly Dictionary<string, Document> documents;
public MdbReader (ModuleDefinition module, MonoSymbolFile symFile)
{
this.module = module;
this.symbol_file = symFile;
this.documents = new Dictionary<string, Document> ();
}
public bool ProcessDebugHeader (ImageDebugDirectory directory, byte [] header)
{
return symbol_file.Guid == module.Mvid;
}
public void Read (MethodBody body, InstructionMapper mapper)
{
var method_token = body.Method.MetadataToken;
var entry = symbol_file.GetMethodByToken (method_token.ToInt32 ());
if (entry == null)
return;
var scopes = ReadScopes (entry, body, mapper);
ReadLineNumbers (entry, mapper);
ReadLocalVariables (entry, body, scopes);
}
static void ReadLocalVariables (MethodEntry entry, MethodBody body, Scope [] scopes)
{
var locals = entry.GetLocals ();
foreach (var local in locals) {
if (local.Index < 0 || local.Index >= body.Variables.Count) // Mono 2.6 emits wrong local infos for iterators
continue;
var variable = body.Variables [local.Index];
variable.Name = local.Name;
var index = local.BlockIndex;
if (index < 0 || index >= scopes.Length)
continue;
var scope = scopes [index];
if (scope == null)
continue;
scope.Variables.Add (variable);
}
}
void ReadLineNumbers (MethodEntry entry, InstructionMapper mapper)
{
Document document = null;
var table = entry.GetLineNumberTable ();
foreach (var line in table.LineNumbers) {
var instruction = mapper (line.Offset);
if (instruction == null)
continue;
if (document == null)
document = GetDocument (entry.CompileUnit.SourceFile);
instruction.SequencePoint = new SequencePoint (document) {
StartLine = line.Row,
EndLine = line.Row,
};
}
}
Document GetDocument (SourceFileEntry file)
{
var file_name = file.FileName;
Document document;
if (documents.TryGetValue (file_name, out document))
return document;
document = new Document (file_name);
documents.Add (file_name, document);
return document;
}
static Scope [] ReadScopes (MethodEntry entry, MethodBody body, InstructionMapper mapper)
{
var blocks = entry.GetCodeBlocks ();
var scopes = new Scope [blocks.Length];
foreach (var block in blocks) {
if (block.BlockType != CodeBlockEntry.Type.Lexical)
continue;
var scope = new Scope ();
scope.Start = mapper (block.StartOffset);
scope.End = mapper (block.EndOffset);
scopes [block.Index] = scope;
if (body.Scope == null)
body.Scope = scope;
if (!AddScope (body.Scope, scope))
body.Scope = scope;
}
return scopes;
}
static bool AddScope (Scope provider, Scope scope)
{
foreach (var sub_scope in provider.Scopes) {
if (AddScope (sub_scope, 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;
}
public void Read (MethodSymbols symbols)
{
var entry = symbol_file.GetMethodByToken (symbols.MethodToken.ToInt32 ());
if (entry == null)
return;
ReadLineNumbers (entry, symbols);
ReadLocalVariables (entry, symbols);
}
void ReadLineNumbers (MethodEntry entry, MethodSymbols symbols)
{
var table = entry.GetLineNumberTable ();
var lines = table.LineNumbers;
var instructions = symbols.instructions = new Collection<InstructionSymbol> (lines.Length);
for (int i = 0; i < lines.Length; i++) {
var line = lines [i];
instructions.Add (new InstructionSymbol (line.Offset, new SequencePoint (GetDocument (entry.CompileUnit.SourceFile)) {
StartLine = line.Row,
EndLine = line.Row,
}));
}
}
static void ReadLocalVariables (MethodEntry entry, MethodSymbols symbols)
{
foreach (var local in entry.GetLocals ()) {
if (local.Index < 0 || local.Index >= symbols.Variables.Count) // Mono 2.6 emits wrong local infos for iterators
continue;
var variable = symbols.Variables [local.Index];
variable.Name = local.Name;
}
}
public void Dispose ()
{
symbol_file.Dispose ();
}
}
}

View File

@@ -0,0 +1,251 @@
//
// MdbWriter.cs
//
// Author:
// Jb Evain (jbevain@gmail.com)
//
// Copyright (c) 2008 - 2011 Jb Evain
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System;
using System.Collections.Generic;
using System.IO;
using Mono.Cecil.Cil;
using Mono.Collections.Generic;
using Mono.CompilerServices.SymbolWriter;
namespace Mono.Cecil.Mdb {
#if !READ_ONLY
public class MdbWriterProvider : ISymbolWriterProvider {
public ISymbolWriter GetSymbolWriter (ModuleDefinition module, string fileName)
{
return new MdbWriter (module.Mvid, fileName);
}
public ISymbolWriter GetSymbolWriter (ModuleDefinition module, Stream symbolStream)
{
throw new NotImplementedException ();
}
}
public class MdbWriter : ISymbolWriter {
readonly Guid mvid;
readonly MonoSymbolWriter writer;
readonly Dictionary<string, SourceFile> source_files;
public MdbWriter (Guid mvid, string assembly)
{
this.mvid = mvid;
this.writer = new MonoSymbolWriter (assembly);
this.source_files = new Dictionary<string, SourceFile> ();
}
static Collection<Instruction> GetInstructions (MethodBody body)
{
var instructions = new Collection<Instruction> ();
foreach (var instruction in body.Instructions)
if (instruction.SequencePoint != null)
instructions.Add (instruction);
return instructions;
}
SourceFile GetSourceFile (Document document)
{
var url = document.Url;
SourceFile source_file;
if (source_files.TryGetValue (url, out source_file))
return source_file;
var entry = writer.DefineDocument (url);
var compile_unit = writer.DefineCompilationUnit (entry);
source_file = new SourceFile (compile_unit, entry);
source_files.Add (url, source_file);
return source_file;
}
void Populate (Collection<Instruction> instructions, int [] offsets,
int [] startRows, int [] startCols, out SourceFile file)
{
SourceFile source_file = null;
for (int i = 0; i < instructions.Count; i++) {
var instruction = instructions [i];
offsets [i] = instruction.Offset;
var sequence_point = instruction.SequencePoint;
if (source_file == null)
source_file = GetSourceFile (sequence_point.Document);
startRows [i] = sequence_point.StartLine;
startCols [i] = sequence_point.StartColumn;
}
file = source_file;
}
public void Write (MethodBody body)
{
var method = new SourceMethod (body.Method);
var instructions = GetInstructions (body);
int count = instructions.Count;
if (count == 0)
return;
var offsets = new int [count];
var start_rows = new int [count];
var start_cols = new int [count];
SourceFile file;
Populate (instructions, offsets, start_rows, start_cols, out file);
var builder = writer.OpenMethod (file.CompilationUnit, 0, method);
for (int i = 0; i < count; i++)
builder.MarkSequencePoint (
offsets [i],
file.CompilationUnit.SourceFile,
start_rows [i],
start_cols [i],
false);
if (body.HasVariables)
AddVariables (body.Variables);
writer.CloseMethod ();
}
readonly static byte [] empty_header = new byte [0];
public bool GetDebugHeader (out ImageDebugDirectory directory, out byte [] header)
{
directory = new ImageDebugDirectory ();
header = empty_header;
return false;
}
void AddVariables (IList<VariableDefinition> variables)
{
for (int i = 0; i < variables.Count; i++) {
var variable = variables [i];
writer.DefineLocalVariable (i, variable.Name);
}
}
public void Write (MethodSymbols symbols)
{
var method = new SourceMethodSymbol (symbols);
var file = GetSourceFile (symbols.Instructions [0].SequencePoint.Document);
var builder = writer.OpenMethod (file.CompilationUnit, 0, method);
var count = symbols.Instructions.Count;
for (int i = 0; i < count; i++) {
var instruction = symbols.Instructions [i];
var sequence_point = instruction.SequencePoint;
builder.MarkSequencePoint (
instruction.Offset,
GetSourceFile (sequence_point.Document).CompilationUnit.SourceFile,
sequence_point.StartLine,
sequence_point.EndLine,
false);
}
if (symbols.HasVariables)
AddVariables (symbols.Variables);
writer.CloseMethod ();
}
public void Dispose ()
{
writer.WriteSymbolFile (mvid);
}
class SourceFile : ISourceFile {
readonly CompileUnitEntry compilation_unit;
readonly SourceFileEntry entry;
public SourceFileEntry Entry {
get { return entry; }
}
public CompileUnitEntry CompilationUnit {
get { return compilation_unit; }
}
public SourceFile (CompileUnitEntry comp_unit, SourceFileEntry entry)
{
this.compilation_unit = comp_unit;
this.entry = entry;
}
}
class SourceMethodSymbol : IMethodDef {
readonly string name;
readonly int token;
public string Name {
get { return name;}
}
public int Token {
get { return token; }
}
public SourceMethodSymbol (MethodSymbols symbols)
{
name = symbols.MethodName;
token = symbols.MethodToken.ToInt32 ();
}
}
class SourceMethod : IMethodDef {
readonly MethodDefinition method;
public string Name {
get { return method.Name; }
}
public int Token {
get { return method.MetadataToken.ToInt32 (); }
}
public SourceMethod (MethodDefinition method)
{
this.method = method;
}
}
}
#endif
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,403 @@
//
// Mono.CSharp.Debugger/MonoSymbolWriter.cs
//
// Author:
// Martin Baulig (martin@ximian.com)
//
// This is the default implementation of the System.Diagnostics.SymbolStore.ISymbolWriter
// interface.
//
// (C) 2002 Ximian, Inc. http://www.ximian.com
//
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System;
using System.Runtime.CompilerServices;
using System.Collections.Generic;
using System.IO;
namespace Mono.CompilerServices.SymbolWriter
{
public class MonoSymbolWriter
{
List<SourceMethodBuilder> methods;
List<SourceFileEntry> sources;
List<CompileUnitEntry> comp_units;
protected readonly MonoSymbolFile file;
string filename;
private SourceMethodBuilder current_method;
#if NET_2_1
System.Collections.Stack current_method_stack = new System.Collections.Stack ();
#else
Stack<SourceMethodBuilder> current_method_stack = new Stack<SourceMethodBuilder> ();
#endif
public MonoSymbolWriter (string filename)
{
this.methods = new List<SourceMethodBuilder> ();
this.sources = new List<SourceFileEntry> ();
this.comp_units = new List<CompileUnitEntry> ();
this.file = new MonoSymbolFile ();
this.filename = filename + ".mdb";
}
public MonoSymbolFile SymbolFile {
get { return file; }
}
public void CloseNamespace ()
{ }
public void DefineLocalVariable (int index, string name)
{
if (current_method == null)
return;
current_method.AddLocal (index, name);
}
public void DefineCapturedLocal (int scope_id, string name, string captured_name)
{
file.DefineCapturedVariable (scope_id, name, captured_name,
CapturedVariable.CapturedKind.Local);
}
public void DefineCapturedParameter (int scope_id, string name, string captured_name)
{
file.DefineCapturedVariable (scope_id, name, captured_name,
CapturedVariable.CapturedKind.Parameter);
}
public void DefineCapturedThis (int scope_id, string captured_name)
{
file.DefineCapturedVariable (scope_id, "this", captured_name,
CapturedVariable.CapturedKind.This);
}
public void DefineCapturedScope (int scope_id, int id, string captured_name)
{
file.DefineCapturedScope (scope_id, id, captured_name);
}
public void DefineScopeVariable (int scope, int index)
{
if (current_method == null)
return;
current_method.AddScopeVariable (scope, index);
}
public void MarkSequencePoint (int offset, SourceFileEntry file, int line, int column,
bool is_hidden)
{
if (current_method == null)
return;
current_method.MarkSequencePoint (offset, file, line, column, is_hidden);
}
public SourceMethodBuilder OpenMethod (ICompileUnit file, int ns_id, IMethodDef method)
{
SourceMethodBuilder builder = new SourceMethodBuilder (file, ns_id, method);
current_method_stack.Push (current_method);
current_method = builder;
methods.Add (current_method);
return builder;
}
public void CloseMethod ()
{
current_method = (SourceMethodBuilder) current_method_stack.Pop ();
}
public SourceFileEntry DefineDocument (string url)
{
SourceFileEntry entry = new SourceFileEntry (file, url);
sources.Add (entry);
return entry;
}
public SourceFileEntry DefineDocument (string url, byte[] guid, byte[] checksum)
{
SourceFileEntry entry = new SourceFileEntry (file, url, guid, checksum);
sources.Add (entry);
return entry;
}
public CompileUnitEntry DefineCompilationUnit (SourceFileEntry source)
{
CompileUnitEntry entry = new CompileUnitEntry (file, source);
comp_units.Add (entry);
return entry;
}
public int DefineNamespace (string name, CompileUnitEntry unit,
string[] using_clauses, int parent)
{
if ((unit == null) || (using_clauses == null))
throw new NullReferenceException ();
return unit.DefineNamespace (name, using_clauses, parent);
}
public int OpenScope (int start_offset)
{
if (current_method == null)
return 0;
current_method.StartBlock (CodeBlockEntry.Type.Lexical, start_offset);
return 0;
}
public void CloseScope (int end_offset)
{
if (current_method == null)
return;
current_method.EndBlock (end_offset);
}
public void OpenCompilerGeneratedBlock (int start_offset)
{
if (current_method == null)
return;
current_method.StartBlock (CodeBlockEntry.Type.CompilerGenerated,
start_offset);
}
public void CloseCompilerGeneratedBlock (int end_offset)
{
if (current_method == null)
return;
current_method.EndBlock (end_offset);
}
public void StartIteratorBody (int start_offset)
{
current_method.StartBlock (CodeBlockEntry.Type.IteratorBody,
start_offset);
}
public void EndIteratorBody (int end_offset)
{
current_method.EndBlock (end_offset);
}
public void StartIteratorDispatcher (int start_offset)
{
current_method.StartBlock (CodeBlockEntry.Type.IteratorDispatcher,
start_offset);
}
public void EndIteratorDispatcher (int end_offset)
{
current_method.EndBlock (end_offset);
}
public void DefineAnonymousScope (int id)
{
file.DefineAnonymousScope (id);
}
public void WriteSymbolFile (Guid guid)
{
foreach (SourceMethodBuilder method in methods)
method.DefineMethod (file);
try {
// We mmap the file, so unlink the previous version since it may be in use
File.Delete (filename);
} catch {
// We can safely ignore
}
using (FileStream fs = new FileStream (filename, FileMode.Create, FileAccess.Write)) {
file.CreateSymbolFile (guid, fs);
}
}
}
public class SourceMethodBuilder
{
List<LocalVariableEntry> _locals;
List<CodeBlockEntry> _blocks;
List<ScopeVariable> _scope_vars;
#if NET_2_1
System.Collections.Stack _block_stack;
#else
Stack<CodeBlockEntry> _block_stack;
#endif
string _real_name;
IMethodDef _method;
ICompileUnit _comp_unit;
// MethodEntry.Flags _method_flags;
int _ns_id;
public SourceMethodBuilder (ICompileUnit comp_unit, int ns_id, IMethodDef method)
{
this._comp_unit = comp_unit;
this._method = method;
this._ns_id = ns_id;
method_lines = new LineNumberEntry [32];
}
private LineNumberEntry [] method_lines;
private int method_lines_pos = 0;
public void MarkSequencePoint (int offset, SourceFileEntry file, int line, int column,
bool is_hidden)
{
if (method_lines_pos == method_lines.Length) {
LineNumberEntry [] tmp = method_lines;
method_lines = new LineNumberEntry [method_lines.Length * 2];
Array.Copy (tmp, method_lines, method_lines_pos);
}
int file_idx = file != null ? file.Index : 0;
method_lines [method_lines_pos++] = new LineNumberEntry (
file_idx, line, offset, is_hidden);
}
public void StartBlock (CodeBlockEntry.Type type, int start_offset)
{
if (_block_stack == null) {
#if NET_2_1
_block_stack = new System.Collections.Stack ();
#else
_block_stack = new Stack<CodeBlockEntry> ();
#endif
}
if (_blocks == null)
_blocks = new List<CodeBlockEntry> ();
int parent = CurrentBlock != null ? CurrentBlock.Index : -1;
CodeBlockEntry block = new CodeBlockEntry (
_blocks.Count + 1, parent, type, start_offset);
_block_stack.Push (block);
_blocks.Add (block);
}
public void EndBlock (int end_offset)
{
CodeBlockEntry block = (CodeBlockEntry) _block_stack.Pop ();
block.Close (end_offset);
}
public CodeBlockEntry[] Blocks {
get {
if (_blocks == null)
return new CodeBlockEntry [0];
CodeBlockEntry[] retval = new CodeBlockEntry [_blocks.Count];
_blocks.CopyTo (retval, 0);
return retval;
}
}
public CodeBlockEntry CurrentBlock {
get {
if ((_block_stack != null) && (_block_stack.Count > 0))
return (CodeBlockEntry) _block_stack.Peek ();
else
return null;
}
}
public LocalVariableEntry[] Locals {
get {
if (_locals == null)
return new LocalVariableEntry [0];
else {
LocalVariableEntry[] retval =
new LocalVariableEntry [_locals.Count];
_locals.CopyTo (retval, 0);
return retval;
}
}
}
public void AddLocal (int index, string name)
{
if (_locals == null)
_locals = new List<LocalVariableEntry> ();
int block_idx = CurrentBlock != null ? CurrentBlock.Index : 0;
_locals.Add (new LocalVariableEntry (index, name, block_idx));
}
public ScopeVariable[] ScopeVariables {
get {
if (_scope_vars == null)
return new ScopeVariable [0];
ScopeVariable[] retval = new ScopeVariable [_scope_vars.Count];
_scope_vars.CopyTo (retval);
return retval;
}
}
public void AddScopeVariable (int scope, int index)
{
if (_scope_vars == null)
_scope_vars = new List<ScopeVariable> ();
_scope_vars.Add (
new ScopeVariable (scope, index));
}
public string RealMethodName {
get { return _real_name; }
}
public void SetRealMethodName (string name)
{
_real_name = name;
}
public ICompileUnit SourceFile {
get { return _comp_unit; }
}
public IMethodDef Method {
get { return _method; }
}
public void DefineMethod (MonoSymbolFile file)
{
LineNumberEntry[] lines = new LineNumberEntry [method_lines_pos];
Array.Copy (method_lines, lines, method_lines_pos);
MethodEntry entry = new MethodEntry (
file, _comp_unit.Entry, _method.Token, ScopeVariables,
Locals, lines, Blocks, RealMethodName, 0, //_method_flags,
_ns_id);
file.AddMethod (entry);
}
}
}

View File

@@ -0,0 +1,349 @@
//
// SymbolWriterImpl.cs
//
// Author:
// Lluis Sanchez Gual (lluis@novell.com)
//
// (C) 2005 Novell, Inc. http://www.novell.com
//
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System;
using System.Reflection;
using System.Reflection.Emit;
using System.Runtime.CompilerServices;
using System.Collections;
using System.IO;
using System.Diagnostics.SymbolStore;
namespace Mono.CompilerServices.SymbolWriter
{
public class SymbolWriterImpl: ISymbolWriter
{
MonoSymbolWriter msw;
int nextLocalIndex;
int currentToken;
string methodName;
Stack namespaceStack = new Stack ();
bool methodOpened;
Hashtable documents = new Hashtable ();
#if !CECIL
ModuleBuilder mb;
delegate Guid GetGuidFunc (ModuleBuilder mb);
GetGuidFunc get_guid_func;
public SymbolWriterImpl (ModuleBuilder mb)
{
this.mb = mb;
}
public void Close ()
{
MethodInfo mi = typeof (ModuleBuilder).GetMethod (
"Mono_GetGuid",
BindingFlags.Static | BindingFlags.NonPublic);
if (mi == null)
return;
get_guid_func = (GetGuidFunc) System.Delegate.CreateDelegate (
typeof (GetGuidFunc), mi);
msw.WriteSymbolFile (get_guid_func (mb));
}
#else
Guid guid;
public SymbolWriterImpl (Guid guid)
{
this.guid = guid;
}
public void Close ()
{
msw.WriteSymbolFile (guid);
}
#endif
public void CloseMethod ()
{
if (methodOpened) {
methodOpened = false;
nextLocalIndex = 0;
msw.CloseMethod ();
}
}
public void CloseNamespace ()
{
namespaceStack.Pop ();
msw.CloseNamespace ();
}
public void CloseScope (int endOffset)
{
msw.CloseScope (endOffset);
}
public ISymbolDocumentWriter DefineDocument (
string url,
Guid language,
Guid languageVendor,
Guid documentType)
{
SymbolDocumentWriterImpl doc = (SymbolDocumentWriterImpl) documents [url];
if (doc == null) {
SourceFileEntry entry = msw.DefineDocument (url);
CompileUnitEntry comp_unit = msw.DefineCompilationUnit (entry);
doc = new SymbolDocumentWriterImpl (comp_unit);
documents [url] = doc;
}
return doc;
}
public void DefineField (
SymbolToken parent,
string name,
FieldAttributes attributes,
byte[] signature,
SymAddressKind addrKind,
int addr1,
int addr2,
int addr3)
{
}
public void DefineGlobalVariable (
string name,
FieldAttributes attributes,
byte[] signature,
SymAddressKind addrKind,
int addr1,
int addr2,
int addr3)
{
}
public void DefineLocalVariable (
string name,
FieldAttributes attributes,
byte[] signature,
SymAddressKind addrKind,
int addr1,
int addr2,
int addr3,
int startOffset,
int endOffset)
{
msw.DefineLocalVariable (nextLocalIndex++, name);
}
public void DefineParameter (
string name,
ParameterAttributes attributes,
int sequence,
SymAddressKind addrKind,
int addr1,
int addr2,
int addr3)
{
}
public void DefineSequencePoints (
ISymbolDocumentWriter document,
int[] offsets,
int[] lines,
int[] columns,
int[] endLines,
int[] endColumns)
{
SymbolDocumentWriterImpl doc = (SymbolDocumentWriterImpl) document;
SourceFileEntry file = doc != null ? doc.Entry.SourceFile : null;
for (int n=0; n<offsets.Length; n++) {
if (n > 0 && offsets[n] == offsets[n-1] && lines[n] == lines[n-1] && columns[n] == columns[n-1])
continue;
msw.MarkSequencePoint (offsets[n], file, lines[n], columns[n], false);
}
}
public void Initialize (IntPtr emitter, string filename, bool fFullBuild)
{
msw = new MonoSymbolWriter (filename);
}
public void OpenMethod (SymbolToken method)
{
currentToken = method.GetToken ();
}
public void OpenNamespace (string name)
{
NamespaceInfo n = new NamespaceInfo ();
n.NamespaceID = -1;
n.Name = name;
namespaceStack.Push (n);
}
public int OpenScope (int startOffset)
{
return msw.OpenScope (startOffset);
}
public void SetMethodSourceRange (
ISymbolDocumentWriter startDoc,
int startLine,
int startColumn,
ISymbolDocumentWriter endDoc,
int endLine,
int endColumn)
{
int nsId = GetCurrentNamespace (startDoc);
SourceMethodImpl sm = new SourceMethodImpl (methodName, currentToken, nsId);
msw.OpenMethod (((ICompileUnit)startDoc).Entry, nsId, sm);
methodOpened = true;
}
public void SetScopeRange (int scopeID, int startOffset, int endOffset)
{
}
public void SetSymAttribute (SymbolToken parent, string name, byte[] data)
{
// This is a hack! but MonoSymbolWriter needs the method name
// and ISymbolWriter does not have any method for providing it
if (name == "__name")
methodName = System.Text.Encoding.UTF8.GetString (data);
}
public void SetUnderlyingWriter (IntPtr underlyingWriter)
{
}
public void SetUserEntryPoint (SymbolToken entryMethod)
{
}
public void UsingNamespace (string fullName)
{
if (namespaceStack.Count == 0) {
OpenNamespace ("");
}
NamespaceInfo ni = (NamespaceInfo) namespaceStack.Peek ();
if (ni.NamespaceID != -1) {
NamespaceInfo old = ni;
CloseNamespace ();
OpenNamespace (old.Name);
ni = (NamespaceInfo) namespaceStack.Peek ();
ni.UsingClauses = old.UsingClauses;
}
ni.UsingClauses.Add (fullName);
}
int GetCurrentNamespace (ISymbolDocumentWriter doc)
{
if (namespaceStack.Count == 0) {
OpenNamespace ("");
}
NamespaceInfo ni = (NamespaceInfo) namespaceStack.Peek ();
if (ni.NamespaceID == -1)
{
string[] usings = (string[]) ni.UsingClauses.ToArray (typeof(string));
int parentId = 0;
if (namespaceStack.Count > 1) {
namespaceStack.Pop ();
parentId = ((NamespaceInfo) namespaceStack.Peek ()).NamespaceID;
namespaceStack.Push (ni);
}
ni.NamespaceID = msw.DefineNamespace (ni.Name, ((ICompileUnit)doc).Entry, usings, parentId);
}
return ni.NamespaceID;
}
}
class SymbolDocumentWriterImpl: ISymbolDocumentWriter, ISourceFile, ICompileUnit
{
CompileUnitEntry comp_unit;
public SymbolDocumentWriterImpl (CompileUnitEntry comp_unit)
{
this.comp_unit = comp_unit;
}
public void SetCheckSum (Guid algorithmId, byte[] checkSum)
{
}
public void SetSource (byte[] source)
{
}
SourceFileEntry ISourceFile.Entry {
get { return comp_unit.SourceFile; }
}
public CompileUnitEntry Entry {
get { return comp_unit; }
}
}
class SourceMethodImpl: IMethodDef
{
string name;
int token;
int namespaceID;
public SourceMethodImpl (string name, int token, int namespaceID)
{
this.name = name;
this.token = token;
this.namespaceID = namespaceID;
}
public string Name {
get { return name; }
}
public int NamespaceID {
get { return namespaceID; }
}
public int Token {
get { return token; }
}
}
class NamespaceInfo
{
public string Name;
public int NamespaceID;
public ArrayList UsingClauses = new ArrayList ();
}
}

View File

@@ -0,0 +1,4 @@
bin
obj
*.xml
*.user

View File

@@ -0,0 +1,119 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">net_4_0_Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProductVersion>9.0.30729</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{AC71DF9C-99FA-4A63-990A-66C8010355A6}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Mono.Cecil.Mdb.Tests</RootNamespace>
<AssemblyName>Mono.Cecil.Mdb.Tests</AssemblyName>
<FileAlignment>512</FileAlignment>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'net_2_0_Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\net_2_0_Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<TargetFrameworkVersion>v2.0</TargetFrameworkVersion>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'net_2_0_Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\net_2_0_Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<TargetFrameworkVersion>v2.0</TargetFrameworkVersion>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'net_3_5_Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\net_3_5_Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE;NET_3_5</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'net_3_5_Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\net_3_5_Release\</OutputPath>
<DefineConstants>TRACE;NET_3_5</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'net_4_0_Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\net_4_0_Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE;NET_3_5;NET_4_0</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'net_4_0_Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\net_4_0_Release\</OutputPath>
<DefineConstants>TRACE;NET_3_5;NET_4_0</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
</PropertyGroup>
<ItemGroup Condition=" '$(TargetFrameworkVersion)' != 'v2.0' ">
<Reference Include="System.Core" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\..\Mono.Cecil.csproj">
<Project>{D68133BD-1E63-496E-9EDE-4FBDBF77B486}</Project>
<Name>Mono.Cecil</Name>
</ProjectReference>
<ProjectReference Include="..\..\..\Test\Mono.Cecil.Tests.csproj">
<Project>{A47B1F49-A81A-43E8-BE6B-DD28AF2C4055}</Project>
<Name>Mono.Cecil.Tests</Name>
</ProjectReference>
<ProjectReference Include="..\Mono.Cecil.Mdb.csproj">
<Project>{8559DD7F-A16F-46D0-A05A-9139FAEBA8FD}</Project>
<Name>Mono.Cecil.Mdb</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<Compile Include="Mono.Cecil.Tests\Addin.cs" />
<Compile Include="Mono.Cecil.Tests\MdbTests.cs" />
</ItemGroup>
<ItemGroup>
<Content Include="Resources\assemblies\hello.exe" />
<Content Include="Resources\assemblies\hello.exe.mdb" />
</ItemGroup>
<ItemGroup>
<Reference Include="nunit.core">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\Test\libs\nunit-2.6.2\nunit.core.dll</HintPath>
</Reference>
<Reference Include="nunit.core.interfaces">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\Test\libs\nunit-2.6.2\nunit.core.interfaces.dll</HintPath>
</Reference>
<Reference Include="nunit.framework">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\Test\libs\nunit-2.6.2\nunit.framework.dll</HintPath>
</Reference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>

View File

@@ -0,0 +1,8 @@
using NUnit.Core.Extensibility;
namespace Mono.Cecil.Tests {
[NUnitAddin]
public class CecilMdbAddin : CecilTestAddin {
}
}

View File

@@ -0,0 +1,58 @@
using Mono.Cecil.Mdb;
using NUnit.Framework;
namespace Mono.Cecil.Tests {
[TestFixture]
public class MdbTests : BaseTestFixture {
[TestModule ("hello.exe", SymbolReaderProvider = typeof (MdbReaderProvider), SymbolWriterProvider = typeof (MdbWriterProvider))]
public void Main (ModuleDefinition module)
{
var type = module.GetType ("Program");
var main = type.GetMethod ("Main");
AssertCode (@"
.locals init (System.Int32 i)
.line 7,7:0,0 'C:\sources\cecil\symbols\Mono.Cecil.Mdb\Test\Resources\assemblies\hello.cs'
IL_0000: ldc.i4.0
IL_0001: stloc.0
.line 7,7:0,0 'C:\sources\cecil\symbols\Mono.Cecil.Mdb\Test\Resources\assemblies\hello.cs'
IL_0002: br IL_0013
.line 8,8:0,0 'C:\sources\cecil\symbols\Mono.Cecil.Mdb\Test\Resources\assemblies\hello.cs'
IL_0007: ldarg.0
IL_0008: ldloc.0
IL_0009: ldelem.ref
IL_000a: call System.Void Program::Print(System.String)
.line 7,7:0,0 'C:\sources\cecil\symbols\Mono.Cecil.Mdb\Test\Resources\assemblies\hello.cs'
IL_000f: ldloc.0
IL_0010: ldc.i4.1
IL_0011: add
IL_0012: stloc.0
IL_0013: ldloc.0
IL_0014: ldarg.0
IL_0015: ldlen
IL_0016: conv.i4
IL_0017: blt IL_0007
.line 10,10:0,0 'C:\sources\cecil\symbols\Mono.Cecil.Mdb\Test\Resources\assemblies\hello.cs'
IL_001c: ldc.i4.0
IL_001d: ret
", main);
}
static void AssertCode (string expected, MethodDefinition method)
{
Assert.IsTrue (method.HasBody);
Assert.IsNotNull (method.Body);
Assert.AreEqual (Normalize (expected), Normalize (Formatter.FormatMethodBody (method)));
}
static string Normalize (string str)
{
return str.Trim ().Replace ("\r\n", "\n");
}
}
}

Binary file not shown.

Binary file not shown.