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

568
mcs/tools/ChangeLog Normal file

File diff suppressed because it is too large Load Diff

81
mcs/tools/Makefile Normal file
View File

@@ -0,0 +1,81 @@
thisdir = tools
per_profile_dirs = \
al \
linker \
tuner \
culevel \
genxs \
mkbundle \
monop \
mono-service \
mono-xsd \
resgen \
gacutil \
wsdl \
xbuild
net_4_0_dirs := \
$(per_profile_dirs) \
csharp \
corcompare \
compiler-tester \
mono-xmltool \
mono-shlib-cop \
sgen \
mconfig \
installutil \
nunitreport \
pdb2mdb \
sqlsharp \
sqlmetal \
svcutil \
ictool \
disco \
soapsuds \
browsercaps-updater \
cil-strip \
macpack \
dtd2rng \
dtd2xsd \
mdoc \
mod \
installvst \
lc \
mono-configuration-crypto \
ccrewrite \
cccheck \
security \
mdbrebase \
ikdasm
net_2_0_dirs := \
$(per_profile_dirs)
build_SUBDIRS = gacutil security culevel
net_2_0_SUBDIRS := $(basic_SUBDIRS) $(net_2_0_dirs)
net_4_0_SUBDIRS := $(net_4_0_dirs) $(basic_SUBDIRS)
net_4_5_SUBDIRS := $(net_4_0_SUBDIRS)
SUBDIRS = $(basic_SUBDIRS) $(net_2_0_SUBDIRS)
DIST_SUBDIRS = $(SUBDIRS) $(net_4_0_dirs)
include ../build/rules.make
DISTFILES = \
assemblies.xml \
mono-win32-setup-dark.bmp \
mono-win32-setup-light.bmp \
mono-win32-setup.nsi \
scan-tests.pl \
tinderbox/smtp.c \
tinderbox/tinderbox.sh \
removecomments.sh
test-local csproj-local run-test-local run-test-ondotnet-local all-local install-local uninstall-local doc-update-local:
@:
dist-local: dist-default
clean-local:
rm -f *.exe *.dll *.pdb cormissing.xml

879
mcs/tools/al/Al.cs Normal file

File diff suppressed because it is too large Load Diff

75
mcs/tools/al/ChangeLog Normal file
View File

@@ -0,0 +1,75 @@
2007-08-23 Gert Driesen <drieseng@users.sourceforge.net>
* Al.cs: Ignore AssemblyKeyAttribute in template when KeyFile is null
or a zero-length string. Ignore AssemblyKeyNameAtribute in template
when KeyName is null or a zero-length string. Fixes bug #82550.
2007-01-15 Gert Driesen <drieseng@users.sourceforge.net>
* Al.cs: Use DelaySign enum to capture whether a delaysign (+ or -)
option was specified, and what value was set. This was necessary to
make a distinction between leaving the default value (possibly
obtained from a template assembly), and explicitly turned delay signing
off. Removed unused IsStrongName method. Added support for absolute
paths for modules on unix (borrowed from mcs). Previously absolute
paths where reported as unrecognized command line options. Only add
AssemblyDelaySignAttribute, AssemblyKeyFileAttribute and
AssemblyKeyNameAttribute on 1.0 profile. Do not add an
AssemblyCultureAttribute if culture is specified, instead set the
culture on the AssemblyName. When template is not an absolute path,
then consider it to relative to the current directory. Removed unused
AddResource method. Do not require template to be strongly signed;
although MSDN states this, MS does not enforce this (and it should not).
Template option take a file name, not an assembly name. Fixed bug
#80440. When a template is set, use the keyfile specified in
AssemblyKeyFileAttribute of that template to sign the assembly (unless
overridden by /keyfile option). Same goes for AssemblyDelaySignAttribute
and AssemblyKeyNameAttribute.
2007-01-12 Gert Driesen <drieseng@users.sourceforge.net>
* Makefile: Make profile-specific.
(CLEAN_FILES): Add 'al.exe' and 'al.exe.mdb'.
2005-08-01 Carlos Alberto Cortez <calberto.cortez@gmail.com>
* Al.cs: Use AssemblyBuilder.AddResourceFile instead of
AddResourceFile when linkin to a resource, just as .NET
does.
2005-07-08 Zoltan Varga <vargaz@freemail.hu>
* Al.cs: Applied patch from Sridhar Kulkarni (sridharkulkarni@msn.com).
Implement /template option. Fixes #74814.
2005-06-14 Sebastien Pouliot <sebastien@ximian.com>
* Al.cs: Added support for signing/delay-signing/ecma-delay-signing.
* Makefile: Added dependency on Mono.Security.dll for CryptoConvert.
2005-03-01 Zoltan Varga <vargaz@freemail.hu>
* Al.cs: Applied patch from Gert Driesen (gert.driesen@pandora.be).
Fixes #72274.
* Al.cs: Algid and Flags should be specified in hexadecimal. Fixes
#72282.
2005-01-30 Zoltan Varga <vargaz@freemail.hu>
* Al.cs: Fix spitting of newlines.
* Al.cs: Add support for response files. Fixes #71949.
2004-03-15 Zoltan Varga <vargaz@freemail.hu>
* Al.cs: Avoid crash if entryPoint is not defined.
2004-01-16 Atsushi Enomoto <atsushi@ximian.com>
* Al.cs : csc build fix. See bugzilla #47991.
2004-01-15 Zoltan Varga <vargaz@freemail.hu>
* Al.cs Makefile ChangeLog al.exe.sources: New files.

10
mcs/tools/al/Makefile Normal file
View File

@@ -0,0 +1,10 @@
thisdir = tools/al
SUBDIRS =
include ../../build/rules.make
LOCAL_MCS_FLAGS = -r:Mono.Security.dll
PROGRAM = al.exe
CLEAN_FILES = al.exe al.exe.mdb
include ../../build/executable.make

View File

@@ -0,0 +1,2 @@
Al.cs
../../build/common/Consts.cs

21
mcs/tools/assemblies.xml Normal file
View File

@@ -0,0 +1,21 @@
<assemblies>
<path url="C:\WINNT\Microsoft.NET\Framework\v1.0.3705">
<assembly file="mscorlib.dll"/>
<assembly file="System.Web.dll"/>
<assembly file="System.dll"/>
<assembly file="System.Drawing.dll"/>
<assembly file="System.Security.dll"/>
<assembly file="System.Windows.Forms.dll"/>
<assembly file="System.Xml.dll"/>
<assembly file="System.Data.dll"/>
<assembly file="System.Design.dll"/>
<assembly file="System.EnterpriseServices.dll"/>
<assembly file="System.Management.dll"/>
<assembly file="System.Messaging.dll"/>
<assembly file="System.Runtime.Remoting.dll"/>
<assembly file="System.ServiceProcess.dll"/>
<assembly file="System.Web.RegularExpressions.dll"/>
<assembly file="System.Web.Services.dll"/>
<assembly file="System.Web.Mobile.dll"/>
</path>
</assemblies>

View File

@@ -0,0 +1,187 @@
//
// BrowserCapsUpdater.cs: updates $prefix/etc/mono/browscap.ini file.
//
// Authors:
// Gonzalo Paniagua Javier (gonzalo@ximian.com)
//
// (C) 2003 Novell, Inc (http://www.novell.com)
//
using System;
using System.IO;
using System.Net;
using System.Reflection;
using System.Text;
namespace Mono.ASPNET
{
class Driver
{
static string GetFilePath ()
{
Type type = typeof (Environment);
MethodInfo method = type.GetMethod ("GetMachineConfigPath", BindingFlags.Static |
BindingFlags.NonPublic);
if (method == null) {
Console.WriteLine ("You need to run this under Mono runtime");
return null;
}
string path = (string) method.Invoke (null, null);
return Path.Combine (Path.GetDirectoryName (path), "browscap.ini");
}
static int Main (string [] args)
{
string path = GetFilePath ();
if (path == null)
return 1;
Updater updater = new Updater (path);
if (File.Exists (path)) {
bool uptodate;
Console.WriteLine (updater.GetLocalMessage (out uptodate));
if (uptodate)
return 0;
Console.WriteLine ("WARNING: your site may be blocked from updating if you abuse.");
Console.WriteLine ("You're encouraged to browse and understand " +
"http://browsers.GaryKeith.com/");
string r = "NO";
while (r != "YES") {
Console.Write ("Do you want to update your file now? (yes/NO) ");
r = Console.ReadLine ();
if (r == null)
r = "NO";
else
r = r.ToUpper ();
if (r == "NO")
return 0;
}
}
try {
updater.Update ();
Console.WriteLine ("browscap.ini file provided by Gary J. Keith.");
} catch (Exception e) {
Console.Error.WriteLine ("Update failed.");
Console.Error.WriteLine ("Reason: {0}", e.Message);
return 1;
}
return 0;
}
}
class Updater
{
static string VersionUrl = "http://browsers.garykeith.com/version-number.asp";
static string BrowscapUrl = "http://browsers.garykeith.com/stream.asp?BrowsCapINI";
static string UserAgent = "Mono Browser Capabilities Updater 0.1";
string filename;
string tempfile;
string local;
int nupdates;
string date;
public Updater (string filename)
{
this.filename = filename;
}
public string GetLocalMessage (out bool upToDate)
{
StringBuilder sb = new StringBuilder ();
string localdate = null;
string remotedate = null;
using (StreamReader reader = new StreamReader (File.OpenRead (filename))) {
string str;
while ((str = reader.ReadLine ()) != null) {
if (str.StartsWith ("version="))
break;
}
if (str != null) {
localdate = str.Substring (8);
sb.AppendFormat ("Your file is dated {0}\r\n", localdate);
} else {
sb.AppendFormat ("Couldn't retrieve date from {0}\r\n", filename);
}
}
remotedate = GetRemoteDate ();
remotedate = remotedate.Replace ("AM ", "");
remotedate = remotedate.Replace ("PM ", "");
remotedate = remotedate.Replace ("/", "-");
sb.AppendFormat ("Remote file is dated {0}", remotedate);
upToDate = (remotedate == localdate);
if (upToDate)
sb.Append ("\r\nThe file IS up to date.");
return sb.ToString ();
}
static string GetRemoteDate ()
{
HttpWebRequest request = (HttpWebRequest) WebRequest.Create (VersionUrl);
request.UserAgent = UserAgent;
WebResponse resp = request.GetResponse ();
string str = new StreamReader (resp.GetResponseStream ()).ReadLine ();
resp.Close ();
return str;
}
public void Update ()
{
HttpWebRequest request = (HttpWebRequest) WebRequest.Create (BrowscapUrl);
request.UserAgent = UserAgent;
StreamWriter writer = null;
StreamReader reader = null;
Console.Write ("Connecting...");
WebResponse resp = request.GetResponse ();
string tmppath = null;
try {
tmppath = Path.GetTempFileName ();
reader = new StreamReader (resp.GetResponseStream ());
Console.WriteLine (" done");
writer = new StreamWriter (File.OpenWrite (tmppath));
Console.WriteLine ("Downloading data to {0}", tmppath);
string str;
while ((str = reader.ReadLine ()) != null) {
writer.WriteLine (str);
}
writer.Close ();
writer = null;
reader.Close ();
reader = null;
Console.WriteLine ("Removing old {0}", filename);
File.Delete (filename);
Console.WriteLine ("Copying {0} to {1}", tmppath, filename);
File.Copy (tmppath, filename);
} finally {
try {
File.Delete (tmppath);
} catch {}
if (writer != null) {
try {
writer.Close ();
} catch {}
}
if (reader != null) {
try {
reader.Close ();
} catch {}
}
}
}
}
}

View File

@@ -0,0 +1,12 @@
2004-05-26 Gonzalo Paniagua Javier <gonzalo@ximian.com>
* BrowserCapsUpdater.cs: update URL for browscap.ini.
2003-12-16 Gonzalo Paniagua Javier <gonzalo@ximian.com>
* ChangeLog:
* Makefile:
* browsercaps-updater.exe.sources:
* BrowserCapsUpdater.cs: new tool to update browscap.ini file. For
those users who just can't wait for the next mono release.

View File

@@ -0,0 +1,7 @@
thisdir = tools/browsercaps-updater
SUBDIRS =
include ../../build/rules.make
PROGRAM = browsercaps-updater.exe
include ../../build/executable.make

View File

@@ -0,0 +1 @@
BrowserCapsUpdater.cs

View File

@@ -0,0 +1,9 @@
thisdir = tools/cccheck
SUBDIRS =
include ../../build/rules.make
PROGRAM = cccheck.exe
LOCAL_MCS_FLAGS = -r:Mono.CodeContracts.dll
include ../../build/executable.make

View File

@@ -0,0 +1,66 @@
using System;
using Mono.CodeContracts.Static;
using Mono.Options;
namespace cccheck {
internal class Program {
private static void Main (string[] args)
{
var options = new CheckOptions ();
bool showOptions = false;
string showMsg = null;
var optionSet = new OptionSet {
{"help", "Show this help.", v => showOptions = v != null},
{"assembly=", "Assembly to check.", v => options.Assembly = v},
{"method=", "Method name (if you want to check only it).", v => options.Method = v},
{"debug=", "Show debug information", v=> options.ShowDebug = v != null}
};
try {
optionSet.Parse (args);
} catch (OptionException e) {
showOptions = true;
showMsg = e.Message;
}
if (showOptions) {
Console.WriteLine ("cccheck");
Console.WriteLine ();
Console.WriteLine ("Options:");
optionSet.WriteOptionDescriptions (Console.Out);
Console.WriteLine ();
if (showMsg != null) {
Console.WriteLine (showMsg);
Console.WriteLine ();
}
return;
}
CheckResults results = Checker.Check (options);
Console.WriteLine ();
if (results.AnyErrors) {
foreach (string error in results.Errors)
Console.WriteLine ("Error: " + error);
}
if (results.AnyWarnings) {
foreach (string warning in results.Warnings)
Console.WriteLine ("Warning: " + warning);
}
if (results.Results != null) {
foreach (var methodValidationResults in results.Results) {
string methodName = methodValidationResults.Key;
Console.WriteLine ("Method: " + methodName);
foreach (string result in methodValidationResults.Value)
Console.WriteLine (" " + result);
Console.WriteLine ();
}
}
Console.WriteLine ();
Console.WriteLine ("*** done ***");
}
}
}

View File

@@ -0,0 +1,3 @@
../../build/common/Consts.cs
../../class/Mono.Options/Mono.Options/Options.cs
Program.cs

View File

@@ -0,0 +1,9 @@
thisdir = tools/ccrewrite
SUBDIRS =
include ../../build/rules.make
PROGRAM = ccrewrite.exe
LOCAL_MCS_FLAGS = -r:Mono.CodeContracts.dll
include ../../build/executable.make

View File

@@ -0,0 +1,74 @@
#define CONTRACTS_FULL
using System;
using System.Collections.Generic;
using System.Diagnostics.Contracts;
using System.Linq;
using System.Text;
using System.IO;
using Mono.CodeContracts.Rewrite;
using Mono.Options;
namespace ccrewrite {
class Program {
static void Main (string [] args)
{
RewriterOptions options = new RewriterOptions ();
bool showOptions = false;
string showMsg = null;
var optionSet = new OptionSet {
{ "help", "Show this help.", v => showOptions = v != null },
{ "debug", "Use MDB or PDB debug information (default=true).", v => options.Debug = v != null },
{ "level=", "Instrumentation level, 0 - 4 (default=4).", (int var) => options.Level = var},
{ "writePDBFile", "Write MDB or PDB file (default=true).", v => options.WritePdbFile = v != null },
{ "rewrite", "Rewrite the assembly (default=true).", v => options.Rewrite = v != null },
{ "assembly=", "Assembly to rewrite.", v => options.Assembly = v },
{ "breakIntoDebugger|break", "Break into debugger on contract failure.", v => options.BreakIntoDebugger = v != null },
{ "throwOnFailure|throw", "Throw ContractException on contract failure.", v => options.ThrowOnFailure = v != null },
{ "output|out=", "Output filename of rewritten file.", v => options.OutputFile = v },
};
try {
optionSet.Parse (args);
} catch (OptionException e) {
showOptions = true;
showMsg = e.Message;
}
if (showOptions) {
Console.WriteLine ("ccrewrite");
Console.WriteLine ();
Console.WriteLine ("Options:");
optionSet.WriteOptionDescriptions (Console.Out);
Console.WriteLine ();
if (showMsg != null) {
Console.WriteLine (showMsg);
Console.WriteLine ();
}
return;
}
var results = Rewriter.Rewrite (options);
if (results.AnyErrors) {
foreach (var error in results.Errors) {
Console.WriteLine ("Error: " + error);
}
}
if (results.AnyWarnings) {
foreach (var warning in results.Warnings) {
Console.WriteLine ("Warning: " + warning);
}
}
Console.WriteLine ();
Console.WriteLine ("*** done ***");
//Console.ReadKey ();
}
}
}

View File

@@ -0,0 +1,3 @@
../../build/common/Consts.cs
../../class/Mono.Options/Mono.Options/Options.cs
Program.cs

View File

@@ -0,0 +1,221 @@
//
// AssemblyStripper.cs
//
// Author:
// Jb Evain (jbevain@novell.com)
//
// (C) 2008 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.Collections;
using System.IO;
using Mono.Cecil;
using Mono.Cecil.Binary;
using Mono.Cecil.Cil;
using Mono.Cecil.Metadata;
namespace Mono.CilStripper {
class AssemblyStripper {
AssemblyDefinition assembly;
BinaryWriter writer;
Image original;
Image stripped;
ReflectionWriter reflection_writer;
MetadataWriter metadata_writer;
TablesHeap original_tables;
TablesHeap stripped_tables;
AssemblyStripper (AssemblyDefinition assembly, BinaryWriter writer)
{
this.assembly = assembly;
this.writer = writer;
}
void Strip ()
{
FullLoad ();
ClearMethodBodies ();
CopyOriginalImage ();
PatchMethods ();
PatchFields ();
PatchResources ();
Write ();
}
void FullLoad ()
{
assembly.MainModule.FullLoad ();
}
void ClearMethodBodies ()
{
foreach (TypeDefinition type in assembly.MainModule.Types) {
ClearMethodBodies (type.Constructors);
ClearMethodBodies (type.Methods);
}
}
static void ClearMethodBodies (ICollection methods)
{
foreach (MethodDefinition method in methods) {
if (!method.HasBody)
continue;
MethodBody body = new MethodBody (method);
body.CilWorker.Emit (OpCodes.Ret);
method.Body = body;
}
}
void CopyOriginalImage ()
{
original = assembly.MainModule.Image;
stripped = Image.CreateImage();
stripped.Accept (new CopyImageVisitor (original));
assembly.MainModule.Image = stripped;
original_tables = original.MetadataRoot.Streams.TablesHeap;
stripped_tables = stripped.MetadataRoot.Streams.TablesHeap;
TableCollection tables = original_tables.Tables;
foreach (IMetadataTable table in tables)
stripped_tables.Tables.Add(table);
stripped_tables.Valid = original_tables.Valid;
stripped_tables.Sorted = original_tables.Sorted;
reflection_writer = new ReflectionWriter (assembly.MainModule);
reflection_writer.StructureWriter = new StructureWriter (assembly, writer);
reflection_writer.CodeWriter.Stripped = true;
metadata_writer = reflection_writer.MetadataWriter;
PatchHeap (metadata_writer.StringWriter, original.MetadataRoot.Streams.StringsHeap);
PatchHeap (metadata_writer.GuidWriter, original.MetadataRoot.Streams.GuidHeap);
PatchHeap (metadata_writer.UserStringWriter, original.MetadataRoot.Streams.UserStringsHeap);
PatchHeap (metadata_writer.BlobWriter, original.MetadataRoot.Streams.BlobHeap);
if (assembly.EntryPoint != null)
metadata_writer.EntryPointToken = assembly.EntryPoint.MetadataToken.ToUInt ();
}
static void PatchHeap (MemoryBinaryWriter heap_writer, MetadataHeap heap)
{
if (heap == null)
return;
heap_writer.BaseStream.Position = 0;
heap_writer.Write (heap.Data);
}
void PatchMethods ()
{
MethodTable methodTable = (MethodTable) stripped_tables [MethodTable.RId];
if (methodTable == null)
return;
RVA method_rva = RVA.Zero;
for (int i = 0; i < methodTable.Rows.Count; i++) {
MethodRow methodRow = methodTable[i];
MetadataToken methodToken = MetadataToken.FromMetadataRow (TokenType.Method, i);
MethodDefinition method = (MethodDefinition) assembly.MainModule.LookupByToken (methodToken);
if (method.HasBody) {
method_rva = method_rva != RVA.Zero
? method_rva
: reflection_writer.CodeWriter.WriteMethodBody (method);
methodRow.RVA = method_rva;
} else
methodRow.RVA = RVA.Zero;
}
}
void PatchFields ()
{
FieldRVATable fieldRvaTable = (FieldRVATable) stripped_tables [FieldRVATable.RId];
if (fieldRvaTable == null)
return;
for (int i = 0; i < fieldRvaTable.Rows.Count; i++) {
FieldRVARow fieldRvaRow = fieldRvaTable [i];
MetadataToken fieldToken = new MetadataToken (TokenType.Field, fieldRvaRow.Field);
FieldDefinition field = (FieldDefinition) assembly.MainModule.LookupByToken (fieldToken);
fieldRvaRow.RVA = metadata_writer.GetDataCursor ();
metadata_writer.AddData (field.InitialValue.Length + 3 & (~3));
metadata_writer.AddFieldInitData (field.InitialValue);
}
}
void PatchResources ()
{
ManifestResourceTable resourceTable = (ManifestResourceTable) stripped_tables [ManifestResourceTable.RId];
if (resourceTable == null)
return;
for (int i = 0; i < resourceTable.Rows.Count; i++) {
ManifestResourceRow resourceRow = resourceTable [i];
if (resourceRow.Implementation.RID != 0)
continue;
foreach (Resource resource in assembly.MainModule.Resources) {
EmbeddedResource er = resource as EmbeddedResource;
if (er == null)
continue;
if (resource.Name != original.MetadataRoot.Streams.StringsHeap [resourceRow.Name])
continue;
resourceRow.Offset = metadata_writer.AddResource (er.Data);
}
}
}
void Write ()
{
stripped.MetadataRoot.Accept (metadata_writer);
}
public static void StripAssembly (AssemblyDefinition assembly, string file)
{
using (FileStream fs = new FileStream (file, FileMode.Create, FileAccess.Write, FileShare.None)) {
new AssemblyStripper (assembly, new BinaryWriter (fs)).Strip ();
}
}
}
}

View File

@@ -0,0 +1,8 @@
2009-03-12 Jb Evain <jbevain@novell.com>
* cilstrip.cs: unwrap TargetInvocationException.
2008-10-01 Jb Evain <jbevain@novell.com>
* cilstrip.cs: mono-cecil-cil is a tool to empty method bodies for
assemblies that have been AOTed.

View File

@@ -0,0 +1,7 @@
thisdir = tools/cil-strip
SUBDIRS =
include ../../build/rules.make
PROGRAM = mono-cil-strip.exe
include ../../build/executable.make

Some files were not shown because too many files have changed in this diff Show More