Browse Source

Add ShowChildIndexInBlock option to make debugging of larger blocks easier.

pull/1253/head
Siegfried Pammer 7 years ago
parent
commit
2047923809
  1. 14
      ICSharpCode.Decompiler/IL/ILAstWritingOptions.cs
  2. 5
      ICSharpCode.Decompiler/IL/Instructions/Block.cs
  3. 1
      ILSpy/DebugSteps.xaml

14
ICSharpCode.Decompiler/IL/ILAstWritingOptions.cs

@ -26,6 +26,7 @@ namespace ICSharpCode.Decompiler.IL @@ -26,6 +26,7 @@ namespace ICSharpCode.Decompiler.IL
private bool useLogicOperationSugar;
private bool useFieldSugar;
private bool showILRanges;
private bool showChildIndexInBlock;
/// <summary>
/// Sugar for logic.not/and/or.
@ -66,6 +67,19 @@ namespace ICSharpCode.Decompiler.IL @@ -66,6 +67,19 @@ namespace ICSharpCode.Decompiler.IL
}
}
/// <summary>
/// Show the child index of the instruction in ILAst output.
/// </summary>
public bool ShowChildIndexInBlock {
get { return showChildIndexInBlock; }
set {
if (showChildIndexInBlock != value) {
showChildIndexInBlock = value;
OnPropertyChanged();
}
}
}
protected virtual void OnPropertyChanged([CallerMemberName] string propertyName = null)
{
OnPropertyChanged(new PropertyChangedEventArgs(propertyName));

5
ICSharpCode.Decompiler/IL/Instructions/Block.cs

@ -161,7 +161,12 @@ namespace ICSharpCode.Decompiler.IL @@ -161,7 +161,12 @@ namespace ICSharpCode.Decompiler.IL
output.MarkFoldStart("{...}");
output.WriteLine("{");
output.Indent();
int index = 0;
foreach (var inst in Instructions) {
if (options.ShowChildIndexInBlock) {
output.Write("[" + index + "] ");
index++;
}
inst.WriteTo(output, options);
output.WriteLine();
}

1
ILSpy/DebugSteps.xaml

@ -11,6 +11,7 @@ @@ -11,6 +11,7 @@
<CheckBox Margin="3" Content="UseFieldSugar" IsChecked="{Binding UseFieldSugar, Source={x:Static local:DebugSteps.Options}}" />
<CheckBox Margin="3" Content="UseLogicOperationSugar" IsChecked="{Binding UseLogicOperationSugar, Source={x:Static local:DebugSteps.Options}}" />
<CheckBox Margin="3" Content="ShowILRanges" IsChecked="{Binding ShowILRanges, Source={x:Static local:DebugSteps.Options}}" />
<CheckBox Margin="3" Content="ShowChildIndexInBlock" IsChecked="{Binding ShowChildIndexInBlock, Source={x:Static local:DebugSteps.Options}}" />
</StackPanel>
<TreeView Name="tree" MouseDoubleClick="ShowStateAfter_Click" KeyDown="tree_KeyDown">
<TreeView.ItemTemplate>

Loading…
Cancel
Save