Browse Source

Merge pull request #2193 from iwillspeak/master

Show Sequence Points from CLI
pull/2201/head
Siegfried Pammer 5 years ago committed by GitHub
parent
commit
4f8cd0c597
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 11
      ICSharpCode.Decompiler.Console/IlspyCmdProgram.cs

11
ICSharpCode.Decompiler.Console/IlspyCmdProgram.cs

@ -47,6 +47,9 @@ Remarks: @@ -47,6 +47,9 @@ Remarks:
[Option("-il|--ilcode", "Show IL code.", CommandOptionType.NoValue)]
public bool ShowILCodeFlag { get; }
[Option("--il-sequence-points", "Show IL with sequence points. Implies -il.", CommandOptionType.NoValue)]
public bool ShowILSequencePointsFlag { get; }
[Option("-genpdb", "Generate PDB.", CommandOptionType.NoValue)]
public bool CreateDebugInfoFlag { get; }
@ -90,7 +93,7 @@ Remarks: @@ -90,7 +93,7 @@ Remarks:
}
return ListContent(InputAssemblyName, output, kinds);
} else if (ShowILCodeFlag) {
} else if (ShowILCodeFlag || ShowILSequencePointsFlag) {
if (outputDirectorySpecified) {
string outputName = Path.GetFileNameWithoutExtension(InputAssemblyName);
output = File.CreateText(Path.Combine(OutputDirectory, outputName) + ".il");
@ -169,7 +172,11 @@ Remarks: @@ -169,7 +172,11 @@ Remarks:
{
var module = new PEFile(assemblyFileName);
output.WriteLine($"// IL code: {module.Name}");
var disassembler = new ReflectionDisassembler(new PlainTextOutput(output), CancellationToken.None);
var disassembler = new ReflectionDisassembler(new PlainTextOutput(output), CancellationToken.None)
{
DebugInfo = TryLoadPDB(module),
ShowSequencePoints = ShowILSequencePointsFlag,
};
disassembler.WriteModuleContents(module);
return 0;
}

Loading…
Cancel
Save