Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/ikdasm.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeroen Frijters <jeroen@frijters.net>2013-03-16 12:03:02 +0400
committerJeroen Frijters <jeroen@frijters.net>2013-03-16 12:03:02 +0400
commit944a6f1f766938fc5465ab1701092115b0c49a77 (patch)
tree2637eef8f8ae67f60907a9dd925d15300032b9ed
parent9b7577d079431bc017de44cb6b58949de1c52282 (diff)
Added /caverbal option.
Added /caverbal option and made not decoding the CA blob the default.
-rw-r--r--Disassembler.cs18
-rw-r--r--Program.cs19
2 files changed, 29 insertions, 8 deletions
diff --git a/Disassembler.cs b/Disassembler.cs
index 6cf9a21..063e294 100644
--- a/Disassembler.cs
+++ b/Disassembler.cs
@@ -38,6 +38,14 @@ namespace Ildasm
V45,
}
+ [Flags]
+ enum Flags
+ {
+ None = 0,
+ DiffMode = 1,
+ Caverbal = 2,
+ }
+
sealed partial class Disassembler
{
const int IMAGE_SCN_CNT_CODE = 0x00000020;
@@ -84,12 +92,14 @@ namespace Ildasm
readonly CompatLevel compat;
readonly string outputFile;
readonly bool diffMode;
+ readonly Flags flags;
- internal Disassembler(string inputFile, string outputFile, CompatLevel compat, bool diffMode)
+ internal Disassembler(string inputFile, string outputFile, CompatLevel compat, Flags flags)
{
this.outputFile = outputFile;
this.compat = compat;
- this.diffMode = diffMode;
+ this.diffMode = (flags & Flags.DiffMode) != 0;
+ this.flags = flags;
universe.AssemblyResolve += new IKVM.Reflection.ResolveEventHandler(universe_AssemblyResolve);
mscorlib = universe.Import(typeof(object)).Assembly;
typeofSystemBoolean = universe.Import(typeof(bool));
@@ -2591,8 +2601,8 @@ namespace Ildasm
else
{
var wrap = lw.Column >= 80;
- var sb = new StringBuilder();
- if (DecodeCABlob(sb, ca.Constructor, blob, wrap ? (level0 + 4) * (comment ? -1 : 1) : lw.Column + 5))
+ StringBuilder sb;
+ if ((flags & Flags.Caverbal) != 0 && DecodeCABlob(sb = new StringBuilder(), ca.Constructor, blob, wrap ? (level0 + 4) * (comment ? -1 : 1) : lw.Column + 5))
{
lw.Write(")");
if (wrap)
diff --git a/Program.cs b/Program.cs
index 528fdfb..2467971 100644
--- a/Program.cs
+++ b/Program.cs
@@ -1,5 +1,5 @@
/*
- Copyright (C) 2012 Jeroen Frijters
+ Copyright (C) 2012-2013 Jeroen Frijters
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
@@ -36,7 +36,7 @@ namespace Ildasm
string outputFile = null;
string inputFile = null;
var compatLevel = CompatLevel.None;
- var diffMode = false;
+ var flags = Flags.None;
foreach (var arg in args)
{
if (arg.StartsWith("-", StringComparison.Ordinal) || arg.StartsWith("/", StringComparison.Ordinal))
@@ -66,7 +66,11 @@ namespace Ildasm
}
else if (String.Compare(arg, 1, "diffmode", 0, 8, StringComparison.OrdinalIgnoreCase) == 0)
{
- diffMode = true;
+ flags |= Flags.DiffMode;
+ }
+ else if (IsIldasmOption(arg, "caverbal"))
+ {
+ flags |= Flags.Caverbal;
}
else
{
@@ -92,7 +96,7 @@ namespace Ildasm
PrintUsage();
return;
}
- var disassembler = new Disassembler(inputFile, outputFile, compatLevel, diffMode);
+ var disassembler = new Disassembler(inputFile, outputFile, compatLevel, flags);
if (outputFile != null)
{
Encoding enc;
@@ -133,6 +137,12 @@ namespace Ildasm
return false;
}
+ static bool IsIldasmOption(string arg, string option)
+ {
+ // we match ildasm options on the first three letters (like ildasm)
+ return String.Compare(arg, 1, option, 0, 3, StringComparison.OrdinalIgnoreCase) == 0;
+ }
+
static void PrintUsage()
{
Console.WriteLine("IKDASM - IL disassembler example for IKVM.Reflection");
@@ -144,6 +154,7 @@ namespace Ildasm
Console.WriteLine(" /OUT=<file name> Direct output to file rather than to stdout.");
Console.WriteLine(" /COMPAT=<version> Match ildasm behavior. (<version> = 2.0 | 4.0 | 4.5)");
Console.WriteLine(" /DIFFMODE Remove superficial differences to allow assembly comparisons");
+ Console.WriteLine(" /CAVERBAL Try to decode custom attribute blobs");
}
}
}