Browse Source

Removed unused Cecil files from the debugger

git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/trunk@5159 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61
shortcuts
David Srbecký 16 years ago
parent
commit
fedfd8bb05
  1. 1
      src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Mono.Cecil/AUTHORS
  2. 3617
      src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Mono.Cecil/ChangeLog
  3. 226
      src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Mono.Cecil/CodeGen/cecil-gen-attributes.rb
  4. 14
      src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Mono.Cecil/CodeGen/cecil-gen-sources.rb
  5. 61
      src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Mono.Cecil/CodeGen/cecil-gen-tests.rb
  6. 262
      src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Mono.Cecil/CodeGen/cecil-gen-types.rb
  7. 161
      src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Mono.Cecil/CodeGen/cecil-gen.rb
  8. 159
      src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Mono.Cecil/CodeGen/cecil-mig.rb
  9. 608
      src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Mono.Cecil/CodeGen/cecil.xml
  10. 112
      src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Mono.Cecil/CodeGen/templates/BaseMetadataVisitor.cs
  11. 37
      src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Mono.Cecil/CodeGen/templates/Code.cs
  12. 38
      src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Mono.Cecil/CodeGen/templates/CodedIndex.cs
  13. 65
      src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Mono.Cecil/CodeGen/templates/IMetadataVisitor.cs
  14. 296
      src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Mono.Cecil/CodeGen/templates/IndexedCollection.cs
  15. 110
      src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Mono.Cecil/CodeGen/templates/MetadataRowReader.cs
  16. 145
      src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Mono.Cecil/CodeGen/templates/MetadataRowWriter.cs
  17. 97
      src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Mono.Cecil/CodeGen/templates/MetadataTableReader.cs
  18. 98
      src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Mono.Cecil/CodeGen/templates/MetadataTableWriter.cs
  19. 232
      src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Mono.Cecil/CodeGen/templates/NamedCollection.cs
  20. 67
      src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Mono.Cecil/CodeGen/templates/OpCodes.cs
  21. 81
      src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Mono.Cecil/CodeGen/templates/Table.cs
  22. 116
      src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Mono.Cecil/CodeGen/templates/Tests.cs
  23. 211
      src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Mono.Cecil/CodeGen/templates/Utilities.cs
  24. 12
      src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Mono.Cecil/Makefile
  25. 101
      src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Mono.Cecil/Mono.Cecil.Binary/BaseImageVisitor.cs
  26. 68
      src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Mono.Cecil/Mono.Cecil.Binary/CLIHeader.cs
  27. 119
      src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Mono.Cecil/Mono.Cecil.Binary/CopyImageVisitor.cs
  28. 75
      src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Mono.Cecil/Mono.Cecil.Binary/DOSHeader.cs
  29. 87
      src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Mono.Cecil/Mono.Cecil.Binary/DataDirectory.cs
  30. 73
      src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Mono.Cecil/Mono.Cecil.Binary/DebugHeader.cs
  31. 45
      src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Mono.Cecil/Mono.Cecil.Binary/DebugStoreType.cs
  32. 59
      src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Mono.Cecil/Mono.Cecil.Binary/ExportTable.cs
  33. 35
      src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Mono.Cecil/Mono.Cecil.Binary/IBinaryVisitable.cs
  34. 51
      src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Mono.Cecil/Mono.Cecil.Binary/IBinaryVisitor.cs
  35. 34
      src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Mono.Cecil/Mono.Cecil.Binary/IHeader.cs
  36. 236
      src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Mono.Cecil/Mono.Cecil.Binary/Image.cs
  37. 57
      src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Mono.Cecil/Mono.Cecil.Binary/ImageCharacteristics.cs
  38. 139
      src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Mono.Cecil/Mono.Cecil.Binary/ImageInitializer.cs
  39. 466
      src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Mono.Cecil/Mono.Cecil.Binary/ImageReader.cs
  40. 427
      src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Mono.Cecil/Mono.Cecil.Binary/ImageWriter.cs
  41. 98
      src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Mono.Cecil/Mono.Cecil.Binary/Imports.cs
  42. 70
      src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Mono.Cecil/Mono.Cecil.Binary/MemoryBinaryWriter.cs
  43. 58
      src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Mono.Cecil/Mono.Cecil.Binary/PEFileHeader.cs
  44. 200
      src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Mono.Cecil/Mono.Cecil.Binary/PEOptionalHeader.cs
  45. 115
      src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Mono.Cecil/Mono.Cecil.Binary/RVA.cs
  46. 48
      src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Mono.Cecil/Mono.Cecil.Binary/ResourceDataEntry.cs
  47. 66
      src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Mono.Cecil/Mono.Cecil.Binary/ResourceDirectoryEntry.cs
  48. 45
      src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Mono.Cecil/Mono.Cecil.Binary/ResourceDirectoryString.cs
  49. 56
      src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Mono.Cecil/Mono.Cecil.Binary/ResourceDirectoryTable.cs
  50. 44
      src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Mono.Cecil/Mono.Cecil.Binary/ResourceNode.cs
  51. 143
      src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Mono.Cecil/Mono.Cecil.Binary/ResourceReader.cs
  52. 216
      src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Mono.Cecil/Mono.Cecil.Binary/ResourceWriter.cs
  53. 37
      src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Mono.Cecil/Mono.Cecil.Binary/RuntimeImage.cs
  54. 66
      src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Mono.Cecil/Mono.Cecil.Binary/Section.cs
  55. 70
      src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Mono.Cecil/Mono.Cecil.Binary/SectionCharacteristics.cs
  56. 114
      src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Mono.Cecil/Mono.Cecil.Binary/SectionCollection.cs
  57. 45
      src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Mono.Cecil/Mono.Cecil.Binary/SubSystem.cs
  58. 73
      src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Mono.Cecil/Mono.Cecil.Cil/BaseCodeVisitor.cs
  59. 357
      src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Mono.Cecil/Mono.Cecil.Cil/CilWorker.cs
  60. 255
      src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Mono.Cecil/Mono.Cecil.Cil/Code.cs
  61. 355
      src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Mono.Cecil/Mono.Cecil.Cil/CodeReader.cs
  62. 528
      src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Mono.Cecil/Mono.Cecil.Cil/CodeWriter.cs
  63. 78
      src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Mono.Cecil/Mono.Cecil.Cil/Document.cs
  64. 36
      src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Mono.Cecil/Mono.Cecil.Cil/DocumentHashAlgorithm.cs
  65. 45
      src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Mono.Cecil/Mono.Cecil.Cil/DocumentLanguage.cs
  66. 35
      src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Mono.Cecil/Mono.Cecil.Cil/DocumentLanguageVendor.cs
  67. 35
      src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Mono.Cecil/Mono.Cecil.Cil/DocumentType.cs
  68. 95
      src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Mono.Cecil/Mono.Cecil.Cil/ExceptionHandler.cs
  69. 93
      src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Mono.Cecil/Mono.Cecil.Cil/ExceptionHandlerCollection.cs
  70. 37
      src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Mono.Cecil/Mono.Cecil.Cil/ExceptionHandlerType.cs
  71. 42
      src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Mono.Cecil/Mono.Cecil.Cil/FlowControl.cs
  72. 91
      src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Mono.Cecil/Mono.Cecil.Cil/GuidAttribute.cs
  73. 34
      src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Mono.Cecil/Mono.Cecil.Cil/ICodeVisitable.cs
  74. 45
      src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Mono.Cecil/Mono.Cecil.Cil/ICodeVisitor.cs
  75. 35
      src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Mono.Cecil/Mono.Cecil.Cil/IScopeProvider.cs
  76. 37
      src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Mono.Cecil/Mono.Cecil.Cil/ISymbolReader.cs
  77. 36
      src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Mono.Cecil/Mono.Cecil.Cil/ISymbolStoreFactory.cs
  78. 37
      src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Mono.Cecil/Mono.Cecil.Cil/ISymbolWriter.cs
  79. 35
      src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Mono.Cecil/Mono.Cecil.Cil/IVariableDefinitionProvider.cs
  80. 96
      src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Mono.Cecil/Mono.Cecil.Cil/Instruction.cs
  81. 94
      src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Mono.Cecil/Mono.Cecil.Cil/InstructionCollection.cs
  82. 374
      src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Mono.Cecil/Mono.Cecil.Cil/MethodBody.cs
  83. 37
      src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Mono.Cecil/Mono.Cecil.Cil/MethodDataSection.cs
  84. 37
      src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Mono.Cecil/Mono.Cecil.Cil/MethodHeader.cs
  85. 139
      src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Mono.Cecil/Mono.Cecil.Cil/OpCode.cs
  86. 39
      src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Mono.Cecil/Mono.Cecil.Cil/OpCodeType.cs
  87. 1583
      src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Mono.Cecil/Mono.Cecil.Cil/OpCodes.cs
  88. 53
      src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Mono.Cecil/Mono.Cecil.Cil/OperandType.cs
  89. 79
      src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Mono.Cecil/Mono.Cecil.Cil/Scope.cs
  90. 93
      src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Mono.Cecil/Mono.Cecil.Cil/ScopeCollection.cs
  91. 78
      src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Mono.Cecil/Mono.Cecil.Cil/SequencePoint.cs
  92. 62
      src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Mono.Cecil/Mono.Cecil.Cil/StackBehaviour.cs
  93. 77
      src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Mono.Cecil/Mono.Cecil.Cil/SymbolStoreHelper.cs
  94. 55
      src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Mono.Cecil/Mono.Cecil.Cil/VariableDefinition.cs
  95. 93
      src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Mono.Cecil/Mono.Cecil.Cil/VariableDefinitionCollection.cs
  96. 73
      src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Mono.Cecil/Mono.Cecil.Cil/VariableReference.cs
  97. 88
      src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Mono.Cecil/Mono.Cecil.Metadata/Assembly.cs
  98. 80
      src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Mono.Cecil/Mono.Cecil.Metadata/AssemblyOS.cs
  99. 78
      src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Mono.Cecil/Mono.Cecil.Metadata/AssemblyProcessor.cs
  100. 88
      src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Mono.Cecil/Mono.Cecil.Metadata/AssemblyRef.cs
  101. Some files were not shown because too many files have changed in this diff Show More

1
src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Mono.Cecil/AUTHORS

@ -1 +0,0 @@ @@ -1 +0,0 @@
Jb Evain (jbevain@gmail.com)

3617
src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Mono.Cecil/ChangeLog

File diff suppressed because it is too large Load Diff

226
src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Mono.Cecil/CodeGen/cecil-gen-attributes.rb

@ -1,226 +0,0 @@ @@ -1,226 +0,0 @@
#!/usr/bin/env ruby
$providers = []
$mapping = {
"Assem" => "IsAssembly",
"FamORAssem" => "IsFamilyOrAssembly",
"FamANDAssem" => "IsFamilyAndAssembly",
"NestedFamORAssem" => "IsNestedFamilyOrAssembly",
"NestedFamANDAssem" => "IsNestedFamilyAndAssembly",
"RTSpecialName" => "IsRuntimeSpecialName",
"Compilercontrolled" => "IsCompilerControlled",
"NotNullableValueTypeConstraint" => "HasNotNullableValueTypeConstraint",
"ReferenceTypeConstraint" => "HasReferenceTypeConstraint",
"DefaultConstructorConstraint" => "HasDefaultConstructorConstraint",
"SupportsLastError" => "SupportsLastError",
"NoInlining" => "NoInlining",
}
$black_list = [
"None", "Unused", "RequireSecObject",
"HasFieldMarshal", "HasFieldRVA",
"OPTIL", "MaxMethodImplVal"
]
class Attribute
attr_accessor(:name)
attr_accessor(:type)
def initialize(name, type)
@name = name
@type = type
end
def full_name
"#{@type}.#{@name}"
end
def to_csharp
""" public bool #{get_name()} {
#{getter()}#{setter()} }
"""
end
def to_s
"Attribute #{full_name}"
end
protected
def getter
""" get { return (m_attributes & #{full_name()}) != 0; }
"""
end
def setter
""" set {
if (value)
m_attributes |= #{full_name()};
else
m_attributes &= ~#{full_name()};
}
"""
end
private
def get_name
name = @name
return $mapping[name] if $mapping.include?(name)
return name if name.rindex("Has") == 0
"Is#{name}"
end
end
class MaskedAttribute < Attribute
attr_accessor(:mask)
def initialize(name, type, mask)
super(name, type)
@mask = mask
end
def mask_full_name
"#{@type}.#{@mask}"
end
def to_s
"MaskedAttribute #{full_name()}, masked by #{mask_full_name()}"
end
protected
def getter
""" get { return (m_attributes & #{mask_full_name()}) == #{full_name()}; }
"""
end
def setter
""" set {
if (value) {
m_attributes &= ~#{mask_full_name()};
m_attributes |= #{full_name()};
} else
m_attributes &= ~(#{mask_full_name()} & #{full_name()});
}
"""
end
end
class Provider
attr_accessor(:type)
attr_accessor(:attributes_file)
attr_accessor(:target_file)
attr_accessor(:attributes)
def initialize(type, attributes_file, target_file)
@type = type
@attributes_file = attributes_file
@target_file = target_file
@attributes = []
end
def parse
f = File.open(@attributes_file, File::RDONLY)
have_mask = false
mask = ""
f.readlines.each { |line|
if line.chomp().length == 0
have_mask = false
else
name = get_name(line)
if not name.nil? and name.index("Mask")
mask = name
have_mask = true
elsif not name.nil?
attr = nil
if (have_mask)
attr = MaskedAttribute.new(name, @type, mask)
else
attr = Attribute.new(name, @type)
end
@attributes << attr
end
end
}
f.close
end
def patch
buffer = read_target_content()
buffer = patch_buffer(buffer)
if buffer != read_target_content()
puts("#{@target_file} patched")
write_target_content (buffer)
end
end
private
def patch_buffer(buffer)
region = "#region " + @type
endregion = "#endregion"
endpart = buffer[(buffer.index(endregion) - 3)..buffer.length]
rep = buffer[0..(buffer.index(region) + region.length)]
rep += "\n"
@attributes.each { |attr|
rep += attr.to_csharp
rep += "\n" if attr != @attributes.last
}
rep += endpart
rep
end
def read_target_content
f = File.new(@target_file, File::RDONLY)
content = f.readlines.join
f.close
content
end
def write_target_content(content)
File.open(@target_file, File::WRONLY | File::TRUNC) { |f|
f.write(content)
}
end
def get_name(line)
pos = line.index("=")
return nil if not pos
name = line[0..(pos - 1)].strip
return nil if $black_list.include?(name)
name
end
end
def to_cecil_file(file)
"../Mono.Cecil/#{file}.cs"
end
[ "Event", "Field", "Method", "Parameter", "Property", "Type" ].each { |name|
attributes = "#{name}Attributes"
definition = "#{name}Definition"
$providers << Provider.new(attributes, to_cecil_file(attributes), to_cecil_file(definition))
}
{ "GenericParameter" => "GenericParameter",
"ManifestResource" => "Resource",
"PInvoke" => "PInvokeInfo",
# "MethodImpl" => "MethodDefinition",
# "MethodSemantics" => "MethodDefinition",
}.each { |k, v|
attributes = "#{k}Attributes"
$providers << Provider.new(attributes, to_cecil_file(attributes), to_cecil_file(v))
}
$providers.each { |p|
p.parse
p.patch
}

14
src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Mono.Cecil/CodeGen/cecil-gen-sources.rb

@ -1,14 +0,0 @@ @@ -1,14 +0,0 @@
#!/usr/bin/env ruby
f = File.new("../Mono.Cecil.dll.sources", File::CREAT | File::WRONLY | File::TRUNC)
[ "Mono.Cecil", "Mono.Cecil.Binary",
"Mono.Cecil.Metadata", "Mono.Cecil.Cil",
"Mono.Cecil.Signatures", "Mono.Xml" ].each { |dir|
Dir.foreach("../" + dir) { |file|
f.print("./#{dir}/#{file}\n") if file[(file.length - 3)..file.length] == ".cs"
}
}
f.close

61
src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Mono.Cecil/CodeGen/cecil-gen-tests.rb

@ -1,61 +0,0 @@ @@ -1,61 +0,0 @@
#!/usr/bin/env ruby
require 'erb'
class Language
attr_reader(:name)
attr_reader(:compiler)
attr_reader(:ext)
attr_reader(:command)
def initialize(name, compiler, ext, command)
@name = name
@compiler = compiler
@ext = ext
@command = command
end
end
class TestCase
attr_reader(:lang)
attr_reader(:file)
def initialize(lang, file)
@lang = lang
@file = file
end
def method()
meth = @file.gsub(/[^a-zA-Z1-9]/, "_")
return meth[1..meth.length] if (meth[0].chr == "_")
return meth
end
end
$languages = [
Language.new("cil", "ilasm", ".il", "{0} /exe /output:{2} {1}"),
Language.new("csharp", "mcs", ".cs", "{0} /t:exe /o:{2} {1}")
]
$tests = [
]
def analyze(dir)
$languages.each { |l|
pattern = File.join(dir, "**", "*" + l.ext)
Dir[pattern].each { |file|
$tests.push(TestCase.new(l, File.expand_path(file)))
}
}
end
ARGV.each { |dir|
analyze(dir)
}
if $tests.length > 0
erb = ERB.new(IO.read("./templates/Tests.cs"))
print(erb.result)
end

262
src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Mono.Cecil/CodeGen/cecil-gen-types.rb

@ -1,262 +0,0 @@ @@ -1,262 +0,0 @@
# types used in templates
module Cecil
class Evolutive # abstract
attr_reader(:requ)
def initialize(requ)
@requ = requ
end
end
class FieldWorker # abstract
attr_reader(:field_name)
attr_reader(:property_name)
attr_reader(:type)
attr_reader(:ns)
attr_reader(:size)
attr_reader(:target)
def initialize(name, type, target)
@property_name = name
@target = target
@field_name = to_field(name)
@objtype = type
ar = type.name.split(".")
@type = ar.pop()
@ns = ar.join(".")
@size = type.size
end
def to_field(name)
name = String.new(name)
name[0] = name[0].chr.downcase
return "m_" + name
end
def write_binary(inst, writer)
pre = writer + ".Write ("
prp = inst + "." + @property_name
suf = ")"
return case @type
when "byte", "ushort", "short", "uint", "int"
pre + prp + suf
when "RVA"
pre + prp + ".Value" + suf
when "DataDirectory"
pre + prp + ".VirtualAddress" + suf + ";\n\t\t\t" + pre + prp + ".Size" + suf
else
pre + "(" + @objtype.underlying + ") " + prp + suf
end
end
def read_binary(inst)
return case @type
when "byte"
inst + ".ReadByte ()"
when "ushort"
inst + ".ReadUInt16 ()";
when "short"
inst + ".ReadInt16 ()";
when "uint"
inst + ".ReadUInt32 ()";
when "int"
inst + ".ReadInt32 ()";
when "RVA"
"new RVA (" + inst + ".ReadUInt32 ())"
when "DataDirectory"
"new DataDirectory (\n new RVA (" + inst + ".ReadUInt32 ()),\n " + inst + ".ReadUInt32 ())"
else
"(" + @objtype.name + ") " + case @objtype.underlying
when "int"
inst + ".ReadInt32 ()";
when "short"
inst + ".ReadInt16 ()";
when "ushort"
inst + ".ReadUInt16 ()";
when "uint"
inst + ".ReadUInt32 ()";
end
end
end
end
class Type
attr_reader(:name)
attr_reader(:size)
attr_reader(:underlying)
def initialize(name, size, underlying = nil)
@name = name
@size = size
@underlying = underlying
end
end
class Table < Evolutive
attr_reader(:ref_ns)
attr_reader(:rid)
attr_reader(:name)
attr_reader(:table_name)
attr_reader(:row_name)
attr_reader(:columns)
def initialize(name, rid, requ)
super(requ)
@name = name
@table_name = name + "Table"
@row_name = name + "Row"
@rid = rid
@ref_ns = Array.new
@columns = Array.new
end
def add_column(col)
if (!@ref_ns.include?(col.ns) && col.ns.length != 0 && col.ns != "Mono.Cecil.Metadata") then
@ref_ns.push(col.ns)
@ref_ns.sort!()
end
@columns.push(col)
end
def row_size()
size = 0
@columns.each { |col|
size += col.size
}
return size
end
end
class Column < FieldWorker
def initialize(name, type, target)
super(name, type, target)
end
end
class Collection
attr_reader(:type)
attr_reader(:intf)
attr_reader(:name)
attr_reader(:container)
attr_reader(:container_impl)
attr_reader(:item_name)
attr_reader(:visitable)
attr_reader(:visitor)
attr_reader(:visitThis)
attr_reader(:visitItem)
attr_reader(:lazyload)
attr_reader(:pathtoloader)
attr_reader(:target)
attr_reader(:indexed)
def initialize(type, container, visit, name, lazyload, pathtoloader, target, indexed = false, usecntintf = false)
@type = type
basename = (name.nil? ? type : name)
@intf = "I" + basename + "Collection"
@name = @intf[1..@intf.length]
@item_name = basename[0..basename.length]
@container = container
@container_impl = usecntintf ? @container : @container[0..@container.length]
if (!visit.nil?) then
@visitable = visit + "Visitable"
@visitor = visit + "Visitor"
@visitThis = "Visit" + @name
@visitItem = "Visit" + @item_name
end
@lazyload = lazyload
@pathtoloader = pathtoloader
@target = target
@indexed = indexed
end
end
class OpCode < Evolutive
attr_reader(:name)
attr_reader(:field_name)
attr_reader(:op1)
attr_reader(:op2)
attr_reader(:size)
attr_reader(:flowcontrol)
attr_reader(:opcodetype)
attr_reader(:operandtype)
attr_reader(:stackbehaviourpop)
attr_reader(:stackbehaviourpush)
def initialize(name, op1, op2, flowcontrol, opcodetype, operandtype, stackbehaviourpop, stackbehaviourpush, requ)
super(requ)
@name = name
@field_name = name_to_prop(name)
@op1 = op1 ; @op2 = op2
@size = @op1 == "0xff" ? 1 : 2
@flowcontrol = "FlowControl." + flowcontrol
@opcodetype = "OpCodeType." + opcodetype
@operandtype = "OperandType." + operandtype
@stackbehaviourpop = "StackBehaviour." + stackbehaviourpop
@stackbehaviourpush = "StackBehaviour." + stackbehaviourpush
end
def name_to_prop(name)
field = ""
ar = name.split(".")
ar.each { |part|
field += part.capitalize()
field += "_" unless ar.last == part
}
return field
end
end
class Field < FieldWorker
attr_reader(:default)
def initialize(name, type, default)
super(name, type, nil)
@default = default
end
end
class CodedIndexTable
attr_reader(:name)
attr_reader(:tag)
def initialize(name, tag)
@name = name
@tag = tag
end
end
class CodedIndex < Evolutive
attr_reader(:name)
attr_reader(:size)
attr_reader(:tables)
def initialize(name, size, requ)
super(requ)
@name = name
@size = size
@tables = Array.new
end
def add_table(name, tag)
@tables.push(CodedIndexTable.new(name, tag))
end
end
end

161
src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Mono.Cecil/CodeGen/cecil-gen.rb

@ -1,161 +0,0 @@ @@ -1,161 +0,0 @@
#!/usr/bin/env ruby
# extern libraries used by code generator
require 'erb'
require 'rexml/document'
# our library
require 'cecil-gen-types'
# time to generate code now
$types = Hash.new
$tables = Array.new
$colls = Array.new
$coded_indexes = Array.new
$ops = Array.new
doc = REXML::Document.new(File.open("cecil.xml"))
doc.root.each_element("/cecil/types//type") { |node|
type = Cecil::Type.new(
node.attribute("name").value,
node.attribute("size").value.to_i,
(node.attribute("underlying").nil? ? nil : node.attribute("underlying").value))
$types[type.name] = type
}
doc.root.each_element("/cecil/metadata/tables//table") { |node|
table = Cecil::Table.new(node.attribute("name").value,
node.attribute("rid").value,
node.attribute("requires").nil? ? nil : node.attribute("requires").value)
node.each_element("column") { |col|
column = Cecil::Column.new(col.attribute("name").value,
$types[col.attribute("type").value],
col.attribute("target").nil? ? nil : col.attribute("target").value)
table.add_column(column)
}
$tables.push(table)
}
$tables.sort!() { |a, b|
a.name <=> b.name
}
$stables = $tables.sort { |a, b|
eval(a.rid) <=> eval(b.rid)
}
doc.root.each_element("/cecil/metadata/codedindexes//codedindex") { |node|
ci = Cecil::CodedIndex.new(node.attribute("name").value,
node.attribute("size").value,
node.attribute("requires").nil? ? nil : node.attribute("requires").value)
node.each_element("table") { |table|
ci.add_table(table.attribute("name").value, table.attribute("tag").value)
}
$coded_indexes.push(ci)
}
doc.root.each_element("/cecil/metadata/opcodes//opcode") { |node|
$ops.push(Cecil::OpCode.new(node.attribute("name").value, node.attribute("op1").value,
node.attribute("op2").value, node.attribute("flowcontrol").value,
node.attribute("opcodetype").value, node.attribute("operandtype").value,
node.attribute("stackbehaviourpop").value, node.attribute("stackbehaviourpush").value,
node.attribute("requires").nil? ? nil : node.attribute("requires").value))
}
$ops.sort!() { |a, b|
if a.op1 == b.op1
eval(a.op2) <=> eval(b.op2)
elsif a.op1 == "0xff"
-1
else
1
end
}
doc.root.each_element("/cecil/collections//collection") { |node|
$colls.push(Cecil::Collection.new(node.attribute("type").value, node.attribute("container").value,
(node.attribute("visit").nil? ? nil : node.attribute("visit").value),
(node.attribute("name").nil? ? nil : node.attribute("name").value),
(node.attribute("lazyload").nil? ? false : node.attribute("lazyload").value == "true"),
(node.attribute("pathtoloader").nil? ? nil : node.attribute("pathtoloader").value),
node.attribute("target").value,
(node.attribute("indexed").nil? ? false : node.attribute("indexed").value == "true"),
(node.attribute("usecontainerinterface").nil? ? false : node.attribute("usecontainerinterface").value == "true")))
}
def cecil_compile(file, template)
erb = ERB.new(IO.read(template))
res = erb.result
if (!File.exists?(file))
File.open(file, File::CREAT|File::WRONLY|File::TRUNC) { |cur_file|
cur_file.write(res)
}
puts("#Created: #{file}")
else
ext = ".tmp"
File.open(file + ext, File::CREAT|File::WRONLY|File::TRUNC) { |temp_file|
temp_file.write(res)
}
save = Array.new
[file, file + ext].each { |fileloc|
File.open(fileloc, File::RDONLY) { |f|
buf = f.readlines
buf.each { |line|
line.chomp!()
}
buf = buf.join
buf = buf[buf.index("SOFTWARE."), buf.length]
save.push(buf)
}
}
if (save[0] != save[1]) then
File.delete(file) if File.exists?(file)
File.rename(file + ext, file)
puts("#Modified: #{file}")
else
File.delete(file + ext)
end
end
end
$tables.each { |table|
$cur_table = table
filename = "../Mono.Cecil.Metadata/" + table.name + ".cs"
cecil_compile(filename, "./templates/Table.cs")
}
$cur_table = nil
[ "MetadataTableReader.cs", "MetadataRowReader.cs",
"MetadataTableWriter.cs", "MetadataRowWriter.cs", "BaseMetadataVisitor.cs",
"CodedIndex.cs", "Utilities.cs" ].each { |file|
cecil_compile("../Mono.Cecil.Metadata/" + file, "./templates/" + file)
}
cecil_compile("../Mono.Cecil.Metadata/IMetadataVisitor.cs", "./templates/IMetadataVisitor.cs")
cecil_compile("../Mono.Cecil.Cil/OpCodes.cs", "./templates/OpCodes.cs")
cecil_compile("../Mono.Cecil.Cil/Code.cs", "./templates/Code.cs")
$colls.each { |coll|
$cur_coll = coll
file = "../#{coll.target}/" + coll.name + ".cs"
type = coll.indexed ? "Indexed" : "Named"
template = "./templates/#{type}Collection.cs"
cecil_compile(file, template)
}
$cur_coll = nil

159
src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Mono.Cecil/CodeGen/cecil-mig.rb

@ -1,159 +0,0 @@ @@ -1,159 +0,0 @@
#!/usr/bin/env ruby
#
# usage cecil-mig.rb directory
#
dir = ARGV.length > 0 ? ARGV[0] : "."
$replaces = {
"GenericParamAttributes" => "GenericParameterAttributes",
"ParamAttributes" => "ParameterAttributes",
"IParameterReference" => "ParameterDefinition",
"IPropertyReference" => "PropertyDefinition",
"IEventReference" => "EventDefinition",
"IVariableReference" => "VariableDefinition",
"IMarshalDesc" => "MarshalSpec",
"MarshalDesc" => "MarshalSpec",
"IArrayMarshalDesc" => "ArrayMarshalSpec",
"ArrayMarshalDesc" => "ArrayMarshalSpec",
"ICustomMarshalerDesc" => "CustomMarshalerSpec",
"CustomMarshalerDesc" => "CustomMarshalerSpec",
"ISafeArrayDesc" => "SafeArraySpec",
"SafeArrayDesc" => "SafeArraySpec",
"IFixedArrayDesc" => "FixedArraySpec",
"FixedArrayDesc" => "FixedArraySpec",
"IFixedSysStringDesc" => "FixedSysStringSpec",
"FixedSysStringDesc" => "FixedSysStringSpec",
"IModifierType" => "ModType"
}
$collections = [
"AssemblyNameReferenceCollection",
"ModuleReferenceCollection",
"ModuleDefinitionCollection",
"ResourceCollection",
"TypeDefinitionCollection",
"TypeReferenceCollection",
"InterfaceCollection",
"ParameterDefinitionCollection",
"OverrideCollection",
"MethodDefinitionCollection",
"ConstructorCollection",
"EventDefinitionCollection",
"FieldDefinitionCollection",
"PropertyDefinitionCollection",
"InstructionCollection",
"ExceptionHandlerCollection",
"VariableDefinitionCollection",
"ArrayDimensionCollection",
"CustomAttributeCollection",
"ExternTypeCollection",
"NestedTypeCollection",
"SecurityDeclarationCollection",
"MemberReferenceCollection",
"GenericParameterCollection",
"GenericArgumentCollection",
"ConstraintCollection"
]
$types = [
"AssemblyDefinition",
"ArrayDimension",
"ArrayType",
"AssemblyLinkedResource",
"AssemblyNameReference",
"AssemblyNameDefinition",
"CallSite",
"CustomAttribute",
"EmbeddedResource",
"EventDefinition",
"EventReference",
"FieldDefinition",
"FieldReference",
"FunctionPointerType",
"GenericInstanceMethod",
"GenericInstanceType",
"GenericParameter",
"LinkedResource",
"MethodDefinition",
"MethodReference",
"MethodReturnType",
"ModifierOptional",
"ModifierRequired",
"ModuleDefinition",
"ModuleReference",
"ParameterDefinition",
"ParameterReference",
"PinnedType",
"PInvokeInfo",
"PropertyDefinition",
"PropertyReference",
"ReferenceType",
"Resource",
"SecurityDeclaration",
"TypeDefinition",
"TypeReference",
"TypeSpecification",
"Instruction",
"ExceptionHandler",
"MethodBody",
"VariableDefinition",
"VariableReference"
]
def iface(name)
return "I" + name
end
def bang(buffer, re, str)
nl = "([\\W])"
buffer.gsub!(Regexp.new("#{nl}(#{re})#{nl}"), "\\1" + str + "\\3")
end
def process_replaces(buffer)
$replaces.each_key { |key|
bang(buffer, key, $replaces[key])
}
end
def process_collections(buffer)
$collections.each { |name|
bang(buffer, iface(name), name)
}
end
def process_types(buffer)
$types.each { |name|
bang(buffer, iface(name), name)
}
end
def process_unbreak(buffer)
$unbreak.each { |name|
bang(buffer, name, iface(name))
}
end
def process(file)
buffer = ""
original = ""
File.open(file, File::RDONLY) { |f|
original = f.read()
buffer = original.clone
process_replaces(buffer)
process_collections(buffer)
process_types(buffer)
}
File.open(file, File::WRONLY | File::TRUNC) { |f|
f.write(buffer)
puts("#{file} processed")
} if (original != buffer)
end
Dir[File.join(dir, "**", "*.*")].each { |file|
process(file) if not File.directory?(file)
}

608
src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Mono.Cecil/CodeGen/cecil.xml

@ -1,608 +0,0 @@ @@ -1,608 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<cecil>
<types>
<type name="byte" size="1" />
<type name="ushort" size="2" />
<type name="short" size="2" />
<type name="uint" size="4" />
<type name="int" size="4" />
<type name="Mono.Cecil.Binary.DataDirectory" size="8" />
<type name="Mono.Cecil.Binary.ImageCharacteristics" underlying="ushort" size="2" />
<type name="Mono.Cecil.Binary.DebugStoreType" underlying="uint" size="4" />
<type name="Mono.Cecil.Binary.SubSystem" underlying="ushort" size="2" />
<type name="Mono.Cecil.Binary.SectionCharacteristics" underlying="uint" size="4" />
<type name="Mono.Cecil.Binary.RVA" size="4" />
<type name="Mono.Cecil.Binary.RuntimeImage" underlying="uint" size="4" />
<type name="Mono.Cecil.AssemblyHashAlgorithm" underlying="uint" size="4" />
<type name="Mono.Cecil.AssemblyFlags" underlying="uint" size="4" />
<type name="Mono.Cecil.EventAttributes" underlying="ushort" size="2" />
<type name="Mono.Cecil.TypeAttributes" underlying="uint" size="4" />
<type name="Mono.Cecil.FieldAttributes" underlying="ushort" size="2" />
<type name="Mono.Cecil.FileAttributes" underlying="uint" size="4" />
<type name="Mono.Cecil.GenericParameterAttributes" underlying="ushort" size="2" />
<type name="Mono.Cecil.PInvokeAttributes" underlying="ushort" size="2" />
<type name="Mono.Cecil.ParameterAttributes" underlying="ushort" size="2" />
<type name="Mono.Cecil.PropertyAttributes" underlying="ushort" size="2" />
<type name="Mono.Cecil.ManifestResourceAttributes" underlying="uint" size="4" />
<type name="Mono.Cecil.MethodAttributes" underlying="ushort" size="2" />
<type name="Mono.Cecil.MethodImplAttributes" underlying="ushort" size="2" />
<type name="Mono.Cecil.MethodSemanticsAttributes" underlying="ushort" size="2" />
<type name="Mono.Cecil.SecurityAction" underlying="short" size="2" />
<type name="Mono.Cecil.Metadata.ElementType" underlying="ushort" size="2" />
<type name="Mono.Cecil.Metadata.MetadataToken" underlying="uint" size="4" />
</types>
<!--
All details about the Metadata
reader and writer of Cecil
-->
<metadata>
<!--
This part contains ECMA spec
about CIL tables and rows positions
in a valid CLI image
-->
<tables>
<table name="Assembly" rid="0x20">
<column name="HashAlgId" type="Mono.Cecil.AssemblyHashAlgorithm" />
<column name="MajorVersion" type="ushort" />
<column name="MinorVersion" type="ushort" />
<column name="BuildNumber" type="ushort" />
<column name="RevisionNumber" type="ushort" />
<column name="Flags" type="Mono.Cecil.AssemblyFlags" />
<column name="PublicKey" type="uint" target="BlobHeap" />
<column name="Name" type="uint" target="StringsHeap" />
<column name="Culture" type="uint" target="StringsHeap" />
</table>
<table name="AssemblyOS" rid="0x22">
<column name="OSPlatformID" type="uint" />
<column name="OSMajorVersion" type="uint" />
<column name="OSMinorVersion" type="uint" />
</table>
<table name="AssemblyProcessor" rid="0x21">
<column name="Processor" type="uint" />
</table>
<table name="AssemblyRef" rid="0x23">
<column name="MajorVersion" type="ushort" />
<column name="MinorVersion" type="ushort" />
<column name="BuildNumber" type="ushort" />
<column name="RevisionNumber" type="ushort" />
<column name="Flags" type="Mono.Cecil.AssemblyFlags" />
<column name="PublicKeyOrToken" type="uint" target="BlobHeap" />
<column name="Name" type="uint" target="StringsHeap" />
<column name="Culture" type="uint" target="StringsHeap" />
<column name="HashValue" type="uint" target="BlobHeap" />
</table>
<table name="AssemblyRefOS" rid="0x25">
<column name="OSPlatformID" type="uint" />
<column name="OSMajorVersion" type="uint" />
<column name="OSMinorVersion" type="uint" />
<column name="AssemblyRef" type="uint" target="AssemblyRef" />
</table>
<table name="AssemblyRefProcessor" rid="0x24">
<column name="Processor" type="uint" />
<column name="AssemblyRef" type="uint" target="AssemblyRef" />
</table>
<table name="ClassLayout" rid="0x0f">
<column name="PackingSize" type="ushort" />
<column name="ClassSize" type="uint" />
<column name="Parent" type="uint" target="TypeDef" />
</table>
<table name="Constant" rid="0x0b">
<column name="Type" type="Mono.Cecil.Metadata.ElementType" />
<column name="Parent" type="Mono.Cecil.Metadata.MetadataToken" target="HasConstant" />
<column name="Value" type="uint" target="BlobHeap" />
</table>
<table name="CustomAttribute" rid="0x0c">
<column name="Parent" type="Mono.Cecil.Metadata.MetadataToken" target="HasCustomAttribute" />
<column name="Type" type="Mono.Cecil.Metadata.MetadataToken" target="CustomAttributeType" />
<column name="Value" type="uint" target="BlobHeap" />
</table>
<table name="DeclSecurity" rid="0x0e">
<column name="Action" type="Mono.Cecil.SecurityAction" />
<column name="Parent" type="Mono.Cecil.Metadata.MetadataToken" target="HasDeclSecurity" />
<column name="PermissionSet" type="uint" target="BlobHeap" />
</table>
<table name="EventMap" rid="0x12">
<column name="Parent" type="uint" target="TypeDef" />
<column name="EventList" type="uint" target="Event" />
</table>
<table name="Event" rid="0x14">
<column name="EventFlags" type="Mono.Cecil.EventAttributes" />
<column name="Name" type="uint" target="StringsHeap" />
<column name="EventType" type="Mono.Cecil.Metadata.MetadataToken" target="TypeDefOrRef" />
</table>
<table name="EventPtr" rid="0x13">
<column name="Event" type="uint" target="Event" />
</table>
<table name="ExportedType" rid="0x27">
<column name="Flags" type="Mono.Cecil.TypeAttributes" />
<column name="TypeDefId" type="uint" />
<column name="TypeName" type="uint" target="StringsHeap" />
<column name="TypeNamespace" type="uint" target="StringsHeap" />
<column name="Implementation" type="Mono.Cecil.Metadata.MetadataToken" target="Implementation" />
</table>
<table name="Field" rid="0x04">
<column name="Flags" type="Mono.Cecil.FieldAttributes" />
<column name="Name" type="uint" target="StringsHeap" />
<column name="Signature" type="uint" target="BlobHeap" />
</table>
<table name="FieldLayout" rid="0x10">
<column name="Offset" type="uint" />
<column name="Field" type="uint" target="Field" />
</table>
<table name="FieldMarshal" rid="0x0d">
<column name="Parent" type="Mono.Cecil.Metadata.MetadataToken" target="HasFieldMarshal" />
<column name="NativeType" type="uint" target="BlobHeap" />
</table>
<table name="FieldPtr" rid="0x03">
<column name="Field" type="uint" target="Field" />
</table>
<table name="FieldRVA" rid="0x1d">
<column name="RVA" type="Mono.Cecil.Binary.RVA" />
<column name="Field" type="uint" target="Field" />
</table>
<table name="File" rid="0x26">
<column name="Flags" type="Mono.Cecil.FileAttributes" />
<column name="Name" type="uint" target="StringsHeap" />
<column name="HashValue" type="uint" target="BlobHeap" />
</table>
<table name="GenericParam" rid="0x2a" requires="NET_2_0">
<column name="Number" type="ushort" />
<column name="Flags" type="Mono.Cecil.GenericParameterAttributes" />
<column name="Owner" type="Mono.Cecil.Metadata.MetadataToken" target="TypeOrMethodDef" />
<column name="Name" type="uint" target="StringsHeap" />
</table>
<table name="GenericParamConstraint" rid="0x2c" requires="NET_2_0">
<column name="Owner" type="uint" target="GenericParam" />
<column name="Constraint" type="Mono.Cecil.Metadata.MetadataToken" target="TypeDefOrRef" />
</table>
<table name="ImplMap" rid="0x1c">
<column name="MappingFlags" type="Mono.Cecil.PInvokeAttributes" />
<column name="MemberForwarded" type="Mono.Cecil.Metadata.MetadataToken" target="MemberForwarded" />
<column name="ImportName" type="uint" target="StringsHeap" />
<column name="ImportScope" type="uint" target="ModuleRef" />
</table>
<table name="InterfaceImpl" rid="0x09">
<column name="Class" type="uint" target="TypeDef" />
<column name="Interface" type="Mono.Cecil.Metadata.MetadataToken" target="TypeDefOrRef" />
</table>
<table name="ManifestResource" rid="0x28">
<column name="Offset" type="uint" />
<column name="Flags" type="Mono.Cecil.ManifestResourceAttributes" />
<column name="Name" type="uint" target="StringsHeap" />
<column name="Implementation" type="Mono.Cecil.Metadata.MetadataToken" target="Implementation" />
</table>
<table name="MemberRef" rid="0x0a">
<column name="Class" type="Mono.Cecil.Metadata.MetadataToken" target="MemberRefParent" />
<column name="Name" type="uint" target="StringsHeap" />
<column name="Signature" type="uint" target="BlobHeap" />
</table>
<table name="Method" rid="0x06">
<column name="RVA" type="Mono.Cecil.Binary.RVA" />
<column name="ImplFlags" type="Mono.Cecil.MethodImplAttributes" />
<column name="Flags" type="Mono.Cecil.MethodAttributes" />
<column name="Name" type="uint" target="StringsHeap" />
<column name="Signature" type="uint" target="BlobHeap" />
<column name="ParamList" type="uint" target="Param" />
</table>
<table name="MethodImpl" rid="0x19">
<column name="Class" type="uint" target="TypeDef" />
<column name="MethodBody" type="Mono.Cecil.Metadata.MetadataToken" target="MethodDefOrRef" />
<column name="MethodDeclaration" type="Mono.Cecil.Metadata.MetadataToken" target="MethodDefOrRef" />
</table>
<table name="MethodPtr" rid="0x05">
<column name="Method" type="uint" target="Method" />
</table>
<table name="MethodSemantics" rid="0x18">
<column name="Semantics" type="Mono.Cecil.MethodSemanticsAttributes" />
<column name="Method" type="uint" target="Method" />
<column name="Association" type="Mono.Cecil.Metadata.MetadataToken" target="HasSemantics" />
</table>
<table name="MethodSpec" rid="0x2b" requires="NET_2_0">
<column name="Method" type="Mono.Cecil.Metadata.MetadataToken" target="MethodDefOrRef" />
<column name="Instantiation" type="uint" target="BlobHeap" />
</table>
<table name="Module" rid="0x00">
<column name="Generation" type="ushort" />
<column name="Name" type="uint" target="StringsHeap" />
<column name="Mvid" type="uint" target="GuidHeap" />
<column name="EncId" type="uint" target="GuidHeap" />
<column name="EncBaseId" type="uint" target="GuidHeap" />
</table>
<table name="ModuleRef" rid="0x1a">
<column name="Name" type="uint" target="StringsHeap" />
</table>
<table name="NestedClass" rid="0x29">
<column name="NestedClass" type="uint" target="TypeDef" />
<column name="EnclosingClass" type="uint" target="TypeDef" />
</table>
<table name="Param" rid="0x08">
<column name="Flags" type="Mono.Cecil.ParameterAttributes" />
<column name="Sequence" type="ushort" />
<column name="Name" type="uint" target="StringsHeap" />
</table>
<table name="ParamPtr" rid="0x07">
<column name="Param" type="uint" target="Param" />
</table>
<table name="Property" rid="0x17">
<column name="Flags" type="Mono.Cecil.PropertyAttributes" />
<column name="Name" type="uint" target="StringsHeap" />
<column name="Type" type="uint" target="BlobHeap" />
</table>
<table name="PropertyMap" rid="0x15">
<column name="Parent" type="uint" target="TypeDef" />
<column name="PropertyList" type="uint" target="Property" />
</table>
<table name="PropertyPtr" rid="0x16">
<column name="Property" type="uint" target="Property" />
</table>
<table name="StandAloneSig" rid="0x11">
<column name="Signature" type="uint" target="BlobHeap" />
</table>
<table name="TypeDef" rid="0x02">
<column name="Flags" type="Mono.Cecil.TypeAttributes" />
<column name="Name" type="uint" target="StringsHeap" />
<column name="Namespace" type="uint" target="StringsHeap" />
<column name="Extends" type="Mono.Cecil.Metadata.MetadataToken" target="TypeDefOrRef" />
<column name="FieldList" type="uint" target="Field" />
<column name="MethodList" type="uint" target="Method" />
</table>
<table name="TypeRef" rid="0x01">
<column name="ResolutionScope" type="Mono.Cecil.Metadata.MetadataToken" target="ResolutionScope" />
<column name="Name" type="uint" target="StringsHeap" />
<column name="Namespace" type="uint" target="StringsHeap" />
</table>
<table name="TypeSpec" rid="0x1b">
<column name="Signature" type="uint" target="BlobHeap" />
</table>
</tables>
<codedindexes>
<codedindex name="TypeDefOrRef" size="2">
<table name="TypeDef" tag="0" />
<table name="TypeRef" tag="1" />
<table name="TypeSpec" tag="2" />
</codedindex>
<codedindex name="HasConstant" size="2">
<table name="Field" tag="0" />
<table name="Param" tag="1" />
<table name="Property" tag="2" />
</codedindex>
<codedindex name="HasCustomAttribute" size="5">
<table name="Method" tag="0" />
<table name="Field" tag="1" />
<table name="TypeRef" tag="2" />
<table name="TypeDef" tag="3" />
<table name="Param" tag="4" />
<table name="InterfaceImpl" tag="5" />
<table name="MemberRef" tag="6" />
<table name="Module" tag="7" />
<table name="DeclSecurity" tag="8" />
<table name="Property" tag="9" />
<table name="Event" tag="10" />
<table name="StandAloneSig" tag="11" />
<table name="ModuleRef" tag="12" />
<table name="TypeSpec" tag="13" />
<table name="Assembly" tag="14" />
<table name="AssemblyRef" tag="15" />
<table name="File" tag="16" />
<table name="ExportedType" tag="17" />
<table name="ManifestResource" tag="18" />
<table name="GenericParam" tag="19" />
</codedindex>
<codedindex name="HasFieldMarshal" size="1">
<table name="Field" tag="0" />
<table name="Param" tag="1" />
</codedindex>
<codedindex name="HasDeclSecurity" size="2">
<table name="TypeDef" tag="0" />
<table name="Method" tag="1" />
<table name="Assembly" tag="2" />
</codedindex>
<codedindex name="MemberRefParent" size="3">
<table name="TypeDef" tag="0" />
<table name="TypeRef" tag="1" />
<table name="ModuleRef" tag="2" />
<table name="Method" tag="3" />
<table name="TypeSpec" tag="4" />
</codedindex>
<codedindex name="HasSemantics" size="1">
<table name="Event" tag="0" />
<table name="Property" tag="1" />
</codedindex>
<codedindex name="MethodDefOrRef" size="1">
<table name="Method" tag="0" />
<table name="MemberRef" tag="1" />
</codedindex>
<codedindex name="MemberForwarded" size="1">
<table name="Field" tag="0" />
<table name="Method" tag="1" />
</codedindex>
<codedindex name="Implementation" size="2">
<table name="File" tag="0" />
<table name="AssemblyRef" tag="1" />
<table name="ExportedType" tag="2" />
</codedindex>
<codedindex name="CustomAttributeType" size="3">
<table name="Method" tag="2" />
<table name="MemberRef" tag="3" />
</codedindex>
<codedindex name="ResolutionScope" size="2">
<table name="Module" tag="0" />
<table name="ModuleRef" tag="1" />
<table name="AssemblyRef" tag="2" />
<table name="TypeRef" tag="3" />
</codedindex>
<codedindex name="TypeOrMethodDef" size="1" requires="NET_2_0">
<table name="TypeDef" tag="0" />
<table name="Method" tag="1" />
</codedindex>
</codedindexes>
<!--
This part contains all the standards opcodes
-->
<opcodes>
<opcode name="nop" op1="0xff" op2="0x00" flowcontrol="Next" opcodetype="Primitive" operandtype="InlineNone" stackbehaviourpop="Pop0" stackbehaviourpush="Push0" />
<opcode name="break" op1="0xff" op2="0x01" flowcontrol="Break" opcodetype="Primitive" operandtype="InlineNone" stackbehaviourpop="Pop0" stackbehaviourpush="Push0" />
<opcode name="ldarg.0" op1="0xff" op2="0x02" flowcontrol="Next" opcodetype="Macro" operandtype="InlineNone" stackbehaviourpop="Pop0" stackbehaviourpush="Push1" />
<opcode name="ldarg.1" op1="0xff" op2="0x03" flowcontrol="Next" opcodetype="Macro" operandtype="InlineNone" stackbehaviourpop="Pop0" stackbehaviourpush="Push1" />
<opcode name="ldarg.2" op1="0xff" op2="0x04" flowcontrol="Next" opcodetype="Macro" operandtype="InlineNone" stackbehaviourpop="Pop0" stackbehaviourpush="Push1" />
<opcode name="ldarg.3" op1="0xff" op2="0x05" flowcontrol="Next" opcodetype="Macro" operandtype="InlineNone" stackbehaviourpop="Pop0" stackbehaviourpush="Push1" />
<opcode name="ldloc.0" op1="0xff" op2="0x06" flowcontrol="Next" opcodetype="Macro" operandtype="InlineNone" stackbehaviourpop="Pop0" stackbehaviourpush="Push1" />
<opcode name="ldloc.1" op1="0xff" op2="0x07" flowcontrol="Next" opcodetype="Macro" operandtype="InlineNone" stackbehaviourpop="Pop0" stackbehaviourpush="Push1" />
<opcode name="ldloc.2" op1="0xff" op2="0x08" flowcontrol="Next" opcodetype="Macro" operandtype="InlineNone" stackbehaviourpop="Pop0" stackbehaviourpush="Push1" />
<opcode name="ldloc.3" op1="0xff" op2="0x09" flowcontrol="Next" opcodetype="Macro" operandtype="InlineNone" stackbehaviourpop="Pop0" stackbehaviourpush="Push1" />
<opcode name="stloc.0" op1="0xff" op2="0x0a" flowcontrol="Next" opcodetype="Macro" operandtype="InlineNone" stackbehaviourpop="Pop1" stackbehaviourpush="Push0" />
<opcode name="stloc.1" op1="0xff" op2="0x0b" flowcontrol="Next" opcodetype="Macro" operandtype="InlineNone" stackbehaviourpop="Pop1" stackbehaviourpush="Push0" />
<opcode name="stloc.2" op1="0xff" op2="0x0c" flowcontrol="Next" opcodetype="Macro" operandtype="InlineNone" stackbehaviourpop="Pop1" stackbehaviourpush="Push0" />
<opcode name="stloc.3" op1="0xff" op2="0x0d" flowcontrol="Next" opcodetype="Macro" operandtype="InlineNone" stackbehaviourpop="Pop1" stackbehaviourpush="Push0" />
<opcode name="ldarg.s" op1="0xff" op2="0x0e" flowcontrol="Next" opcodetype="Macro" operandtype="ShortInlineParam" stackbehaviourpop="Pop0" stackbehaviourpush="Push1" />
<opcode name="ldarga.s" op1="0xff" op2="0x0f" flowcontrol="Next" opcodetype="Macro" operandtype="ShortInlineParam" stackbehaviourpop="Pop0" stackbehaviourpush="Pushi" />
<opcode name="starg.s" op1="0xff" op2="0x10" flowcontrol="Next" opcodetype="Macro" operandtype="ShortInlineParam" stackbehaviourpop="Pop1" stackbehaviourpush="Push0" />
<opcode name="ldloc.s" op1="0xff" op2="0x11" flowcontrol="Next" opcodetype="Macro" operandtype="ShortInlineVar" stackbehaviourpop="Pop0" stackbehaviourpush="Push1" />
<opcode name="ldloca.s" op1="0xff" op2="0x12" flowcontrol="Next" opcodetype="Macro" operandtype="ShortInlineVar" stackbehaviourpop="Pop0" stackbehaviourpush="Pushi" />
<opcode name="stloc.s" op1="0xff" op2="0x13" flowcontrol="Next" opcodetype="Macro" operandtype="ShortInlineVar" stackbehaviourpop="Pop1" stackbehaviourpush="Push0" />
<opcode name="ldnull" op1="0xff" op2="0x14" flowcontrol="Next" opcodetype="Primitive" operandtype="InlineNone" stackbehaviourpop="Pop0" stackbehaviourpush="Pushref" />
<opcode name="ldc.i4.m1" op1="0xff" op2="0x15" flowcontrol="Next" opcodetype="Macro" operandtype="InlineNone" stackbehaviourpop="Pop0" stackbehaviourpush="Pushi" />
<opcode name="ldc.i4.0" op1="0xff" op2="0x16" flowcontrol="Next" opcodetype="Macro" operandtype="InlineNone" stackbehaviourpop="Pop0" stackbehaviourpush="Pushi" />
<opcode name="ldc.i4.1" op1="0xff" op2="0x17" flowcontrol="Next" opcodetype="Macro" operandtype="InlineNone" stackbehaviourpop="Pop0" stackbehaviourpush="Pushi" />
<opcode name="ldc.i4.2" op1="0xff" op2="0x18" flowcontrol="Next" opcodetype="Macro" operandtype="InlineNone" stackbehaviourpop="Pop0" stackbehaviourpush="Pushi" />
<opcode name="ldc.i4.3" op1="0xff" op2="0x19" flowcontrol="Next" opcodetype="Macro" operandtype="InlineNone" stackbehaviourpop="Pop0" stackbehaviourpush="Pushi" />
<opcode name="ldc.i4.4" op1="0xff" op2="0x1a" flowcontrol="Next" opcodetype="Macro" operandtype="InlineNone" stackbehaviourpop="Pop0" stackbehaviourpush="Pushi" />
<opcode name="ldc.i4.5" op1="0xff" op2="0x1b" flowcontrol="Next" opcodetype="Macro" operandtype="InlineNone" stackbehaviourpop="Pop0" stackbehaviourpush="Pushi" />
<opcode name="ldc.i4.6" op1="0xff" op2="0x1c" flowcontrol="Next" opcodetype="Macro" operandtype="InlineNone" stackbehaviourpop="Pop0" stackbehaviourpush="Pushi" />
<opcode name="ldc.i4.7" op1="0xff" op2="0x1d" flowcontrol="Next" opcodetype="Macro" operandtype="InlineNone" stackbehaviourpop="Pop0" stackbehaviourpush="Pushi" />
<opcode name="ldc.i4.8" op1="0xff" op2="0x1e" flowcontrol="Next" opcodetype="Macro" operandtype="InlineNone" stackbehaviourpop="Pop0" stackbehaviourpush="Pushi" />
<opcode name="ldc.i4.s" op1="0xff" op2="0x1f" flowcontrol="Next" opcodetype="Macro" operandtype="ShortInlineI" stackbehaviourpop="Pop0" stackbehaviourpush="Pushi" />
<opcode name="ldc.i4" op1="0xff" op2="0x20" flowcontrol="Next" opcodetype="Primitive" operandtype="InlineI" stackbehaviourpop="Pop0" stackbehaviourpush="Pushi" />
<opcode name="ldc.i8" op1="0xff" op2="0x21" flowcontrol="Next" opcodetype="Primitive" operandtype="InlineI8" stackbehaviourpop="Pop0" stackbehaviourpush="Pushi8" />
<opcode name="ldc.r4" op1="0xff" op2="0x22" flowcontrol="Next" opcodetype="Primitive" operandtype="ShortInlineR" stackbehaviourpop="Pop0" stackbehaviourpush="Pushr4" />
<opcode name="ldc.r8" op1="0xff" op2="0x23" flowcontrol="Next" opcodetype="Primitive" operandtype="InlineR" stackbehaviourpop="Pop0" stackbehaviourpush="Pushr8" />
<opcode name="dup" op1="0xff" op2="0x25" flowcontrol="Next" opcodetype="Primitive" operandtype="InlineNone" stackbehaviourpop="Pop1" stackbehaviourpush="Push1_push1" />
<opcode name="pop" op1="0xff" op2="0x26" flowcontrol="Next" opcodetype="Primitive" operandtype="InlineNone" stackbehaviourpop="Pop1" stackbehaviourpush="Push0" />
<opcode name="jmp" op1="0xff" op2="0x27" flowcontrol="Call" opcodetype="Primitive" operandtype="InlineMethod" stackbehaviourpop="Pop0" stackbehaviourpush="Push0" />
<opcode name="call" op1="0xff" op2="0x28" flowcontrol="Call" opcodetype="Primitive" operandtype="InlineMethod" stackbehaviourpop="Varpop" stackbehaviourpush="Varpush" />
<opcode name="calli" op1="0xff" op2="0x29" flowcontrol="Call" opcodetype="Primitive" operandtype="InlineSig" stackbehaviourpop="Varpop" stackbehaviourpush="Varpush" />
<opcode name="ret" op1="0xff" op2="0x2a" flowcontrol="Return" opcodetype="Primitive" operandtype="InlineNone" stackbehaviourpop="Varpop" stackbehaviourpush="Push0" />
<opcode name="br.s" op1="0xff" op2="0x2b" flowcontrol="Branch" opcodetype="Macro" operandtype="ShortInlineBrTarget" stackbehaviourpop="Pop0" stackbehaviourpush="Push0" />
<opcode name="brfalse.s" op1="0xff" op2="0x2c" flowcontrol="Cond_Branch" opcodetype="Macro" operandtype="ShortInlineBrTarget" stackbehaviourpop="Popi" stackbehaviourpush="Push0" />
<opcode name="brtrue.s" op1="0xff" op2="0x2d" flowcontrol="Cond_Branch" opcodetype="Macro" operandtype="ShortInlineBrTarget" stackbehaviourpop="Popi" stackbehaviourpush="Push0" />
<opcode name="beq.s" op1="0xff" op2="0x2e" flowcontrol="Cond_Branch" opcodetype="Macro" operandtype="ShortInlineBrTarget" stackbehaviourpop="Pop1_pop1" stackbehaviourpush="Push0" />
<opcode name="bge.s" op1="0xff" op2="0x2f" flowcontrol="Cond_Branch" opcodetype="Macro" operandtype="ShortInlineBrTarget" stackbehaviourpop="Pop1_pop1" stackbehaviourpush="Push0" />
<opcode name="bgt.s" op1="0xff" op2="0x30" flowcontrol="Cond_Branch" opcodetype="Macro" operandtype="ShortInlineBrTarget" stackbehaviourpop="Pop1_pop1" stackbehaviourpush="Push0" />
<opcode name="ble.s" op1="0xff" op2="0x31" flowcontrol="Cond_Branch" opcodetype="Macro" operandtype="ShortInlineBrTarget" stackbehaviourpop="Pop1_pop1" stackbehaviourpush="Push0" />
<opcode name="blt.s" op1="0xff" op2="0x32" flowcontrol="Cond_Branch" opcodetype="Macro" operandtype="ShortInlineBrTarget" stackbehaviourpop="Pop1_pop1" stackbehaviourpush="Push0" />
<opcode name="bne.un.s" op1="0xff" op2="0x33" flowcontrol="Cond_Branch" opcodetype="Macro" operandtype="ShortInlineBrTarget" stackbehaviourpop="Pop1_pop1" stackbehaviourpush="Push0" />
<opcode name="bge.un.s" op1="0xff" op2="0x34" flowcontrol="Cond_Branch" opcodetype="Macro" operandtype="ShortInlineBrTarget" stackbehaviourpop="Pop1_pop1" stackbehaviourpush="Push0" />
<opcode name="bgt.un.s" op1="0xff" op2="0x35" flowcontrol="Cond_Branch" opcodetype="Macro" operandtype="ShortInlineBrTarget" stackbehaviourpop="Pop1_pop1" stackbehaviourpush="Push0" />
<opcode name="ble.un.s" op1="0xff" op2="0x36" flowcontrol="Cond_Branch" opcodetype="Macro" operandtype="ShortInlineBrTarget" stackbehaviourpop="Pop1_pop1" stackbehaviourpush="Push0" />
<opcode name="blt.un.s" op1="0xff" op2="0x37" flowcontrol="Cond_Branch" opcodetype="Macro" operandtype="ShortInlineBrTarget" stackbehaviourpop="Pop1_pop1" stackbehaviourpush="Push0" />
<opcode name="br" op1="0xff" op2="0x38" flowcontrol="Branch" opcodetype="Primitive" operandtype="InlineBrTarget" stackbehaviourpop="Pop0" stackbehaviourpush="Push0" />
<opcode name="brfalse" op1="0xff" op2="0x39" flowcontrol="Cond_Branch" opcodetype="Primitive" operandtype="InlineBrTarget" stackbehaviourpop="Popi" stackbehaviourpush="Push0" />
<opcode name="brtrue" op1="0xff" op2="0x3a" flowcontrol="Cond_Branch" opcodetype="Primitive" operandtype="InlineBrTarget" stackbehaviourpop="Popi" stackbehaviourpush="Push0" />
<opcode name="beq" op1="0xff" op2="0x3b" flowcontrol="Cond_Branch" opcodetype="Macro" operandtype="InlineBrTarget" stackbehaviourpop="Pop1_pop1" stackbehaviourpush="Push0" />
<opcode name="bge" op1="0xff" op2="0x3c" flowcontrol="Cond_Branch" opcodetype="Macro" operandtype="InlineBrTarget" stackbehaviourpop="Pop1_pop1" stackbehaviourpush="Push0" />
<opcode name="bgt" op1="0xff" op2="0x3d" flowcontrol="Cond_Branch" opcodetype="Macro" operandtype="InlineBrTarget" stackbehaviourpop="Pop1_pop1" stackbehaviourpush="Push0" />
<opcode name="ble" op1="0xff" op2="0x3e" flowcontrol="Cond_Branch" opcodetype="Macro" operandtype="InlineBrTarget" stackbehaviourpop="Pop1_pop1" stackbehaviourpush="Push0" />
<opcode name="blt" op1="0xff" op2="0x3f" flowcontrol="Cond_Branch" opcodetype="Macro" operandtype="InlineBrTarget" stackbehaviourpop="Pop1_pop1" stackbehaviourpush="Push0" />
<opcode name="bne.un" op1="0xff" op2="0x40" flowcontrol="Cond_Branch" opcodetype="Macro" operandtype="InlineBrTarget" stackbehaviourpop="Pop1_pop1" stackbehaviourpush="Push0" />
<opcode name="bge.un" op1="0xff" op2="0x41" flowcontrol="Cond_Branch" opcodetype="Macro" operandtype="InlineBrTarget" stackbehaviourpop="Pop1_pop1" stackbehaviourpush="Push0" />
<opcode name="bgt.un" op1="0xff" op2="0x42" flowcontrol="Cond_Branch" opcodetype="Macro" operandtype="InlineBrTarget" stackbehaviourpop="Pop1_pop1" stackbehaviourpush="Push0" />
<opcode name="ble.un" op1="0xff" op2="0x43" flowcontrol="Cond_Branch" opcodetype="Macro" operandtype="InlineBrTarget" stackbehaviourpop="Pop1_pop1" stackbehaviourpush="Push0" />
<opcode name="blt.un" op1="0xff" op2="0x44" flowcontrol="Cond_Branch" opcodetype="Macro" operandtype="InlineBrTarget" stackbehaviourpop="Pop1_pop1" stackbehaviourpush="Push0" />
<opcode name="switch" op1="0xff" op2="0x45" flowcontrol="Cond_Branch" opcodetype="Primitive" operandtype="InlineSwitch" stackbehaviourpop="Popi" stackbehaviourpush="Push0" />
<opcode name="ldind.i1" op1="0xff" op2="0x46" flowcontrol="Next" opcodetype="Primitive" operandtype="InlineNone" stackbehaviourpop="Popi" stackbehaviourpush="Pushi" />
<opcode name="ldind.u1" op1="0xff" op2="0x47" flowcontrol="Next" opcodetype="Primitive" operandtype="InlineNone" stackbehaviourpop="Popi" stackbehaviourpush="Pushi" />
<opcode name="ldind.i2" op1="0xff" op2="0x48" flowcontrol="Next" opcodetype="Primitive" operandtype="InlineNone" stackbehaviourpop="Popi" stackbehaviourpush="Pushi" />
<opcode name="ldind.u2" op1="0xff" op2="0x49" flowcontrol="Next" opcodetype="Primitive" operandtype="InlineNone" stackbehaviourpop="Popi" stackbehaviourpush="Pushi" />
<opcode name="ldind.i4" op1="0xff" op2="0x4a" flowcontrol="Next" opcodetype="Primitive" operandtype="InlineNone" stackbehaviourpop="Popi" stackbehaviourpush="Pushi" />
<opcode name="ldind.u4" op1="0xff" op2="0x4b" flowcontrol="Next" opcodetype="Primitive" operandtype="InlineNone" stackbehaviourpop="Popi" stackbehaviourpush="Pushi" />
<opcode name="ldind.i8" op1="0xff" op2="0x4c" flowcontrol="Next" opcodetype="Primitive" operandtype="InlineNone" stackbehaviourpop="Popi" stackbehaviourpush="Pushi8" />
<opcode name="ldind.i" op1="0xff" op2="0x4d" flowcontrol="Next" opcodetype="Primitive" operandtype="InlineNone" stackbehaviourpop="Popi" stackbehaviourpush="Pushi" />
<opcode name="ldind.r4" op1="0xff" op2="0x4e" flowcontrol="Next" opcodetype="Primitive" operandtype="InlineNone" stackbehaviourpop="Popi" stackbehaviourpush="Pushr4" />
<opcode name="ldind.r8" op1="0xff" op2="0x4f" flowcontrol="Next" opcodetype="Primitive" operandtype="InlineNone" stackbehaviourpop="Popi" stackbehaviourpush="Pushr8" />
<opcode name="ldind.ref" op1="0xff" op2="0x50" flowcontrol="Next" opcodetype="Primitive" operandtype="InlineNone" stackbehaviourpop="Popi" stackbehaviourpush="Pushref" />
<opcode name="stind.ref" op1="0xff" op2="0x51" flowcontrol="Next" opcodetype="Primitive" operandtype="InlineNone" stackbehaviourpop="Popi_popi" stackbehaviourpush="Push0" />
<opcode name="stind.i1" op1="0xff" op2="0x52" flowcontrol="Next" opcodetype="Primitive" operandtype="InlineNone" stackbehaviourpop="Popi_popi" stackbehaviourpush="Push0" />
<opcode name="stind.i2" op1="0xff" op2="0x53" flowcontrol="Next" opcodetype="Primitive" operandtype="InlineNone" stackbehaviourpop="Popi_popi" stackbehaviourpush="Push0" />
<opcode name="stind.i4" op1="0xff" op2="0x54" flowcontrol="Next" opcodetype="Primitive" operandtype="InlineNone" stackbehaviourpop="Popi_popi" stackbehaviourpush="Push0" />
<opcode name="stind.i8" op1="0xff" op2="0x55" flowcontrol="Next" opcodetype="Primitive" operandtype="InlineNone" stackbehaviourpop="Popi_popi8" stackbehaviourpush="Push0" />
<opcode name="stind.r4" op1="0xff" op2="0x56" flowcontrol="Next" opcodetype="Primitive" operandtype="InlineNone" stackbehaviourpop="Popi_popr4" stackbehaviourpush="Push0" />
<opcode name="stind.r8" op1="0xff" op2="0x57" flowcontrol="Next" opcodetype="Primitive" operandtype="InlineNone" stackbehaviourpop="Popi_popr8" stackbehaviourpush="Push0" />
<opcode name="add" op1="0xff" op2="0x58" flowcontrol="Next" opcodetype="Primitive" operandtype="InlineNone" stackbehaviourpop="Pop1_pop1" stackbehaviourpush="Push1" />
<opcode name="sub" op1="0xff" op2="0x59" flowcontrol="Next" opcodetype="Primitive" operandtype="InlineNone" stackbehaviourpop="Pop1_pop1" stackbehaviourpush="Push1" />
<opcode name="mul" op1="0xff" op2="0x5a" flowcontrol="Next" opcodetype="Primitive" operandtype="InlineNone" stackbehaviourpop="Pop1_pop1" stackbehaviourpush="Push1" />
<opcode name="div" op1="0xff" op2="0x5b" flowcontrol="Next" opcodetype="Primitive" operandtype="InlineNone" stackbehaviourpop="Pop1_pop1" stackbehaviourpush="Push1" />
<opcode name="div.un" op1="0xff" op2="0x5c" flowcontrol="Next" opcodetype="Primitive" operandtype="InlineNone" stackbehaviourpop="Pop1_pop1" stackbehaviourpush="Push1" />
<opcode name="rem" op1="0xff" op2="0x5d" flowcontrol="Next" opcodetype="Primitive" operandtype="InlineNone" stackbehaviourpop="Pop1_pop1" stackbehaviourpush="Push1" />
<opcode name="rem.un" op1="0xff" op2="0x5e" flowcontrol="Next" opcodetype="Primitive" operandtype="InlineNone" stackbehaviourpop="Pop1_pop1" stackbehaviourpush="Push1" />
<opcode name="and" op1="0xff" op2="0x5f" flowcontrol="Next" opcodetype="Primitive" operandtype="InlineNone" stackbehaviourpop="Pop1_pop1" stackbehaviourpush="Push1" />
<opcode name="or" op1="0xff" op2="0x60" flowcontrol="Next" opcodetype="Primitive" operandtype="InlineNone" stackbehaviourpop="Pop1_pop1" stackbehaviourpush="Push1" />
<opcode name="xor" op1="0xff" op2="0x61" flowcontrol="Next" opcodetype="Primitive" operandtype="InlineNone" stackbehaviourpop="Pop1_pop1" stackbehaviourpush="Push1" />
<opcode name="shl" op1="0xff" op2="0x62" flowcontrol="Next" opcodetype="Primitive" operandtype="InlineNone" stackbehaviourpop="Pop1_pop1" stackbehaviourpush="Push1" />
<opcode name="shr" op1="0xff" op2="0x63" flowcontrol="Next" opcodetype="Primitive" operandtype="InlineNone" stackbehaviourpop="Pop1_pop1" stackbehaviourpush="Push1" />
<opcode name="shr.un" op1="0xff" op2="0x64" flowcontrol="Next" opcodetype="Primitive" operandtype="InlineNone" stackbehaviourpop="Pop1_pop1" stackbehaviourpush="Push1" />
<opcode name="neg" op1="0xff" op2="0x65" flowcontrol="Next" opcodetype="Primitive" operandtype="InlineNone" stackbehaviourpop="Pop1" stackbehaviourpush="Push1" />
<opcode name="not" op1="0xff" op2="0x66" flowcontrol="Next" opcodetype="Primitive" operandtype="InlineNone" stackbehaviourpop="Pop1" stackbehaviourpush="Push1" />
<opcode name="conv.i1" op1="0xff" op2="0x67" flowcontrol="Next" opcodetype="Primitive" operandtype="InlineNone" stackbehaviourpop="Pop1" stackbehaviourpush="Pushi" />
<opcode name="conv.i2" op1="0xff" op2="0x68" flowcontrol="Next" opcodetype="Primitive" operandtype="InlineNone" stackbehaviourpop="Pop1" stackbehaviourpush="Pushi" />
<opcode name="conv.i4" op1="0xff" op2="0x69" flowcontrol="Next" opcodetype="Primitive" operandtype="InlineNone" stackbehaviourpop="Pop1" stackbehaviourpush="Pushi" />
<opcode name="conv.i8" op1="0xff" op2="0x6a" flowcontrol="Next" opcodetype="Primitive" operandtype="InlineNone" stackbehaviourpop="Pop1" stackbehaviourpush="Pushi8" />
<opcode name="conv.r4" op1="0xff" op2="0x6b" flowcontrol="Next" opcodetype="Primitive" operandtype="InlineNone" stackbehaviourpop="Pop1" stackbehaviourpush="Pushr4" />
<opcode name="conv.r8" op1="0xff" op2="0x6c" flowcontrol="Next" opcodetype="Primitive" operandtype="InlineNone" stackbehaviourpop="Pop1" stackbehaviourpush="Pushr8" />
<opcode name="conv.u4" op1="0xff" op2="0x6d" flowcontrol="Next" opcodetype="Primitive" operandtype="InlineNone" stackbehaviourpop="Pop1" stackbehaviourpush="Pushi" />
<opcode name="conv.u8" op1="0xff" op2="0x6e" flowcontrol="Next" opcodetype="Primitive" operandtype="InlineNone" stackbehaviourpop="Pop1" stackbehaviourpush="Pushi8" />
<opcode name="callvirt" op1="0xff" op2="0x6f" flowcontrol="Call" opcodetype="Objmodel" operandtype="InlineMethod" stackbehaviourpop="Varpop" stackbehaviourpush="Varpush" />
<opcode name="cpobj" op1="0xff" op2="0x70" flowcontrol="Next" opcodetype="Objmodel" operandtype="InlineType" stackbehaviourpop="Popi_popi" stackbehaviourpush="Push0" />
<opcode name="ldobj" op1="0xff" op2="0x71" flowcontrol="Next" opcodetype="Objmodel" operandtype="InlineType" stackbehaviourpop="Popi" stackbehaviourpush="Push1" />
<opcode name="ldstr" op1="0xff" op2="0x72" flowcontrol="Next" opcodetype="Objmodel" operandtype="InlineString" stackbehaviourpop="Pop0" stackbehaviourpush="Pushref" />
<opcode name="newobj" op1="0xff" op2="0x73" flowcontrol="Call" opcodetype="Objmodel" operandtype="InlineMethod" stackbehaviourpop="Varpop" stackbehaviourpush="Pushref" />
<opcode name="castclass" op1="0xff" op2="0x74" flowcontrol="Next" opcodetype="Objmodel" operandtype="InlineType" stackbehaviourpop="Popref" stackbehaviourpush="Pushref" />
<opcode name="isinst" op1="0xff" op2="0x75" flowcontrol="Next" opcodetype="Objmodel" operandtype="InlineType" stackbehaviourpop="Popref" stackbehaviourpush="Pushi" />
<opcode name="conv.r.un" op1="0xff" op2="0x76" flowcontrol="Next" opcodetype="Primitive" operandtype="InlineNone" stackbehaviourpop="Pop1" stackbehaviourpush="Pushr8" />
<opcode name="unbox" op1="0xff" op2="0x79" flowcontrol="Next" opcodetype="Primitive" operandtype="InlineType" stackbehaviourpop="Popref" stackbehaviourpush="Pushi" />
<opcode name="throw" op1="0xff" op2="0x7a" flowcontrol="Throw" opcodetype="Objmodel" operandtype="InlineNone" stackbehaviourpop="Popref" stackbehaviourpush="Push0" />
<opcode name="ldfld" op1="0xff" op2="0x7b" flowcontrol="Next" opcodetype="Objmodel" operandtype="InlineField" stackbehaviourpop="Popref" stackbehaviourpush="Push1" />
<opcode name="ldflda" op1="0xff" op2="0x7c" flowcontrol="Next" opcodetype="Objmodel" operandtype="InlineField" stackbehaviourpop="Popref" stackbehaviourpush="Pushi" />
<opcode name="stfld" op1="0xff" op2="0x7d" flowcontrol="Next" opcodetype="Objmodel" operandtype="InlineField" stackbehaviourpop="Popref_pop1" stackbehaviourpush="Push0" />
<opcode name="ldsfld" op1="0xff" op2="0x7e" flowcontrol="Next" opcodetype="Objmodel" operandtype="InlineField" stackbehaviourpop="Pop0" stackbehaviourpush="Push1" />
<opcode name="ldsflda" op1="0xff" op2="0x7f" flowcontrol="Next" opcodetype="Objmodel" operandtype="InlineField" stackbehaviourpop="Pop0" stackbehaviourpush="Pushi" />
<opcode name="stsfld" op1="0xff" op2="0x80" flowcontrol="Next" opcodetype="Objmodel" operandtype="InlineField" stackbehaviourpop="Pop1" stackbehaviourpush="Push0" />
<opcode name="stobj" op1="0xff" op2="0x81" flowcontrol="Next" opcodetype="Objmodel" operandtype="InlineType" stackbehaviourpop="Popi_pop1" stackbehaviourpush="Push0" />
<opcode name="conv.ovf.i1.un" op1="0xff" op2="0x82" flowcontrol="Next" opcodetype="Primitive" operandtype="InlineNone" stackbehaviourpop="Pop1" stackbehaviourpush="Pushi" />
<opcode name="conv.ovf.i2.un" op1="0xff" op2="0x83" flowcontrol="Next" opcodetype="Primitive" operandtype="InlineNone" stackbehaviourpop="Pop1" stackbehaviourpush="Pushi" />
<opcode name="conv.ovf.i4.un" op1="0xff" op2="0x84" flowcontrol="Next" opcodetype="Primitive" operandtype="InlineNone" stackbehaviourpop="Pop1" stackbehaviourpush="Pushi" />
<opcode name="conv.ovf.i8.un" op1="0xff" op2="0x85" flowcontrol="Next" opcodetype="Primitive" operandtype="InlineNone" stackbehaviourpop="Pop1" stackbehaviourpush="Pushi8" />
<opcode name="conv.ovf.u1.un" op1="0xff" op2="0x86" flowcontrol="Next" opcodetype="Primitive" operandtype="InlineNone" stackbehaviourpop="Pop1" stackbehaviourpush="Pushi" />
<opcode name="conv.ovf.u2.un" op1="0xff" op2="0x87" flowcontrol="Next" opcodetype="Primitive" operandtype="InlineNone" stackbehaviourpop="Pop1" stackbehaviourpush="Pushi" />
<opcode name="conv.ovf.u4.un" op1="0xff" op2="0x88" flowcontrol="Next" opcodetype="Primitive" operandtype="InlineNone" stackbehaviourpop="Pop1" stackbehaviourpush="Pushi" />
<opcode name="conv.ovf.u8.un" op1="0xff" op2="0x89" flowcontrol="Next" opcodetype="Primitive" operandtype="InlineNone" stackbehaviourpop="Pop1" stackbehaviourpush="Pushi8" />
<opcode name="conv.ovf.i.un" op1="0xff" op2="0x8a" flowcontrol="Next" opcodetype="Primitive" operandtype="InlineNone" stackbehaviourpop="Pop1" stackbehaviourpush="Pushi" />
<opcode name="conv.ovf.u.un" op1="0xff" op2="0x8b" flowcontrol="Next" opcodetype="Primitive" operandtype="InlineNone" stackbehaviourpop="Pop1" stackbehaviourpush="Pushi" />
<opcode name="box" op1="0xff" op2="0x8c" flowcontrol="Next" opcodetype="Primitive" operandtype="InlineType" stackbehaviourpop="Pop1" stackbehaviourpush="Pushref" />
<opcode name="newarr" op1="0xff" op2="0x8d" flowcontrol="Next" opcodetype="Objmodel" operandtype="InlineType" stackbehaviourpop="Popi" stackbehaviourpush="Pushref" />
<opcode name="ldlen" op1="0xff" op2="0x8e" flowcontrol="Next" opcodetype="Objmodel" operandtype="InlineNone" stackbehaviourpop="Popref" stackbehaviourpush="Pushi" />
<opcode name="ldelema" op1="0xff" op2="0x8f" flowcontrol="Next" opcodetype="Objmodel" operandtype="InlineType" stackbehaviourpop="Popref_popi" stackbehaviourpush="Pushi" />
<opcode name="ldelem.i1" op1="0xff" op2="0x90" flowcontrol="Next" opcodetype="Objmodel" operandtype="InlineNone" stackbehaviourpop="Popref_popi" stackbehaviourpush="Pushi" />
<opcode name="ldelem.u1" op1="0xff" op2="0x91" flowcontrol="Next" opcodetype="Objmodel" operandtype="InlineNone" stackbehaviourpop="Popref_popi" stackbehaviourpush="Pushi" />
<opcode name="ldelem.i2" op1="0xff" op2="0x92" flowcontrol="Next" opcodetype="Objmodel" operandtype="InlineNone" stackbehaviourpop="Popref_popi" stackbehaviourpush="Pushi" />
<opcode name="ldelem.u2" op1="0xff" op2="0x93" flowcontrol="Next" opcodetype="Objmodel" operandtype="InlineNone" stackbehaviourpop="Popref_popi" stackbehaviourpush="Pushi" />
<opcode name="ldelem.i4" op1="0xff" op2="0x94" flowcontrol="Next" opcodetype="Objmodel" operandtype="InlineNone" stackbehaviourpop="Popref_popi" stackbehaviourpush="Pushi" />
<opcode name="ldelem.u4" op1="0xff" op2="0x95" flowcontrol="Next" opcodetype="Objmodel" operandtype="InlineNone" stackbehaviourpop="Popref_popi" stackbehaviourpush="Pushi" />
<opcode name="ldelem.i8" op1="0xff" op2="0x96" flowcontrol="Next" opcodetype="Objmodel" operandtype="InlineNone" stackbehaviourpop="Popref_popi" stackbehaviourpush="Pushi8" />
<opcode name="ldelem.i" op1="0xff" op2="0x97" flowcontrol="Next" opcodetype="Objmodel" operandtype="InlineNone" stackbehaviourpop="Popref_popi" stackbehaviourpush="Pushi" />
<opcode name="ldelem.r4" op1="0xff" op2="0x98" flowcontrol="Next" opcodetype="Objmodel" operandtype="InlineNone" stackbehaviourpop="Popref_popi" stackbehaviourpush="Pushr4" />
<opcode name="ldelem.r8" op1="0xff" op2="0x99" flowcontrol="Next" opcodetype="Objmodel" operandtype="InlineNone" stackbehaviourpop="Popref_popi" stackbehaviourpush="Pushr8" />
<opcode name="ldelem.ref" op1="0xff" op2="0x9a" flowcontrol="Next" opcodetype="Objmodel" operandtype="InlineNone" stackbehaviourpop="Popref_popi" stackbehaviourpush="Pushref" />
<opcode name="stelem.i" op1="0xff" op2="0x9b" flowcontrol="Next" opcodetype="Objmodel" operandtype="InlineNone" stackbehaviourpop="Popref_popi_popi" stackbehaviourpush="Push0" />
<opcode name="stelem.i1" op1="0xff" op2="0x9c" flowcontrol="Next" opcodetype="Objmodel" operandtype="InlineNone" stackbehaviourpop="Popref_popi_popi" stackbehaviourpush="Push0" />
<opcode name="stelem.i2" op1="0xff" op2="0x9d" flowcontrol="Next" opcodetype="Objmodel" operandtype="InlineNone" stackbehaviourpop="Popref_popi_popi" stackbehaviourpush="Push0" />
<opcode name="stelem.i4" op1="0xff" op2="0x9e" flowcontrol="Next" opcodetype="Objmodel" operandtype="InlineNone" stackbehaviourpop="Popref_popi_popi" stackbehaviourpush="Push0" />
<opcode name="stelem.i8" op1="0xff" op2="0x9f" flowcontrol="Next" opcodetype="Objmodel" operandtype="InlineNone" stackbehaviourpop="Popref_popi_popi8" stackbehaviourpush="Push0" />
<opcode name="stelem.r4" op1="0xff" op2="0xa0" flowcontrol="Next" opcodetype="Objmodel" operandtype="InlineNone" stackbehaviourpop="Popref_popi_popr4" stackbehaviourpush="Push0" />
<opcode name="stelem.r8" op1="0xff" op2="0xa1" flowcontrol="Next" opcodetype="Objmodel" operandtype="InlineNone" stackbehaviourpop="Popref_popi_popr8" stackbehaviourpush="Push0" />
<opcode name="stelem.ref" op1="0xff" op2="0xa2" flowcontrol="Next" opcodetype="Objmodel" operandtype="InlineNone" stackbehaviourpop="Popref_popi_popref" stackbehaviourpush="Push0" />
<opcode name="ldelem.any" op1="0xff" op2="0xa3" flowcontrol="Next" opcodetype="Objmodel" operandtype="InlineType" stackbehaviourpop="Popref_popi" stackbehaviourpush="Push1" requires="NET_2_0" />
<opcode name="stelem.any" op1="0xff" op2="0xa4" flowcontrol="Next" opcodetype="Objmodel" operandtype="InlineType" stackbehaviourpop="Popref_popi_popref" stackbehaviourpush="Push0" requires="NET_2_0" />
<opcode name="unbox.any" op1="0xff" op2="0xa5" flowcontrol="Next" opcodetype="Objmodel" operandtype="InlineType" stackbehaviourpop="Popref" stackbehaviourpush="Push1" requires="NET_2_0" />
<opcode name="conv.ovf.i1" op1="0xff" op2="0xb3" flowcontrol="Next" opcodetype="Primitive" operandtype="InlineNone" stackbehaviourpop="Pop1" stackbehaviourpush="Pushi" />
<opcode name="conv.ovf.u1" op1="0xff" op2="0xb4" flowcontrol="Next" opcodetype="Primitive" operandtype="InlineNone" stackbehaviourpop="Pop1" stackbehaviourpush="Pushi" />
<opcode name="conv.ovf.i2" op1="0xff" op2="0xb5" flowcontrol="Next" opcodetype="Primitive" operandtype="InlineNone" stackbehaviourpop="Pop1" stackbehaviourpush="Pushi" />
<opcode name="conv.ovf.u2" op1="0xff" op2="0xb6" flowcontrol="Next" opcodetype="Primitive" operandtype="InlineNone" stackbehaviourpop="Pop1" stackbehaviourpush="Pushi" />
<opcode name="conv.ovf.i4" op1="0xff" op2="0xb7" flowcontrol="Next" opcodetype="Primitive" operandtype="InlineNone" stackbehaviourpop="Pop1" stackbehaviourpush="Pushi" />
<opcode name="conv.ovf.u4" op1="0xff" op2="0xb8" flowcontrol="Next" opcodetype="Primitive" operandtype="InlineNone" stackbehaviourpop="Pop1" stackbehaviourpush="Pushi" />
<opcode name="conv.ovf.i8" op1="0xff" op2="0xb9" flowcontrol="Next" opcodetype="Primitive" operandtype="InlineNone" stackbehaviourpop="Pop1" stackbehaviourpush="Pushi8" />
<opcode name="conv.ovf.u8" op1="0xff" op2="0xba" flowcontrol="Next" opcodetype="Primitive" operandtype="InlineNone" stackbehaviourpop="Pop1" stackbehaviourpush="Pushi8" />
<opcode name="refanyval" op1="0xff" op2="0xc2" flowcontrol="Next" opcodetype="Primitive" operandtype="InlineType" stackbehaviourpop="Pop1" stackbehaviourpush="Pushi" />
<opcode name="ckfinite" op1="0xff" op2="0xc3" flowcontrol="Next" opcodetype="Primitive" operandtype="InlineNone" stackbehaviourpop="Pop1" stackbehaviourpush="Pushr8" />
<opcode name="mkrefany" op1="0xff" op2="0xc6" flowcontrol="Next" opcodetype="Primitive" operandtype="InlineType" stackbehaviourpop="Popi" stackbehaviourpush="Push1" />
<opcode name="ldtoken" op1="0xff" op2="0xd0" flowcontrol="Next" opcodetype="Primitive" operandtype="InlineTok" stackbehaviourpop="Pop0" stackbehaviourpush="Pushi" />
<opcode name="conv.u2" op1="0xff" op2="0xd1" flowcontrol="Next" opcodetype="Primitive" operandtype="InlineNone" stackbehaviourpop="Pop1" stackbehaviourpush="Pushi" />
<opcode name="conv.u1" op1="0xff" op2="0xd2" flowcontrol="Next" opcodetype="Primitive" operandtype="InlineNone" stackbehaviourpop="Pop1" stackbehaviourpush="Pushi" />
<opcode name="conv.i" op1="0xff" op2="0xd3" flowcontrol="Next" opcodetype="Primitive" operandtype="InlineNone" stackbehaviourpop="Pop1" stackbehaviourpush="Pushi" />
<opcode name="conv.ovf.i" op1="0xff" op2="0xd4" flowcontrol="Next" opcodetype="Primitive" operandtype="InlineNone" stackbehaviourpop="Pop1" stackbehaviourpush="Pushi" />
<opcode name="conv.ovf.u" op1="0xff" op2="0xd5" flowcontrol="Next" opcodetype="Primitive" operandtype="InlineNone" stackbehaviourpop="Pop1" stackbehaviourpush="Pushi" />
<opcode name="add.ovf" op1="0xff" op2="0xd6" flowcontrol="Next" opcodetype="Primitive" operandtype="InlineNone" stackbehaviourpop="Pop1_pop1" stackbehaviourpush="Push1" />
<opcode name="add.ovf.un" op1="0xff" op2="0xd7" flowcontrol="Next" opcodetype="Primitive" operandtype="InlineNone" stackbehaviourpop="Pop1_pop1" stackbehaviourpush="Push1" />
<opcode name="mul.ovf" op1="0xff" op2="0xd8" flowcontrol="Next" opcodetype="Primitive" operandtype="InlineNone" stackbehaviourpop="Pop1_pop1" stackbehaviourpush="Push1" />
<opcode name="mul.ovf.un" op1="0xff" op2="0xd9" flowcontrol="Next" opcodetype="Primitive" operandtype="InlineNone" stackbehaviourpop="Pop1_pop1" stackbehaviourpush="Push1" />
<opcode name="sub.ovf" op1="0xff" op2="0xda" flowcontrol="Next" opcodetype="Primitive" operandtype="InlineNone" stackbehaviourpop="Pop1_pop1" stackbehaviourpush="Push1" />
<opcode name="sub.ovf.un" op1="0xff" op2="0xdb" flowcontrol="Next" opcodetype="Primitive" operandtype="InlineNone" stackbehaviourpop="Pop1_pop1" stackbehaviourpush="Push1" />
<opcode name="endfinally" op1="0xff" op2="0xdc" flowcontrol="Return" opcodetype="Primitive" operandtype="InlineNone" stackbehaviourpop="Pop0" stackbehaviourpush="Push0" />
<opcode name="leave" op1="0xff" op2="0xdd" flowcontrol="Branch" opcodetype="Primitive" operandtype="InlineBrTarget" stackbehaviourpop="PopAll" stackbehaviourpush="Push0" />
<opcode name="leave.s" op1="0xff" op2="0xde" flowcontrol="Branch" opcodetype="Macro" operandtype="ShortInlineBrTarget" stackbehaviourpop="PopAll" stackbehaviourpush="Push0" />
<opcode name="stind.i" op1="0xff" op2="0xdf" flowcontrol="Next" opcodetype="Primitive" operandtype="InlineNone" stackbehaviourpop="Popi_popi" stackbehaviourpush="Push0" />
<opcode name="conv.u" op1="0xff" op2="0xe0" flowcontrol="Next" opcodetype="Primitive" operandtype="InlineNone" stackbehaviourpop="Pop1" stackbehaviourpush="Pushi" />
<opcode name="arglist" op1="0xfe" op2="0x00" flowcontrol="Next" opcodetype="Primitive" operandtype="InlineNone" stackbehaviourpop="Pop0" stackbehaviourpush="Pushi" />
<opcode name="ceq" op1="0xfe" op2="0x01" flowcontrol="Next" opcodetype="Primitive" operandtype="InlineNone" stackbehaviourpop="Pop1_pop1" stackbehaviourpush="Pushi" />
<opcode name="cgt" op1="0xfe" op2="0x02" flowcontrol="Next" opcodetype="Primitive" operandtype="InlineNone" stackbehaviourpop="Pop1_pop1" stackbehaviourpush="Pushi" />
<opcode name="cgt.un" op1="0xfe" op2="0x03" flowcontrol="Next" opcodetype="Primitive" operandtype="InlineNone" stackbehaviourpop="Pop1_pop1" stackbehaviourpush="Pushi" />
<opcode name="clt" op1="0xfe" op2="0x04" flowcontrol="Next" opcodetype="Primitive" operandtype="InlineNone" stackbehaviourpop="Pop1_pop1" stackbehaviourpush="Pushi" />
<opcode name="clt.un" op1="0xfe" op2="0x05" flowcontrol="Next" opcodetype="Primitive" operandtype="InlineNone" stackbehaviourpop="Pop1_pop1" stackbehaviourpush="Pushi" />
<opcode name="ldftn" op1="0xfe" op2="0x06" flowcontrol="Next" opcodetype="Primitive" operandtype="InlineMethod" stackbehaviourpop="Pop0" stackbehaviourpush="Pushi" />
<opcode name="ldvirtftn" op1="0xfe" op2="0x07" flowcontrol="Next" opcodetype="Primitive" operandtype="InlineMethod" stackbehaviourpop="Popref" stackbehaviourpush="Pushi" />
<opcode name="ldarg" op1="0xfe" op2="0x09" flowcontrol="Next" opcodetype="Primitive" operandtype="InlineParam" stackbehaviourpop="Pop0" stackbehaviourpush="Push1" />
<opcode name="ldarga" op1="0xfe" op2="0x0a" flowcontrol="Next" opcodetype="Primitive" operandtype="InlineParam" stackbehaviourpop="Pop0" stackbehaviourpush="Pushi" />
<opcode name="starg" op1="0xfe" op2="0x0b" flowcontrol="Next" opcodetype="Primitive" operandtype="InlineParam" stackbehaviourpop="Pop1" stackbehaviourpush="Push0" />
<opcode name="ldloc" op1="0xfe" op2="0x0c" flowcontrol="Next" opcodetype="Primitive" operandtype="InlineVar" stackbehaviourpop="Pop0" stackbehaviourpush="Push1" />
<opcode name="ldloca" op1="0xfe" op2="0x0d" flowcontrol="Next" opcodetype="Primitive" operandtype="InlineVar" stackbehaviourpop="Pop0" stackbehaviourpush="Pushi" />
<opcode name="stloc" op1="0xfe" op2="0x0e" flowcontrol="Next" opcodetype="Primitive" operandtype="InlineVar" stackbehaviourpop="Pop1" stackbehaviourpush="Push0" />
<opcode name="localloc" op1="0xfe" op2="0x0f" flowcontrol="Next" opcodetype="Primitive" operandtype="InlineNone" stackbehaviourpop="Popi" stackbehaviourpush="Pushi" />
<opcode name="endfilter" op1="0xfe" op2="0x11" flowcontrol="Return" opcodetype="Primitive" operandtype="InlineNone" stackbehaviourpop="Popi" stackbehaviourpush="Push0" />
<opcode name="unaligned." op1="0xfe" op2="0x12" flowcontrol="Meta" opcodetype="Prefix" operandtype="ShortInlineI" stackbehaviourpop="Pop0" stackbehaviourpush="Push0" />
<opcode name="volatile." op1="0xfe" op2="0x13" flowcontrol="Meta" opcodetype="Prefix" operandtype="InlineNone" stackbehaviourpop="Pop0" stackbehaviourpush="Push0" />
<opcode name="tail." op1="0xfe" op2="0x14" flowcontrol="Meta" opcodetype="Prefix" operandtype="InlineNone" stackbehaviourpop="Pop0" stackbehaviourpush="Push0" />
<opcode name="initobj" op1="0xfe" op2="0x15" flowcontrol="Next" opcodetype="Objmodel" operandtype="InlineType" stackbehaviourpop="Popi" stackbehaviourpush="Push0" />
<opcode name="constrained." op1="0xfe" op2="0x16" flowcontrol="Next" opcodetype="Prefix" operandtype="InlineTok" stackbehaviourpop="Pop0" stackbehaviourpush="Push0" />
<opcode name="cpblk" op1="0xfe" op2="0x17" flowcontrol="Next" opcodetype="Primitive" operandtype="InlineNone" stackbehaviourpop="Popi_popi_popi" stackbehaviourpush="Push0" />
<opcode name="initblk" op1="0xfe" op2="0x18" flowcontrol="Next" opcodetype="Primitive" operandtype="InlineNone" stackbehaviourpop="Popi_popi_popi" stackbehaviourpush="Push0" />
<opcode name="no." op1="0xfe" op2="0x19" flowcontrol="Next" opcodetype="Prefix" operandtype="ShortInlineI" stackbehaviourpop="Pop0" stackbehaviourpush="Push0" />
<opcode name="rethrow" op1="0xfe" op2="0x1a" flowcontrol="Throw" opcodetype="Objmodel" operandtype="InlineNone" stackbehaviourpop="Pop0" stackbehaviourpush="Push0" />
<opcode name="sizeof" op1="0xfe" op2="0x1c" flowcontrol="Next" opcodetype="Primitive" operandtype="InlineType" stackbehaviourpop="Pop0" stackbehaviourpush="Pushi" />
<opcode name="refanytype" op1="0xfe" op2="0x1d" flowcontrol="Next" opcodetype="Primitive" operandtype="InlineNone" stackbehaviourpop="Pop1" stackbehaviourpush="Pushi" />
<opcode name="readonly." op1="0xfe" op2="0x1e" flowcontrol="Next" opcodetype="Prefix" operandtype="InlineNone" stackbehaviourpop="Pop0" stackbehaviourpush="Push0" />
</opcodes>
</metadata>
<!--
This part contains all the collections
that will be used in the Reflection ns
-->
<collections>
<collection type="AssemblyNameReference" container="ModuleDefinition" visit="IReflectionStructure" target="Mono.Cecil" indexed="true" />
<collection type="ModuleReference" container="ModuleDefinition" visit="IReflectionStructure" indexed="true" target="Mono.Cecil" />
<collection type="ModuleDefinition" container="AssemblyDefinition" visit="IReflectionStructure" indexed="true" target="Mono.Cecil" />
<collection type="Resource" container="ModuleDefinition" visit="IReflectionStructure" target="Mono.Cecil" indexed="true" />
<collection type="TypeDefinition" container="ModuleDefinition" visit="IReflection" target="Mono.Cecil" />
<collection type="TypeReference" container="ModuleDefinition" visit="IReflection" target="Mono.Cecil" />
<collection type="TypeReference" container="TypeDefinition" visit="IReflection" name="Interface" indexed="true" target="Mono.Cecil" />
<collection type="ParameterDefinition" container="IMemberReference" visit="IReflection" indexed="true" target="Mono.Cecil" />
<collection type="MethodReference" container="MethodDefinition" visit="IReflection" name="Override" indexed="true" target="Mono.Cecil" />
<collection type="MethodDefinition" container="TypeDefinition" visit="IReflection" indexed="true" target="Mono.Cecil" />
<collection type="MethodDefinition" container="TypeDefinition" visit="IReflection" name="Constructor" indexed="true" target="Mono.Cecil" />
<collection type="EventDefinition" container="TypeDefinition" visit="IReflection" target="Mono.Cecil" indexed="true" />
<collection type="FieldDefinition" container="TypeDefinition" visit="IReflection" target="Mono.Cecil" indexed="true" />
<collection type="PropertyDefinition" container="TypeDefinition" visit="IReflection" target="Mono.Cecil" indexed="true" />
<collection type="Instruction" container="MethodBody" visit="ICode" indexed="true" target="Mono.Cecil.Cil" />
<collection type="ExceptionHandler" container="MethodBody" visit="ICode" indexed="true" target="Mono.Cecil.Cil" />
<collection type="VariableDefinition" container="IVariableDefinitionProvider" visit="ICode" indexed="true" target="Mono.Cecil.Cil" />
<collection type="ArrayDimension" container="ArrayType" target="Mono.Cecil" indexed="true" />
<!-- modified behaviour
<collection type="SecurityDeclaration" container="IHasSecurity" usecontainerinterface="true" target="Mono.Cecil" indexed="true" visit="IReflection" />
-->
<collection type="CustomAttribute" container="ICustomAttributeProvider" usecontainerinterface="true" target="Mono.Cecil" indexed="true" visit="IReflection" />
<collection type="TypeReference" container="ModuleDefinition" target="Mono.Cecil" visit="IReflection" name="ExternType" />
<collection type="TypeDefinition" container="TypeDefinition" target="Mono.Cecil" visit="IReflection" name="NestedType" indexed="true" />
<collection type="MemberReference" container="ModuleDefinition" target="Mono.Cecil" visit="IReflection" indexed="true" />
<collection type="GenericParameter" container="IGenericParameterProvider" usecontainerinterface="true" target="Mono.Cecil" indexed="true" visit="IReflection" />
<collection type="TypeReference" name="GenericArgument" container="IGenericInstance" target="Mono.Cecil" indexed="true" />
<collection type="TypeReference" name="Constraint" container="GenericParameter" target="Mono.Cecil" indexed="true" />
<collection type="Scope" container="IScopeProvider" visit="ICode" target="Mono.Cecil.Cil" indexed="true" />
</collections>
</cecil>

112
src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Mono.Cecil/CodeGen/templates/BaseMetadataVisitor.cs

@ -1,112 +0,0 @@ @@ -1,112 +0,0 @@
//
// BaseMetadataVisitor.cs
//
// Author:
// Jb Evain (jbevain@gmail.com)
//
// Generated by /CodeGen/cecil-gen.rb do not edit
// <%=Time.now%>
//
// (C) 2005 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.
//
namespace Mono.Cecil.Metadata {
public abstract class BaseMetadataVisitor : IMetadataVisitor {
public virtual void VisitMetadataRoot (MetadataRoot root)
{
}
public virtual void VisitMetadataRootHeader (MetadataRoot.MetadataRootHeader header)
{
}
public virtual void VisitMetadataStreamCollection (MetadataStreamCollection streams)
{
}
public virtual void VisitMetadataStream (MetadataStream stream)
{
}
public virtual void VisitMetadataStreamHeader (MetadataStream.MetadataStreamHeader header)
{
}
public virtual void VisitGuidHeap (GuidHeap heap)
{
}
public virtual void VisitStringsHeap (StringsHeap heap)
{
}
public virtual void VisitTablesHeap (TablesHeap heap)
{
}
public virtual void VisitBlobHeap (BlobHeap heap)
{
}
public virtual void VisitUserStringsHeap (UserStringsHeap heap)
{
}
public virtual void TerminateMetadataRoot (MetadataRoot root)
{
}
}
public abstract class BaseMetadataTableVisitor : IMetadataTableVisitor {
public virtual void VisitTableCollection (TableCollection coll)
{
}
<% $tables.each { |table| %> public virtual void Visit<%=table.table_name%> (<%=table.table_name%> table)
{
}
<% } %> public virtual void TerminateTableCollection (TableCollection coll)
{
}
public abstract IMetadataRowVisitor GetRowVisitor();
}
public abstract class BaseMetadataRowVisitor : IMetadataRowVisitor {
public virtual void VisitRowCollection (RowCollection coll)
{
}
<% $tables.each { |table| %> public virtual void Visit<%=table.row_name%> (<%=table.row_name%> row)
{
}
<% } %> public virtual void TerminateRowCollection (RowCollection coll)
{
}
}
}

37
src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Mono.Cecil/CodeGen/templates/Code.cs

@ -1,37 +0,0 @@ @@ -1,37 +0,0 @@
//
// Code.cs
//
// Author:
// Jb Evain (jbevain@gmail.com)
//
// Generated by /CodeGen/cecil-gen.rb do not edit
// <%=Time.now%>
//
// (C) 2007 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.
//
namespace Mono.Cecil.Cil {
public enum Code {
<% $ops.each { |op| %> <%=op.field_name%>,
<% } %> }
}

38
src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Mono.Cecil/CodeGen/templates/CodedIndex.cs

@ -1,38 +0,0 @@ @@ -1,38 +0,0 @@
//
// CodedIndex.cs
//
// Author:
// Jb Evain (jbevain@gmail.com)
//
// Generated by /CodeGen/cecil-gen.rb do not edit
// <%=Time.now%>
//
// (C) 2005 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.
//
namespace Mono.Cecil.Metadata {
public enum CodedIndex {
<% $coded_indexes.each { |ci| %> <%=ci.name%><% if ci != $coded_indexes.last %>,<% end %>
<% }
%> }
}

65
src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Mono.Cecil/CodeGen/templates/IMetadataVisitor.cs

@ -1,65 +0,0 @@ @@ -1,65 +0,0 @@
//
// IMetadataVisitor.cs
//
// Author:
// Jb Evain (jbevain@gmail.com)
//
// Generated by /CodeGen/cecil-gen.rb do not edit
// <%=Time.now%>
//
// (C) 2005 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.
//
namespace Mono.Cecil.Metadata {
public interface IMetadataVisitor {
void VisitMetadataRoot (MetadataRoot root);
void VisitMetadataRootHeader (MetadataRoot.MetadataRootHeader header);
void VisitMetadataStreamCollection (MetadataStreamCollection streams);
void VisitMetadataStream (MetadataStream stream);
void VisitMetadataStreamHeader (MetadataStream.MetadataStreamHeader header);
void VisitGuidHeap (GuidHeap heap);
void VisitStringsHeap (StringsHeap heap);
void VisitTablesHeap (TablesHeap heap);
void VisitBlobHeap (BlobHeap heap);
void VisitUserStringsHeap (UserStringsHeap heap);
void TerminateMetadataRoot (MetadataRoot root);
}
public interface IMetadataTableVisitor {
void VisitTableCollection (TableCollection coll);
<% $tables.each { |table| %> void Visit<%=table.table_name%> (<%=table.table_name%> table);
<% } %>
void TerminateTableCollection (TableCollection coll);
IMetadataRowVisitor GetRowVisitor();
}
public interface IMetadataRowVisitor {
void VisitRowCollection (RowCollection coll);
<% $tables.each { |table| %> void Visit<%=table.row_name%> (<%=table.row_name%> row);
<% } %>
void TerminateRowCollection (RowCollection coll);
}
}

296
src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Mono.Cecil/CodeGen/templates/IndexedCollection.cs

@ -1,296 +0,0 @@ @@ -1,296 +0,0 @@
//
// <%=$cur_coll.name%>.cs
//
// Author:
// Jb Evain (jbevain@gmail.com)
//
// Generated by /CodeGen/cecil-gen.rb do not edit
// <%=Time.now%>
//
// (C) 2005 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.
//
<%
def member_visibility()
return $cur_coll.type == "Instruction" ? "internal" : "public"
end
def use_event?()
case $cur_coll.name
when "NestedTypeCollection", "MethodDefinitionCollection", "ConstructorCollection", "FieldDefinitionCollection", "EventDefinitionCollection", "PropertyDefinitionCollection"
return true
end
return false
end
%>
namespace <%=$cur_coll.target%> {
using System;
using System.Collections;
using Mono.Cecil.Cil;
public sealed class <%=$cur_coll.name%> : CollectionBase<% if (!$cur_coll.visitable.nil?) then %>, <%=$cur_coll.visitable%><% end %> {
<%=$cur_coll.container_impl%> m_container;<%
if $cur_coll.type == "Instruction" %>
public readonly Instruction Outside = new Instruction (int.MaxValue, OpCodes.Nop);<% end %>
public <%=$cur_coll.type%> this [int index] {
get { return List [index] as <%=$cur_coll.type%>; }
set { List [index] = value; }
}
public <%=$cur_coll.container%> Container {
get { return m_container; }
}
public <%=$cur_coll.name%> (<%=$cur_coll.container_impl%> container)
{
m_container = container;
}
<%= member_visibility() %> void Add (<%=$cur_coll.type%> value)
{<%
if use_event?() %>
Attach (value);
<% end %>
List.Add (value);
}
<%
if use_event?() %>
public new void Clear ()
{
foreach (<%=$cur_coll.type%> item in this)
Detach (item);
base.Clear ();
}
<% end %>
public bool Contains (<%=$cur_coll.type%> value)
{
return List.Contains (value);
}
public int IndexOf (<%=$cur_coll.type%> value)
{
return List.IndexOf (value);
}
<%= member_visibility() %> void Insert (int index, <%=$cur_coll.type%> value)
{<%
if use_event?() %>
Attach (value);
<% end %>
List.Insert (index, value);
}
<%= member_visibility() %> void Remove (<%=$cur_coll.type%> value)
{
List.Remove (value);
<% if use_event?() %>
Detach (value);
<% end %> }
<%
if use_event?() %>
<%= member_visibility() %> new void RemoveAt (int index)
{
<%=$cur_coll.type%> item = this [index];
Remove (item);
}
<% end %>
protected override void OnValidate (object o)
{
if (! (o is <%=$cur_coll.type%>))
throw new ArgumentException ("Must be of type " + typeof (<%=$cur_coll.type%>).FullName);
}
<%
case $cur_coll.item_name
when "MethodDefinition"
%>
public MethodDefinition [] GetMethod (string name)
{
ArrayList ret = new ArrayList ();
foreach (MethodDefinition meth in this)
if (meth.Name == name)
ret.Add (meth);
return ret.ToArray (typeof (MethodDefinition)) as MethodDefinition [];
}
internal MethodDefinition GetMethodInternal (string name, IList parameters)
{
foreach (MethodDefinition meth in this) {
if (meth.Name != name || meth.Parameters.Count != parameters.Count)
continue;
bool match = true;
for (int i = 0; i < parameters.Count; i++) {
string pname;
object param = parameters [i];
if (param is Type)
pname = ReflectionHelper.GetTypeSignature (param as Type);
else if (param is TypeReference)
pname = (param as TypeReference).FullName;
else if (param is ParameterDefinition)
pname = (param as ParameterDefinition).ParameterType.FullName;
else
throw new NotSupportedException ();
if (meth.Parameters [i].ParameterType.FullName != pname) {
match = false;
break;
}
}
if (match)
return meth;
}
return null;
}
public MethodDefinition GetMethod (string name, Type [] parameters)
{
return GetMethodInternal (name, parameters);
}
public MethodDefinition GetMethod (string name, TypeReference [] parameters)
{
return GetMethodInternal (name, parameters);
}
public MethodDefinition GetMethod (string name, ParameterDefinitionCollection parameters)
{
return GetMethodInternal (name, parameters);
}
<%
when "FieldDefinition"
%>
public FieldDefinition GetField (string name)
{
foreach (FieldDefinition field in this)
if (field.Name == name)
return field;
return null;
}
<%
when "Constructor"
%>
internal MethodDefinition GetConstructorInternal (bool isStatic, IList parameters)
{
foreach (MethodDefinition ctor in this) {
if (ctor.IsStatic != isStatic || ctor.Parameters.Count != parameters.Count)
continue;
bool match = true;
for (int i = 0; i < parameters.Count; i++) {
string pname;
object param = parameters [i];
if (param is Type)
pname = ReflectionHelper.GetTypeSignature (param as Type);
else if (param is TypeReference)
pname = (param as TypeReference).FullName;
else if (param is ParameterDefinition)
pname = (param as ParameterDefinition).ParameterType.FullName;
else
throw new NotSupportedException ();
if (ctor.Parameters [i].ParameterType.FullName != pname) {
match = false;
break;
}
}
if (match)
return ctor;
}
return null;
}
public MethodDefinition GetConstructor (bool isStatic, Type [] parameters)
{
return GetConstructorInternal (isStatic, parameters);
}
public MethodDefinition GetConstructor (bool isStatic, TypeReference [] parameters)
{
return GetConstructorInternal (isStatic, parameters);
}
public MethodDefinition GetConstructor (bool isStatic, ParameterDefinitionCollection parameters)
{
return GetConstructorInternal (isStatic, parameters);
}
<%
when "EventDefinition"
%>
public EventDefinition GetEvent (string name)
{
foreach (EventDefinition evt in this)
if (evt.Name == name)
return evt;
return null;
}
<%
when "PropertyDefinition"
%>
public PropertyDefinition [] GetProperties (string name)
{
ArrayList ret = new ArrayList ();
foreach (PropertyDefinition prop in this)
if (prop.Name == name)
ret.Add (prop);
return ret.ToArray (typeof (PropertyDefinition)) as PropertyDefinition [];
}
<%
end
if use_event?()
%>
void Attach (MemberReference member)
{
if (member.DeclaringType != null)
throw new ReflectionException ("Member already attached, clone it instead");
member.DeclaringType = m_container;
}
void Detach (MemberReference member)
{
member.DeclaringType = null;
}
<% end
if !$cur_coll.visitor.nil? then %>
public void Accept (<%=$cur_coll.visitor%> visitor)
{
visitor.<%=$cur_coll.visitThis%> (this);
}
<% end %> }
}

110
src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Mono.Cecil/CodeGen/templates/MetadataRowReader.cs

@ -1,110 +0,0 @@ @@ -1,110 +0,0 @@
//
// MetadataRowReader.cs
//
// Author:
// Jb Evain (jbevain@gmail.com)
//
// Generated by /CodeGen/cecil-gen.rb do not edit
// <%=Time.now%>
//
// (C) 2005 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.
//
namespace Mono.Cecil.Metadata {
using System;
using System.Collections;
using System.IO;
using Mono.Cecil.Binary;
class MetadataRowReader : BaseMetadataRowVisitor {
MetadataTableReader m_mtrv;
BinaryReader m_binaryReader;
MetadataRoot m_metadataRoot;
IDictionary m_ciCache;
int m_blobHeapIdxSz;
int m_stringsHeapIdxSz;
int m_guidHeapIdxSz;
public MetadataRowReader (MetadataTableReader mtrv)
{
m_mtrv = mtrv;
m_binaryReader = mtrv.GetReader ();
m_metadataRoot = mtrv.GetMetadataRoot ();
m_ciCache = new Hashtable ();
}
int GetIndexSize (int rid)
{
return m_mtrv.GetNumberOfRows (rid) < (1 << 16) ? 2 : 4;
}
int GetCodedIndexSize (CodedIndex ci)
{
return Utilities.GetCodedIndexSize (ci,
new Utilities.TableRowCounter (m_mtrv.GetNumberOfRows), m_ciCache);
}
uint ReadByIndexSize (int size)
{
if (size == 2) {
return (uint) m_binaryReader.ReadUInt16 ();
} else if (size == 4) {
return m_binaryReader.ReadUInt32 ();
} else {
throw new MetadataFormatException ("Non valid size for indexing");
}
}
public override void VisitRowCollection (RowCollection coll)
{
m_blobHeapIdxSz = m_metadataRoot.Streams.BlobHeap != null ?
m_metadataRoot.Streams.BlobHeap.IndexSize : 2;
m_stringsHeapIdxSz = m_metadataRoot.Streams.StringsHeap != null ?
m_metadataRoot.Streams.StringsHeap.IndexSize : 2;
m_guidHeapIdxSz = m_metadataRoot.Streams.GuidHeap != null ?
m_metadataRoot.Streams.GuidHeap.IndexSize : 2;
}
<% $tables.each { |table| %> public override void Visit<%=table.row_name%> (<%=table.row_name%> row)
{
<% table.columns.each { |col|
if (col.target.nil?)
%> row.<%=col.property_name%> = <%=col.read_binary("m_binaryReader")%>;
<% elsif (col.target == "BlobHeap")
%> row.<%=col.property_name%> = ReadByIndexSize (m_blobHeapIdxSz);
<% elsif (col.target == "StringsHeap")
%> row.<%=col.property_name%> = ReadByIndexSize (m_stringsHeapIdxSz);
<% elsif (col.target == "GuidHeap")
%> row.<%=col.property_name%> = ReadByIndexSize (m_guidHeapIdxSz);
<% elsif (col.type == "MetadataToken")
%> row.<%=col.property_name%> = Utilities.GetMetadataToken (CodedIndex.<%=col.target%>,
ReadByIndexSize (GetCodedIndexSize (CodedIndex.<%=col.target%>)));
<% else
%> row.<%=col.property_name%> = ReadByIndexSize (GetIndexSize (<%=col.target%>Table.RId));
<% end
}%> }
<% } %> }
}

145
src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Mono.Cecil/CodeGen/templates/MetadataRowWriter.cs

@ -1,145 +0,0 @@ @@ -1,145 +0,0 @@
//
// MetadataRowWriter.cs
//
// Author:
// Jb Evain (jbevain@gmail.com)
//
// Generated by /CodeGen/cecil-gen.rb do not edit
// <%=Time.now%>
//
// (C) 2005 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.
//
namespace Mono.Cecil.Metadata {
using System;
using System.Collections;
using Mono.Cecil.Binary;
class MetadataRowWriter : BaseMetadataRowVisitor {
MetadataRoot m_root;
MemoryBinaryWriter m_binaryWriter;
IDictionary m_ciCache;
int m_blobHeapIdxSz;
int m_stringsHeapIdxSz;
int m_guidHeapIdxSz;
public MetadataRowWriter (MetadataTableWriter mtwv)
{
m_binaryWriter = mtwv.GetWriter ();
m_root = mtwv.GetMetadataRoot ();
m_ciCache = new Hashtable ();
}
void WriteBlobPointer (uint pointer)
{
WriteByIndexSize (pointer, m_blobHeapIdxSz);
}
void WriteStringPointer (uint pointer)
{
WriteByIndexSize (pointer, m_stringsHeapIdxSz);
}
void WriteGuidPointer (uint pointer)
{
WriteByIndexSize (pointer, m_guidHeapIdxSz);
}
void WriteTablePointer (uint pointer, int rid)
{
WriteByIndexSize (pointer, GetNumberOfRows (rid) < (1 << 16) ? 2 : 4);
}
void WriteMetadataToken (MetadataToken token, CodedIndex ci)
{
WriteByIndexSize (Utilities.CompressMetadataToken (ci, token),
Utilities.GetCodedIndexSize (
ci, new Utilities.TableRowCounter (GetNumberOfRows), m_ciCache));
}
int GetNumberOfRows (int rid)
{
IMetadataTable t = m_root.Streams.TablesHeap [rid];
if (t == null || t.Rows == null)
return 0;
return t.Rows.Count;
}
void WriteByIndexSize (uint value, int size)
{
if (size == 4)
m_binaryWriter.Write (value);
else if (size == 2)
m_binaryWriter.Write ((ushort) value);
else
throw new MetadataFormatException ("Non valid size for indexing");
}
<% $tables.each { |table|
parameters = ""
table.columns.each { |col|
parameters += col.type
parameters += " "
parameters += col.field_name[1..col.field_name.length]
parameters += ", " if (table.columns.last != col)
}
%> public <%=table.row_name%> Create<%=table.row_name%> (<%=parameters%>)
{
<%=table.row_name%> row = new <%=table.row_name%> ();
<% table.columns.each { |col| %> row.<%=col.property_name%> = <%=col.field_name[1..col.field_name.length]%>;
<% } %> return row;
}
<% } %> public override void VisitRowCollection (RowCollection coll)
{
m_blobHeapIdxSz = m_root.Streams.BlobHeap != null ?
m_root.Streams.BlobHeap.IndexSize : 2;
m_stringsHeapIdxSz = m_root.Streams.StringsHeap != null ?
m_root.Streams.StringsHeap.IndexSize : 2;
m_guidHeapIdxSz = m_root.Streams.GuidHeap != null ?
m_root.Streams.GuidHeap.IndexSize : 2;
}
<% $tables.each { |table| %> public override void Visit<%=table.row_name%> (<%=table.row_name%> row)
{
<% table.columns.each { |col|
if (col.target.nil?)
%> <%=col.write_binary("row", "m_binaryWriter")%>;
<% elsif (col.target == "BlobHeap")
%> WriteBlobPointer (row.<%=col.property_name%>);
<% elsif (col.target == "StringsHeap")
%> WriteStringPointer (row.<%=col.property_name%>);
<% elsif (col.target == "GuidHeap")
%> WriteGuidPointer (row.<%=col.property_name%>);
<% elsif (col.type == "MetadataToken")
%> WriteMetadataToken (row.<%=col.property_name%>, CodedIndex.<%=col.target%>);
<% else
%> WriteTablePointer (row.<%=col.property_name%>, <%=col.target%>Table.RId);
<% end
}%> }
<% } %> }
}

97
src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Mono.Cecil/CodeGen/templates/MetadataTableReader.cs

@ -1,97 +0,0 @@ @@ -1,97 +0,0 @@
//
// MetadataTableReader.cs
//
// Author:
// Jb Evain (jbevain@gmail.com)
//
// Generated by /CodeGen/cecil-gen.rb do not edit
// <%=Time.now%>
//
// (C) 2005 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.
//
namespace Mono.Cecil.Metadata {
using System;
using System.Collections;
using System.IO;
class MetadataTableReader : BaseMetadataTableVisitor {
MetadataRoot m_metadataRoot;
TablesHeap m_heap;
MetadataRowReader m_mrrv;
BinaryReader m_binaryReader;
int [] m_rows = new int [TablesHeap.MaxTableCount];
public MetadataTableReader (MetadataReader mrv)
{
m_metadataRoot = mrv.GetMetadataRoot ();
m_heap = m_metadataRoot.Streams.TablesHeap;
m_binaryReader = new BinaryReader (new MemoryStream (m_heap.Data));
m_binaryReader.BaseStream.Position = 24;
m_mrrv = new MetadataRowReader (this);
}
public MetadataRoot GetMetadataRoot ()
{
return m_metadataRoot;
}
public BinaryReader GetReader ()
{
return m_binaryReader;
}
public override IMetadataRowVisitor GetRowVisitor ()
{
return m_mrrv;
}
public int GetNumberOfRows (int rid)
{
return m_rows [rid];
}
<% $tables.each { |table| %>
public <%=table.table_name%> Get<%=table.table_name%> ()
{
return (<%=table.table_name%>) m_heap [<%=table.table_name%>.RId];
}
<% } %>
public override void VisitTableCollection (TableCollection coll)
{
<% $stables.each { |table| %> if (m_heap.HasTable (<%=table.table_name%>.RId)) {
coll.Add (new <%=table.table_name%> ());
m_rows [<%=table.table_name%>.RId] = m_binaryReader.ReadInt32 ();
}
<% } %> }
<% $tables.each { |table| %> public override void Visit<%=table.table_name%> (<%=table.table_name%> table)
{
int number = m_rows [<%=table.table_name%>.RId];
table.Rows = new RowCollection (number);
for (int i = 0; i < number; i++)
table.Rows.Add (new <%=table.row_name%> ());
}
<% } %> }
}

98
src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Mono.Cecil/CodeGen/templates/MetadataTableWriter.cs

@ -1,98 +0,0 @@ @@ -1,98 +0,0 @@
//
// MetadataTableWriter.cs
//
// Author:
// Jb Evain (jbevain@gmail.com)
//
// Generated by /CodeGen/cecil-gen.rb do not edit
// <%=Time.now%>
//
// (C) 2005 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.
//
namespace Mono.Cecil.Metadata {
using System;
using System.Collections;
using Mono.Cecil.Binary;
internal sealed class MetadataTableWriter : BaseMetadataTableVisitor {
MetadataRoot m_root;
TablesHeap m_heap;
MetadataRowWriter m_mrrw;
MemoryBinaryWriter m_binaryWriter;
public MetadataTableWriter (MetadataWriter mrv, MemoryBinaryWriter writer)
{
m_root = mrv.GetMetadataRoot ();
m_heap = m_root.Streams.TablesHeap;
m_binaryWriter = writer;
m_mrrw = new MetadataRowWriter (this);
}
public MetadataRoot GetMetadataRoot ()
{
return m_root;
}
public override IMetadataRowVisitor GetRowVisitor ()
{
return m_mrrw;
}
public MemoryBinaryWriter GetWriter ()
{
return m_binaryWriter;
}
void InitializeTable (IMetadataTable table)
{
table.Rows = new RowCollection ();
m_heap.Valid |= 1L << table.Id;
m_heap.Tables.Add (table);
}
void WriteCount (int rid)
{
if (m_heap.HasTable (rid))
m_binaryWriter.Write (m_heap [rid].Rows.Count);
}
<% $tables.each { |table| %> public <%=table.table_name%> Get<%=table.table_name%> ()
{
<%=table.table_name%> table = m_heap [<%=table.table_name%>.RId] as <%=table.table_name%>;
if (table != null)
return table;
table = new <%=table.table_name%> ();
InitializeTable (table);
return table;
}
<% } %> public override void VisitTableCollection (TableCollection coll)
{
<% $stables.each { |table| %> WriteCount (<%=table.table_name%>.RId);
<% } %> }
}
}

232
src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Mono.Cecil/CodeGen/templates/NamedCollection.cs

@ -1,232 +0,0 @@ @@ -1,232 +0,0 @@
//
// <%=$cur_coll.name%>.cs
//
// Author:
// Jb Evain (jbevain@gmail.com)
//
// Generated by /CodeGen/cecil-gen.rb do not edit
// <%=Time.now%>
//
// (C) 2005 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.
//
<%
def use_event?()
case $cur_coll.name
when "TypeDefinitionCollection", "TypeReferenceCollection", "ExternTypeCollection"
return true
end
return false
end
%>
namespace <%=$cur_coll.target%> {
using System;
using System.Collections;
using System.Collections.Specialized;
using Mono.Cecil.Cil;
using Hcp = Mono.Cecil.HashCodeProvider;
using Cmp = System.Collections.Comparer;
public sealed class <%=$cur_coll.name%> : NameObjectCollectionBase, IList<% if (!$cur_coll.visitable.nil?) then %>, <%=$cur_coll.visitable%><% end %> {
<%=$cur_coll.container%> m_container;
public <%=$cur_coll.type%> this [int index] {
get { return this.BaseGet (index) as <%=$cur_coll.type%>; }
set { this.BaseSet (index, value); }
}
public <%=$cur_coll.type%> this [string fullName] {
get { return this.BaseGet (fullName) as <%=$cur_coll.type%>; }
set { this.BaseSet (fullName, value); }
}
public <%=$cur_coll.container%> Container {
get { return m_container; }
}
public bool IsSynchronized {
get { return false; }
}
public object SyncRoot {
get { return this; }
}
bool IList.IsReadOnly {
get { return false; }
}
bool IList.IsFixedSize {
get { return false; }
}
object IList.this [int index] {
get { return BaseGet (index); }
set {
Check (value);
BaseSet (index, value);
}
}
public <%=$cur_coll.name%> (<%=$cur_coll.container%> container) :
base (Hcp.Instance, Cmp.Default)
{
m_container = container;
}
public void Add (<%=$cur_coll.type%> value)
{
if (value == null)
throw new ArgumentNullException ("value");
<% if use_event?() %>Attach (value);<% end %>
this.BaseAdd (value.FullName, value);
}
public void Clear ()
{<%
if use_event?() %>
foreach (<%=$cur_coll.type%> item in this)
Detach (item);
<% end %>
this.BaseClear ();
}
public bool Contains (<%=$cur_coll.type%> value)
{
return Contains (value.FullName);
}
public bool Contains (string fullName)
{
return this.BaseGet (fullName) != null;
}
public int IndexOf (<%=$cur_coll.type%> value)
{
string [] keys = this.BaseGetAllKeys ();
return Array.IndexOf (keys, value.FullName, 0, keys.Length);
}
public void Remove (<%=$cur_coll.type%> value)
{
this.BaseRemove (value.FullName);
<% if use_event?() %>
Detach (value);
<% end %> }
public void RemoveAt (int index)
{
<%=$cur_coll.type%> item = this [index];
Remove (item);
<% if use_event?() %>
Detach (item);
<% end %> }
public void CopyTo (Array ary, int index)
{
this.BaseGetAllValues ().CopyTo (ary, index);
}
public new IEnumerator GetEnumerator ()
{
return this.BaseGetAllValues ().GetEnumerator ();
}
<% if !$cur_coll.visitor.nil? then %>
public void Accept (<%=$cur_coll.visitor%> visitor)
{
visitor.<%=$cur_coll.visitThis%> (this);
}
<% end %>
#if CF_1_0 || CF_2_0
internal object [] BaseGetAllValues ()
{
object [] values = new object [this.Count];
for (int i=0; i < values.Length; ++i) {
values [i] = this.BaseGet (i);
}
return values;
}
#endif
void Check (object value)
{
if (!(value is <%=$cur_coll.type%>))
throw new ArgumentException ();
}
int IList.Add (object value)
{
Check (value);
Add (value as <%=$cur_coll.type%>);
return 0;
}
bool IList.Contains (object value)
{
Check (value);
return Contains (value as <%=$cur_coll.type%>);
}
int IList.IndexOf (object value)
{
throw new NotSupportedException ();
}
void IList.Insert (int index, object value)
{
throw new NotSupportedException ();
}
void IList.Remove (object value)
{
Check (value);
Remove (value as <%=$cur_coll.type%>);
}
<%
if use_event?()
%>
void Detach (TypeReference type)
{
type.Module = null;
}
void Attach (TypeReference type)
{
if (type.Module != null)
throw new ReflectionException ("Type is already attached, clone it instead");
type.Module = m_container;<%
if $cur_coll.type == "TypeDefinition" %>
type.AttachToScope (m_container);
<% end %>
}<%
end
%>
}
}

67
src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Mono.Cecil/CodeGen/templates/OpCodes.cs

@ -1,67 +0,0 @@ @@ -1,67 +0,0 @@
//
// OpCodes.cs
//
// Author:
// Jb Evain (jbevain@gmail.com)
//
// Generated by /CodeGen/cecil-gen.rb do not edit
// <%=Time.now%>
//
// (C) 2005 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.
//
<%
oboc = Array.new
tboc = Array.new
$ops.each { |op|
if op.op1 == "0xff"
oboc.push(op)
else
tboc.push(op)
end
}
%>
namespace Mono.Cecil.Cil {
public sealed class OpCodes {
internal static readonly OpCode [] OneByteOpCode = new OpCode [<%=oboc[oboc.length - 1].op2%> + 1];
internal static readonly OpCode [] TwoBytesOpCode = new OpCode [<%=tboc[tboc.length - 1].op2%> + 1];
<% $ops.each { |op| %> public static readonly OpCode <%=op.field_name%> = new OpCode (
"<%=op.name%>", <%=op.op1%>, <%=op.op2%>, <%=op.size%>,
Code.<%=op.field_name%>, <%=op.flowcontrol%>,
<%=op.opcodetype%>, <%=op.operandtype%>,
<%=op.stackbehaviourpop%>, <%=op.stackbehaviourpush%>);
<% } %> OpCodes()
{
}
public static OpCode GetOpCode (Code code)
{
switch (code) {
<% $ops.each { |op| %> case Code.<%=op.field_name%> : return OpCodes.<%=op.field_name%>;
<% } %> default : return OpCodes.Nop;
}
}
}
}

81
src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Mono.Cecil/CodeGen/templates/Table.cs

@ -1,81 +0,0 @@ @@ -1,81 +0,0 @@
//
// <%=$cur_table.table_name%>.cs
//
// Author:
// Jb Evain (jbevain@gmail.com)
//
// Generated by /CodeGen/cecil-gen.rb do not edit
// <%=Time.now%>
//
// (C) 2005 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.
//
namespace Mono.Cecil.Metadata {
<% $cur_table.ref_ns.each { |ns| %>
using <%=ns%>;
<% }
%>
public sealed class <%=$cur_table.table_name%> : IMetadataTable {
public const int RId = <%=$cur_table.rid%>;
RowCollection m_rows;
public <%=$cur_table.row_name%> this [int index] {
get { return m_rows [index] as <%=$cur_table.row_name%>; }
set { m_rows [index] = value; }
}
public RowCollection Rows {
get { return m_rows; }
set { m_rows = value; }
}
public int Id {
get { return RId; }
}
internal <%=$cur_table.table_name%> ()
{
}
public void Accept (IMetadataTableVisitor visitor)
{
visitor.Visit<%=$cur_table.table_name%> (this);
this.Rows.Accept (visitor.GetRowVisitor ());
}
}
public sealed class <%=$cur_table.row_name%> : IMetadataRow {
<% $cur_table.columns.each { |col| %> public <%=col.type%> <%=col.property_name%>;
<% } %>
internal <%=$cur_table.row_name%> ()
{
}
public void Accept (IMetadataRowVisitor visitor)
{
visitor.Visit<%=$cur_table.row_name%> (this);
}
}
}

116
src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Mono.Cecil/CodeGen/templates/Tests.cs

@ -1,116 +0,0 @@ @@ -1,116 +0,0 @@
//
// Tests.cs
//
// Author:
// Jb Evain (jbevain@gmail.com)
//
// Generated by /CodeGen/cecil-gen-tests.rb do not edit
// <%=Time.now%>
//
// (C) 2005 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.
//
namespace Mono.Cecil.Tests {
using System;
using System.IO;
using System.Collections;
using NUnit.Framework;
using Mono.Cecil;
class Language {
string m_compiler;
string m_command;
public string Compiler {
get { return m_compiler; }
}
public string Command {
get { return m_command; }
}
public Language (string compiler, string command)
{
m_compiler = compiler;
m_command = command;
}
static IDictionary m_languages = new Hashtable ();
static Language ()
{
<%
$languages.each { |l|
%>
m_languages.Add ("<%= l.name %>", new Language (
"<%= l.compiler %>",
"<%= l.command %>"
));
<%
}
%>
}
public static Language GetLanguage (string name)
{
return (Language) m_languages [name];
}
}
class TestCase {
Language m_lang;
FileInfo m_file;
public TestCase (Language lang, string file)
{
m_lang = lang;
m_file = new FileInfo (file);
}
}
[TestFixture]
class GeneratedTests {
void Test (TestCase test)
{
}
<%
$tests.each { |test|
%>
[Test]
public void <%= test.method %> ()
{
Test (new TestCase (
Language.GetLanguage ("<%= test.lang.name %>"),
@"<%= test.file %>"));
}
<%
}
%>
}
}

211
src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Mono.Cecil/CodeGen/templates/Utilities.cs

@ -1,211 +0,0 @@ @@ -1,211 +0,0 @@
//
// Utilities.cs
//
// Author:
// Jb Evain (jbevain@gmail.com)
//
// Generated by /CodeGen/cecil-gen.rb do not edit
// <%=Time.now%>
//
// (C) 2005 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.
//
namespace Mono.Cecil.Metadata {
using System;
using System.Collections;
using System.IO;
class Utilities {
Utilities ()
{
}
public static int ReadCompressedInteger (byte [] data, int pos, out int start)
{
int integer = 0;
start = pos;
if ((data [pos] & 0x80) == 0) {
integer = data [pos];
start++;
} else if ((data [pos] & 0x40) == 0) {
integer = (data [start] & ~0x80) << 8;
integer |= data [pos + 1];
start += 2;
} else {
integer = (data [start] & ~0xc0) << 24;
integer |= data [pos + 1] << 16;
integer |= data [pos + 2] << 8;
integer |= data [pos + 3];
start += 4;
}
return integer;
}
public static int WriteCompressedInteger (BinaryWriter writer, int value)
{
if (value < 0x80)
writer.Write ((byte) value);
else if (value < 0x4000) {
writer.Write ((byte) (0x80 | (value >> 8)));
writer.Write ((byte) (value & 0xff));
} else {
writer.Write ((byte) ((value >> 24) | 0xc0));
writer.Write ((byte) ((value >> 16) & 0xff));
writer.Write ((byte) ((value >> 8) & 0xff));
writer.Write ((byte) (value & 0xff));
}
return (int) writer.BaseStream.Position;
}
public static MetadataToken GetMetadataToken (CodedIndex cidx, uint data)
{
uint rid = 0;
switch (cidx) {
<% $coded_indexes.each { |ci| %> case CodedIndex.<%=ci.name%> :
rid = data >> <%=ci.size%>;
switch (data & <%=(2 ** ci.size.to_i - 1).to_s%>) {
<% ci.tables.each { |tbl|
name = tbl.name
if (name == "DeclSecurity")
name = "Permission"
elsif (name == "StandAloneSig")
name = "Signature"
end
%> case <%=tbl.tag%> :
return new MetadataToken (TokenType.<%=name%>, rid);
<% }
%> default :
return MetadataToken.Zero;
}
<% } %> default :
return MetadataToken.Zero;
}
}
public static uint CompressMetadataToken (CodedIndex cidx, MetadataToken token)
{
uint ret = 0;
if (token.RID == 0)
return ret;
switch (cidx) {
<% $coded_indexes.each { |ci| %> case CodedIndex.<%=ci.name%> :
ret = token.RID << <%=ci.size%>;
switch (token.TokenType) {
<% ci.tables.each { |tbl|
name = tbl.name
if (name == "DeclSecurity")
name = "Permission"
elsif (name == "StandAloneSig")
name = "Signature"
end
%> case TokenType.<%=name%> :
return ret | <%=tbl.tag%>;
<% }
%> default :
throw new MetadataFormatException("Non valid Token for <%=ci.name%>");
}
<% } %> default :
throw new MetadataFormatException ("Non valid CodedIndex");
}
}
internal static Type GetCorrespondingTable (TokenType t)
{
switch (t) {
case TokenType.Assembly :
return typeof (AssemblyTable);
case TokenType.AssemblyRef :
return typeof (AssemblyRefTable);
case TokenType.CustomAttribute :
return typeof (CustomAttributeTable);
case TokenType.Event :
return typeof (EventTable);
case TokenType.ExportedType :
return typeof (ExportedTypeTable);
case TokenType.Field :
return typeof (FieldTable);
case TokenType.File :
return typeof (FileTable);
case TokenType.InterfaceImpl :
return typeof (InterfaceImplTable);
case TokenType.MemberRef :
return typeof (MemberRefTable);
case TokenType.Method :
return typeof (MethodTable);
case TokenType.Module :
return typeof (ModuleTable);
case TokenType.ModuleRef :
return typeof (ModuleRefTable);
case TokenType.Param :
return typeof (ParamTable);
case TokenType.Permission :
return typeof (DeclSecurityTable);
case TokenType.Property :
return typeof (PropertyTable);
case TokenType.Signature :
return typeof (StandAloneSigTable);
case TokenType.TypeDef :
return typeof (TypeDefTable);
case TokenType.TypeRef :
return typeof (TypeRefTable);
case TokenType.TypeSpec :
return typeof (TypeSpecTable);
default :
return null;
}
}
internal delegate int TableRowCounter (int rid);
internal static int GetCodedIndexSize (CodedIndex ci, TableRowCounter rowCounter, IDictionary codedIndexCache)
{
int bits = 0, max = 0;
if (codedIndexCache [ci] != null)
return (int) codedIndexCache [ci];
int res = 0;
int [] rids;
switch (ci) {
<% $coded_indexes.each { |ci| %> case CodedIndex.<%=ci.name%> :
bits = <%=ci.size%>;
rids = new int [<%=ci.tables.length%>];
<% ci.tables.each_with_index { |tbl, i|
%> rids [<%=i%>] = <%=tbl.name%>Table.RId;
<% }
%> break;
<% } %> default :
throw new MetadataFormatException ("Non valid CodedIndex");
}
for (int i = 0; i < rids.Length; i++) {
int rows = rowCounter (rids [i]);
if (rows > max) max = rows;
}
res = max < (1 << (16 - bits)) ? 2 : 4;
codedIndexCache [ci] = res;
return res;
}
}
}

12
src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Mono.Cecil/Makefile

@ -1,12 +0,0 @@ @@ -1,12 +0,0 @@
thisdir = class/Mono.Cecil
include ../../build/rules.make
LIBRARY = Mono.Cecil.dll
LIBRARY_SNK = ../mono.snk
LIBRARY_PACKAGE = none
LIB_MCS_FLAGS = /r:$(corlib) /r:System.dll -keyfile:$(LIBRARY_SNK)
NO_TEST = yes
include ../../build/library.make

101
src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Mono.Cecil/Mono.Cecil.Binary/BaseImageVisitor.cs

@ -1,101 +0,0 @@ @@ -1,101 +0,0 @@
//
// BaseImageVisitor.cs
//
// Author:
// Jb Evain (jbevain@gmail.com)
//
// (C) 2005 - 2007 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.
//
namespace Mono.Cecil.Binary {
public abstract class BaseImageVisitor : IBinaryVisitor {
public virtual void VisitImage (Image img)
{
}
public virtual void VisitDOSHeader (DOSHeader header)
{
}
public virtual void VisitPEFileHeader (PEFileHeader header)
{
}
public virtual void VisitPEOptionalHeader (PEOptionalHeader header)
{
}
public virtual void VisitStandardFieldsHeader (PEOptionalHeader.StandardFieldsHeader header)
{
}
public virtual void VisitNTSpecificFieldsHeader (PEOptionalHeader.NTSpecificFieldsHeader header)
{
}
public virtual void VisitDataDirectoriesHeader (PEOptionalHeader.DataDirectoriesHeader header)
{
}
public virtual void VisitSectionCollection (SectionCollection coll)
{
}
public virtual void VisitSection (Section section)
{
}
public virtual void VisitImportAddressTable (ImportAddressTable iat)
{
}
public virtual void VisitDebugHeader (DebugHeader dh)
{
}
public virtual void VisitCLIHeader (CLIHeader header)
{
}
public virtual void VisitImportTable (ImportTable it)
{
}
public virtual void VisitImportLookupTable (ImportLookupTable ilt)
{
}
public virtual void VisitHintNameTable (HintNameTable hnt)
{
}
public virtual void VisitExportTable (ExportTable et)
{
}
public virtual void TerminateImage (Image img)
{
}
}
}

68
src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Mono.Cecil/Mono.Cecil.Binary/CLIHeader.cs

@ -1,68 +0,0 @@ @@ -1,68 +0,0 @@
//
// CLIHeader.cs
//
// Author:
// Jb Evain (jbevain@gmail.com)
//
// (C) 2005 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.
//
namespace Mono.Cecil.Binary {
public sealed class CLIHeader : IHeader, IBinaryVisitable {
public uint Cb;
public ushort MajorRuntimeVersion;
public ushort MinorRuntimeVersion;
public DataDirectory Metadata;
public RuntimeImage Flags;
public uint EntryPointToken;
public DataDirectory Resources;
public DataDirectory StrongNameSignature;
public DataDirectory CodeManagerTable;
public DataDirectory VTableFixups;
public DataDirectory ExportAddressTableJumps;
public DataDirectory ManagedNativeHeader;
public byte [] ImageHash;
internal CLIHeader ()
{
}
public void SetDefaultValues ()
{
Cb = 0x48;
MajorRuntimeVersion = 2;
MinorRuntimeVersion = 0;
Flags = RuntimeImage.ILOnly;
CodeManagerTable = DataDirectory.Zero;
ExportAddressTableJumps = DataDirectory.Zero;
ManagedNativeHeader = DataDirectory.Zero;
}
public void Accept (IBinaryVisitor visitor)
{
visitor.VisitCLIHeader (this);
}
}
}

119
src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Mono.Cecil/Mono.Cecil.Binary/CopyImageVisitor.cs

@ -1,119 +0,0 @@ @@ -1,119 +0,0 @@
//
// CopyImageVisitor.cs
//
// Author:
// Jb Evain (jbevain@gmail.com)
//
// (C) 2005 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.
//
namespace Mono.Cecil.Binary {
class CopyImageVisitor : BaseImageVisitor {
Image m_newImage;
Image m_originalImage;
public CopyImageVisitor (Image originalImage)
{
m_originalImage = originalImage;
}
public override void VisitImage (Image img)
{
m_newImage = img;
if (m_originalImage.DebugHeader != null)
m_newImage.AddDebugHeader ();
}
public override void VisitDebugHeader (DebugHeader dbgHeader)
{
DebugHeader old = m_originalImage.DebugHeader;
dbgHeader.Age = old.Age;
dbgHeader.Characteristics = old.Characteristics;
dbgHeader.FileName = old.FileName;
dbgHeader.Signature = old.Signature;
dbgHeader.TimeDateStamp = ImageInitializer.TimeDateStampFromEpoch();
dbgHeader.Type = old.Type;
}
public override void VisitSectionCollection (SectionCollection sections)
{
Section old = null;
foreach (Section s in m_originalImage.Sections)
if (s.Name == Section.Resources)
old = s;
if (old == null)
return;
Section rsrc = new Section ();
rsrc.Characteristics = old.Characteristics;
rsrc.Name = old.Name;
sections.Add (rsrc);
}
public override void TerminateImage (Image img)
{
if (m_originalImage.ResourceDirectoryRoot == null)
return;
m_newImage.ResourceDirectoryRoot = CloneResourceDirectoryTable (m_originalImage.ResourceDirectoryRoot);
}
ResourceDirectoryTable CloneResourceDirectoryTable (ResourceDirectoryTable old)
{
ResourceDirectoryTable rdt = new ResourceDirectoryTable ();
foreach (ResourceDirectoryEntry oldEntry in old.Entries)
rdt.Entries.Add (CloneResourceDirectoryEntry (oldEntry));
return rdt;
}
ResourceDirectoryEntry CloneResourceDirectoryEntry (ResourceDirectoryEntry old)
{
ResourceDirectoryEntry rde;
if (old.IdentifiedByName)
rde = new ResourceDirectoryEntry(old.Name);
else
rde = new ResourceDirectoryEntry (old.ID);
if (old.Child is ResourceDirectoryTable)
rde.Child = CloneResourceDirectoryTable (old.Child as ResourceDirectoryTable);
else
rde.Child = CloneResourceDataEntry (old.Child as ResourceDataEntry);
return rde;
}
ResourceDataEntry CloneResourceDataEntry (ResourceDataEntry old)
{
ResourceDataEntry rde = new ResourceDataEntry ();
rde.Size = old.Size;
rde.Codepage = old.Codepage;
rde.ResourceData = old.ResourceData;
return rde;
}
}
}

75
src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Mono.Cecil/Mono.Cecil.Binary/DOSHeader.cs

@ -1,75 +0,0 @@ @@ -1,75 +0,0 @@
//
// DOSHeader.cs
//
// Author:
// Jb Evain (jbevain@gmail.com)
//
// (C) 2005 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.
//
namespace Mono.Cecil.Binary {
public sealed class DOSHeader : IHeader, IBinaryVisitable {
public byte [] Start;
public byte [] End;
public uint Lfanew;
internal DOSHeader ()
{
}
public void SetDefaultValues ()
{
Start = new byte [60] {
0x4d, 0x5a, 0x90, 0x00, 0x03, 0x00, 0x00,
0x00, 0x04, 0x00, 0x00, 0x00, 0xff, 0xff,
0x00, 0x00, 0xb8, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00
};
Lfanew = 128;
End = new byte [64] {
0x0e, 0x1f, 0xba, 0x0e, 0x00, 0xb4, 0x09,
0xcd, 0x21, 0xb8, 0x01, 0x4c, 0xcd, 0x21,
0x54, 0x68, 0x69, 0x73, 0x20, 0x70, 0x72,
0x6f, 0x67, 0x72, 0x61, 0x6d, 0x20, 0x63,
0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x20, 0x62,
0x65, 0x20, 0x72, 0x75, 0x6e, 0x20, 0x69,
0x6e, 0x20, 0x44, 0x4f, 0x53, 0x20, 0x6d,
0x6f, 0x64, 0x65, 0x2e, 0x0d, 0x0d, 0x0a,
0x24, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00
};
}
public void Accept (IBinaryVisitor visitor)
{
visitor.VisitDOSHeader (this);
}
}
}

87
src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Mono.Cecil/Mono.Cecil.Binary/DataDirectory.cs

@ -1,87 +0,0 @@ @@ -1,87 +0,0 @@
//
// DataDirectory.cs
//
// Author:
// Jb Evain (jbevain@gmail.com)
//
// (C) 2005 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.
//
namespace Mono.Cecil.Binary {
using Mono.Cecil.Metadata;
public struct DataDirectory {
public static readonly DataDirectory Zero = new DataDirectory(RVA.Zero, 0);
RVA m_virtualAddress;
uint m_size;
public RVA VirtualAddress {
get { return m_virtualAddress; }
set { m_virtualAddress = value; }
}
public uint Size {
get { return m_size; }
set { m_size = value; }
}
public DataDirectory (RVA virtualAddress, uint size)
{
m_virtualAddress = virtualAddress;
m_size = size;
}
public override int GetHashCode ()
{
return (m_virtualAddress.GetHashCode () ^ (int) m_size << 1);
}
public override bool Equals (object other)
{
if (other is DataDirectory) {
DataDirectory odd = (DataDirectory)other;
return (this.m_virtualAddress == odd.m_virtualAddress &&
this.m_size == odd.m_size);
}
return false;
}
public override string ToString ()
{
return string.Format ("{0} [{1}]",
m_virtualAddress.ToString (), m_size.ToString ("X"));
}
public static bool operator == (DataDirectory one, DataDirectory other)
{
return one.Equals (other);
}
public static bool operator != (DataDirectory one, DataDirectory other)
{
return !one.Equals (other);
}
}
}

73
src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Mono.Cecil/Mono.Cecil.Binary/DebugHeader.cs

@ -1,73 +0,0 @@ @@ -1,73 +0,0 @@
//
// DebugHeader.cs
//
// Author:
// Jb Evain (jbevain@gmail.com)
//
// (C) 2005 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.
//
namespace Mono.Cecil.Binary {
using System;
public sealed class DebugHeader : IHeader, IBinaryVisitable {
public uint Characteristics;
public uint TimeDateStamp;
public ushort MajorVersion;
public ushort MinorVersion;
public DebugStoreType Type;
public uint SizeOfData;
public RVA AddressOfRawData;
public uint PointerToRawData;
public uint Magic;
public Guid Signature;
public uint Age;
public string FileName;
internal DebugHeader ()
{
}
public void SetDefaultValues ()
{
Characteristics = 0;
this.Magic = 0x53445352;
this.Age = 0;
this.Type = DebugStoreType.CodeView;
this.FileName = string.Empty;
}
public uint GetSize ()
{
return 0x34 + (uint) FileName.Length + 1;
}
public void Accept (IBinaryVisitor visitor)
{
visitor.VisitDebugHeader (this);
}
}
}

45
src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Mono.Cecil/Mono.Cecil.Binary/DebugStoreType.cs

@ -1,45 +0,0 @@ @@ -1,45 +0,0 @@
//
// DebugStoreType.cs
//
// Author:
// Jb Evain (jbevain@gmail.com)
//
// (C) 2005 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.
//
namespace Mono.Cecil.Binary {
public enum DebugStoreType : uint {
Unknown = 0x00000000,
COFF = 0x00000001,
CodeView = 0x00000002,
FPO = 0x00000003,
Misc = 0x00000004,
Exception = 0x00000005,
Fixup = 0x00000006,
OMAPToSrc = 0x00000007,
OMAPFromSrc = 0x00000008,
Borland = 0x00000009,
Reserved10 = 0x0000000a,
CLSID = 0x0000000b
}
}

59
src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Mono.Cecil/Mono.Cecil.Binary/ExportTable.cs

@ -1,59 +0,0 @@ @@ -1,59 +0,0 @@
//
// ExportTable.cs
//
// Author:
// Jb Evain (jbevain@gmail.com)
//
// (C) 2007 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.
//
namespace Mono.Cecil.Binary {
public sealed class ExportTable : IBinaryVisitable {
public uint Characteristics;
public uint TimeDateStamp;
public ushort MajorVersion;
public ushort MinorVersion;
public string Name;
public uint Base;
public uint NumberOfFunctions;
public uint NumberOfNames;
public RVA AddressOfFunctions;
public RVA AddressOfNames;
public RVA AddressOfNameOrdinals;
public RVA [] AddressesOfFunctions;
public RVA [] AddressesOfNames;
public ushort [] NameOrdinals;
public string [] Names;
internal ExportTable ()
{
}
public void Accept (IBinaryVisitor visitor)
{
visitor.VisitExportTable (this);
}
}
}

35
src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Mono.Cecil/Mono.Cecil.Binary/IBinaryVisitable.cs

@ -1,35 +0,0 @@ @@ -1,35 +0,0 @@
//
// IBinaryVisitable.cs
//
// Author:
// Jb Evain (jbevain@gmail.com)
//
// (C) 2005 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.
//
namespace Mono.Cecil.Binary {
public interface IBinaryVisitable {
void Accept (IBinaryVisitor visitor);
}
}

51
src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Mono.Cecil/Mono.Cecil.Binary/IBinaryVisitor.cs

@ -1,51 +0,0 @@ @@ -1,51 +0,0 @@
//
// IBinaryVisitor.cs
//
// Author:
// Jb Evain (jbevain@gmail.com)
//
// (C) 2005 - 2007 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.
//
namespace Mono.Cecil.Binary {
public interface IBinaryVisitor {
void VisitImage (Image img);
void VisitDOSHeader (DOSHeader header);
void VisitPEFileHeader (PEFileHeader header);
void VisitPEOptionalHeader (PEOptionalHeader header);
void VisitStandardFieldsHeader (PEOptionalHeader.StandardFieldsHeader header);
void VisitNTSpecificFieldsHeader (PEOptionalHeader.NTSpecificFieldsHeader header);
void VisitDataDirectoriesHeader (PEOptionalHeader.DataDirectoriesHeader header);
void VisitSectionCollection (SectionCollection coll);
void VisitSection (Section section);
void VisitImportAddressTable (ImportAddressTable iat);
void VisitDebugHeader (DebugHeader dh);
void VisitCLIHeader (CLIHeader header);
void VisitImportTable (ImportTable it);
void VisitImportLookupTable (ImportLookupTable ilt);
void VisitHintNameTable (HintNameTable hnt);
void VisitExportTable (ExportTable et);
void TerminateImage (Image img);
}
}

34
src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Mono.Cecil/Mono.Cecil.Binary/IHeader.cs

@ -1,34 +0,0 @@ @@ -1,34 +0,0 @@
//
// IHeader.cs
//
// Author:
// Jb Evain (jbevain@gmail.com)
//
// (C) 2005 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.
//
namespace Mono.Cecil.Binary {
internal interface IHeader {
void SetDefaultValues ();
}
}

236
src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Mono.Cecil/Mono.Cecil.Binary/Image.cs

@ -1,236 +0,0 @@ @@ -1,236 +0,0 @@
//
// Image.cs
//
// Author:
// Jb Evain (jbevain@gmail.com)
//
// (C) 2005 - 2007 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.
//
namespace Mono.Cecil.Binary {
using System;
using System.IO;
using Mono.Cecil.Metadata;
public sealed class Image : IBinaryVisitable {
DOSHeader m_dosHeader;
PEFileHeader m_peFileHeader;
PEOptionalHeader m_peOptionalHeader;
SectionCollection m_sections;
Section m_textSection;
ImportAddressTable m_importAddressTable;
CLIHeader m_cliHeader;
ImportTable m_importTable;
ImportLookupTable m_importLookupTable;
HintNameTable m_hintNameTable;
ExportTable m_exportTable;
DebugHeader m_debugHeader;
MetadataRoot m_mdRoot;
ResourceDirectoryTable m_rsrcRoot;
FileInfo m_img;
public DOSHeader DOSHeader {
get { return m_dosHeader; }
}
public PEFileHeader PEFileHeader {
get { return m_peFileHeader; }
}
public PEOptionalHeader PEOptionalHeader {
get { return m_peOptionalHeader; }
}
public SectionCollection Sections {
get { return m_sections; }
}
public Section TextSection {
get { return m_textSection; }
set { m_textSection = value; }
}
public ImportAddressTable ImportAddressTable {
get { return m_importAddressTable; }
}
public CLIHeader CLIHeader {
get { return m_cliHeader; }
set { m_cliHeader = value; }
}
public DebugHeader DebugHeader {
get { return m_debugHeader; }
set { m_debugHeader = value; }
}
public MetadataRoot MetadataRoot {
get { return m_mdRoot; }
}
public ImportTable ImportTable {
get { return m_importTable; }
}
public ImportLookupTable ImportLookupTable {
get { return m_importLookupTable; }
}
public HintNameTable HintNameTable {
get { return m_hintNameTable; }
}
public ExportTable ExportTable {
get { return m_exportTable; }
set { m_exportTable = value; }
}
internal ResourceDirectoryTable ResourceDirectoryRoot {
get { return m_rsrcRoot; }
set { m_rsrcRoot = value; }
}
public FileInfo FileInformation {
get { return m_img; }
}
internal Image ()
{
m_dosHeader = new DOSHeader ();
m_peFileHeader = new PEFileHeader ();
m_peOptionalHeader = new PEOptionalHeader ();
m_sections = new SectionCollection ();
m_importAddressTable = new ImportAddressTable ();
m_importTable = new ImportTable ();
m_importLookupTable = new ImportLookupTable ();
m_hintNameTable = new HintNameTable ();
m_mdRoot = new MetadataRoot (this);
}
internal Image (FileInfo img) : this ()
{
m_img = img;
}
public long ResolveVirtualAddress (RVA rva)
{
foreach (Section sect in this.Sections) {
if (rva >= sect.VirtualAddress &&
rva < sect.VirtualAddress + sect.SizeOfRawData)
return rva + sect.PointerToRawData - sect.VirtualAddress;
}
throw new ArgumentOutOfRangeException ("Cannot map the rva to any section");
}
public BinaryReader GetReaderAtVirtualAddress (RVA rva)
{
foreach (Section sect in this.Sections) {
if (rva >= sect.VirtualAddress &&
rva < sect.VirtualAddress + sect.SizeOfRawData) {
BinaryReader br = new BinaryReader (new MemoryStream (sect.Data));
br.BaseStream.Position = rva - sect.VirtualAddress;
return br;
}
}
return null;
}
public void AddDebugHeader ()
{
m_debugHeader = new DebugHeader ();
m_debugHeader.SetDefaultValues ();
}
internal void SetFileInfo (FileInfo file)
{
m_img = file;
}
public void Accept (IBinaryVisitor visitor)
{
visitor.VisitImage (this);
m_dosHeader.Accept (visitor);
m_peFileHeader.Accept (visitor);
m_peOptionalHeader.Accept (visitor);
m_sections.Accept (visitor);
m_importAddressTable.Accept (visitor);
AcceptIfNotNull (m_cliHeader, visitor);
AcceptIfNotNull (m_debugHeader, visitor);
m_importTable.Accept (visitor);
m_importLookupTable.Accept (visitor);
m_hintNameTable.Accept (visitor);
AcceptIfNotNull (m_exportTable, visitor);
visitor.TerminateImage (this);
}
static void AcceptIfNotNull (IBinaryVisitable visitable, IBinaryVisitor visitor)
{
if (visitable == null)
return;
visitable.Accept (visitor);
}
public static Image CreateImage ()
{
Image img = new Image ();
ImageInitializer init = new ImageInitializer (img);
img.Accept (init);
return img;
}
public static Image GetImage (string file)
{
return ImageReader.Read (file).Image;
}
public static Image GetImage (byte [] image)
{
return ImageReader.Read (image).Image;
}
public static Image GetImage (Stream stream)
{
return ImageReader.Read (stream).Image;
}
}
}

57
src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Mono.Cecil/Mono.Cecil.Binary/ImageCharacteristics.cs

@ -1,57 +0,0 @@ @@ -1,57 +0,0 @@
//
// ImageCharacteristics.cs
//
// Author:
// Jb Evain (jbevain@gmail.com)
//
// (C) 2005 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.
//
namespace Mono.Cecil.Binary {
using System;
[Flags]
public enum ImageCharacteristics : ushort {
RelocsStripped = 0x0001,
ExecutableImage = 0x0002,
LineNumsStripped = 0x0004,
LocalSymsStripped = 0x0008,
AggressiveWSTrim = 0x0010,
LargeAddressAware = 0x0020,
ReservedForFutureUse = 0x0040,
BytesReversedLo = 0x0080,
_32BitsMachine = 0x0100,
DebugStripped = 0x0200,
RemovableRunFromSwap = 0x0400,
NetRunFromSwap = 0x0800,
System = 0x1000,
Dll = 0x2000,
UPSystemOnly = 0x4000,
BytesReversedHI = 0x8000,
__flags = 0x0002 | 0x0004 | 0x0008 | 0x0100,
CILOnlyDll = 0x2000 | (ushort) __flags,
CILOnlyExe = __flags
}
}

139
src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Mono.Cecil/Mono.Cecil.Binary/ImageInitializer.cs

@ -1,139 +0,0 @@ @@ -1,139 +0,0 @@
//
// ImageInitializer.cs
//
// Author:
// Jb Evain (jbevain@gmail.com)
//
// (C) 2005 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.
//
namespace Mono.Cecil.Binary {
using System;
using Mono.Cecil.Metadata;
class ImageInitializer : BaseImageVisitor {
Image m_image;
MetadataInitializer m_mdinit;
public Image Image {
get { return m_image; }
}
public MetadataInitializer Metadata {
get { return m_mdinit; }
}
public ImageInitializer (Image image)
{
m_image = image;
m_image.CLIHeader = new CLIHeader ();
m_mdinit = new MetadataInitializer (this);
}
public override void VisitDOSHeader (DOSHeader header)
{
header.SetDefaultValues ();
}
public override void VisitPEOptionalHeader (PEOptionalHeader header)
{
header.SetDefaultValues ();
}
public override void VisitPEFileHeader (PEFileHeader header)
{
header.SetDefaultValues ();
header.TimeDateStamp = TimeDateStampFromEpoch ();
}
public override void VisitNTSpecificFieldsHeader (PEOptionalHeader.NTSpecificFieldsHeader header)
{
header.SetDefaultValues ();
}
public override void VisitStandardFieldsHeader (PEOptionalHeader.StandardFieldsHeader header)
{
header.SetDefaultValues ();
}
public override void VisitDataDirectoriesHeader (PEOptionalHeader.DataDirectoriesHeader header)
{
header.SetDefaultValues ();
}
public override void VisitSectionCollection (SectionCollection coll)
{
Section text = new Section ();
text.Name = Section.Text;
text.Characteristics = SectionCharacteristics.ContainsCode |
SectionCharacteristics.MemoryRead | SectionCharacteristics.MemExecute;
m_image.TextSection = text;
Section reloc = new Section ();
reloc.Name = Section.Relocs;
reloc.Characteristics = SectionCharacteristics.ContainsInitializedData |
SectionCharacteristics.MemDiscardable | SectionCharacteristics.MemoryRead;
coll.Add (text);
coll.Add (reloc);
}
public override void VisitSection (Section sect)
{
sect.SetDefaultValues ();
}
public override void VisitDebugHeader (DebugHeader dh)
{
if (dh != null)
dh.SetDefaultValues ();
}
public override void VisitCLIHeader (CLIHeader header)
{
header.SetDefaultValues ();
m_image.MetadataRoot.Accept (m_mdinit);
}
public override void VisitImportTable (ImportTable it)
{
it.ImportAddressTable = new RVA (0x2000);
}
public override void VisitHintNameTable (HintNameTable hnt)
{
hnt.Hint = 0;
hnt.RuntimeLibrary = HintNameTable.RuntimeCorEE;
hnt.EntryPoint = 0x25ff;
hnt.RVA = new RVA (0x402000);
}
public static uint TimeDateStampFromEpoch ()
{
return (uint) DateTime.UtcNow.Subtract (
new DateTime (1970, 1, 1)).TotalSeconds;
}
}
}

466
src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Mono.Cecil/Mono.Cecil.Binary/ImageReader.cs

@ -1,466 +0,0 @@ @@ -1,466 +0,0 @@
//
// ImageReader.cs
//
// Author:
// Jb Evain (jbevain@gmail.com)
//
// (C) 2005 - 2007 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.
//
namespace Mono.Cecil.Binary {
using System;
using System.IO;
using System.Text;
using Mono.Cecil.Metadata;
class ImageReader : BaseImageVisitor {
MetadataReader m_mdReader;
BinaryReader m_binaryReader;
Image m_image;
public MetadataReader MetadataReader {
get { return m_mdReader; }
}
public Image Image {
get { return m_image; }
}
ImageReader (Image img, BinaryReader reader)
{
m_image = img;
m_binaryReader = reader;
}
static ImageReader Read (Image img, Stream stream)
{
ImageReader reader = new ImageReader (img, new BinaryReader (stream));
img.Accept (reader);
return reader;
}
public static ImageReader Read (string file)
{
if (file == null)
throw new ArgumentNullException ("file");
FileInfo fi = new FileInfo (file);
if (!File.Exists (fi.FullName))
#if CF_1_0 || CF_2_0
throw new FileNotFoundException (fi.FullName);
#else
throw new FileNotFoundException (string.Format ("File '{0}' not found.", fi.FullName), fi.FullName);
#endif
return Read (new Image (fi), new FileStream (
fi.FullName, FileMode.Open,
FileAccess.Read, FileShare.Read));
}
public static ImageReader Read (byte [] image)
{
if (image == null)
throw new ArgumentNullException ("image");
if (image.Length == 0)
throw new ArgumentException ("Empty image array");
return Read (new Image (), new MemoryStream (image));
}
public static ImageReader Read (Stream stream)
{
if (stream == null)
throw new ArgumentNullException ("stream");
if (!stream.CanRead)
throw new ArgumentException ("Can not read from stream");
return Read (new Image (), stream);
}
public BinaryReader GetReader ()
{
return m_binaryReader;
}
public override void VisitImage (Image img)
{
m_mdReader = new MetadataReader (this);
}
void SetPositionToAddress (RVA address)
{
m_binaryReader.BaseStream.Position = m_image.ResolveVirtualAddress (address);
}
public override void VisitDOSHeader (DOSHeader header)
{
header.Start = m_binaryReader.ReadBytes (60);
header.Lfanew = m_binaryReader.ReadUInt32 ();
header.End = m_binaryReader.ReadBytes (64);
m_binaryReader.BaseStream.Position = header.Lfanew;
if (m_binaryReader.ReadUInt16 () != 0x4550 ||
m_binaryReader.ReadUInt16 () != 0)
throw new ImageFormatException ("Invalid PE File Signature");
}
public override void VisitPEFileHeader (PEFileHeader header)
{
header.Machine = m_binaryReader.ReadUInt16 ();
header.NumberOfSections = m_binaryReader.ReadUInt16 ();
header.TimeDateStamp = m_binaryReader.ReadUInt32 ();
header.PointerToSymbolTable = m_binaryReader.ReadUInt32 ();
header.NumberOfSymbols = m_binaryReader.ReadUInt32 ();
header.OptionalHeaderSize = m_binaryReader.ReadUInt16 ();
header.Characteristics = (ImageCharacteristics) m_binaryReader.ReadUInt16 ();
}
ulong ReadIntOrLong ()
{
return m_image.PEOptionalHeader.StandardFields.IsPE64 ?
m_binaryReader.ReadUInt64 () :
m_binaryReader.ReadUInt32 ();
}
RVA ReadRVA ()
{
return m_binaryReader.ReadUInt32 ();
}
DataDirectory ReadDataDirectory ()
{
return new DataDirectory (ReadRVA (), m_binaryReader.ReadUInt32 ());
}
public override void VisitNTSpecificFieldsHeader (PEOptionalHeader.NTSpecificFieldsHeader header)
{
header.ImageBase = ReadIntOrLong ();
header.SectionAlignment = m_binaryReader.ReadUInt32 ();
header.FileAlignment = m_binaryReader.ReadUInt32 ();
header.OSMajor = m_binaryReader.ReadUInt16 ();
header.OSMinor = m_binaryReader.ReadUInt16 ();
header.UserMajor = m_binaryReader.ReadUInt16 ();
header.UserMinor = m_binaryReader.ReadUInt16 ();
header.SubSysMajor = m_binaryReader.ReadUInt16 ();
header.SubSysMinor = m_binaryReader.ReadUInt16 ();
header.Reserved = m_binaryReader.ReadUInt32 ();
header.ImageSize = m_binaryReader.ReadUInt32 ();
header.HeaderSize = m_binaryReader.ReadUInt32 ();
header.FileChecksum = m_binaryReader.ReadUInt32 ();
header.SubSystem = (SubSystem) m_binaryReader.ReadUInt16 ();
header.DLLFlags = m_binaryReader.ReadUInt16 ();
header.StackReserveSize = ReadIntOrLong ();
header.StackCommitSize = ReadIntOrLong ();
header.HeapReserveSize = ReadIntOrLong ();
header.HeapCommitSize = ReadIntOrLong ();
header.LoaderFlags = m_binaryReader.ReadUInt32 ();
header.NumberOfDataDir = m_binaryReader.ReadUInt32 ();
}
public override void VisitStandardFieldsHeader (PEOptionalHeader.StandardFieldsHeader header)
{
header.Magic = m_binaryReader.ReadUInt16 ();
header.LMajor = m_binaryReader.ReadByte ();
header.LMinor = m_binaryReader.ReadByte ();
header.CodeSize = m_binaryReader.ReadUInt32 ();
header.InitializedDataSize = m_binaryReader.ReadUInt32 ();
header.UninitializedDataSize = m_binaryReader.ReadUInt32 ();
header.EntryPointRVA = ReadRVA ();
header.BaseOfCode = ReadRVA ();
if (!header.IsPE64)
header.BaseOfData = ReadRVA ();
}
public override void VisitDataDirectoriesHeader (PEOptionalHeader.DataDirectoriesHeader header)
{
header.ExportTable = ReadDataDirectory ();
header.ImportTable = ReadDataDirectory ();
header.ResourceTable = ReadDataDirectory ();
header.ExceptionTable = ReadDataDirectory ();
header.CertificateTable = ReadDataDirectory ();
header.BaseRelocationTable = ReadDataDirectory ();
header.Debug = ReadDataDirectory ();
header.Copyright = ReadDataDirectory ();
header.GlobalPtr = ReadDataDirectory ();
header.TLSTable = ReadDataDirectory ();
header.LoadConfigTable = ReadDataDirectory ();
header.BoundImport = ReadDataDirectory ();
header.IAT = ReadDataDirectory ();
header.DelayImportDescriptor = ReadDataDirectory ();
header.CLIHeader = ReadDataDirectory ();
header.Reserved = ReadDataDirectory ();
if (header.CLIHeader != DataDirectory.Zero)
m_image.CLIHeader = new CLIHeader ();
if (header.ExportTable != DataDirectory.Zero)
m_image.ExportTable = new ExportTable ();
}
public override void VisitSectionCollection (SectionCollection coll)
{
for (int i = 0; i < m_image.PEFileHeader.NumberOfSections; i++)
coll.Add (new Section ());
}
public override void VisitSection (Section sect)
{
char [] buffer = new char [8];
int read = 0;
while (read < 8) {
char cur = (char) m_binaryReader.ReadSByte ();
if (cur == '\0') {
m_binaryReader.BaseStream.Position += 8 - read - 1;
break;
}
buffer [read++] = cur;
}
sect.Name = read == 0 ? string.Empty : new string (buffer, 0, read);
if (sect.Name == Section.Text)
m_image.TextSection = sect;
sect.VirtualSize = m_binaryReader.ReadUInt32 ();
sect.VirtualAddress = ReadRVA ();
sect.SizeOfRawData = m_binaryReader.ReadUInt32 ();
sect.PointerToRawData = ReadRVA ();
sect.PointerToRelocations = ReadRVA ();
sect.PointerToLineNumbers = ReadRVA ();
sect.NumberOfRelocations = m_binaryReader.ReadUInt16 ();
sect.NumberOfLineNumbers = m_binaryReader.ReadUInt16 ();
sect.Characteristics = (SectionCharacteristics) m_binaryReader.ReadUInt32 ();
long pos = m_binaryReader.BaseStream.Position;
m_binaryReader.BaseStream.Position = sect.PointerToRawData;
sect.Data = m_binaryReader.ReadBytes ((int) sect.SizeOfRawData);
m_binaryReader.BaseStream.Position = pos;
}
public override void VisitImportAddressTable (ImportAddressTable iat)
{
if (m_image.PEOptionalHeader.DataDirectories.IAT.VirtualAddress == RVA.Zero)
return;
SetPositionToAddress (m_image.PEOptionalHeader.DataDirectories.IAT.VirtualAddress);
iat.HintNameTableRVA = ReadRVA ();
}
public override void VisitCLIHeader (CLIHeader header)
{
if (m_image.PEOptionalHeader.DataDirectories.Debug != DataDirectory.Zero) {
m_image.DebugHeader = new DebugHeader ();
VisitDebugHeader (m_image.DebugHeader);
}
SetPositionToAddress (m_image.PEOptionalHeader.DataDirectories.CLIHeader.VirtualAddress);
header.Cb = m_binaryReader.ReadUInt32 ();
header.MajorRuntimeVersion = m_binaryReader.ReadUInt16 ();
header.MinorRuntimeVersion = m_binaryReader.ReadUInt16 ();
header.Metadata = ReadDataDirectory ();
header.Flags = (RuntimeImage) m_binaryReader.ReadUInt32 ();
header.EntryPointToken = m_binaryReader.ReadUInt32 ();
header.Resources = ReadDataDirectory ();
header.StrongNameSignature = ReadDataDirectory ();
header.CodeManagerTable = ReadDataDirectory ();
header.VTableFixups = ReadDataDirectory ();
header.ExportAddressTableJumps = ReadDataDirectory ();
header.ManagedNativeHeader = ReadDataDirectory ();
if (header.StrongNameSignature != DataDirectory.Zero) {
SetPositionToAddress (header.StrongNameSignature.VirtualAddress);
header.ImageHash = m_binaryReader.ReadBytes ((int) header.StrongNameSignature.Size);
} else
header.ImageHash = new byte [0];
SetPositionToAddress (m_image.CLIHeader.Metadata.VirtualAddress);
m_image.MetadataRoot.Accept (m_mdReader);
}
public override void VisitDebugHeader (DebugHeader header)
{
if (m_image.PEOptionalHeader.DataDirectories.Debug == DataDirectory.Zero)
return;
long pos = m_binaryReader.BaseStream.Position;
SetPositionToAddress (m_image.PEOptionalHeader.DataDirectories.Debug.VirtualAddress);
header.Characteristics = m_binaryReader.ReadUInt32 ();
header.TimeDateStamp = m_binaryReader.ReadUInt32 ();
header.MajorVersion = m_binaryReader.ReadUInt16 ();
header.MinorVersion = m_binaryReader.ReadUInt16 ();
header.Type = (DebugStoreType) m_binaryReader.ReadUInt32 ();
header.SizeOfData = m_binaryReader.ReadUInt32 ();
header.AddressOfRawData = ReadRVA ();
header.PointerToRawData = m_binaryReader.ReadUInt32 ();
m_binaryReader.BaseStream.Position = header.PointerToRawData;
header.Magic = m_binaryReader.ReadUInt32 ();
header.Signature = new Guid (m_binaryReader.ReadBytes (16));
header.Age = m_binaryReader.ReadUInt32 ();
header.FileName = ReadZeroTerminatedString ();
m_binaryReader.BaseStream.Position = pos;
}
string ReadZeroTerminatedString ()
{
StringBuilder sb = new StringBuilder ();
while (true) {
byte chr = m_binaryReader.ReadByte ();
if (chr == 0)
break;
sb.Append ((char) chr);
}
return sb.ToString ();
}
public override void VisitImportTable (ImportTable it)
{
if (m_image.PEOptionalHeader.DataDirectories.ImportTable.VirtualAddress == RVA.Zero)
return;
SetPositionToAddress (m_image.PEOptionalHeader.DataDirectories.ImportTable.VirtualAddress);
it.ImportLookupTable = ReadRVA ();
it.DateTimeStamp = m_binaryReader.ReadUInt32 ();
it.ForwardChain = m_binaryReader.ReadUInt32 ();
it.Name = ReadRVA ();
it.ImportAddressTable = ReadRVA ();
}
public override void VisitImportLookupTable (ImportLookupTable ilt)
{
if (m_image.ImportTable.ImportLookupTable == RVA.Zero)
return;
SetPositionToAddress (m_image.ImportTable.ImportLookupTable);
ilt.HintNameRVA = ReadRVA ();
}
public override void VisitHintNameTable (HintNameTable hnt)
{
if (m_image.ImportAddressTable.HintNameTableRVA == RVA.Zero)
return;
SetPositionToAddress (m_image.ImportAddressTable.HintNameTableRVA);
hnt.Hint = m_binaryReader.ReadUInt16 ();
byte [] bytes = m_binaryReader.ReadBytes (11);
hnt.RuntimeMain = Encoding.ASCII.GetString (bytes, 0, bytes.Length);
SetPositionToAddress (m_image.ImportTable.Name);
bytes = m_binaryReader.ReadBytes (11);
hnt.RuntimeLibrary = Encoding.ASCII.GetString (bytes, 0, bytes.Length);
SetPositionToAddress (m_image.PEOptionalHeader.StandardFields.EntryPointRVA);
hnt.EntryPoint = m_binaryReader.ReadUInt16 ();
hnt.RVA = ReadRVA ();
}
public override void VisitExportTable (ExportTable et)
{
SetPositionToAddress (m_image.PEOptionalHeader.DataDirectories.ExportTable.VirtualAddress);
et.Characteristics = m_binaryReader.ReadUInt32 ();
et.TimeDateStamp = m_binaryReader.ReadUInt32 ();
et.MajorVersion = m_binaryReader.ReadUInt16 ();
et.MinorVersion = m_binaryReader.ReadUInt16 ();
//et.Name =
m_binaryReader.ReadUInt32 ();
et.Base = m_binaryReader.ReadUInt32 ();
et.NumberOfFunctions = m_binaryReader.ReadUInt32 ();
et.NumberOfNames = m_binaryReader.ReadUInt32 ();
et.AddressOfFunctions = m_binaryReader.ReadUInt32 ();
et.AddressOfNames = m_binaryReader.ReadUInt32 ();
et.AddressOfNameOrdinals = m_binaryReader.ReadUInt32 ();
et.AddressesOfFunctions = ReadArrayOfRVA (et.AddressOfFunctions, et.NumberOfFunctions);
et.AddressesOfNames = ReadArrayOfRVA (et.AddressOfNames, et.NumberOfNames);
et.NameOrdinals = ReadArrayOfUInt16 (et.AddressOfNameOrdinals, et.NumberOfNames);
et.Names = new string [et.NumberOfFunctions];
for (int i = 0; i < et.NumberOfFunctions; i++) {
if (et.AddressesOfFunctions [i] == 0)
continue;
et.Names [i] = ReadFunctionName (et, i);
}
}
string ReadFunctionName (ExportTable et, int index)
{
for (int i = 0; i < et.NumberOfNames; i++) {
if (et.NameOrdinals [i] != index)
continue;
SetPositionToAddress (et.AddressesOfNames [i]);
return ReadZeroTerminatedString ();
}
return string.Empty;
}
ushort [] ReadArrayOfUInt16 (RVA position, uint length)
{
SetPositionToAddress (position);
ushort [] array = new ushort [length];
for (int i = 0; i < length; i++)
array [i] = m_binaryReader.ReadUInt16 ();
return array;
}
RVA [] ReadArrayOfRVA (RVA position, uint length)
{
SetPositionToAddress (position);
RVA [] addresses = new RVA [length];
for (int i = 0; i < length; i++)
addresses [i] = m_binaryReader.ReadUInt32 ();
return addresses;
}
public override void TerminateImage(Image img)
{
m_binaryReader.Close ();
try {
ResourceReader resReader = new ResourceReader (img);
img.ResourceDirectoryRoot = resReader.Read ();
} catch {
img.ResourceDirectoryRoot = null;
}
}
}
}

427
src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Mono.Cecil/Mono.Cecil.Binary/ImageWriter.cs

@ -1,427 +0,0 @@ @@ -1,427 +0,0 @@
//
// ImageWriter.cs
//
// Author:
// Jb Evain (jbevain@gmail.com)
//
// (C) 2005 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.
//
namespace Mono.Cecil.Binary {
using System.IO;
using System.Text;
using Mono.Cecil.Metadata;
class ImageWriter : BaseImageVisitor {
Image m_img;
AssemblyKind m_kind;
MetadataWriter m_mdWriter;
BinaryWriter m_binaryWriter;
Section m_textSect;
MemoryBinaryWriter m_textWriter;
Section m_relocSect;
MemoryBinaryWriter m_relocWriter;
Section m_rsrcSect;
MemoryBinaryWriter m_rsrcWriter;
public ImageWriter (MetadataWriter writer, AssemblyKind kind, BinaryWriter bw)
{
m_mdWriter= writer;
m_img = writer.GetMetadataRoot ().GetImage ();
m_kind = kind;
m_binaryWriter = bw;
m_textWriter = new MemoryBinaryWriter ();
m_textWriter.BaseStream.Position = 80;
m_relocWriter = new MemoryBinaryWriter ();
}
public Image GetImage ()
{
return m_img;
}
public MemoryBinaryWriter GetTextWriter ()
{
return m_textWriter;
}
public uint GetAligned (uint integer, uint alignWith)
{
return (integer + alignWith - 1) & ~(alignWith - 1);
}
public void Initialize ()
{
Image img = m_img;
ResourceWriter resWriter = null;
uint sectAlign = img.PEOptionalHeader.NTSpecificFields.SectionAlignment;
uint fileAlign = img.PEOptionalHeader.NTSpecificFields.FileAlignment;
m_textSect = img.TextSection;
foreach (Section s in img.Sections) {
if (s.Name == Section.Relocs)
m_relocSect = s;
else if (s.Name == Section.Resources) {
m_rsrcSect = s;
m_rsrcWriter = new MemoryBinaryWriter ();
resWriter = new ResourceWriter (img, m_rsrcSect, m_rsrcWriter);
resWriter.Write ();
}
}
// size computations, fields setting, etc.
uint nbSects = (uint) img.Sections.Count;
img.PEFileHeader.NumberOfSections = (ushort) nbSects;
// build the reloc section data
uint relocSize = 12;
m_relocWriter.Write ((uint) 0);
m_relocWriter.Write (relocSize);
m_relocWriter.Write ((ushort) 0);
m_relocWriter.Write ((ushort) 0);
m_textSect.VirtualSize = (uint) m_textWriter.BaseStream.Length;
m_relocSect.VirtualSize = (uint) m_relocWriter.BaseStream.Length;
if (m_rsrcSect != null)
m_rsrcSect.VirtualSize = (uint) m_rsrcWriter.BaseStream.Length;
// start counting before sections headers
// section start + section header sixe * number of sections
uint headersEnd = 0x178 + 0x28 * nbSects;
uint fileOffset = headersEnd;
uint sectOffset = sectAlign;
uint imageSize = 0;
foreach (Section sect in img.Sections) {
fileOffset = GetAligned (fileOffset, fileAlign);
sectOffset = GetAligned (sectOffset, sectAlign);
sect.PointerToRawData = new RVA (fileOffset);
sect.VirtualAddress = new RVA (sectOffset);
sect.SizeOfRawData = GetAligned (sect.VirtualSize, fileAlign);
fileOffset += sect.SizeOfRawData;
sectOffset += sect.SizeOfRawData;
imageSize += GetAligned (sect.SizeOfRawData, sectAlign);
}
if (m_textSect.VirtualAddress.Value != 0x2000)
throw new ImageFormatException ("Wrong RVA for .text section");
if (resWriter != null)
resWriter.Patch ();
img.PEOptionalHeader.StandardFields.CodeSize = GetAligned (
m_textSect.SizeOfRawData, fileAlign);
img.PEOptionalHeader.StandardFields.InitializedDataSize = m_textSect.SizeOfRawData;
if (m_rsrcSect != null)
img.PEOptionalHeader.StandardFields.InitializedDataSize += m_rsrcSect.SizeOfRawData;
img.PEOptionalHeader.StandardFields.BaseOfCode = m_textSect.VirtualAddress;
img.PEOptionalHeader.StandardFields.BaseOfData = m_relocSect.VirtualAddress;
imageSize += headersEnd;
img.PEOptionalHeader.NTSpecificFields.ImageSize = GetAligned (imageSize, sectAlign);
img.PEOptionalHeader.DataDirectories.BaseRelocationTable = new DataDirectory (
m_relocSect.VirtualAddress, m_relocSect.VirtualSize);
if (m_rsrcSect != null)
img.PEOptionalHeader.DataDirectories.ResourceTable = new DataDirectory (
m_rsrcSect.VirtualAddress, (uint) m_rsrcWriter.BaseStream.Length);
if (m_kind == AssemblyKind.Dll) {
img.PEFileHeader.Characteristics = ImageCharacteristics.CILOnlyDll;
img.HintNameTable.RuntimeMain = HintNameTable.RuntimeMainDll;
img.PEOptionalHeader.NTSpecificFields.DLLFlags = 0x400;
} else {
img.PEFileHeader.Characteristics = ImageCharacteristics.CILOnlyExe;
img.HintNameTable.RuntimeMain = HintNameTable.RuntimeMainExe;
}
switch (m_kind) {
case AssemblyKind.Dll :
case AssemblyKind.Console :
img.PEOptionalHeader.NTSpecificFields.SubSystem = SubSystem.WindowsCui;
break;
case AssemblyKind.Windows :
img.PEOptionalHeader.NTSpecificFields.SubSystem = SubSystem.WindowsGui;
break;
}
RVA importTable = new RVA (img.TextSection.VirtualAddress + m_mdWriter.ImportTablePosition);
img.PEOptionalHeader.DataDirectories.ImportTable = new DataDirectory (importTable, 0x57);
img.ImportTable.ImportLookupTable = new RVA ((uint) importTable + 0x28);
img.ImportLookupTable.HintNameRVA = img.ImportAddressTable.HintNameTableRVA =
new RVA ((uint) img.ImportTable.ImportLookupTable + 0x14);
img.ImportTable.Name = new RVA ((uint) img.ImportLookupTable.HintNameRVA + 0xe);
}
public override void VisitDOSHeader (DOSHeader header)
{
m_binaryWriter.Write (header.Start);
m_binaryWriter.Write (header.Lfanew);
m_binaryWriter.Write (header.End);
m_binaryWriter.Write ((ushort) 0x4550);
m_binaryWriter.Write ((ushort) 0);
}
public override void VisitPEFileHeader (PEFileHeader header)
{
m_binaryWriter.Write (header.Machine);
m_binaryWriter.Write (header.NumberOfSections);
m_binaryWriter.Write (header.TimeDateStamp);
m_binaryWriter.Write (header.PointerToSymbolTable);
m_binaryWriter.Write (header.NumberOfSymbols);
m_binaryWriter.Write (header.OptionalHeaderSize);
m_binaryWriter.Write ((ushort) header.Characteristics);
}
public override void VisitNTSpecificFieldsHeader (PEOptionalHeader.NTSpecificFieldsHeader header)
{
WriteIntOrLong (header.ImageBase);
m_binaryWriter.Write (header.SectionAlignment);
m_binaryWriter.Write (header.FileAlignment);
m_binaryWriter.Write (header.OSMajor);
m_binaryWriter.Write (header.OSMinor);
m_binaryWriter.Write (header.UserMajor);
m_binaryWriter.Write (header.UserMinor);
m_binaryWriter.Write (header.SubSysMajor);
m_binaryWriter.Write (header.SubSysMinor);
m_binaryWriter.Write (header.Reserved);
m_binaryWriter.Write (header.ImageSize);
m_binaryWriter.Write (header.HeaderSize);
m_binaryWriter.Write (header.FileChecksum);
m_binaryWriter.Write ((ushort) header.SubSystem);
m_binaryWriter.Write (header.DLLFlags);
WriteIntOrLong (header.StackReserveSize);
WriteIntOrLong (header.StackCommitSize);
WriteIntOrLong (header.HeapReserveSize);
WriteIntOrLong (header.HeapCommitSize);
m_binaryWriter.Write (header.LoaderFlags);
m_binaryWriter.Write (header.NumberOfDataDir);
}
public override void VisitStandardFieldsHeader (PEOptionalHeader.StandardFieldsHeader header)
{
m_binaryWriter.Write (header.Magic);
m_binaryWriter.Write (header.LMajor);
m_binaryWriter.Write (header.LMinor);
m_binaryWriter.Write (header.CodeSize);
m_binaryWriter.Write (header.InitializedDataSize);
m_binaryWriter.Write (header.UninitializedDataSize);
m_binaryWriter.Write (header.EntryPointRVA.Value);
m_binaryWriter.Write (header.BaseOfCode.Value);
if (!header.IsPE64)
m_binaryWriter.Write (header.BaseOfData.Value);
}
void WriteIntOrLong (ulong value)
{
if (m_img.PEOptionalHeader.StandardFields.IsPE64)
m_binaryWriter.Write (value);
else
m_binaryWriter.Write ((uint) value);
}
public override void VisitDataDirectoriesHeader (PEOptionalHeader.DataDirectoriesHeader header)
{
m_binaryWriter.Write (header.ExportTable.VirtualAddress);
m_binaryWriter.Write (header.ExportTable.Size);
m_binaryWriter.Write (header.ImportTable.VirtualAddress);
m_binaryWriter.Write (header.ImportTable.Size);
m_binaryWriter.Write (header.ResourceTable.VirtualAddress);
m_binaryWriter.Write (header.ResourceTable.Size);
m_binaryWriter.Write (header.ExceptionTable.VirtualAddress);
m_binaryWriter.Write (header.ExceptionTable.Size);
m_binaryWriter.Write (header.CertificateTable.VirtualAddress);
m_binaryWriter.Write (header.CertificateTable.Size);
m_binaryWriter.Write (header.BaseRelocationTable.VirtualAddress);
m_binaryWriter.Write (header.BaseRelocationTable.Size);
m_binaryWriter.Write (header.Debug.VirtualAddress);
m_binaryWriter.Write (header.Debug.Size);
m_binaryWriter.Write (header.Copyright.VirtualAddress);
m_binaryWriter.Write (header.Copyright.Size);
m_binaryWriter.Write (header.GlobalPtr.VirtualAddress);
m_binaryWriter.Write (header.GlobalPtr.Size);
m_binaryWriter.Write (header.TLSTable.VirtualAddress);
m_binaryWriter.Write (header.TLSTable.Size);
m_binaryWriter.Write (header.LoadConfigTable.VirtualAddress);
m_binaryWriter.Write (header.LoadConfigTable.Size);
m_binaryWriter.Write (header.BoundImport.VirtualAddress);
m_binaryWriter.Write (header.BoundImport.Size);
m_binaryWriter.Write (header.IAT.VirtualAddress);
m_binaryWriter.Write (header.IAT.Size);
m_binaryWriter.Write (header.DelayImportDescriptor.VirtualAddress);
m_binaryWriter.Write (header.DelayImportDescriptor.Size);
m_binaryWriter.Write (header.CLIHeader.VirtualAddress);
m_binaryWriter.Write (header.CLIHeader.Size);
m_binaryWriter.Write (header.Reserved.VirtualAddress);
m_binaryWriter.Write (header.Reserved.Size);
}
public override void VisitSection (Section sect)
{
m_binaryWriter.Write (Encoding.ASCII.GetBytes (sect.Name));
int more = 8 - sect.Name.Length;
for (int i = 0; i < more; i++)
m_binaryWriter.Write ((byte) 0);
m_binaryWriter.Write (sect.VirtualSize);
m_binaryWriter.Write (sect.VirtualAddress.Value);
m_binaryWriter.Write (sect.SizeOfRawData);
m_binaryWriter.Write (sect.PointerToRawData.Value);
m_binaryWriter.Write (sect.PointerToRelocations.Value);
m_binaryWriter.Write (sect.PointerToLineNumbers.Value);
m_binaryWriter.Write (sect.NumberOfRelocations);
m_binaryWriter.Write (sect.NumberOfLineNumbers);
m_binaryWriter.Write ((uint) sect.Characteristics);
}
public override void VisitImportAddressTable (ImportAddressTable iat)
{
m_textWriter.BaseStream.Position = 0;
m_textWriter.Write (iat.HintNameTableRVA.Value);
m_textWriter.Write (new byte [4]);
}
public override void VisitCLIHeader (CLIHeader header)
{
m_textWriter.Write (header.Cb);
m_textWriter.Write (header.MajorRuntimeVersion);
m_textWriter.Write (header.MinorRuntimeVersion);
m_textWriter.Write (header.Metadata.VirtualAddress);
m_textWriter.Write (header.Metadata.Size);
m_textWriter.Write ((uint) header.Flags);
m_textWriter.Write (header.EntryPointToken);
m_textWriter.Write (header.Resources.VirtualAddress);
m_textWriter.Write (header.Resources.Size);
m_textWriter.Write (header.StrongNameSignature.VirtualAddress);
m_textWriter.Write (header.StrongNameSignature.Size);
m_textWriter.Write (header.CodeManagerTable.VirtualAddress);
m_textWriter.Write (header.CodeManagerTable.Size);
m_textWriter.Write (header.VTableFixups.VirtualAddress);
m_textWriter.Write (header.VTableFixups.Size);
m_textWriter.Write (header.ExportAddressTableJumps.VirtualAddress);
m_textWriter.Write (header.ExportAddressTableJumps.Size);
m_textWriter.Write (header.ManagedNativeHeader.VirtualAddress);
m_textWriter.Write (header.ManagedNativeHeader.Size);
}
public override void VisitDebugHeader (DebugHeader header)
{
m_textWriter.BaseStream.Position = m_mdWriter.DebugHeaderPosition;
uint sizeUntilData = 0x1c;
header.AddressOfRawData = m_img.TextSection.VirtualAddress + m_mdWriter.DebugHeaderPosition + sizeUntilData;
header.PointerToRawData = 0x200 + m_mdWriter.DebugHeaderPosition + sizeUntilData;
header.SizeOfData = 0x18 + (uint) header.FileName.Length + 1;
m_textWriter.Write (header.Characteristics);
m_textWriter.Write (header.TimeDateStamp);
m_textWriter.Write (header.MajorVersion);
m_textWriter.Write (header.MinorVersion);
m_textWriter.Write ((uint) header.Type);
m_textWriter.Write (header.SizeOfData);
m_textWriter.Write (header.AddressOfRawData.Value);
m_textWriter.Write (header.PointerToRawData);
m_textWriter.Write (header.Magic);
m_textWriter.Write (header.Signature.ToByteArray ());
m_textWriter.Write (header.Age);
m_textWriter.Write (Encoding.ASCII.GetBytes (header.FileName));
m_textWriter.Write ((byte) 0);
}
public override void VisitImportTable (ImportTable it)
{
m_textWriter.BaseStream.Position = m_mdWriter.ImportTablePosition;
m_textWriter.Write (it.ImportLookupTable.Value);
m_textWriter.Write (it.DateTimeStamp);
m_textWriter.Write (it.ForwardChain);
m_textWriter.Write (it.Name.Value);
m_textWriter.Write (it.ImportAddressTable.Value);
m_textWriter.Write (new byte [20]);
}
public override void VisitImportLookupTable (ImportLookupTable ilt)
{
m_textWriter.Write (ilt.HintNameRVA.Value);
m_textWriter.Write (new byte [16]);
}
public override void VisitHintNameTable (HintNameTable hnt)
{
m_textWriter.Write (hnt.Hint);
m_textWriter.Write (Encoding.ASCII.GetBytes (hnt.RuntimeMain));
m_textWriter.Write ('\0');
m_textWriter.Write (Encoding.ASCII.GetBytes (hnt.RuntimeLibrary));
m_textWriter.Write ('\0');
m_textWriter.Write (new byte [4]);
// patch header with ep rva
RVA ep = m_img.TextSection.VirtualAddress +
(uint) m_textWriter.BaseStream.Position;
long pos = m_binaryWriter.BaseStream.Position;
m_binaryWriter.BaseStream.Position = 0xa8;
m_binaryWriter.Write (ep.Value);
m_binaryWriter.BaseStream.Position = pos;
// patch reloc Sect with ep
uint reloc = (ep.Value + 2) % 0x1000;
uint rva = (ep.Value + 2) - reloc;
m_relocWriter.BaseStream.Position = 0;
m_relocWriter.Write (rva);
m_relocWriter.BaseStream.Position = 8;
m_relocWriter.Write ((ushort) ((3 << 12) | reloc));
m_textWriter.Write (hnt.EntryPoint);
m_textWriter.Write (hnt.RVA);
}
public override void TerminateImage (Image img)
{
m_binaryWriter.BaseStream.Position = 0x200;
WriteSection (m_textSect, m_textWriter);
WriteSection (m_relocSect, m_relocWriter);
if (m_rsrcSect != null)
WriteSection (m_rsrcSect, m_rsrcWriter);
}
void WriteSection (Section sect, MemoryBinaryWriter sectWriter)
{
sectWriter.MemoryStream.WriteTo (m_binaryWriter.BaseStream);
m_binaryWriter.Write (new byte [
sect.SizeOfRawData - sectWriter.BaseStream.Length]);
}
}
}

98
src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Mono.Cecil/Mono.Cecil.Binary/Imports.cs

@ -1,98 +0,0 @@ @@ -1,98 +0,0 @@
//
// Imports.cs
//
// Author:
// Jb Evain (jbevain@gmail.com)
//
// (C) 2005 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.
//
namespace Mono.Cecil.Binary {
public sealed class ImportAddressTable : IBinaryVisitable {
public RVA HintNameTableRVA;
internal ImportAddressTable ()
{
}
public void Accept (IBinaryVisitor visitor)
{
visitor.VisitImportAddressTable (this);
}
}
public sealed class ImportTable : IBinaryVisitable {
public RVA ImportLookupTable;
public uint DateTimeStamp;
public uint ForwardChain;
public RVA Name;
public RVA ImportAddressTable;
internal ImportTable ()
{
}
public void Accept (IBinaryVisitor visitor)
{
visitor.VisitImportTable (this);
}
}
public sealed class ImportLookupTable : IBinaryVisitable {
public RVA HintNameRVA;
internal ImportLookupTable ()
{
}
public void Accept (IBinaryVisitor visitor)
{
visitor.VisitImportLookupTable (this);
}
}
public sealed class HintNameTable : IBinaryVisitable {
public const string RuntimeMainExe = "_CorExeMain";
public const string RuntimeMainDll = "_CorDllMain";
public const string RuntimeCorEE = "mscoree.dll";
public ushort Hint;
public string RuntimeMain;
public string RuntimeLibrary;
public ushort EntryPoint;
public RVA RVA;
internal HintNameTable ()
{
}
public void Accept (IBinaryVisitor visitor)
{
visitor.VisitHintNameTable (this);
}
}
}

70
src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Mono.Cecil/Mono.Cecil.Binary/MemoryBinaryWriter.cs

@ -1,70 +0,0 @@ @@ -1,70 +0,0 @@
//
// MemoryBinaryWriter.cs
//
// Author:
// Jb Evain (jbevain@gmail.com)
//
// (C) 2005 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.
//
namespace Mono.Cecil.Binary {
using System.IO;
using System.Text;
internal sealed class MemoryBinaryWriter : BinaryWriter {
public MemoryStream MemoryStream {
get { return (MemoryStream) this.BaseStream; }
}
public MemoryBinaryWriter () : base (new MemoryStream ())
{
}
public MemoryBinaryWriter (Encoding enc) : base (new MemoryStream (), enc)
{
}
public void Empty ()
{
this.BaseStream.Position = 0;
this.BaseStream.SetLength (0);
}
public void Write (MemoryBinaryWriter writer)
{
writer.MemoryStream.WriteTo (this.BaseStream);
}
public byte [] ToArray ()
{
return this.MemoryStream.ToArray ();
}
public void QuadAlign ()
{
this.BaseStream.Position += 3;
this.BaseStream.Position &= ~3;
}
}
}

58
src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Mono.Cecil/Mono.Cecil.Binary/PEFileHeader.cs

@ -1,58 +0,0 @@ @@ -1,58 +0,0 @@
//
// PEFileHeader.cs
//
// Author:
// Jb Evain (jbevain@gmail.com)
//
// (C) 2005 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.
//
namespace Mono.Cecil.Binary {
public sealed class PEFileHeader : IHeader, IBinaryVisitable {
public ushort Machine;
public ushort NumberOfSections;
public uint TimeDateStamp;
public uint PointerToSymbolTable;
public uint NumberOfSymbols;
public ushort OptionalHeaderSize;
public ImageCharacteristics Characteristics;
internal PEFileHeader ()
{
}
public void SetDefaultValues ()
{
Machine = 0x14c;
PointerToSymbolTable = 0;
NumberOfSymbols = 0;
OptionalHeaderSize = 0xe0;
}
public void Accept (IBinaryVisitor visitor)
{
visitor.VisitPEFileHeader (this);
}
}
}

200
src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Mono.Cecil/Mono.Cecil.Binary/PEOptionalHeader.cs

@ -1,200 +0,0 @@ @@ -1,200 +0,0 @@
//
// PEOptionalHeader.cs
//
// Author:
// Jb Evain (jbevain@gmail.com)
//
// (C) 2005 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.
//
namespace Mono.Cecil.Binary {
public sealed class PEOptionalHeader : IHeader, IBinaryVisitable {
public StandardFieldsHeader StandardFields;
public NTSpecificFieldsHeader NTSpecificFields;
public DataDirectoriesHeader DataDirectories;
internal PEOptionalHeader ()
{
StandardFields = new StandardFieldsHeader ();
NTSpecificFields = new NTSpecificFieldsHeader ();
DataDirectories = new DataDirectoriesHeader ();
}
public void SetDefaultValues ()
{
}
public void Accept (IBinaryVisitor visitor)
{
visitor.VisitPEOptionalHeader (this);
StandardFields.Accept (visitor);
NTSpecificFields.Accept (visitor);
DataDirectories.Accept (visitor);
}
public sealed class StandardFieldsHeader : IHeader, IBinaryVisitable {
public ushort Magic;
public byte LMajor;
public byte LMinor;
public uint CodeSize;
public uint InitializedDataSize;
public uint UninitializedDataSize;
public RVA EntryPointRVA;
public RVA BaseOfCode;
public RVA BaseOfData;
public bool IsPE64 {
get { return Magic == 0x20b; }
set {
if (value)
Magic = 0x20b;
else
Magic = 0x10b;
}
}
internal StandardFieldsHeader ()
{
}
public void SetDefaultValues ()
{
Magic = 0x10b;
LMajor = 6;
LMinor = 0;
}
public void Accept (IBinaryVisitor visitor)
{
visitor.VisitStandardFieldsHeader (this);
}
}
public sealed class NTSpecificFieldsHeader : IHeader, IBinaryVisitable {
public ulong ImageBase;
public uint SectionAlignment;
public uint FileAlignment;
public ushort OSMajor;
public ushort OSMinor;
public ushort UserMajor;
public ushort UserMinor;
public ushort SubSysMajor;
public ushort SubSysMinor;
public uint Reserved;
public uint ImageSize;
public uint HeaderSize;
public uint FileChecksum;
public SubSystem SubSystem;
public ushort DLLFlags;
public ulong StackReserveSize;
public ulong StackCommitSize;
public ulong HeapReserveSize;
public ulong HeapCommitSize;
public uint LoaderFlags;
public uint NumberOfDataDir;
internal NTSpecificFieldsHeader ()
{
}
public void SetDefaultValues ()
{
ImageBase = 0x400000;
SectionAlignment = 0x2000;
FileAlignment = 0x200;
OSMajor = 4;
OSMinor = 0;
UserMajor = 0;
UserMinor = 0;
SubSysMajor = 4;
SubSysMinor = 0;
Reserved = 0;
HeaderSize = 0x200;
FileChecksum = 0;
DLLFlags = 0;
StackReserveSize = 0x100000;
StackCommitSize = 0x1000;
HeapReserveSize = 0x100000;
HeapCommitSize = 0x1000;
LoaderFlags = 0;
NumberOfDataDir = 0x10;
}
public void Accept (IBinaryVisitor visitor)
{
visitor.VisitNTSpecificFieldsHeader (this);
}
}
public sealed class DataDirectoriesHeader : IHeader, IBinaryVisitable {
public DataDirectory ExportTable;
public DataDirectory ImportTable;
public DataDirectory ResourceTable;
public DataDirectory ExceptionTable;
public DataDirectory CertificateTable;
public DataDirectory BaseRelocationTable;
public DataDirectory Debug;
public DataDirectory Copyright;
public DataDirectory GlobalPtr;
public DataDirectory TLSTable;
public DataDirectory LoadConfigTable;
public DataDirectory BoundImport;
public DataDirectory IAT;
public DataDirectory DelayImportDescriptor;
public DataDirectory CLIHeader;
public DataDirectory Reserved;
internal DataDirectoriesHeader ()
{
}
public void SetDefaultValues ()
{
ExportTable = DataDirectory.Zero;
ResourceTable = DataDirectory.Zero;
ExceptionTable = DataDirectory.Zero;
CertificateTable = DataDirectory.Zero;
Debug = DataDirectory.Zero;
Copyright = DataDirectory.Zero;
GlobalPtr = DataDirectory.Zero;
TLSTable = DataDirectory.Zero;
LoadConfigTable = DataDirectory.Zero;
BoundImport = DataDirectory.Zero;
IAT = new DataDirectory (new RVA (0x2000), 8);
DelayImportDescriptor = DataDirectory.Zero;
CLIHeader = new DataDirectory (new RVA (0x2008), 0x48);
Reserved = DataDirectory.Zero;
}
public void Accept (IBinaryVisitor visitor)
{
visitor.VisitDataDirectoriesHeader (this);
}
}
}
}

115
src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Mono.Cecil/Mono.Cecil.Binary/RVA.cs

@ -1,115 +0,0 @@ @@ -1,115 +0,0 @@
//
// RVA.cs
//
// Author:
// Jb Evain (jbevain@gmail.com)
//
// (C) 2005 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.
//
namespace Mono.Cecil.Binary {
public struct RVA {
public static readonly RVA Zero = new RVA (0);
uint m_rva;
public uint Value {
get { return m_rva; }
set { m_rva = value; }
}
public RVA (uint rva)
{
m_rva = rva;
}
public override int GetHashCode ()
{
return (int) m_rva;
}
public override bool Equals (object other)
{
if (other is RVA)
return this.m_rva == ((RVA) other).m_rva;
return false;
}
public override string ToString ()
{
return string.Format ("0x{0}", m_rva.ToString ("X"));
}
public static bool operator == (RVA one, RVA other)
{
return one.Equals (other);
}
public static bool operator != (RVA one, RVA other)
{
return !one.Equals (other);
}
public static bool operator < (RVA one, RVA other)
{
return one.m_rva < other.m_rva;
}
public static bool operator > (RVA one, RVA other)
{
return one.m_rva > other.m_rva;
}
public static bool operator <= (RVA one, RVA other)
{
return one.m_rva <= other.m_rva;
}
public static bool operator >= (RVA one, RVA other)
{
return one.m_rva >= other.m_rva;
}
public static RVA operator + (RVA rva, uint x)
{
return new RVA (rva.m_rva + x);
}
public static RVA operator - (RVA rva, uint x)
{
return new RVA (rva.m_rva - x);
}
public static implicit operator RVA (uint val)
{
return val == 0 ? RVA.Zero : new RVA (val);
}
public static implicit operator uint (RVA rva)
{
return rva.m_rva;
}
}
}

48
src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Mono.Cecil/Mono.Cecil.Binary/ResourceDataEntry.cs

@ -1,48 +0,0 @@ @@ -1,48 +0,0 @@
//
// ResourceDataEntry.cs
//
// Author:
// Jb Evain (jbevain@gmail.com)
//
// (C) 2006 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.
//
namespace Mono.Cecil.Binary {
public class ResourceDataEntry : ResourceNode {
public RVA Data;
public uint Size;
public uint Codepage;
public uint Reserved = 0;
public byte [] ResourceData;
public ResourceDataEntry (int offset) : base (offset)
{
}
public ResourceDataEntry ()
{
}
}
}

66
src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Mono.Cecil/Mono.Cecil.Binary/ResourceDirectoryEntry.cs

@ -1,66 +0,0 @@ @@ -1,66 +0,0 @@
//
// ResourceDirectoryEntry.cs
//
// Author:
// Jb Evain (jbevain@gmail.com)
//
// (C) 2006 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.
//
namespace Mono.Cecil.Binary {
public class ResourceDirectoryEntry : ResourceNode {
private bool m_idByName;
public int ID;
public ResourceDirectoryString Name;
public bool IdentifiedByName {
get { return m_idByName; }
}
public ResourceNode Child;
public ResourceDirectoryEntry (ResourceDirectoryString name)
{
this.Name = name;
m_idByName = true;
}
public ResourceDirectoryEntry (ResourceDirectoryString name, int offset) : base (offset)
{
this.Name = name;
m_idByName = true;
}
public ResourceDirectoryEntry (int id)
{
this.ID = id;
}
public ResourceDirectoryEntry (int id, int offset) : base (offset)
{
this.ID = id;
}
}
}

45
src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Mono.Cecil/Mono.Cecil.Binary/ResourceDirectoryString.cs

@ -1,45 +0,0 @@ @@ -1,45 +0,0 @@
//
// ResourceDirectoryString.cs
//
// Author:
// Jb Evain (jbevain@gmail.com)
//
// (C) 2006 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.
//
namespace Mono.Cecil.Binary {
public class ResourceDirectoryString : ResourceNode {
public string String;
public ResourceDirectoryString (string str)
{
this.String = str;
}
public ResourceDirectoryString (string str, int offset) : base (offset)
{
this.String = str;
}
}
}

56
src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Mono.Cecil/Mono.Cecil.Binary/ResourceDirectoryTable.cs

@ -1,56 +0,0 @@ @@ -1,56 +0,0 @@
//
// ResourceDirectoryTable.cs
//
// Author:
// Jb Evain (jbevain@gmail.com)
//
// (C) 2006 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.
//
namespace Mono.Cecil.Binary {
using System.Collections;
public class ResourceDirectoryTable : ResourceNode {
private ArrayList m_entries;
public uint Characteristics;
public uint TimeDateStamp;
public ushort MajorVersion;
public ushort MinorVersion;
public IList Entries {
get { return m_entries; }
}
public ResourceDirectoryTable (int offset) : base (offset)
{
m_entries = new ArrayList ();
}
public ResourceDirectoryTable ()
{
m_entries = new ArrayList ();
}
}
}

44
src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Mono.Cecil/Mono.Cecil.Binary/ResourceNode.cs

@ -1,44 +0,0 @@ @@ -1,44 +0,0 @@
//
// ResourceNode.cs
//
// Author:
// Jb Evain (jbevain@gmail.com)
//
// (C) 2006 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.
//
namespace Mono.Cecil.Binary {
public abstract class ResourceNode {
public int Offset;
internal ResourceNode (int offset)
{
this.Offset = offset;
}
internal ResourceNode ()
{
}
}
}

143
src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Mono.Cecil/Mono.Cecil.Binary/ResourceReader.cs

@ -1,143 +0,0 @@ @@ -1,143 +0,0 @@
//
// ResourceReader.cs
//
// Author:
// Jb Evain (jbevain@gmail.com)
//
// (C) 2006 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.
//
namespace Mono.Cecil.Binary {
using System.IO;
using System.Text;
class ResourceReader {
Image m_img;
Section m_rsrc;
BinaryReader m_reader;
public ResourceReader (Image img)
{
m_img = img;
}
public ResourceDirectoryTable Read ()
{
m_rsrc = GetResourceSection ();
if (m_rsrc == null)
return null;
m_reader = new BinaryReader (new MemoryStream (m_rsrc.Data));
return ReadDirectoryTable ();
}
Section GetResourceSection ()
{
foreach (Section s in m_img.Sections)
if (s.Name == Section.Resources)
return s;
return null;
}
int GetOffset ()
{
return (int) m_reader.BaseStream.Position;
}
ResourceDirectoryTable ReadDirectoryTable ()
{
ResourceDirectoryTable rdt = new ResourceDirectoryTable (GetOffset ());
rdt.Characteristics = m_reader.ReadUInt32 ();
rdt.TimeDateStamp = m_reader.ReadUInt32 ();
rdt.MajorVersion = m_reader.ReadUInt16 ();
rdt.MinorVersion = m_reader.ReadUInt16 ();
ushort nameEntries = m_reader.ReadUInt16 ();
ushort idEntries = m_reader.ReadUInt16 ();
for (int i = 0; i < nameEntries; i++)
rdt.Entries.Add (ReadDirectoryEntry ());
for (int i = 0; i < idEntries; i++)
rdt.Entries.Add (ReadDirectoryEntry ());
return rdt;
}
ResourceDirectoryEntry ReadDirectoryEntry ()
{
uint name = m_reader.ReadUInt32 ();
uint child = m_reader.ReadUInt32 ();
ResourceDirectoryEntry rde;
if ((name & 0x80000000) != 0)
rde = new ResourceDirectoryEntry (ReadDirectoryString ((int) name & 0x7fffffff), GetOffset ());
else
rde = new ResourceDirectoryEntry ((int) name & 0x7fffffff, GetOffset ());
long pos = m_reader.BaseStream.Position;
m_reader.BaseStream.Position = child & 0x7fffffff;
if ((child & 0x80000000) != 0)
rde.Child = ReadDirectoryTable ();
else
rde.Child = ReadDataEntry ();
m_reader.BaseStream.Position = pos;
return rde;
}
ResourceDirectoryString ReadDirectoryString (int offset)
{
long pos = m_reader.BaseStream.Position;
m_reader.BaseStream.Position = offset;
byte [] str = m_reader.ReadBytes (m_reader.ReadUInt16 ());
ResourceDirectoryString rds = new ResourceDirectoryString (
Encoding.Unicode.GetString (str, 0, str.Length),
GetOffset ());
m_reader.BaseStream.Position = pos;
return rds;
}
ResourceNode ReadDataEntry ()
{
ResourceDataEntry rde = new ResourceDataEntry (GetOffset ());
rde.Data = m_reader.ReadUInt32 ();
rde.Size = m_reader.ReadUInt32 ();
rde.Codepage = m_reader.ReadUInt32 ();
rde.Reserved = m_reader.ReadUInt32 ();
BinaryReader dataReader = m_img.GetReaderAtVirtualAddress (rde.Data);
rde.ResourceData = dataReader.ReadBytes ((int) rde.Size);
dataReader.Close ();
return rde;
}
}
}

216
src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Mono.Cecil/Mono.Cecil.Binary/ResourceWriter.cs

@ -1,216 +0,0 @@ @@ -1,216 +0,0 @@
//
// ResourceWriter.cs
//
// Author:
// Jb Evain (jbevain@gmail.com)
//
// (C) 2006 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.Text;
namespace Mono.Cecil.Binary {
using System.Collections;
class ResourceWriter {
Image m_img;
Section m_rsrc;
MemoryBinaryWriter m_writer;
ArrayList m_dataEntries;
ArrayList m_stringEntries;
long m_pos;
public ResourceWriter (Image img, Section rsrc, MemoryBinaryWriter writer)
{
m_img = img;
m_rsrc = rsrc;
m_writer = writer;
m_dataEntries = new ArrayList ();
m_stringEntries = new ArrayList ();
}
public void Write ()
{
if (m_img.ResourceDirectoryRoot == null)
return;
ComputeOffset (m_img.ResourceDirectoryRoot);
WriteResourceDirectoryTable (m_img.ResourceDirectoryRoot);
}
public void Patch ()
{
foreach (ResourceDataEntry rde in m_dataEntries) {
GotoOffset (rde.Offset);
m_writer.Write ((uint) rde.Data + m_rsrc.VirtualAddress);
RestoreOffset ();
}
}
void ComputeOffset (ResourceDirectoryTable root)
{
int offset = 0;
Queue directoryTables = new Queue ();
directoryTables.Enqueue (root);
while (directoryTables.Count > 0) {
ResourceDirectoryTable rdt = directoryTables.Dequeue () as ResourceDirectoryTable;
rdt.Offset = offset;
offset += 16;
foreach (ResourceDirectoryEntry rde in rdt.Entries) {
rde.Offset = offset;
offset += 8;
if (rde.IdentifiedByName)
m_stringEntries.Add (rde.Name);
if (rde.Child is ResourceDirectoryTable)
directoryTables.Enqueue (rde.Child);
else
m_dataEntries.Add (rde.Child);
}
}
foreach (ResourceDataEntry rde in m_dataEntries) {
rde.Offset = offset;
offset += 16;
}
foreach (ResourceDirectoryString rds in m_stringEntries) {
rds.Offset = offset;
byte [] str = Encoding.Unicode.GetBytes (rds.String);
offset += 2 + str.Length;
offset += 3;
offset &= ~3;
}
foreach (ResourceDataEntry rde in m_dataEntries) {
rde.Data = (uint) offset;
offset += rde.ResourceData.Length;
offset += 3;
offset &= ~3;
}
m_writer.Write (new byte [offset]);
}
void WriteResourceDirectoryTable (ResourceDirectoryTable rdt)
{
GotoOffset (rdt.Offset);
m_writer.Write (rdt.Characteristics);
m_writer.Write (rdt.TimeDateStamp);
m_writer.Write (rdt.MajorVersion);
m_writer.Write (rdt.MinorVersion);
ResourceDirectoryEntry [] namedEntries = GetEntries (rdt, true);
ResourceDirectoryEntry [] idEntries = GetEntries (rdt, false);
m_writer.Write ((ushort) namedEntries.Length);
m_writer.Write ((ushort) idEntries.Length);
foreach (ResourceDirectoryEntry rde in namedEntries)
WriteResourceDirectoryEntry (rde);
foreach (ResourceDirectoryEntry rde in idEntries)
WriteResourceDirectoryEntry (rde);
RestoreOffset ();
}
ResourceDirectoryEntry [] GetEntries (ResourceDirectoryTable rdt, bool identifiedByName)
{
ArrayList entries = new ArrayList ();
foreach (ResourceDirectoryEntry rde in rdt.Entries)
if (rde.IdentifiedByName == identifiedByName)
entries.Add (rde);
return entries.ToArray (typeof (ResourceDirectoryEntry)) as ResourceDirectoryEntry [];
}
void WriteResourceDirectoryEntry (ResourceDirectoryEntry rde)
{
GotoOffset (rde.Offset);
if (rde.IdentifiedByName) {
m_writer.Write ((uint) rde.Name.Offset | 0x80000000);
WriteResourceDirectoryString (rde.Name);
} else
m_writer.Write ((uint) rde.ID);
if (rde.Child is ResourceDirectoryTable) {
m_writer.Write((uint) rde.Child.Offset | 0x80000000);
WriteResourceDirectoryTable (rde.Child as ResourceDirectoryTable);
} else {
m_writer.Write (rde.Child.Offset);
WriteResourceDataEntry (rde.Child as ResourceDataEntry);
}
RestoreOffset ();
}
void WriteResourceDataEntry (ResourceDataEntry rde)
{
GotoOffset (rde.Offset);
m_writer.Write (0);
m_writer.Write ((uint) rde.ResourceData.Length);
m_writer.Write (rde.Codepage);
m_writer.Write (rde.Reserved);
m_writer.BaseStream.Position = rde.Data;
m_writer.Write (rde.ResourceData);
RestoreOffset ();
}
void WriteResourceDirectoryString (ResourceDirectoryString name)
{
GotoOffset (name.Offset);
byte [] str = Encoding.Unicode.GetBytes (name.String);
m_writer.Write ((ushort) str.Length);
m_writer.Write (str);
RestoreOffset ();
}
void GotoOffset (int offset)
{
m_pos = m_writer.BaseStream.Position;
m_writer.BaseStream.Position = offset;
}
void RestoreOffset ()
{
m_writer.BaseStream.Position = m_pos;
}
}
}

37
src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Mono.Cecil/Mono.Cecil.Binary/RuntimeImage.cs

@ -1,37 +0,0 @@ @@ -1,37 +0,0 @@
//
// RuntimeImage.cs
//
// Author:
// Jb Evain (jbevain@gmail.com)
//
// (C) 2005 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.
//
namespace Mono.Cecil.Binary {
public enum RuntimeImage : uint {
ILOnly = 0x0000001,
F32BitsRequired = 0x0000002,
StrongNameSigned = 0x0000008,
TrackDebugData = 0x00010000
}
}

66
src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Mono.Cecil/Mono.Cecil.Binary/Section.cs

@ -1,66 +0,0 @@ @@ -1,66 +0,0 @@
//
// Section.cs
//
// Author:
// Jb Evain (jbevain@gmail.com)
//
// (C) 2005 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.
//
namespace Mono.Cecil.Binary {
public sealed class Section : IHeader, IBinaryVisitable {
public const string Text = ".text";
public const string Resources = ".rsrc";
public const string Relocs = ".reloc";
public const string SData = ".sdata";
public uint VirtualSize;
public RVA VirtualAddress;
public uint SizeOfRawData;
public RVA PointerToRawData;
public RVA PointerToRelocations;
public RVA PointerToLineNumbers;
public ushort NumberOfRelocations;
public ushort NumberOfLineNumbers;
public SectionCharacteristics Characteristics;
public string Name;
public byte [] Data;
internal Section ()
{
}
public void SetDefaultValues ()
{
PointerToLineNumbers = RVA.Zero;
NumberOfLineNumbers = 0;
}
public void Accept (IBinaryVisitor visitor)
{
visitor.VisitSection (this);
}
}
}

70
src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Mono.Cecil/Mono.Cecil.Binary/SectionCharacteristics.cs

@ -1,70 +0,0 @@ @@ -1,70 +0,0 @@
//
// SectionCharacteristics.cs
//
// Author:
// Jb Evain (jbevain@gmail.com)
//
// (C) 2005 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.
//
namespace Mono.Cecil.Binary {
using System;
[Flags]
public enum SectionCharacteristics : uint {
TypeNoPad = 0x0000008,
ContainsCode = 0x00000020,
ContainsInitializedData = 0x00000040,
ContainsUninitializedData = 0x00000080,
LnkOther = 0x0000100,
LnkInfo = 0x000200,
LnkRemove = 0x0000800,
LnkCOMDAT = 0x00001000,
GPRel = 0x00008000,
MemPurgeable = 0x00020000,
MemLocked = 0x00040000,
MemPreload = 0x00080000,
Align1Bytes = 0x00100000,
Align2Bytes = 0x00200000,
Align4Bytes = 0x00300000,
Align8Bytes = 0x00400000,
Align16Bytes = 0x00500000,
Align32Bytes = 0x00600000,
Align64Bytes = 0x00700000,
Align128Bytes = 0x00800000,
Align256Bytes = 0x00900000,
Align512Bytes = 0x00a00000,
Align1024Bytes = 0x00b00000,
Align2048Bytes = 0x00c00000,
Align4096Bytes = 0x00d00000,
Align8192Bytes = 0x00e00000,
LnkNRelocOvfl = 0x01000000,
MemDiscardable = 0x02000000,
MemNotCached = 0x04000000,
MemNotPaged = 0x08000000,
MemShared = 0x10000000,
MemExecute = 0x20000000,
MemoryRead = 0x40000000,
MemoryWrite = 0x80000000
}
}

114
src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Mono.Cecil/Mono.Cecil.Binary/SectionCollection.cs

@ -1,114 +0,0 @@ @@ -1,114 +0,0 @@
//
// SectionCollection.cs
//
// Author:
// Jb Evain (jbevain@gmail.com)
//
// (C) 2005 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.
//
namespace Mono.Cecil.Binary {
using System;
using System.Collections;
public sealed class SectionCollection : ICollection, IBinaryVisitable {
IList m_items;
public Section this [int index]
{
get { return m_items [index] as Section; }
set { m_items [index] = value; }
}
public int Count {
get { return m_items.Count; }
}
public bool IsSynchronized {
get { return false; }
}
public object SyncRoot {
get { return this; }
}
internal SectionCollection ()
{
m_items = new ArrayList (4);
}
internal void Add (Section value)
{
m_items.Add (value);
}
internal void Clear ()
{
m_items.Clear ();
}
public bool Contains (Section value)
{
return m_items.Contains (value);
}
public int IndexOf (Section value)
{
return m_items.IndexOf (value);
}
internal void Insert (int index, Section value)
{
m_items.Insert (index, value);
}
internal void Remove (Section value)
{
m_items.Remove (value);
}
internal void RemoveAt (int index)
{
m_items.Remove (index);
}
public void CopyTo (Array ary, int index)
{
m_items.CopyTo (ary, index);
}
public IEnumerator GetEnumerator ()
{
return m_items.GetEnumerator ();
}
public void Accept (IBinaryVisitor visitor)
{
visitor.VisitSectionCollection (this);
for (int i = 0; i < m_items.Count; i++)
this [i].Accept (visitor);
}
}
}

45
src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Mono.Cecil/Mono.Cecil.Binary/SubSystem.cs

@ -1,45 +0,0 @@ @@ -1,45 +0,0 @@
//
// SubSystem.cs
//
// Author:
// Jb Evain (jbevain@gmail.com)
//
// (C) 2005 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.
//
namespace Mono.Cecil.Binary {
public enum SubSystem : ushort {
Unknown = 0x0,
Native = 0x1,
WindowsGui = 0x2,
WindowsCui = 0x3,
PosixCui = 0x7,
WindowsCeGui = 0x9,
EfiApplication = 0x10,
EfiBootServiceDriver = 0x11,
EfiRuntimeDriver = 0x12,
EfiRom = 0x13,
Xbox = 0x14,
NexusAgent = 0x15
}
}

73
src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Mono.Cecil/Mono.Cecil.Cil/BaseCodeVisitor.cs

@ -1,73 +0,0 @@ @@ -1,73 +0,0 @@
//
// BaseCodeVisitor.cs
//
// Author:
// Jb Evain (jbevain@gmail.com)
//
// (C) 2005 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.
//
namespace Mono.Cecil.Cil {
public abstract class BaseCodeVisitor : ICodeVisitor {
public virtual void VisitMethodBody (MethodBody body)
{
}
public virtual void VisitInstructionCollection (InstructionCollection instructions)
{
}
public virtual void VisitInstruction (Instruction instr)
{
}
public virtual void VisitExceptionHandlerCollection (ExceptionHandlerCollection seh)
{
}
public virtual void VisitExceptionHandler (ExceptionHandler eh)
{
}
public virtual void VisitVariableDefinitionCollection (VariableDefinitionCollection variables)
{
}
public virtual void VisitVariableDefinition (VariableDefinition var)
{
}
public virtual void VisitScopeCollection (ScopeCollection scopes)
{
}
public virtual void VisitScope (Scope s)
{
}
public virtual void TerminateMethodBody (MethodBody body)
{
}
}
}

357
src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Mono.Cecil/Mono.Cecil.Cil/CilWorker.cs

@ -1,357 +0,0 @@ @@ -1,357 +0,0 @@
//
// CilWorker.cs
//
// Author:
// Jb Evain (jbevain@gmail.com)
//
// (C) 2005 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.
//
namespace Mono.Cecil.Cil {
using System;
using SR = System.Reflection;
public sealed class CilWorker {
MethodBody m_mbody;
InstructionCollection m_instrs;
internal CilWorker (MethodBody body)
{
m_mbody = body;
m_instrs = m_mbody.Instructions;
}
public MethodBody GetBody ()
{
return m_mbody;
}
public Instruction Create (OpCode opcode)
{
if (opcode.OperandType != OperandType.InlineNone)
throw new ArgumentException ("opcode");
return FinalCreate (opcode);
}
public Instruction Create (OpCode opcode, TypeReference type)
{
if (opcode.OperandType != OperandType.InlineType &&
opcode.OperandType != OperandType.InlineTok)
throw new ArgumentException ("opcode");
return FinalCreate (opcode, type);
}
public Instruction Create (OpCode opcode, MethodReference meth)
{
if (opcode.OperandType != OperandType.InlineMethod &&
opcode.OperandType != OperandType.InlineTok)
throw new ArgumentException ("opcode");
return FinalCreate (opcode, meth);
}
public Instruction Create (OpCode opcode, FieldReference field)
{
if (opcode.OperandType != OperandType.InlineField &&
opcode.OperandType != OperandType.InlineTok)
throw new ArgumentException ("opcode");
return FinalCreate (opcode, field);
}
public Instruction Create (OpCode opcode, string str)
{
if (opcode.OperandType != OperandType.InlineString)
throw new ArgumentException ("opcode");
return FinalCreate (opcode, str);
}
public Instruction Create (OpCode opcode, sbyte b)
{
if (opcode.OperandType != OperandType.ShortInlineI &&
opcode != OpCodes.Ldc_I4_S)
throw new ArgumentException ("opcode");
return FinalCreate (opcode, b);
}
public Instruction Create (OpCode opcode, byte b)
{
if (opcode.OperandType != OperandType.ShortInlineI ||
opcode == OpCodes.Ldc_I4_S)
throw new ArgumentException ("opcode");
return FinalCreate (opcode, b);
}
public Instruction Create (OpCode opcode, int i)
{
if (opcode.OperandType != OperandType.InlineI)
throw new ArgumentException ("opcode");
return FinalCreate (opcode, i);
}
public Instruction Create (OpCode opcode, long l)
{
if (opcode.OperandType != OperandType.InlineI8)
throw new ArgumentException ("opcode");
return FinalCreate (opcode, l);
}
public Instruction Create (OpCode opcode, float f)
{
if (opcode.OperandType != OperandType.ShortInlineR)
throw new ArgumentException ("opcode");
return FinalCreate (opcode, f);
}
public Instruction Create (OpCode opcode, double d)
{
if (opcode.OperandType != OperandType.InlineR)
throw new ArgumentException ("opcode");
return FinalCreate (opcode, d);
}
public Instruction Create (OpCode opcode, Instruction label)
{
if (opcode.OperandType != OperandType.InlineBrTarget &&
opcode.OperandType != OperandType.ShortInlineBrTarget)
throw new ArgumentException ("opcode");
return FinalCreate (opcode, label);
}
public Instruction Create (OpCode opcode, Instruction [] labels)
{
if (opcode.OperandType != OperandType.InlineSwitch)
throw new ArgumentException ("opcode");
return FinalCreate (opcode, labels);
}
public Instruction Create (OpCode opcode, VariableDefinition var)
{
if (opcode.OperandType != OperandType.ShortInlineVar &&
opcode.OperandType != OperandType.InlineVar)
throw new ArgumentException ("opcode");
return FinalCreate (opcode, var);
}
public Instruction Create (OpCode opcode, ParameterDefinition param)
{
if (opcode.OperandType != OperandType.ShortInlineParam &&
opcode.OperandType != OperandType.InlineParam)
throw new ArgumentException ("opcode");
return FinalCreate (opcode, param);
}
Instruction FinalCreate (OpCode opcode)
{
return FinalCreate (opcode, null);
}
Instruction FinalCreate (OpCode opcode, object operand)
{
return new Instruction (opcode, operand);
}
public Instruction Emit (OpCode opcode)
{
Instruction instr = Create (opcode);
Append (instr);
return instr;
}
public Instruction Emit (OpCode opcode, TypeReference type)
{
Instruction instr = Create (opcode, type);
Append (instr);
return instr;
}
public Instruction Emit (OpCode opcode, MethodReference meth)
{
Instruction instr = Create (opcode, meth);
Append (instr);
return instr;
}
public Instruction Emit (OpCode opcode, FieldReference field)
{
Instruction instr = Create (opcode, field);
Append (instr);
return instr;
}
public Instruction Emit (OpCode opcode, string str)
{
Instruction instr = Create (opcode, str);
Append (instr);
return instr;
}
public Instruction Emit (OpCode opcode, byte b)
{
Instruction instr = Create (opcode, b);
Append (instr);
return instr;
}
public Instruction Emit (OpCode opcode, sbyte b)
{
Instruction instr = Create (opcode, b);
Append (instr);
return instr;
}
public Instruction Emit (OpCode opcode, int i)
{
Instruction instr = Create (opcode, i);
Append (instr);
return instr;
}
public Instruction Emit (OpCode opcode, long l)
{
Instruction instr = Create (opcode, l);
Append (instr);
return instr;
}
public Instruction Emit (OpCode opcode, float f)
{
Instruction instr = Create (opcode, f);
Append (instr);
return instr;
}
public Instruction Emit (OpCode opcode, double d)
{
Instruction instr = Create (opcode, d);
Append (instr);
return instr;
}
public Instruction Emit (OpCode opcode, Instruction target)
{
Instruction instr = Create (opcode, target);
Append (instr);
return instr;
}
public Instruction Emit (OpCode opcode, Instruction [] targets)
{
Instruction instr = Create (opcode, targets);
Append (instr);
return instr;
}
public Instruction Emit (OpCode opcode, VariableDefinition var)
{
Instruction instr = Create (opcode, var);
Append (instr);
return instr;
}
public Instruction Emit (OpCode opcode, ParameterDefinition param)
{
Instruction instr = Create (opcode, param);
Append (instr);
return instr;
}
public void InsertBefore (Instruction target, Instruction instr)
{
int index = m_instrs.IndexOf (target);
if (index == -1)
throw new ArgumentOutOfRangeException ("Target instruction not in method body");
m_instrs.Insert (index, instr);
instr.Previous = target.Previous;
if (target.Previous != null)
target.Previous.Next = instr;
target.Previous = instr;
instr.Next = target;
}
public void InsertAfter (Instruction target, Instruction instr)
{
int index = m_instrs.IndexOf (target);
if (index == -1)
throw new ArgumentOutOfRangeException ("Target instruction not in method body");
m_instrs.Insert (index + 1, instr);
instr.Next = target.Next;
if (target.Next != null)
target.Next.Previous = instr;
target.Next = instr;
instr.Previous = target;
}
public void Append (Instruction instr)
{
Instruction last = null, current = instr;
if (m_instrs.Count > 0)
last = m_instrs [m_instrs.Count - 1];
if (last != null) {
last.Next = instr;
current.Previous = last;
}
m_instrs.Add (current);
}
public void Replace (Instruction old, Instruction instr)
{
int index = m_instrs.IndexOf (old);
if (index == -1)
throw new ArgumentOutOfRangeException ("Target instruction not in method body");
InsertAfter (old, instr);
Remove (old);
}
public void Remove (Instruction instr)
{
if (!m_instrs.Contains (instr))
throw new ArgumentException ("Instruction not in method body");
if (instr.Previous != null)
instr.Previous.Next = instr.Next;
if (instr.Next != null)
instr.Next.Previous = instr.Previous;
m_instrs.Remove (instr);
}
}
}

255
src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Mono.Cecil/Mono.Cecil.Cil/Code.cs

@ -1,255 +0,0 @@ @@ -1,255 +0,0 @@
//
// Code.cs
//
// Author:
// Jb Evain (jbevain@gmail.com)
//
// Generated by /CodeGen/cecil-gen.rb do not edit
// Fri Mar 16 15:37:23 +0100 2007
//
// (C) 2007 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.
//
namespace Mono.Cecil.Cil {
public enum Code {
Nop,
Break,
Ldarg_0,
Ldarg_1,
Ldarg_2,
Ldarg_3,
Ldloc_0,
Ldloc_1,
Ldloc_2,
Ldloc_3,
Stloc_0,
Stloc_1,
Stloc_2,
Stloc_3,
Ldarg_S,
Ldarga_S,
Starg_S,
Ldloc_S,
Ldloca_S,
Stloc_S,
Ldnull,
Ldc_I4_M1,
Ldc_I4_0,
Ldc_I4_1,
Ldc_I4_2,
Ldc_I4_3,
Ldc_I4_4,
Ldc_I4_5,
Ldc_I4_6,
Ldc_I4_7,
Ldc_I4_8,
Ldc_I4_S,
Ldc_I4,
Ldc_I8,
Ldc_R4,
Ldc_R8,
Dup,
Pop,
Jmp,
Call,
Calli,
Ret,
Br_S,
Brfalse_S,
Brtrue_S,
Beq_S,
Bge_S,
Bgt_S,
Ble_S,
Blt_S,
Bne_Un_S,
Bge_Un_S,
Bgt_Un_S,
Ble_Un_S,
Blt_Un_S,
Br,
Brfalse,
Brtrue,
Beq,
Bge,
Bgt,
Ble,
Blt,
Bne_Un,
Bge_Un,
Bgt_Un,
Ble_Un,
Blt_Un,
Switch,
Ldind_I1,
Ldind_U1,
Ldind_I2,
Ldind_U2,
Ldind_I4,
Ldind_U4,
Ldind_I8,
Ldind_I,
Ldind_R4,
Ldind_R8,
Ldind_Ref,
Stind_Ref,
Stind_I1,
Stind_I2,
Stind_I4,
Stind_I8,
Stind_R4,
Stind_R8,
Add,
Sub,
Mul,
Div,
Div_Un,
Rem,
Rem_Un,
And,
Or,
Xor,
Shl,
Shr,
Shr_Un,
Neg,
Not,
Conv_I1,
Conv_I2,
Conv_I4,
Conv_I8,
Conv_R4,
Conv_R8,
Conv_U4,
Conv_U8,
Callvirt,
Cpobj,
Ldobj,
Ldstr,
Newobj,
Castclass,
Isinst,
Conv_R_Un,
Unbox,
Throw,
Ldfld,
Ldflda,
Stfld,
Ldsfld,
Ldsflda,
Stsfld,
Stobj,
Conv_Ovf_I1_Un,
Conv_Ovf_I2_Un,
Conv_Ovf_I4_Un,
Conv_Ovf_I8_Un,
Conv_Ovf_U1_Un,
Conv_Ovf_U2_Un,
Conv_Ovf_U4_Un,
Conv_Ovf_U8_Un,
Conv_Ovf_I_Un,
Conv_Ovf_U_Un,
Box,
Newarr,
Ldlen,
Ldelema,
Ldelem_I1,
Ldelem_U1,
Ldelem_I2,
Ldelem_U2,
Ldelem_I4,
Ldelem_U4,
Ldelem_I8,
Ldelem_I,
Ldelem_R4,
Ldelem_R8,
Ldelem_Ref,
Stelem_I,
Stelem_I1,
Stelem_I2,
Stelem_I4,
Stelem_I8,
Stelem_R4,
Stelem_R8,
Stelem_Ref,
Ldelem_Any,
Stelem_Any,
Unbox_Any,
Conv_Ovf_I1,
Conv_Ovf_U1,
Conv_Ovf_I2,
Conv_Ovf_U2,
Conv_Ovf_I4,
Conv_Ovf_U4,
Conv_Ovf_I8,
Conv_Ovf_U8,
Refanyval,
Ckfinite,
Mkrefany,
Ldtoken,
Conv_U2,
Conv_U1,
Conv_I,
Conv_Ovf_I,
Conv_Ovf_U,
Add_Ovf,
Add_Ovf_Un,
Mul_Ovf,
Mul_Ovf_Un,
Sub_Ovf,
Sub_Ovf_Un,
Endfinally,
Leave,
Leave_S,
Stind_I,
Conv_U,
Arglist,
Ceq,
Cgt,
Cgt_Un,
Clt,
Clt_Un,
Ldftn,
Ldvirtftn,
Ldarg,
Ldarga,
Starg,
Ldloc,
Ldloca,
Stloc,
Localloc,
Endfilter,
Unaligned,
Volatile,
Tail,
Initobj,
Constrained,
Cpblk,
Initblk,
No,
Rethrow,
Sizeof,
Refanytype,
Readonly,
}
}

355
src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Mono.Cecil/Mono.Cecil.Cil/CodeReader.cs

@ -1,355 +0,0 @@ @@ -1,355 +0,0 @@
//
// CodeReader.cs
//
// Author:
// Jb Evain (jbevain@gmail.com)
//
// (C) 2005 - 2007 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.
//
namespace Mono.Cecil.Cil {
using System;
using System.Collections;
using System.IO;
using Mono.Cecil;
using Mono.Cecil.Metadata;
using Mono.Cecil.Signatures;
class CodeReader : BaseCodeVisitor {
ReflectionReader m_reflectReader;
MetadataRoot m_root;
public CodeReader (ReflectionReader reflectReader)
{
m_reflectReader = reflectReader;
m_root = m_reflectReader.MetadataRoot;
}
public override void VisitMethodBody (MethodBody body)
{
MethodDefinition meth = body.Method;
MethodBody methBody = body;
BinaryReader br = m_reflectReader.Module.ImageReader.MetadataReader.GetDataReader (meth.RVA);
// lets read the method
IDictionary instrs;
int flags = br.ReadByte ();
switch (flags & 0x3) {
case (int) MethodHeader.TinyFormat :
methBody.CodeSize = flags >> 2;
methBody.MaxStack = 8;
ReadCilBody (methBody, br, out instrs);
break;
case (int) MethodHeader.FatFormat :
br.BaseStream.Position--;
int fatflags = br.ReadUInt16 ();
//int headersize = (fatflags >> 12) & 0xf;
methBody.MaxStack = br.ReadUInt16 ();
methBody.CodeSize = br.ReadInt32 ();
methBody.LocalVarToken = br.ReadInt32 ();
body.InitLocals = (fatflags & (int) MethodHeader.InitLocals) != 0;
VisitVariableDefinitionCollection (methBody.Variables);
ReadCilBody (methBody, br, out instrs);
if ((fatflags & (int) MethodHeader.MoreSects) != 0)
ReadSection (methBody, br, instrs);
break;
}
if (m_reflectReader.SymbolReader != null)
m_reflectReader.SymbolReader.Read (methBody);
}
public static uint GetRid (int token)
{
return (uint) token & 0x00ffffff;
}
public static ParameterDefinition GetParameter (MethodBody body, int index)
{
if (body.Method.HasThis) {
if (index == 0)
return body.Method.This;
index--;
}
return body.Method.Parameters [index];
}
public static VariableDefinition GetVariable (MethodBody body, int index)
{
return body.Variables [index];
}
void ReadCilBody (MethodBody body, BinaryReader br, out IDictionary instructions)
{
long start = br.BaseStream.Position;
Instruction last = null;
InstructionCollection code = body.Instructions;
instructions = new Hashtable ();
GenericContext context = new GenericContext (body.Method);
while (br.BaseStream.Position < start + body.CodeSize) {
OpCode op;
long offset = br.BaseStream.Position - start;
int cursor = br.ReadByte ();
if (cursor == 0xfe)
op = OpCodes.TwoBytesOpCode [br.ReadByte ()];
else
op = OpCodes.OneByteOpCode [cursor];
Instruction instr = new Instruction ((int) offset, op);
switch (op.OperandType) {
case OperandType.InlineNone :
break;
case OperandType.InlineSwitch :
uint length = br.ReadUInt32 ();
int [] branches = new int [length];
int [] buf = new int [length];
for (int i = 0; i < length; i++)
buf [i] = br.ReadInt32 ();
for (int i = 0; i < length; i++)
branches [i] = Convert.ToInt32 (br.BaseStream.Position - start + buf [i]);
instr.Operand = branches;
break;
case OperandType.ShortInlineBrTarget :
sbyte sbrtgt = br.ReadSByte ();
instr.Operand = Convert.ToInt32 (br.BaseStream.Position - start + sbrtgt);
break;
case OperandType.InlineBrTarget :
int brtgt = br.ReadInt32 ();
instr.Operand = Convert.ToInt32 (br.BaseStream.Position - start + brtgt);
break;
case OperandType.ShortInlineI :
if (op == OpCodes.Ldc_I4_S)
instr.Operand = br.ReadSByte ();
else
instr.Operand = br.ReadByte ();
break;
case OperandType.ShortInlineVar :
instr.Operand = GetVariable (body, br.ReadByte ());
break;
case OperandType.ShortInlineParam :
instr.Operand = GetParameter (body, br.ReadByte ());
break;
case OperandType.InlineSig :
instr.Operand = GetCallSiteAt (br.ReadInt32 (), context);
break;
case OperandType.InlineI :
instr.Operand = br.ReadInt32 ();
break;
case OperandType.InlineVar :
instr.Operand = GetVariable (body, br.ReadInt16 ());
break;
case OperandType.InlineParam :
instr.Operand = GetParameter (body, br.ReadInt16 ());
break;
case OperandType.InlineI8 :
instr.Operand = br.ReadInt64 ();
break;
case OperandType.ShortInlineR :
instr.Operand = br.ReadSingle ();
break;
case OperandType.InlineR :
instr.Operand = br.ReadDouble ();
break;
case OperandType.InlineString :
instr.Operand = m_root.Streams.UserStringsHeap [GetRid (br.ReadInt32 ())];
break;
case OperandType.InlineField :
case OperandType.InlineMethod :
case OperandType.InlineType :
case OperandType.InlineTok :
MetadataToken token = new MetadataToken (br.ReadInt32 ());
switch (token.TokenType) {
case TokenType.TypeDef:
instr.Operand = m_reflectReader.GetTypeDefAt (token.RID);
break;
case TokenType.TypeRef:
instr.Operand = m_reflectReader.GetTypeRefAt (token.RID);
break;
case TokenType.TypeSpec:
instr.Operand = m_reflectReader.GetTypeSpecAt (token.RID, context);
break;
case TokenType.Field:
instr.Operand = m_reflectReader.GetFieldDefAt (token.RID);
break;
case TokenType.Method:
instr.Operand = m_reflectReader.GetMethodDefAt (token.RID);
break;
case TokenType.MethodSpec:
instr.Operand = m_reflectReader.GetMethodSpecAt (token.RID, context);
break;
case TokenType.MemberRef:
instr.Operand = m_reflectReader.GetMemberRefAt (token.RID, context);
break;
default:
throw new ReflectionException ("Wrong token: " + token);
}
break;
}
instructions.Add (instr.Offset, instr);
if (last != null) {
last.Next = instr;
instr.Previous = last;
}
last = instr;
code.Add (instr);
}
// resolve branches
foreach (Instruction i in code) {
switch (i.OpCode.OperandType) {
case OperandType.ShortInlineBrTarget:
case OperandType.InlineBrTarget:
i.Operand = GetInstruction (body, instructions, (int) i.Operand);
break;
case OperandType.InlineSwitch:
int [] lbls = (int []) i.Operand;
Instruction [] instrs = new Instruction [lbls.Length];
for (int j = 0; j < lbls.Length; j++)
instrs [j] = GetInstruction (body, instructions, lbls [j]);
i.Operand = instrs;
break;
}
}
}
static Instruction GetInstruction (MethodBody body, IDictionary instructions, int offset)
{
Instruction instruction = instructions [offset] as Instruction;
if (instruction != null)
return instruction;
return body.Instructions.Outside;
}
void ReadSection (MethodBody body, BinaryReader br, IDictionary instructions)
{
br.BaseStream.Position += 3;
br.BaseStream.Position &= ~3;
byte flags = br.ReadByte ();
if ((flags & (byte) MethodDataSection.FatFormat) == 0) {
int length = br.ReadByte () / 12;
br.ReadBytes (2);
for (int i = 0; i < length; i++) {
ExceptionHandler eh = new ExceptionHandler (
(ExceptionHandlerType) (br.ReadInt16 () & 0x7));
eh.TryStart = GetInstruction (body, instructions, Convert.ToInt32 (br.ReadInt16 ()));
eh.TryEnd = GetInstruction (body, instructions, eh.TryStart.Offset + Convert.ToInt32 (br.ReadByte ()));
eh.HandlerStart = GetInstruction (body, instructions, Convert.ToInt32 (br.ReadInt16 ()));
eh.HandlerEnd = GetInstruction (body, instructions, eh.HandlerStart.Offset + Convert.ToInt32 (br.ReadByte ()));
ReadExceptionHandlerEnd (eh, br, body, instructions);
body.ExceptionHandlers.Add (eh);
}
} else {
br.BaseStream.Position--;
int length = (br.ReadInt32 () >> 8) / 24;
if ((flags & (int) MethodDataSection.EHTable) == 0)
br.ReadBytes (length * 24);
for (int i = 0; i < length; i++) {
ExceptionHandler eh = new ExceptionHandler (
(ExceptionHandlerType) (br.ReadInt32 () & 0x7));
eh.TryStart = GetInstruction (body, instructions, br.ReadInt32 ());
eh.TryEnd = GetInstruction (body, instructions, eh.TryStart.Offset + br.ReadInt32 ());
eh.HandlerStart = GetInstruction (body, instructions, br.ReadInt32 ());
eh.HandlerEnd = GetInstruction (body, instructions, eh.HandlerStart.Offset + br.ReadInt32 ());
ReadExceptionHandlerEnd(eh, br, body, instructions);
body.ExceptionHandlers.Add (eh);
}
}
if ((flags & (byte) MethodDataSection.MoreSects) != 0)
ReadSection (body, br, instructions);
}
void ReadExceptionHandlerEnd (ExceptionHandler eh, BinaryReader br, MethodBody body, IDictionary instructions)
{
switch (eh.Type) {
case ExceptionHandlerType.Catch :
MetadataToken token = new MetadataToken (br.ReadInt32 ());
eh.CatchType = m_reflectReader.GetTypeDefOrRef (token, new GenericContext (body.Method));
break;
case ExceptionHandlerType.Filter :
eh.FilterStart = GetInstruction (body, instructions, br.ReadInt32 ());
eh.FilterEnd = GetInstruction (body, instructions, eh.HandlerStart.Previous.Offset);
break;
default :
br.ReadInt32 ();
break;
}
}
CallSite GetCallSiteAt (int token, GenericContext context)
{
StandAloneSigTable sasTable = m_reflectReader.TableReader.GetStandAloneSigTable ();
MethodSig ms = m_reflectReader.SigReader.GetStandAloneMethodSig (
sasTable [(int) GetRid (token) - 1].Signature);
CallSite cs = new CallSite (ms.HasThis, ms.ExplicitThis,
ms.MethCallConv, m_reflectReader.GetMethodReturnType (ms, context));
cs.MetadataToken = new MetadataToken (token);
for (int i = 0; i < ms.ParamCount; i++) {
Param p = ms.Parameters [i];
cs.Parameters.Add (m_reflectReader.BuildParameterDefinition (i, p, context));
}
ReflectionReader.CreateSentinelIfNeeded (cs, ms);
return cs;
}
public override void VisitVariableDefinitionCollection (VariableDefinitionCollection variables)
{
MethodBody body = variables.Container as MethodBody;
if (body == null || body.LocalVarToken == 0)
return;
StandAloneSigTable sasTable = m_reflectReader.TableReader.GetStandAloneSigTable ();
StandAloneSigRow sasRow = sasTable [(int) GetRid (body.LocalVarToken) - 1];
LocalVarSig sig = m_reflectReader.SigReader.GetLocalVarSig (sasRow.Signature);
for (int i = 0; i < sig.Count; i++) {
LocalVarSig.LocalVariable lv = sig.LocalVariables [i];
TypeReference varType = m_reflectReader.GetTypeRefFromSig (
lv.Type, new GenericContext (body.Method));
if (lv.ByRef)
varType = new ReferenceType (varType);
if ((lv.Constraint & Constraint.Pinned) != 0)
varType = new PinnedType (varType);
varType = m_reflectReader.GetModifierType (lv.CustomMods, varType);
body.Variables.Add (new VariableDefinition (
string.Concat ("V_", i), i, body.Method, varType));
}
}
}
}

528
src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Mono.Cecil/Mono.Cecil.Cil/CodeWriter.cs

@ -1,528 +0,0 @@ @@ -1,528 +0,0 @@
//
// CodeWriter.cs
//
// Author:
// Jb Evain (jbevain@gmail.com)
//
// (C) 2005 - 2007 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.
//
namespace Mono.Cecil.Cil {
using System;
using System.Collections;
using Mono.Cecil;
using Mono.Cecil.Binary;
using Mono.Cecil.Metadata;
using Mono.Cecil.Signatures;
class CodeWriter : BaseCodeVisitor {
ReflectionWriter m_reflectWriter;
MemoryBinaryWriter m_binaryWriter;
MemoryBinaryWriter m_codeWriter;
IDictionary m_localSigCache;
IDictionary m_standaloneSigCache;
public CodeWriter (ReflectionWriter reflectWriter, MemoryBinaryWriter writer)
{
m_reflectWriter = reflectWriter;
m_binaryWriter = writer;
m_codeWriter = new MemoryBinaryWriter ();
m_localSigCache = new Hashtable ();
m_standaloneSigCache = new Hashtable ();
}
public RVA WriteMethodBody (MethodDefinition meth)
{
if (meth.Body == null)
return RVA.Zero;
RVA ret = m_reflectWriter.MetadataWriter.GetDataCursor ();
meth.Body.Accept (this);
return ret;
}
public override void VisitMethodBody (MethodBody body)
{
m_codeWriter.Empty ();
}
void WriteToken (MetadataToken token)
{
if (token.RID == 0)
m_codeWriter.Write (0);
else
m_codeWriter.Write (token.ToUInt ());
}
static int GetParameterIndex (MethodBody body, ParameterDefinition p)
{
int idx = body.Method.Parameters.IndexOf (p);
if (idx == -1 && p == body.Method.This)
return 0;
if (body.Method.HasThis)
idx++;
return idx;
}
public override void VisitInstructionCollection (InstructionCollection instructions)
{
MethodBody body = instructions.Container;
long start = m_codeWriter.BaseStream.Position;
ComputeMaxStack (instructions);
foreach (Instruction instr in instructions) {
instr.Offset = (int) (m_codeWriter.BaseStream.Position - start);
if (instr.OpCode.Size == 1)
m_codeWriter.Write (instr.OpCode.Op2);
else {
m_codeWriter.Write (instr.OpCode.Op1);
m_codeWriter.Write (instr.OpCode.Op2);
}
if (instr.OpCode.OperandType != OperandType.InlineNone &&
instr.Operand == null)
throw new ReflectionException ("OpCode {0} have null operand", instr.OpCode.Name);
switch (instr.OpCode.OperandType) {
case OperandType.InlineNone :
break;
case OperandType.InlineSwitch :
Instruction [] targets = (Instruction []) instr.Operand;
for (int i = 0; i < targets.Length + 1; i++)
m_codeWriter.Write ((uint) 0);
break;
case OperandType.ShortInlineBrTarget :
m_codeWriter.Write ((byte) 0);
break;
case OperandType.InlineBrTarget :
m_codeWriter.Write (0);
break;
case OperandType.ShortInlineI :
if (instr.OpCode == OpCodes.Ldc_I4_S)
m_codeWriter.Write ((sbyte) instr.Operand);
else
m_codeWriter.Write ((byte) instr.Operand);
break;
case OperandType.ShortInlineVar :
m_codeWriter.Write ((byte) body.Variables.IndexOf (
(VariableDefinition) instr.Operand));
break;
case OperandType.ShortInlineParam :
m_codeWriter.Write ((byte) GetParameterIndex (body, (ParameterDefinition) instr.Operand));
break;
case OperandType.InlineSig :
WriteToken (GetCallSiteToken ((CallSite) instr.Operand));
break;
case OperandType.InlineI :
m_codeWriter.Write ((int) instr.Operand);
break;
case OperandType.InlineVar :
m_codeWriter.Write ((short) body.Variables.IndexOf (
(VariableDefinition) instr.Operand));
break;
case OperandType.InlineParam :
m_codeWriter.Write ((short) GetParameterIndex (
body, (ParameterDefinition) instr.Operand));
break;
case OperandType.InlineI8 :
m_codeWriter.Write ((long) instr.Operand);
break;
case OperandType.ShortInlineR :
m_codeWriter.Write ((float) instr.Operand);
break;
case OperandType.InlineR :
m_codeWriter.Write ((double) instr.Operand);
break;
case OperandType.InlineString :
WriteToken (new MetadataToken (TokenType.String,
m_reflectWriter.MetadataWriter.AddUserString (instr.Operand as string)));
break;
case OperandType.InlineField :
case OperandType.InlineMethod :
case OperandType.InlineType :
case OperandType.InlineTok :
if (instr.Operand is TypeReference)
WriteToken (m_reflectWriter.GetTypeDefOrRefToken (
instr.Operand as TypeReference));
else if (instr.Operand is GenericInstanceMethod)
WriteToken (m_reflectWriter.GetMethodSpecToken (instr.Operand as GenericInstanceMethod));
else if (instr.Operand is MemberReference)
WriteToken (m_reflectWriter.GetMemberRefToken ((MemberReference) instr.Operand));
else if (instr.Operand is IMetadataTokenProvider)
WriteToken (((IMetadataTokenProvider) instr.Operand).MetadataToken);
else
throw new ReflectionException (
string.Format ("Wrong operand for {0} OpCode: {1}",
instr.OpCode.OperandType,
instr.Operand.GetType ().FullName));
break;
}
}
// patch branches
long pos = m_codeWriter.BaseStream.Position;
foreach (Instruction instr in instructions) {
switch (instr.OpCode.OperandType) {
case OperandType.InlineSwitch :
m_codeWriter.BaseStream.Position = instr.Offset + instr.OpCode.Size;
Instruction [] targets = (Instruction []) instr.Operand;
m_codeWriter.Write ((uint) targets.Length);
foreach (Instruction tgt in targets)
m_codeWriter.Write ((tgt.Offset - (instr.Offset +
instr.OpCode.Size + (4 * (targets.Length + 1)))));
break;
case OperandType.ShortInlineBrTarget :
m_codeWriter.BaseStream.Position = instr.Offset + instr.OpCode.Size;
m_codeWriter.Write ((byte) (((Instruction) instr.Operand).Offset -
(instr.Offset + instr.OpCode.Size + 1)));
break;
case OperandType.InlineBrTarget :
m_codeWriter.BaseStream.Position = instr.Offset + instr.OpCode.Size;
m_codeWriter.Write(((Instruction) instr.Operand).Offset -
(instr.Offset + instr.OpCode.Size + 4));
break;
}
}
m_codeWriter.BaseStream.Position = pos;
}
MetadataToken GetCallSiteToken (CallSite cs)
{
uint sig;
int sentinel = cs.GetSentinel ();
if (sentinel > 0)
sig = m_reflectWriter.SignatureWriter.AddMethodDefSig (
m_reflectWriter.GetMethodDefSig (cs));
else
sig = m_reflectWriter.SignatureWriter.AddMethodRefSig (
m_reflectWriter.GetMethodRefSig (cs));
if (m_standaloneSigCache.Contains (sig))
return (MetadataToken) m_standaloneSigCache [sig];
StandAloneSigTable sasTable = m_reflectWriter.MetadataTableWriter.GetStandAloneSigTable ();
StandAloneSigRow sasRow = m_reflectWriter.MetadataRowWriter.CreateStandAloneSigRow (sig);
sasTable.Rows.Add(sasRow);
MetadataToken token = new MetadataToken (TokenType.Signature, (uint) sasTable.Rows.Count);
m_standaloneSigCache [sig] = token;
return token;
}
static int GetLength (Instruction start, Instruction end, InstructionCollection instructions)
{
Instruction last = instructions [instructions.Count - 1];
return (end == instructions.Outside ? last.Offset + GetSize (last) : end.Offset) - start.Offset;
}
static int GetSize (Instruction i)
{
int size = i.OpCode.Size;
switch (i.OpCode.OperandType) {
case OperandType.InlineSwitch:
size += ((Instruction []) i.Operand).Length * 4;
break;
case OperandType.InlineI8:
case OperandType.InlineR:
size += 8;
break;
case OperandType.InlineBrTarget:
case OperandType.InlineField:
case OperandType.InlineI:
case OperandType.InlineMethod:
case OperandType.InlineString:
case OperandType.InlineTok:
case OperandType.InlineType:
case OperandType.ShortInlineR:
size += 4;
break;
case OperandType.InlineParam:
case OperandType.InlineVar:
size += 2;
break;
case OperandType.ShortInlineBrTarget:
case OperandType.ShortInlineI:
case OperandType.ShortInlineParam:
case OperandType.ShortInlineVar:
size += 1;
break;
}
return size;
}
static bool IsRangeFat (Instruction start, Instruction end, InstructionCollection instructions)
{
return GetLength (start, end, instructions) >= 256 ||
start.Offset >= 65536;
}
static bool IsFat (ExceptionHandlerCollection seh)
{
for (int i = 0; i < seh.Count; i++) {
ExceptionHandler eh = seh [i];
if (IsRangeFat (eh.TryStart, eh.TryEnd, seh.Container.Instructions))
return true;
if (IsRangeFat (eh.HandlerStart, eh.HandlerEnd, seh.Container.Instructions))
return true;
switch (eh.Type) {
case ExceptionHandlerType.Filter :
if (IsRangeFat (eh.FilterStart, eh.FilterEnd, seh.Container.Instructions))
return true;
break;
}
}
return false;
}
void WriteExceptionHandlerCollection (ExceptionHandlerCollection seh)
{
m_codeWriter.QuadAlign ();
if (seh.Count < 0x15 && !IsFat (seh)) {
m_codeWriter.Write ((byte) MethodDataSection.EHTable);
m_codeWriter.Write ((byte) (seh.Count * 12 + 4));
m_codeWriter.Write (new byte [2]);
foreach (ExceptionHandler eh in seh) {
m_codeWriter.Write ((ushort) eh.Type);
m_codeWriter.Write ((ushort) eh.TryStart.Offset);
m_codeWriter.Write ((byte) (eh.TryEnd.Offset - eh.TryStart.Offset));
m_codeWriter.Write ((ushort) eh.HandlerStart.Offset);
m_codeWriter.Write ((byte) GetLength (eh.HandlerStart, eh.HandlerEnd, seh.Container.Instructions));
WriteHandlerSpecific (eh);
}
} else {
m_codeWriter.Write ((byte) (MethodDataSection.FatFormat | MethodDataSection.EHTable));
WriteFatBlockSize (seh);
foreach (ExceptionHandler eh in seh) {
m_codeWriter.Write ((uint) eh.Type);
m_codeWriter.Write ((uint) eh.TryStart.Offset);
m_codeWriter.Write ((uint) (eh.TryEnd.Offset - eh.TryStart.Offset));
m_codeWriter.Write ((uint) eh.HandlerStart.Offset);
m_codeWriter.Write ((uint) GetLength (eh.HandlerStart, eh.HandlerEnd, seh.Container.Instructions));
WriteHandlerSpecific (eh);
}
}
}
void WriteFatBlockSize (ExceptionHandlerCollection seh)
{
int size = seh.Count * 24 + 4;
m_codeWriter.Write ((byte) (size & 0xff));
m_codeWriter.Write ((byte) ((size >> 8) & 0xff));
m_codeWriter.Write ((byte) ((size >> 16) & 0xff));
}
void WriteHandlerSpecific (ExceptionHandler eh)
{
switch (eh.Type) {
case ExceptionHandlerType.Catch :
WriteToken (eh.CatchType.MetadataToken);
break;
case ExceptionHandlerType.Filter :
m_codeWriter.Write ((uint) eh.FilterStart.Offset);
break;
default :
m_codeWriter.Write (0);
break;
}
}
public override void VisitVariableDefinitionCollection (VariableDefinitionCollection variables)
{
MethodBody body = variables.Container as MethodBody;
if (body == null)
return;
uint sig = m_reflectWriter.SignatureWriter.AddLocalVarSig (
GetLocalVarSig (variables));
if (m_localSigCache.Contains (sig)) {
body.LocalVarToken = (int) m_localSigCache [sig];
return;
}
StandAloneSigTable sasTable = m_reflectWriter.MetadataTableWriter.GetStandAloneSigTable ();
StandAloneSigRow sasRow = m_reflectWriter.MetadataRowWriter.CreateStandAloneSigRow (
sig);
sasTable.Rows.Add (sasRow);
body.LocalVarToken = sasTable.Rows.Count;
m_localSigCache [sig] = body.LocalVarToken;
}
public override void TerminateMethodBody (MethodBody body)
{
long pos = m_binaryWriter.BaseStream.Position;
if (body.Variables.Count > 0 || body.ExceptionHandlers.Count > 0
|| m_codeWriter.BaseStream.Length >= 64 || body.MaxStack > 8) {
MethodHeader header = MethodHeader.FatFormat;
if (body.InitLocals)
header |= MethodHeader.InitLocals;
if (body.ExceptionHandlers.Count > 0)
header |= MethodHeader.MoreSects;
m_binaryWriter.Write ((byte) header);
m_binaryWriter.Write ((byte) 0x30); // (header size / 4) << 4
m_binaryWriter.Write ((short) body.MaxStack);
m_binaryWriter.Write ((int) m_codeWriter.BaseStream.Length);
m_binaryWriter.Write (((int) TokenType.Signature | body.LocalVarToken));
WriteExceptionHandlerCollection (body.ExceptionHandlers);
} else
m_binaryWriter.Write ((byte) ((byte) MethodHeader.TinyFormat |
m_codeWriter.BaseStream.Length << 2));
m_binaryWriter.Write (m_codeWriter);
m_binaryWriter.QuadAlign ();
m_reflectWriter.MetadataWriter.AddData (
(int) (m_binaryWriter.BaseStream.Position - pos));
}
public LocalVarSig.LocalVariable GetLocalVariableSig (VariableDefinition var)
{
LocalVarSig.LocalVariable lv = new LocalVarSig.LocalVariable ();
TypeReference type = var.VariableType;
lv.CustomMods = m_reflectWriter.GetCustomMods (type);
if (type is PinnedType) {
lv.Constraint |= Constraint.Pinned;
type = (type as PinnedType).ElementType;
}
if (type is ReferenceType) {
lv.ByRef = true;
type = (type as ReferenceType).ElementType;
}
lv.Type = m_reflectWriter.GetSigType (type);
return lv;
}
public LocalVarSig GetLocalVarSig (VariableDefinitionCollection vars)
{
LocalVarSig lvs = new LocalVarSig ();
lvs.CallingConvention |= 0x7;
lvs.Count = vars.Count;
lvs.LocalVariables = new LocalVarSig.LocalVariable [lvs.Count];
for (int i = 0; i < lvs.Count; i++) {
lvs.LocalVariables [i] = GetLocalVariableSig (vars [i]);
}
return lvs;
}
static void ComputeMaxStack (InstructionCollection instructions)
{
InstructionCollection ehs = new InstructionCollection (null);
foreach (ExceptionHandler eh in instructions.Container.ExceptionHandlers) {
switch (eh.Type) {
case ExceptionHandlerType.Catch :
ehs.Add (eh.HandlerStart);
break;
case ExceptionHandlerType.Filter :
ehs.Add (eh.FilterStart);
break;
}
}
int max = 0, current = 0;
foreach (Instruction instr in instructions) {
if (ehs.Contains (instr))
current++;
switch (instr.OpCode.StackBehaviourPush) {
case StackBehaviour.Push1:
case StackBehaviour.Pushi:
case StackBehaviour.Pushi8:
case StackBehaviour.Pushr4:
case StackBehaviour.Pushr8:
case StackBehaviour.Pushref:
case StackBehaviour.Varpush:
current++;
break;
case StackBehaviour.Push1_push1:
current += 2;
break;
}
if (max < current)
max = current;
switch (instr.OpCode.StackBehaviourPop) {
case StackBehaviour.Varpop:
break;
case StackBehaviour.Pop1:
case StackBehaviour.Popi:
case StackBehaviour.Popref:
current--;
break;
case StackBehaviour.Pop1_pop1:
case StackBehaviour.Popi_pop1:
case StackBehaviour.Popi_popi:
case StackBehaviour.Popi_popi8:
case StackBehaviour.Popi_popr4:
case StackBehaviour.Popi_popr8:
case StackBehaviour.Popref_pop1:
case StackBehaviour.Popref_popi:
current -= 2;
break;
case StackBehaviour.Popi_popi_popi:
case StackBehaviour.Popref_popi_popi:
case StackBehaviour.Popref_popi_popi8:
case StackBehaviour.Popref_popi_popr4:
case StackBehaviour.Popref_popi_popr8:
case StackBehaviour.Popref_popi_popref:
current -= 3;
break;
}
if (current < 0)
current = 0;
}
instructions.Container.MaxStack = max;
}
}
}

78
src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Mono.Cecil/Mono.Cecil.Cil/Document.cs

@ -1,78 +0,0 @@ @@ -1,78 +0,0 @@
//
// Document.cs
//
// Author:
// Jb Evain (jbevain@gmail.com)
//
// (C) 2006 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.
//
namespace Mono.Cecil.Cil {
public class Document {
string m_url;
DocumentType m_type;
DocumentHashAlgorithm m_hashAlgorithm;
DocumentLanguage m_language;
DocumentLanguageVendor m_languageVendor;
byte [] m_hash;
public string Url {
get { return m_url; }
set { m_url = value; }
}
public DocumentType Type {
get { return m_type; }
set { m_type = value; }
}
public DocumentHashAlgorithm HashAlgorithm {
get { return m_hashAlgorithm; }
set { m_hashAlgorithm = value; }
}
public DocumentLanguage Language {
get { return m_language; }
set { m_language = value; }
}
public DocumentLanguageVendor LanguageVendor {
get { return m_languageVendor; }
set { m_languageVendor = value; }
}
public byte [] Hash {
get { return m_hash; }
set { m_hash = value; }
}
public Document (string url)
{
m_url = url;
m_hash = new byte [0];
}
}
}

36
src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Mono.Cecil/Mono.Cecil.Cil/DocumentHashAlgorithm.cs

@ -1,36 +0,0 @@ @@ -1,36 +0,0 @@
//
// DocumentHashAlgorithm.cs
//
// Author:
// Jb Evain (jbevain@gmail.com)
//
// (C) 2006 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.
//
namespace Mono.Cecil.Cil {
public enum DocumentHashAlgorithm {
[Guid (0x00000000, 0x0000, 0x0000, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00)] None,
[Guid (0x406ea660, 0x64cf, 0x4c82, 0xb6, 0xf0, 0x42, 0xd4, 0x81, 0x72, 0xa7, 0x99)] MD5,
[Guid (0xff1816ec, 0xaa5e, 0x4d10, 0x87, 0xf7, 0x6f, 0x49, 0x63, 0x83, 0x34, 0x60)] SHA1
}
}

45
src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Mono.Cecil/Mono.Cecil.Cil/DocumentLanguage.cs

@ -1,45 +0,0 @@ @@ -1,45 +0,0 @@
//
// DocumentLanguage.cs
//
// Author:
// Jb Evain (jbevain@gmail.com)
//
// (C) 2006 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.
//
namespace Mono.Cecil.Cil {
public enum DocumentLanguage {
[Guid (0x00000000, 0x0000, 0x0000, 0x00, 0x00, 0x0, 0x00, 0x00, 0x00, 0x00, 0x00)] None,
[Guid (0x63a08714, 0xfc37, 0x11d2, 0x90, 0x4c, 0x0, 0xc0, 0x4f, 0xa3, 0x02, 0xa1)] C,
[Guid (0x3a12d0b7, 0xc26c, 0x11d0, 0xb4, 0x42, 0x0, 0xa0, 0x24, 0x4a, 0x1d, 0xd2)] Cpp,
[Guid (0x3f5162f8, 0x07c6, 0x11d3, 0x90, 0x53, 0x0, 0xc0, 0x4f, 0xa3, 0x02, 0xa1)] CSharp,
[Guid (0x3a12d0b8, 0xc26c, 0x11d0, 0xb4, 0x42, 0x0, 0xa0, 0x24, 0x4a, 0x1d, 0xd2)] Basic,
[Guid (0x3a12d0b4, 0xc26c, 0x11d0, 0xb4, 0x42, 0x0, 0xa0, 0x24, 0x4a, 0x1d, 0xd2)] Java,
[Guid (0xaf046cd1, 0xd0e1, 0x11d2, 0x97, 0x7c, 0x0, 0xa0, 0xc9, 0xb4, 0xd5, 0xc)] Cobol,
[Guid (0xaf046cd2, 0xd0e1, 0x11d2, 0x97, 0x7c, 0x0, 0xa0, 0xc9, 0xb4, 0xd5, 0xc)] Pascal,
[Guid (0xaf046cd3, 0xd0e1, 0x11d2, 0x97, 0x7c, 0x0, 0xa0, 0xc9, 0xb4, 0xd5, 0xc)] CIL,
[Guid (0x3a12d0b6, 0xc26c, 0x11d0, 0xb4, 0x42, 0x0, 0xa0, 0x24, 0x4a, 0x1d, 0xd2)] JScript,
[Guid (0xd9b9f7b, 0x6611, 0x11d3, 0xbd, 0x2a, 0x0, 0x0, 0xf8, 0x8, 0x49, 0xbd)] SMC,
[Guid (0x4b35fde8, 0x07c6, 0x11d3, 0x90, 0x53, 0x0, 0xc0, 0x4f, 0xa3, 0x02, 0xa1)] MCpp
}
}

35
src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Mono.Cecil/Mono.Cecil.Cil/DocumentLanguageVendor.cs

@ -1,35 +0,0 @@ @@ -1,35 +0,0 @@
//
// DocumentLanguageVendor.cs
//
// Author:
// Jb Evain (jbevain@gmail.com)
//
// (C) 2006 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.
//
namespace Mono.Cecil.Cil {
public enum DocumentLanguageVendor {
[Guid (0x00000000, 0x0000, 0x0000, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00)] Other,
[Guid (0x994b45c4, 0xe6e9, 0x11d2, 0x90, 0x3f, 0x00, 0xc0, 0x4f, 0xa3, 0x02, 0xa1)] Microsoft
}
}

35
src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Mono.Cecil/Mono.Cecil.Cil/DocumentType.cs

@ -1,35 +0,0 @@ @@ -1,35 +0,0 @@
//
// DocumentType.cs
//
// Author:
// Jb Evain (jbevain@gmail.com)
//
// (C) 2006 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.
//
namespace Mono.Cecil.Cil {
public enum DocumentType {
[Guid (0x00000000, 0x0000, 0x0000, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00)] Other,
[Guid (0x5a869d0b, 0x6611, 0x11d3, 0xbd, 0x2a, 0x00, 0x00, 0xf8, 0x08, 0x49, 0xbd)] Text
}
}

95
src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Mono.Cecil/Mono.Cecil.Cil/ExceptionHandler.cs

@ -1,95 +0,0 @@ @@ -1,95 +0,0 @@
//
// ExceptionHandler.cs
//
// Author:
// Jb Evain (jbevain@gmail.com)
//
// (C) 2005 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.
//
namespace Mono.Cecil.Cil {
using Mono.Cecil;
public sealed class ExceptionHandler : ICodeVisitable {
Instruction m_tryStart;
Instruction m_tryEnd;
Instruction m_filterStart;
Instruction m_filterEnd;
Instruction m_handlerStart;
Instruction m_handlerEnd;
TypeReference m_catchType;
ExceptionHandlerType m_type;
public Instruction TryStart {
get { return m_tryStart; }
set { m_tryStart = value; }
}
public Instruction TryEnd {
get { return m_tryEnd; }
set { m_tryEnd = value; }
}
public Instruction FilterStart {
get { return m_filterStart; }
set { m_filterStart = value; }
}
public Instruction FilterEnd {
get { return m_filterEnd; }
set { m_filterEnd = value; }
}
public Instruction HandlerStart {
get { return m_handlerStart; }
set { m_handlerStart = value; }
}
public Instruction HandlerEnd {
get { return m_handlerEnd; }
set { m_handlerEnd = value; }
}
public TypeReference CatchType {
get { return m_catchType; }
set { m_catchType = value; }
}
public ExceptionHandlerType Type {
get { return m_type; }
set { m_type = value; }
}
public ExceptionHandler (ExceptionHandlerType type)
{
m_type = type;
}
public void Accept (ICodeVisitor visitor)
{
visitor.VisitExceptionHandler (this);
}
}
}

93
src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Mono.Cecil/Mono.Cecil.Cil/ExceptionHandlerCollection.cs

@ -1,93 +0,0 @@ @@ -1,93 +0,0 @@
//
// ExceptionHandlerCollection.cs
//
// Author:
// Jb Evain (jbevain@gmail.com)
//
// Generated by /CodeGen/cecil-gen.rb do not edit
// Wed Sep 27 12:46:53 CEST 2006
//
// (C) 2005 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.
//
namespace Mono.Cecil.Cil {
using System;
using System.Collections;
using Mono.Cecil.Cil;
public sealed class ExceptionHandlerCollection : CollectionBase, ICodeVisitable {
MethodBody m_container;
public ExceptionHandler this [int index] {
get { return List [index] as ExceptionHandler; }
set { List [index] = value; }
}
public MethodBody Container {
get { return m_container; }
}
public ExceptionHandlerCollection (MethodBody container)
{
m_container = container;
}
public void Add (ExceptionHandler value)
{
List.Add (value);
}
public bool Contains (ExceptionHandler value)
{
return List.Contains (value);
}
public int IndexOf (ExceptionHandler value)
{
return List.IndexOf (value);
}
public void Insert (int index, ExceptionHandler value)
{
List.Insert (index, value);
}
public void Remove (ExceptionHandler value)
{
List.Remove (value);
}
protected override void OnValidate (object o)
{
if (! (o is ExceptionHandler))
throw new ArgumentException ("Must be of type " + typeof (ExceptionHandler).FullName);
}
public void Accept (ICodeVisitor visitor)
{
visitor.VisitExceptionHandlerCollection (this);
}
}
}

37
src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Mono.Cecil/Mono.Cecil.Cil/ExceptionHandlerType.cs

@ -1,37 +0,0 @@ @@ -1,37 +0,0 @@
//
// ExceptionHandlerType.cs
//
// Author:
// Jb Evain (jbevain@gmail.com)
//
// (C) 2005 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.
//
namespace Mono.Cecil.Cil {
public enum ExceptionHandlerType {
Catch = 0x0000,
Filter = 0x0001,
Finally = 0x0002,
Fault = 0x0004
}
}

42
src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Mono.Cecil/Mono.Cecil.Cil/FlowControl.cs

@ -1,42 +0,0 @@ @@ -1,42 +0,0 @@
//
// FlowControl.cs
//
// Author:
// Jb Evain (jbevain@gmail.com)
//
// (C) 2005 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.
//
namespace Mono.Cecil.Cil {
public enum FlowControl {
Branch,
Break,
Call,
Cond_Branch,
Meta,
Next,
Phi,
Return,
Throw
}
}

91
src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Mono.Cecil/Mono.Cecil.Cil/GuidAttribute.cs

@ -1,91 +0,0 @@ @@ -1,91 +0,0 @@
//
// GuidAttribute.cs
//
// Author:
// Jb Evain (jbevain@gmail.com)
//
// (C) 2006 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.
//
namespace Mono.Cecil.Cil {
using System;
using System.Reflection;
[AttributeUsage (AttributeTargets.Field)]
public class GuidAttribute : Attribute {
private Guid m_guid;
public Guid Guid {
get { return m_guid; }
}
GuidAttribute ()
{
m_guid = new Guid ();
}
public GuidAttribute (
uint a,
ushort b,
ushort c,
byte d,
byte e,
byte f,
byte g,
byte h,
byte i,
byte j,
byte k)
{
m_guid = new Guid ((int) a, (short) b, (short) c, d, e, f, g, h, i, j, k);
}
public static int GetValueFromGuid (Guid id, Type enumeration)
{
foreach (FieldInfo fi in enumeration.GetFields (BindingFlags.Static | BindingFlags.Public))
if (id == GetGuidAttribute (fi).Guid)
return (int) fi.GetValue (null);
return -1;
}
public static Guid GetGuidFromValue (int value, Type enumeration)
{
foreach (FieldInfo fi in enumeration.GetFields (BindingFlags.Static | BindingFlags.Public))
if (value == (int) fi.GetValue (null))
return GetGuidAttribute (fi).Guid;
return new Guid ();
}
static GuidAttribute GetGuidAttribute (FieldInfo fi)
{
GuidAttribute [] attributes = fi.GetCustomAttributes (typeof (GuidAttribute), false) as GuidAttribute [];
if (attributes == null || attributes.Length != 1)
return new GuidAttribute ();
return attributes [0];
}
}
}

34
src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Mono.Cecil/Mono.Cecil.Cil/ICodeVisitable.cs

@ -1,34 +0,0 @@ @@ -1,34 +0,0 @@
//
// ICodeVisitable.cs
//
// Author:
// Jb Evain (jbevain@gmail.com)
//
// (C) 2005 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.
//
namespace Mono.Cecil.Cil {
public interface ICodeVisitable {
void Accept (ICodeVisitor visitor);
}
}

45
src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Mono.Cecil/Mono.Cecil.Cil/ICodeVisitor.cs

@ -1,45 +0,0 @@ @@ -1,45 +0,0 @@
//
// ICodeVisitor.cs
//
// Author:
// Jb Evain (jbevain@gmail.com)
//
// (C) 2005 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.
//
namespace Mono.Cecil.Cil {
public interface ICodeVisitor {
void VisitMethodBody (MethodBody body);
void VisitInstructionCollection (InstructionCollection instructions);
void VisitInstruction (Instruction instr);
void VisitExceptionHandlerCollection (ExceptionHandlerCollection seh);
void VisitExceptionHandler (ExceptionHandler eh);
void VisitVariableDefinitionCollection (VariableDefinitionCollection variables);
void VisitVariableDefinition (VariableDefinition var);
void VisitScopeCollection (ScopeCollection scopes);
void VisitScope (Scope scope);
void TerminateMethodBody (MethodBody body);
}
}

35
src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Mono.Cecil/Mono.Cecil.Cil/IScopeProvider.cs

@ -1,35 +0,0 @@ @@ -1,35 +0,0 @@
//
// Document.cs
//
// Author:
// Jb Evain (jbevain@gmail.com)
//
// (C) 2006 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.
//
namespace Mono.Cecil.Cil {
public interface IScopeProvider {
ScopeCollection Scopes { get; }
}
}

37
src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Mono.Cecil/Mono.Cecil.Cil/ISymbolReader.cs

@ -1,37 +0,0 @@ @@ -1,37 +0,0 @@
//
// ISymbolReader.cs
//
// Author:
// Jb Evain (jbevain@gmail.com)
//
// (C) 2006 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.
//
namespace Mono.Cecil.Cil {
using System;
public interface ISymbolReader : IDisposable {
void Read (MethodBody body);
}
}

36
src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Mono.Cecil/Mono.Cecil.Cil/ISymbolStoreFactory.cs

@ -1,36 +0,0 @@ @@ -1,36 +0,0 @@
//
// ISymbolStoreFactory.cs
//
// Author:
// Jb Evain (jbevain@gmail.com)
//
// (C) 2006 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.
//
namespace Mono.Cecil.Cil {
public interface ISymbolStoreFactory {
ISymbolReader CreateReader (ModuleDefinition module, string assemblyFileName);
ISymbolWriter CreateWriter (ModuleDefinition module, string assemblyFileName);
}
}

37
src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Mono.Cecil/Mono.Cecil.Cil/ISymbolWriter.cs

@ -1,37 +0,0 @@ @@ -1,37 +0,0 @@
//
// ISymbolWriter.cs
//
// Author:
// Jb Evain (jbevain@gmail.com)
//
// (C) 2006 - 2007 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.
//
namespace Mono.Cecil.Cil {
using System;
public interface ISymbolWriter : IDisposable {
void Write (MethodBody body, byte [][] variables);
}
}

35
src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Mono.Cecil/Mono.Cecil.Cil/IVariableDefinitionProvider.cs

@ -1,35 +0,0 @@ @@ -1,35 +0,0 @@
//
// IVariableDefinitionProvider.cs
//
// Author:
// Jb Evain (jbevain@gmail.com)
//
// (C) 2006 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.
//
namespace Mono.Cecil.Cil {
public interface IVariableDefinitionProvider {
VariableDefinitionCollection Variables { get; }
}
}

96
src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Mono.Cecil/Mono.Cecil.Cil/Instruction.cs

@ -1,96 +0,0 @@ @@ -1,96 +0,0 @@
//
// Instruction.cs
//
// Author:
// Jb Evain (jbevain@gmail.com)
//
// (C) 2005 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.
//
namespace Mono.Cecil.Cil {
public sealed class Instruction : ICodeVisitable {
int m_offset;
OpCode m_opCode;
object m_operand;
Instruction m_previous;
Instruction m_next;
SequencePoint m_sequencePoint;
public int Offset {
get { return m_offset; }
set { m_offset = value; }
}
public OpCode OpCode {
get { return m_opCode; }
set { m_opCode = value; }
}
public object Operand {
get { return m_operand; }
set { m_operand = value; }
}
public Instruction Previous {
get { return m_previous; }
set { m_previous = value; }
}
public Instruction Next {
get { return m_next; }
set { m_next = value; }
}
public SequencePoint SequencePoint {
get { return m_sequencePoint; }
set { m_sequencePoint = value; }
}
internal Instruction (int offset, OpCode opCode, object operand) : this (offset, opCode)
{
m_operand = operand;
}
internal Instruction (int offset, OpCode opCode)
{
m_offset = offset;
m_opCode = opCode;
}
internal Instruction (OpCode opCode, object operand) : this (0, opCode, operand)
{
}
internal Instruction (OpCode opCode) : this (0, opCode)
{
}
public void Accept (ICodeVisitor visitor)
{
visitor.VisitInstruction (this);
}
}
}

94
src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Mono.Cecil/Mono.Cecil.Cil/InstructionCollection.cs

@ -1,94 +0,0 @@ @@ -1,94 +0,0 @@
//
// InstructionCollection.cs
//
// Author:
// Jb Evain (jbevain@gmail.com)
//
// Generated by /CodeGen/cecil-gen.rb do not edit
// Thu Sep 28 17:54:43 CEST 2006
//
// (C) 2005 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.
//
namespace Mono.Cecil.Cil {
using System;
using System.Collections;
using Mono.Cecil.Cil;
public sealed class InstructionCollection : CollectionBase, ICodeVisitable {
MethodBody m_container;
public readonly Instruction Outside = new Instruction (int.MaxValue, OpCodes.Nop);
public Instruction this [int index] {
get { return List [index] as Instruction; }
set { List [index] = value; }
}
public MethodBody Container {
get { return m_container; }
}
public InstructionCollection (MethodBody container)
{
m_container = container;
}
internal void Add (Instruction value)
{
List.Add (value);
}
public bool Contains (Instruction value)
{
return List.Contains (value);
}
public int IndexOf (Instruction value)
{
return List.IndexOf (value);
}
internal void Insert (int index, Instruction value)
{
List.Insert (index, value);
}
internal void Remove (Instruction value)
{
List.Remove (value);
}
protected override void OnValidate (object o)
{
if (! (o is Instruction))
throw new ArgumentException ("Must be of type " + typeof (Instruction).FullName);
}
public void Accept (ICodeVisitor visitor)
{
visitor.VisitInstructionCollection (this);
}
}
}

374
src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Mono.Cecil/Mono.Cecil.Cil/MethodBody.cs

@ -1,374 +0,0 @@ @@ -1,374 +0,0 @@
//
// MethodBody.cs
//
// Author:
// Jb Evain (jbevain@gmail.com)
//
// (C) 2005 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.
//
namespace Mono.Cecil.Cil {
using Mono.Cecil;
public sealed class MethodBody : IVariableDefinitionProvider, IScopeProvider, ICodeVisitable {
MethodDefinition m_method;
int m_maxStack;
int m_codeSize;
bool m_initLocals;
int m_localVarToken;
InstructionCollection m_instructions;
ExceptionHandlerCollection m_exceptions;
VariableDefinitionCollection m_variables;
ScopeCollection m_scopes;
private CilWorker m_cilWorker;
public MethodDefinition Method {
get { return m_method; }
}
public int MaxStack {
get { return m_maxStack; }
set { m_maxStack = value; }
}
public int CodeSize {
get { return m_codeSize; }
set { m_codeSize = value; }
}
public bool InitLocals {
get { return m_initLocals; }
set { m_initLocals = value; }
}
internal int LocalVarToken {
get { return m_localVarToken; }
set { m_localVarToken = value; }
}
public CilWorker CilWorker {
get {
if (m_cilWorker == null)
m_cilWorker = new CilWorker (this);
return m_cilWorker;
}
set { m_cilWorker = value; }
}
public InstructionCollection Instructions {
get { return m_instructions; }
}
public ExceptionHandlerCollection ExceptionHandlers {
get { return m_exceptions; }
}
public VariableDefinitionCollection Variables {
get { return m_variables; }
}
public ScopeCollection Scopes {
get { return m_scopes; }
}
public MethodBody (MethodDefinition meth)
{
m_method = meth;
m_instructions = new InstructionCollection (this);
m_exceptions = new ExceptionHandlerCollection (this);
m_variables = new VariableDefinitionCollection (this);
m_scopes = new ScopeCollection (this);
}
internal static Instruction GetInstruction (MethodBody oldBody, MethodBody newBody, Instruction i)
{
int pos = oldBody.Instructions.IndexOf (i);
if (pos > -1 && pos < newBody.Instructions.Count)
return newBody.Instructions [pos];
return newBody.Instructions.Outside;
}
internal static MethodBody Clone (MethodBody body, MethodDefinition parent, ImportContext context)
{
MethodBody nb = new MethodBody (parent);
nb.MaxStack = body.MaxStack;
nb.InitLocals = body.InitLocals;
nb.CodeSize = body.CodeSize;
foreach (VariableDefinition var in body.Variables)
nb.Variables.Add (new VariableDefinition (
context.Import (var.VariableType)));
foreach (Instruction instr in body.Instructions) {
Instruction ni = new Instruction (instr.OpCode);
switch (instr.OpCode.OperandType) {
case OperandType.InlineParam :
case OperandType.ShortInlineParam :
if (instr.Operand == body.Method.This)
ni.Operand = nb.Method.This;
else {
int param = body.Method.Parameters.IndexOf ((ParameterDefinition) instr.Operand);
ni.Operand = parent.Parameters [param];
}
break;
case OperandType.InlineVar :
case OperandType.ShortInlineVar :
int var = body.Variables.IndexOf ((VariableDefinition) instr.Operand);
ni.Operand = nb.Variables [var];
break;
case OperandType.InlineField :
ni.Operand = context.Import ((FieldReference) instr.Operand);
break;
case OperandType.InlineMethod :
ni.Operand = context.Import ((MethodReference) instr.Operand);
break;
case OperandType.InlineType :
ni.Operand = context.Import ((TypeReference) instr.Operand);
break;
case OperandType.InlineTok :
if (instr.Operand is TypeReference)
ni.Operand = context.Import ((TypeReference) instr.Operand);
else if (instr.Operand is FieldReference)
ni.Operand = context.Import ((FieldReference) instr.Operand);
else if (instr.Operand is MethodReference)
ni.Operand = context.Import ((MethodReference) instr.Operand);
break;
case OperandType.ShortInlineBrTarget :
case OperandType.InlineBrTarget :
break;
default :
ni.Operand = instr.Operand;
break;
}
nb.Instructions.Add (ni);
}
for (int i = 0; i < body.Instructions.Count; i++) {
Instruction instr = nb.Instructions [i];
if (instr.OpCode.OperandType != OperandType.ShortInlineBrTarget &&
instr.OpCode.OperandType != OperandType.InlineBrTarget)
continue;
instr.Operand = GetInstruction (body, nb, (Instruction) body.Instructions [i].Operand);
}
foreach (ExceptionHandler eh in body.ExceptionHandlers) {
ExceptionHandler neh = new ExceptionHandler (eh.Type);
neh.TryStart = GetInstruction (body, nb, eh.TryStart);
neh.TryEnd = GetInstruction (body, nb, eh.TryEnd);
neh.HandlerStart = GetInstruction (body, nb, eh.HandlerStart);
neh.HandlerEnd = GetInstruction (body, nb, eh.HandlerEnd);
switch (eh.Type) {
case ExceptionHandlerType.Catch :
neh.CatchType = context.Import (eh.CatchType);
break;
case ExceptionHandlerType.Filter :
neh.FilterStart = GetInstruction (body, nb, eh.FilterStart);
neh.FilterEnd = GetInstruction (body, nb, eh.FilterEnd);
break;
}
nb.ExceptionHandlers.Add (neh);
}
return nb;
}
public void Simplify ()
{
foreach (Instruction i in this.Instructions) {
if (i.OpCode.OpCodeType != OpCodeType.Macro)
continue;
switch (i.OpCode.Code) {
case Code.Ldarg_0 :
Simplify (i, OpCodes.Ldarg,
CodeReader.GetParameter (this, 0));
break;
case Code.Ldarg_1 :
Simplify (i, OpCodes.Ldarg,
CodeReader.GetParameter (this, 1));
break;
case Code.Ldarg_2 :
Simplify (i, OpCodes.Ldarg,
CodeReader.GetParameter (this, 2));
break;
case Code.Ldarg_3 :
Simplify (i, OpCodes.Ldarg,
CodeReader.GetParameter (this, 3));
break;
case Code.Ldloc_0 :
Simplify (i, OpCodes.Ldloc,
CodeReader.GetVariable (this, 0));
break;
case Code.Ldloc_1 :
Simplify (i, OpCodes.Ldloc,
CodeReader.GetVariable (this, 1));
break;
case Code.Ldloc_2 :
Simplify (i, OpCodes.Ldloc,
CodeReader.GetVariable (this, 2));
break;
case Code.Ldloc_3 :
Simplify (i, OpCodes.Ldloc,
CodeReader.GetVariable (this, 3));
break;
case Code.Stloc_0 :
Simplify (i, OpCodes.Stloc,
CodeReader.GetVariable (this, 0));
break;
case Code.Stloc_1 :
Simplify (i, OpCodes.Stloc,
CodeReader.GetVariable (this, 1));
break;
case Code.Stloc_2 :
Simplify (i, OpCodes.Stloc,
CodeReader.GetVariable (this, 2));
break;
case Code.Stloc_3 :
Simplify (i, OpCodes.Stloc,
CodeReader.GetVariable (this, 3));
break;
case Code.Ldarg_S :
i.OpCode = OpCodes.Ldarg;
break;
case Code.Ldarga_S :
i.OpCode = OpCodes.Ldarga;
break;
case Code.Starg_S :
i.OpCode = OpCodes.Starg;
break;
case Code.Ldloc_S :
i.OpCode = OpCodes.Ldloc;
break;
case Code.Ldloca_S :
i.OpCode = OpCodes.Ldloca;
break;
case Code.Stloc_S :
i.OpCode = OpCodes.Stloc;
break;
case Code.Ldc_I4_M1 :
Simplify (i, OpCodes.Ldc_I4, -1);
break;
case Code.Ldc_I4_0 :
Simplify (i, OpCodes.Ldc_I4, 0);
break;
case Code.Ldc_I4_1 :
Simplify (i, OpCodes.Ldc_I4, 1);
break;
case Code.Ldc_I4_2 :
Simplify (i, OpCodes.Ldc_I4, 2);
break;
case Code.Ldc_I4_3 :
Simplify (i, OpCodes.Ldc_I4, 3);
break;
case Code.Ldc_I4_4 :
Simplify (i, OpCodes.Ldc_I4, 4);
break;
case Code.Ldc_I4_5 :
Simplify (i, OpCodes.Ldc_I4, 5);
break;
case Code.Ldc_I4_6 :
Simplify (i, OpCodes.Ldc_I4, 6);
break;
case Code.Ldc_I4_7 :
Simplify (i, OpCodes.Ldc_I4, 7);
break;
case Code.Ldc_I4_8 :
Simplify (i, OpCodes.Ldc_I4, 8);
break;
case Code.Ldc_I4_S :
i.OpCode = OpCodes.Ldc_I4;
i.Operand = (int) (sbyte) i.Operand;
break;
case Code.Br_S :
i.OpCode = OpCodes.Br;
break;
case Code.Brfalse_S :
i.OpCode = OpCodes.Brfalse;
break;
case Code.Brtrue_S :
i.OpCode = OpCodes.Brtrue;
break;
case Code.Beq_S :
i.OpCode = OpCodes.Beq;
break;
case Code.Bge_S :
i.OpCode = OpCodes.Bge;
break;
case Code.Bgt_S :
i.OpCode = OpCodes.Bgt;
break;
case Code.Ble_S :
i.OpCode = OpCodes.Ble;
break;
case Code.Blt_S :
i.OpCode = OpCodes.Blt;
break;
case Code.Bne_Un_S :
i.OpCode = OpCodes.Bne_Un;
break;
case Code.Bge_Un_S :
i.OpCode = OpCodes.Bge_Un;
break;
case Code.Bgt_Un_S :
i.OpCode = OpCodes.Bgt_Un;
break;
case Code.Ble_Un_S :
i.OpCode = OpCodes.Ble_Un;
break;
case Code.Blt_Un_S :
i.OpCode = OpCodes.Blt_Un;
break;
case Code.Leave_S :
i.OpCode = OpCodes.Leave;
break;
}
}
}
static void Simplify (Instruction i, OpCode op, object operand)
{
i.OpCode = op;
i.Operand = operand;
}
public void Accept (ICodeVisitor visitor)
{
visitor.VisitMethodBody (this);
m_variables.Accept (visitor);
m_instructions.Accept (visitor);
m_exceptions.Accept (visitor);
m_scopes.Accept (visitor);
visitor.TerminateMethodBody (this);
}
}
}

37
src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Mono.Cecil/Mono.Cecil.Cil/MethodDataSection.cs

@ -1,37 +0,0 @@ @@ -1,37 +0,0 @@
//
// MethodDataSection.cs
//
// Author:
// Jb Evain (jbevain@gmail.com)
//
// (C) 2005 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.
//
namespace Mono.Cecil.Cil {
internal enum MethodDataSection : ushort {
EHTable = 0x1,
OptILTable = 0x2,
FatFormat = 0x40,
MoreSects = 0x80
}
}

37
src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Mono.Cecil/Mono.Cecil.Cil/MethodHeader.cs

@ -1,37 +0,0 @@ @@ -1,37 +0,0 @@
//
// MethodHeader.cs
//
// Author:
// Jb Evain (jbevain@gmail.com)
//
// (C) 2005 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.
//
namespace Mono.Cecil.Cil {
internal enum MethodHeader : ushort {
TinyFormat = 0x2,
FatFormat = 0x3,
MoreSects = 0x8,
InitLocals = 0x10
}
}

139
src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Mono.Cecil/Mono.Cecil.Cil/OpCode.cs

@ -1,139 +0,0 @@ @@ -1,139 +0,0 @@
//
// OpCode.cs
//
// Author:
// Jb Evain (jbevain@gmail.com)
//
// (C) 2005 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.
//
namespace Mono.Cecil.Cil {
public struct OpCode {
string m_name;
byte m_op1;
byte m_op2;
int m_size;
Code m_code;
FlowControl m_flowControl;
OpCodeType m_opCodeType;
OperandType m_operandType;
StackBehaviour m_stackBehaviourPop;
StackBehaviour m_stackBehaviourPush;
public string Name {
get { return m_name; }
}
public int Size {
get { return m_size; }
}
public byte Op1 {
get { return m_op1; }
}
public byte Op2 {
get { return m_op2; }
}
public short Value {
get { return m_size == 1 ? m_op2 : (short) ((m_op1 << 8) | m_op2); }
}
public Code Code {
get { return m_code; }
}
public FlowControl FlowControl {
get { return m_flowControl; }
}
public OpCodeType OpCodeType {
get { return m_opCodeType; }
}
public OperandType OperandType {
get { return m_operandType; }
}
public StackBehaviour StackBehaviourPop {
get { return m_stackBehaviourPop; }
}
public StackBehaviour StackBehaviourPush {
get { return m_stackBehaviourPush; }
}
internal OpCode (string name, byte op1, byte op2, int size,
Code code, FlowControl flowControl,
OpCodeType opCodeType, OperandType operandType,
StackBehaviour pop, StackBehaviour push)
{
m_name = name;
m_op1 = op1;
m_op2 = op2;
m_size = size;
m_code = code;
m_flowControl = flowControl;
m_opCodeType = opCodeType;
m_operandType = operandType;
m_stackBehaviourPop = pop;
m_stackBehaviourPush = push;
if (op1 == 0xff)
OpCodes.OneByteOpCode [op2] = this;
else
OpCodes.TwoBytesOpCode [op2] = this;
}
public override int GetHashCode ()
{
return this.Value;
}
public override bool Equals (object obj)
{
if (!(obj is OpCode))
return false;
OpCode v = (OpCode) obj;
return v.m_op1 == m_op1 && v.m_op2 == m_op2;
}
public static bool operator == (OpCode one, OpCode other)
{
return one.Equals (other);
}
public static bool operator != (OpCode one, OpCode other)
{
return !one.Equals (other);
}
public override string ToString ()
{
return m_name;
}
}
}

39
src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Mono.Cecil/Mono.Cecil.Cil/OpCodeType.cs

@ -1,39 +0,0 @@ @@ -1,39 +0,0 @@
//
// OpCodeType.cs
//
// Author:
// Jb Evain (jbevain@gmail.com)
//
// (C) 2005 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.
//
namespace Mono.Cecil.Cil {
public enum OpCodeType {
Annotation,
Macro,
Nternal,
Objmodel,
Prefix,
Primitive
}
}

1583
src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Mono.Cecil/Mono.Cecil.Cil/OpCodes.cs

File diff suppressed because it is too large Load Diff

53
src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Mono.Cecil/Mono.Cecil.Cil/OperandType.cs

@ -1,53 +0,0 @@ @@ -1,53 +0,0 @@
//
// OperandType.cs
//
// Author:
// Jb Evain (jbevain@gmail.com)
//
// (C) 2005 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.
//
namespace Mono.Cecil.Cil {
public enum OperandType {
InlineBrTarget,
InlineField,
InlineI,
InlineI8,
InlineMethod,
InlineNone,
InlinePhi,
InlineR,
InlineSig,
InlineString,
InlineSwitch,
InlineTok,
InlineType,
InlineVar,
InlineParam,
ShortInlineBrTarget,
ShortInlineI,
ShortInlineR,
ShortInlineVar,
ShortInlineParam
}
}

79
src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Mono.Cecil/Mono.Cecil.Cil/Scope.cs

@ -1,79 +0,0 @@ @@ -1,79 +0,0 @@
//
// Scope.cs
//
// Author:
// Jb Evain (jbevain@gmail.com)
//
// (C) 2006 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.
//
namespace Mono.Cecil.Cil {
public class Scope : IScopeProvider, IVariableDefinitionProvider, ICodeVisitable {
Instruction m_start;
Instruction m_end;
Scope m_parent;
ScopeCollection m_scopes;
VariableDefinitionCollection m_variables;
public Instruction Start {
get { return m_start; }
set { m_start = value; }
}
public Instruction End {
get { return m_end; }
set { m_end = value; }
}
public Scope Parent {
get { return m_parent; }
set { m_parent = value; }
}
public ScopeCollection Scopes {
get {
if (m_scopes == null)
m_scopes = new ScopeCollection (this);
return m_scopes;
}
}
public VariableDefinitionCollection Variables {
get {
if (m_variables == null)
m_variables = new VariableDefinitionCollection (this);
return m_variables;
}
}
public void Accept (ICodeVisitor visitor)
{
visitor.VisitScope (this);
}
}
}

93
src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Mono.Cecil/Mono.Cecil.Cil/ScopeCollection.cs

@ -1,93 +0,0 @@ @@ -1,93 +0,0 @@
//
// ScopeCollection.cs
//
// Author:
// Jb Evain (jbevain@gmail.com)
//
// Generated by /CodeGen/cecil-gen.rb do not edit
// Wed Sep 27 12:46:54 CEST 2006
//
// (C) 2005 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.
//
namespace Mono.Cecil.Cil {
using System;
using System.Collections;
using Mono.Cecil.Cil;
public sealed class ScopeCollection : CollectionBase, ICodeVisitable {
IScopeProvider m_container;
public Scope this [int index] {
get { return List [index] as Scope; }
set { List [index] = value; }
}
public IScopeProvider Container {
get { return m_container; }
}
public ScopeCollection (IScopeProvider container)
{
m_container = container;
}
public void Add (Scope value)
{
List.Add (value);
}
public bool Contains (Scope value)
{
return List.Contains (value);
}
public int IndexOf (Scope value)
{
return List.IndexOf (value);
}
public void Insert (int index, Scope value)
{
List.Insert (index, value);
}
public void Remove (Scope value)
{
List.Remove (value);
}
protected override void OnValidate (object o)
{
if (! (o is Scope))
throw new ArgumentException ("Must be of type " + typeof (Scope).FullName);
}
public void Accept (ICodeVisitor visitor)
{
visitor.VisitScopeCollection (this);
}
}
}

78
src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Mono.Cecil/Mono.Cecil.Cil/SequencePoint.cs

@ -1,78 +0,0 @@ @@ -1,78 +0,0 @@
//
// SequencePoint.cs
//
// Author:
// Jb Evain (jbevain@gmail.com)
//
// (C) 2006 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.
//
namespace Mono.Cecil.Cil {
public class SequencePoint {
Document m_document;
int m_startLine;
int m_startColumn;
int m_endLine;
int m_endColumn;
public int StartLine {
get { return m_startLine; }
set { m_startLine = value; }
}
public int StartColumn {
get { return m_startColumn; }
set { m_startColumn = value; }
}
public int EndLine {
get { return m_endLine; }
set { m_endLine = value; }
}
public int EndColumn {
get { return m_endColumn; }
set { m_endColumn = value; }
}
public Document Document {
get { return m_document; }
set { m_document = value; }
}
public SequencePoint (Document document)
{
m_document = document;
}
public SequencePoint (Document doc, int startLine, int startCol, int endLine, int endCol) : this (doc)
{
m_startLine = startLine;
m_startColumn = startCol;
m_endLine = endLine;
m_endColumn = endCol;
}
}
}

62
src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Mono.Cecil/Mono.Cecil.Cil/StackBehaviour.cs

@ -1,62 +0,0 @@ @@ -1,62 +0,0 @@
//
// StackBehaviour.cs
//
// Author:
// Jb Evain (jbevain@gmail.com)
//
// (C) 2005 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.
//
namespace Mono.Cecil.Cil {
public enum StackBehaviour {
Pop0,
Pop1,
Pop1_pop1,
Popi,
Popi_pop1,
Popi_popi,
Popi_popi8,
Popi_popi_popi,
Popi_popr4,
Popi_popr8,
Popref,
Popref_pop1,
Popref_popi,
Popref_popi_popi,
Popref_popi_popi8,
Popref_popi_popr4,
Popref_popi_popr8,
Popref_popi_popref,
PopAll,
Push0,
Push1,
Push1_push1,
Pushi,
Pushi8,
Pushr4,
Pushr8,
Pushref,
Varpop,
Varpush
}
}

77
src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Mono.Cecil/Mono.Cecil.Cil/SymbolStoreHelper.cs

@ -1,77 +0,0 @@ @@ -1,77 +0,0 @@
//
// SymbolStoreHelper.cs
//
// Author:
// Jb Evain (jbevain@gmail.com)
//
// (C) 2006 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.
//
namespace Mono.Cecil.Cil {
using System;
using SR = System.Reflection;
class SymbolStoreHelper {
static readonly string MonoSymbolSupport = "Mono.Cecil.Mdb.MdbFactory, Mono.Cecil.Mdb";
static readonly string DotNetSymbolSupport = "Mono.Cecil.Pdb.PdbFactory, Mono.Cecil.Pdb";
static ISymbolStoreFactory s_factory;
SymbolStoreHelper ()
{
}
public static ISymbolReader GetReader (ModuleDefinition module)
{
InitFactory ();
return s_factory.CreateReader (module, module.Image.FileInformation.FullName);
}
public static ISymbolWriter GetWriter (ModuleDefinition module, string assemblyFileName)
{
InitFactory ();
return s_factory.CreateWriter (module, assemblyFileName);
}
static void InitFactory ()
{
if (s_factory != null)
return;
Type factoryType = Type.GetType (OnMono () ?
MonoSymbolSupport :
DotNetSymbolSupport,
true);
s_factory = (ISymbolStoreFactory) Activator.CreateInstance (factoryType);
}
static bool OnMono ()
{
return typeof (object).Assembly.GetType ("System.MonoType", false) != null;
}
}
}

55
src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Mono.Cecil/Mono.Cecil.Cil/VariableDefinition.cs

@ -1,55 +0,0 @@ @@ -1,55 +0,0 @@
//
// VariableDefinition.cs
//
// Author:
// Jb Evain (jbevain@gmail.com)
//
// (C) 2005 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.
//
namespace Mono.Cecil.Cil {
public sealed class VariableDefinition : VariableReference {
MethodDefinition m_method;
public MethodDefinition Method {
get { return m_method; }
set { m_method = value; }
}
public VariableDefinition (TypeReference variableType) : base (variableType)
{
}
public VariableDefinition (string name, int index, MethodDefinition method, TypeReference variableType) :
base (name, index, variableType)
{
m_method = method;
}
public override void Accept (ICodeVisitor visitor)
{
visitor.VisitVariableDefinition (this);
}
}
}

93
src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Mono.Cecil/Mono.Cecil.Cil/VariableDefinitionCollection.cs

@ -1,93 +0,0 @@ @@ -1,93 +0,0 @@
//
// VariableDefinitionCollection.cs
//
// Author:
// Jb Evain (jbevain@gmail.com)
//
// Generated by /CodeGen/cecil-gen.rb do not edit
// Wed Sep 27 12:46:53 CEST 2006
//
// (C) 2005 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.
//
namespace Mono.Cecil.Cil {
using System;
using System.Collections;
using Mono.Cecil.Cil;
public sealed class VariableDefinitionCollection : CollectionBase, ICodeVisitable {
IVariableDefinitionProvider m_container;
public VariableDefinition this [int index] {
get { return List [index] as VariableDefinition; }
set { List [index] = value; }
}
public IVariableDefinitionProvider Container {
get { return m_container; }
}
public VariableDefinitionCollection (IVariableDefinitionProvider container)
{
m_container = container;
}
public void Add (VariableDefinition value)
{
List.Add (value);
}
public bool Contains (VariableDefinition value)
{
return List.Contains (value);
}
public int IndexOf (VariableDefinition value)
{
return List.IndexOf (value);
}
public void Insert (int index, VariableDefinition value)
{
List.Insert (index, value);
}
public void Remove (VariableDefinition value)
{
List.Remove (value);
}
protected override void OnValidate (object o)
{
if (! (o is VariableDefinition))
throw new ArgumentException ("Must be of type " + typeof (VariableDefinition).FullName);
}
public void Accept (ICodeVisitor visitor)
{
visitor.VisitVariableDefinitionCollection (this);
}
}
}

73
src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Mono.Cecil/Mono.Cecil.Cil/VariableReference.cs

@ -1,73 +0,0 @@ @@ -1,73 +0,0 @@
//
// VariableReference.cs
//
// Author:
// Jb Evain (jbevain@gmail.com)
//
// (C) 2005 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.
//
namespace Mono.Cecil.Cil {
public abstract class VariableReference : ICodeVisitable {
string m_name;
int m_index;
TypeReference m_variableType;
public string Name {
get { return m_name; }
set { m_name = value; }
}
public int Index {
get { return m_index; }
set { m_index = value; }
}
public TypeReference VariableType {
get { return m_variableType; }
set { m_variableType = value; }
}
public VariableReference (TypeReference variableType)
{
m_variableType = variableType;
}
public VariableReference (string name, int index, TypeReference variableType) : this (variableType)
{
m_name = name;
m_index = index;
}
public override string ToString ()
{
if (m_name != null && m_name.Length > 0)
return m_name;
return string.Concat ("V_", m_index);
}
public abstract void Accept (ICodeVisitor visitor);
}
}

88
src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Mono.Cecil/Mono.Cecil.Metadata/Assembly.cs

@ -1,88 +0,0 @@ @@ -1,88 +0,0 @@
//
// AssemblyTable.cs
//
// Author:
// Jb Evain (jbevain@gmail.com)
//
// Generated by /CodeGen/cecil-gen.rb do not edit
// Tue Oct 10 23:08:25 CEST 2006
//
// (C) 2005 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.
//
namespace Mono.Cecil.Metadata {
using Mono.Cecil;
public sealed class AssemblyTable : IMetadataTable {
public const int RId = 0x20;
RowCollection m_rows;
public AssemblyRow this [int index] {
get { return m_rows [index] as AssemblyRow; }
set { m_rows [index] = value; }
}
public RowCollection Rows {
get { return m_rows; }
set { m_rows = value; }
}
public int Id {
get { return RId; }
}
internal AssemblyTable ()
{
}
public void Accept (IMetadataTableVisitor visitor)
{
visitor.VisitAssemblyTable (this);
this.Rows.Accept (visitor.GetRowVisitor ());
}
}
public sealed class AssemblyRow : IMetadataRow {
public AssemblyHashAlgorithm HashAlgId;
public ushort MajorVersion;
public ushort MinorVersion;
public ushort BuildNumber;
public ushort RevisionNumber;
public AssemblyFlags Flags;
public uint PublicKey;
public uint Name;
public uint Culture;
internal AssemblyRow ()
{
}
public void Accept (IMetadataRowVisitor visitor)
{
visitor.VisitAssemblyRow (this);
}
}
}

80
src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Mono.Cecil/Mono.Cecil.Metadata/AssemblyOS.cs

@ -1,80 +0,0 @@ @@ -1,80 +0,0 @@
//
// AssemblyOSTable.cs
//
// Author:
// Jb Evain (jbevain@gmail.com)
//
// Generated by /CodeGen/cecil-gen.rb do not edit
// Tue Oct 10 23:08:25 CEST 2006
//
// (C) 2005 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.
//
namespace Mono.Cecil.Metadata {
public sealed class AssemblyOSTable : IMetadataTable {
public const int RId = 0x22;
RowCollection m_rows;
public AssemblyOSRow this [int index] {
get { return m_rows [index] as AssemblyOSRow; }
set { m_rows [index] = value; }
}
public RowCollection Rows {
get { return m_rows; }
set { m_rows = value; }
}
public int Id {
get { return RId; }
}
internal AssemblyOSTable ()
{
}
public void Accept (IMetadataTableVisitor visitor)
{
visitor.VisitAssemblyOSTable (this);
this.Rows.Accept (visitor.GetRowVisitor ());
}
}
public sealed class AssemblyOSRow : IMetadataRow {
public uint OSPlatformID;
public uint OSMajorVersion;
public uint OSMinorVersion;
internal AssemblyOSRow ()
{
}
public void Accept (IMetadataRowVisitor visitor)
{
visitor.VisitAssemblyOSRow (this);
}
}
}

78
src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Mono.Cecil/Mono.Cecil.Metadata/AssemblyProcessor.cs

@ -1,78 +0,0 @@ @@ -1,78 +0,0 @@
//
// AssemblyProcessorTable.cs
//
// Author:
// Jb Evain (jbevain@gmail.com)
//
// Generated by /CodeGen/cecil-gen.rb do not edit
// Tue Oct 10 23:08:25 CEST 2006
//
// (C) 2005 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.
//
namespace Mono.Cecil.Metadata {
public sealed class AssemblyProcessorTable : IMetadataTable {
public const int RId = 0x21;
RowCollection m_rows;
public AssemblyProcessorRow this [int index] {
get { return m_rows [index] as AssemblyProcessorRow; }
set { m_rows [index] = value; }
}
public RowCollection Rows {
get { return m_rows; }
set { m_rows = value; }
}
public int Id {
get { return RId; }
}
internal AssemblyProcessorTable ()
{
}
public void Accept (IMetadataTableVisitor visitor)
{
visitor.VisitAssemblyProcessorTable (this);
this.Rows.Accept (visitor.GetRowVisitor ());
}
}
public sealed class AssemblyProcessorRow : IMetadataRow {
public uint Processor;
internal AssemblyProcessorRow ()
{
}
public void Accept (IMetadataRowVisitor visitor)
{
visitor.VisitAssemblyProcessorRow (this);
}
}
}

88
src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Mono.Cecil/Mono.Cecil.Metadata/AssemblyRef.cs

@ -1,88 +0,0 @@ @@ -1,88 +0,0 @@
//
// AssemblyRefTable.cs
//
// Author:
// Jb Evain (jbevain@gmail.com)
//
// Generated by /CodeGen/cecil-gen.rb do not edit
// Tue Oct 10 23:08:25 CEST 2006
//
// (C) 2005 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.
//
namespace Mono.Cecil.Metadata {
using Mono.Cecil;
public sealed class AssemblyRefTable : IMetadataTable {
public const int RId = 0x23;
RowCollection m_rows;
public AssemblyRefRow this [int index] {
get { return m_rows [index] as AssemblyRefRow; }
set { m_rows [index] = value; }
}
public RowCollection Rows {
get { return m_rows; }
set { m_rows = value; }
}
public int Id {
get { return RId; }
}
internal AssemblyRefTable ()
{
}
public void Accept (IMetadataTableVisitor visitor)
{
visitor.VisitAssemblyRefTable (this);
this.Rows.Accept (visitor.GetRowVisitor ());
}
}
public sealed class AssemblyRefRow : IMetadataRow {
public ushort MajorVersion;
public ushort MinorVersion;
public ushort BuildNumber;
public ushort RevisionNumber;
public AssemblyFlags Flags;
public uint PublicKeyOrToken;
public uint Name;
public uint Culture;
public uint HashValue;
internal AssemblyRefRow ()
{
}
public void Accept (IMetadataRowVisitor visitor)
{
visitor.VisitAssemblyRefRow (this);
}
}
}

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

Loading…
Cancel
Save