├── images ├── icon.png ├── screenshot.gif └── screenshot.png ├── src ├── Resources │ ├── Reload.png │ ├── DisasmWindowCommand.png │ └── AsmSyntax.xshd ├── BenchmarkDotNet.Disassembler.x64 │ ├── BenchmarkDotNet.Disassembler.x64.csproj │ ├── DataContracts.cs │ ├── ClrSourceExtensions.cs │ └── Program.cs ├── DisasmoPackage.cs ├── Properties │ ├── AssemblyInfo.cs │ ├── Settings.settings │ └── Settings.Designer.cs ├── Analyzers │ ├── Base │ │ ├── CommonSuggestedActionsSourceProvider.cs │ │ ├── CommonSuggestedActionsSource.cs │ │ └── BaseSuggestedAction.cs │ ├── DisasmMethodOrClassAction.cs │ ├── BenchmarkSuggestedAction.cs │ └── ObjectLayoutSuggestedAction.cs ├── source.extension.vsixmanifest ├── app.config ├── Utils │ ├── ProcessUtils.cs │ ├── Bdn │ │ ├── BdnDisassembler.cs │ │ └── BdnDisassemblyPrettifier.cs │ ├── IdeUtils.cs │ └── ComPlusDisassemblyPrettifier.cs ├── Views │ ├── DisasmWindowControl.xaml.cs │ └── DisasmWindowControl.xaml ├── DisasmoPackage.vsct ├── ViewModels │ ├── SettingsViewModel.cs │ └── MainViewModel.cs └── Disasmo.Vsix.csproj ├── LICENSE ├── Disasmo.sln ├── README.md └── .gitignore /images/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/XenocodeRCE/Disasmo/master/images/icon.png -------------------------------------------------------------------------------- /images/screenshot.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/XenocodeRCE/Disasmo/master/images/screenshot.gif -------------------------------------------------------------------------------- /images/screenshot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/XenocodeRCE/Disasmo/master/images/screenshot.png -------------------------------------------------------------------------------- /src/Resources/Reload.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/XenocodeRCE/Disasmo/master/src/Resources/Reload.png -------------------------------------------------------------------------------- /src/Resources/DisasmWindowCommand.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/XenocodeRCE/Disasmo/master/src/Resources/DisasmWindowCommand.png -------------------------------------------------------------------------------- /src/BenchmarkDotNet.Disassembler.x64/BenchmarkDotNet.Disassembler.x64.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Exe 5 | net46 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /src/DisasmoPackage.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Runtime.InteropServices; 3 | using System.Threading; 4 | using Microsoft.VisualStudio; 5 | using Microsoft.VisualStudio.Shell; 6 | using Task = System.Threading.Tasks.Task; 7 | 8 | namespace Disasmo 9 | { 10 | [PackageRegistration(UseManagedResourcesOnly = true, AllowsBackgroundLoading = true)] 11 | [Guid(DisasmoPackage.PackageGuidString)] 12 | [ProvideAutoLoad(VSConstants.UICONTEXT.SolutionExistsAndFullyLoaded_string, PackageAutoLoadFlags.BackgroundLoad)] 13 | [ProvideToolWindow(typeof(DisasmWindow))] 14 | public sealed class DisasmoPackage : AsyncPackage 15 | { 16 | public const string PackageGuidString = "6d23b8d8-92f1-4f92-947a-b9021f6ab3dc"; 17 | 18 | protected override async Task InitializeAsync(CancellationToken cancellationToken, IProgress progress) 19 | { 20 | Current = this; 21 | await this.JoinableTaskFactory.SwitchToMainThreadAsync(cancellationToken); 22 | } 23 | 24 | public static DisasmoPackage Current { get; set; } 25 | } 26 | } -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2019 Egor Bogatov 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /src/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("Disasmo")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("Disasmo")] 13 | [assembly: AssemblyCopyright("")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // Version information for an assembly consists of the following four values: 23 | // 24 | // Major Version 25 | // Minor Version 26 | // Build Number 27 | // Revision 28 | // 29 | // You can specify all the values or you can default the Build and Revision Numbers 30 | // by using the '*' as shown below: 31 | // [assembly: AssemblyVersion("1.0.*")] 32 | [assembly: AssemblyVersion("1.0.0.0")] 33 | [assembly: AssemblyFileVersion("1.0.0.0")] 34 | -------------------------------------------------------------------------------- /src/Analyzers/Base/CommonSuggestedActionsSourceProvider.cs: -------------------------------------------------------------------------------- 1 | using System.ComponentModel.Composition; 2 | using Microsoft.CodeAnalysis; 3 | using Microsoft.VisualStudio.Language.Intellisense; 4 | using Microsoft.VisualStudio.LanguageServices; 5 | using Microsoft.VisualStudio.Text; 6 | using Microsoft.VisualStudio.Text.Editor; 7 | using Microsoft.VisualStudio.Text.Operations; 8 | using Microsoft.VisualStudio.Utilities; 9 | 10 | namespace Disasmo.Analyzers 11 | { 12 | [Export(typeof(ISuggestedActionsSourceProvider))] 13 | [Name("Test Suggested Actions")] 14 | [ContentType("text")] 15 | internal class CommonSuggestedActionsSourceProvider : ISuggestedActionsSourceProvider 16 | { 17 | public Workspace Workspace { get; } 18 | 19 | [Import(typeof(ITextStructureNavigatorSelectorService))] 20 | internal ITextStructureNavigatorSelectorService NavigatorService { get; set; } 21 | 22 | [ImportingConstructor] 23 | public CommonSuggestedActionsSourceProvider([Import(typeof(VisualStudioWorkspace), AllowDefault = true)] Workspace workspace) 24 | { 25 | Workspace = workspace; 26 | } 27 | 28 | public ISuggestedActionsSource CreateSuggestedActionsSource(ITextView textView, ITextBuffer textBuffer) 29 | { 30 | if (textBuffer == null && textView == null) 31 | return null; 32 | 33 | return new CommonSuggestedActionsSource(this, textView, textBuffer); 34 | } 35 | } 36 | } -------------------------------------------------------------------------------- /Disasmo.sln: -------------------------------------------------------------------------------- 1 | 2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio Version 16 4 | VisualStudioVersion = 16.0.28516.95 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Disasmo.Vsix", "src\Disasmo.Vsix.csproj", "{3334577B-6E6F-4AF2-BDD3-FE03D697CCC5}" 7 | EndProject 8 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BenchmarkDotNet.Disassembler.x64", "src\BenchmarkDotNet.Disassembler.x64\BenchmarkDotNet.Disassembler.x64.csproj", "{3428BD3B-BA98-42AA-864F-7C85A95A7D05}" 9 | EndProject 10 | Global 11 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 12 | Debug|Any CPU = Debug|Any CPU 13 | Release|Any CPU = Release|Any CPU 14 | EndGlobalSection 15 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 16 | {3334577B-6E6F-4AF2-BDD3-FE03D697CCC5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 17 | {3334577B-6E6F-4AF2-BDD3-FE03D697CCC5}.Debug|Any CPU.Build.0 = Debug|Any CPU 18 | {3334577B-6E6F-4AF2-BDD3-FE03D697CCC5}.Release|Any CPU.ActiveCfg = Release|Any CPU 19 | {3334577B-6E6F-4AF2-BDD3-FE03D697CCC5}.Release|Any CPU.Build.0 = Release|Any CPU 20 | {3428BD3B-BA98-42AA-864F-7C85A95A7D05}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 21 | {3428BD3B-BA98-42AA-864F-7C85A95A7D05}.Debug|Any CPU.Build.0 = Debug|Any CPU 22 | {3428BD3B-BA98-42AA-864F-7C85A95A7D05}.Release|Any CPU.ActiveCfg = Release|Any CPU 23 | {3428BD3B-BA98-42AA-864F-7C85A95A7D05}.Release|Any CPU.Build.0 = Release|Any CPU 24 | EndGlobalSection 25 | GlobalSection(SolutionProperties) = preSolution 26 | HideSolutionNode = FALSE 27 | EndGlobalSection 28 | GlobalSection(ExtensibilityGlobals) = postSolution 29 | SolutionGuid = {F9249C67-05FB-4105-A619-BBE976B34BA1} 30 | EndGlobalSection 31 | EndGlobal 32 | -------------------------------------------------------------------------------- /src/Properties/Settings.settings: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | False 10 | 11 | 12 | True 13 | 14 | 15 | False 16 | 17 | 18 | COMPlus_JitDiffableDasm=1 19 | 20 | 21 | False 22 | 23 | 24 | False 25 | 26 | 27 | True 28 | 29 | 30 | False 31 | 32 | 33 | False 34 | 35 | 36 | 1 37 | 38 | 39 | -------------------------------------------------------------------------------- /src/Analyzers/DisasmMethodOrClassAction.cs: -------------------------------------------------------------------------------- 1 | using System.IO; 2 | using System.Threading; 3 | using System.Threading.Tasks; 4 | using Microsoft.CodeAnalysis; 5 | using Microsoft.CodeAnalysis.CSharp.Syntax; 6 | using Microsoft.CodeAnalysis.FindSymbols; 7 | using Document = Microsoft.CodeAnalysis.Document; 8 | 9 | namespace Disasmo 10 | { 11 | 12 | internal class DisasmMethodOrClassAction : BaseSuggestedAction 13 | { 14 | public DisasmMethodOrClassAction(CommonSuggestedActionsSource actionsSource) : base(actionsSource) {} 15 | 16 | public override async void Invoke(CancellationToken cancellationToken) 17 | { 18 | var window = await IdeUtils.ShowWindowAsync(cancellationToken); 19 | window?.ViewModel?.RunOperationAsync(_symbol, _codeDoc, OperationType.Disasm); 20 | } 21 | 22 | protected override async Task GetSymbol(Document document, int tokenPosition, CancellationToken cancellationToken) 23 | { 24 | SemanticModel semanticModel = await document.GetSemanticModelAsync(cancellationToken); 25 | 26 | var syntaxTree = await semanticModel.SyntaxTree.GetRootAsync(cancellationToken); 27 | var token = syntaxTree.FindToken(tokenPosition); 28 | 29 | if (token.Parent is MethodDeclarationSyntax m) 30 | return ModelExtensions.GetDeclaredSymbol(semanticModel, m); 31 | 32 | if (token.Parent is ClassDeclarationSyntax c) 33 | return ModelExtensions.GetDeclaredSymbol(semanticModel, c); 34 | 35 | return null; 36 | } 37 | 38 | public override string DisplayText 39 | { 40 | get 41 | { 42 | if (_symbol is IMethodSymbol) 43 | return $"Disasm '{_symbol.Name}' method"; 44 | return $"Disasm '{_symbol.Name}' class"; 45 | } 46 | } 47 | } 48 | } -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Disasmo 2 | [VS2019 Add-in.](https://marketplace.visualstudio.com/items?itemName=EgorBogatov.Disasmo) 3 | Click on any method or class to see what .NET Core's JIT generates for them (ASM). 4 | 5 | ![demo](images/screenshot.gif) 6 | 7 | 8 | The Add-in targets .NET Core contributors so it assumes you already have CoreCLR local repo. 9 | If you don't have it, the steps to obtain and configure it are: 10 | ```bash 11 | git clone git@github.com:dotnet/coreclr.git 12 | cd coreclr 13 | build release skiptests 14 | build debug skiptests 15 | ``` 16 | We have to build it twice because we need mostly release files and a debug version of `clrjit.dll`. 17 | For more details visit [viewing-jit-dumps.md](https://github.com/dotnet/coreclr/blob/master/Documentation/building/viewing-jit-dumps.md). 18 | The Add-in basically follows steps mentioned in the doc above: 19 | ``` 20 | dotnet restore 21 | dotnet publish -r win-x64 -c Release 22 | set COMPlus_JitDisasm=%method% 23 | ConsoleApp123.exe 24 | ``` 25 | In order to be able to disasm any method (even unused) the add-in injects a small line to the app's `Main()`: 26 | ```csharp 27 | System.Runtime.CompilerServices.RuntimeHelpers.PrepareMethod(%methodHandle%); 28 | ``` 29 | **However**, you can use BenchmarkDotNet-style disassembler without any local CoreCLR, 30 | just enable it in "Settings/Use BDN disasm". 31 | 32 | ## Known Issues 33 | * Only .NET Core Console applications are supported 34 | * I only tested it for .NET Core 3.0 apps 35 | * Multi-target projects are not supported 36 | * Generic methods are not supported 37 | * **Resharper** hides Roslyn actions by default (Uncheck "Do not show Visual Studio Light Bulb"). 38 | 39 | ## 3rd party dependencies 40 | * [MvvmLight](https://github.com/lbugnion/mvvmlight) (MIT) 41 | * [AvalonEdit](https://github.com/icsharpcode/AvalonEdit) (MIT) 42 | * [BenchmarkDotNet](https://github.com/dotnet/BenchmarkDotNet) (MIT) 43 | * [ObjectLayoutInspector](https://github.com/SergeyTeplyakov/ObjectLayoutInspector) (MIT) 44 | -------------------------------------------------------------------------------- /src/Analyzers/BenchmarkSuggestedAction.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Linq; 3 | using System.Threading; 4 | using System.Threading.Tasks; 5 | using Microsoft.CodeAnalysis; 6 | using Microsoft.CodeAnalysis.CSharp.Syntax; 7 | using Microsoft.CodeAnalysis.Text; 8 | using Microsoft.VisualStudio.Text; 9 | 10 | namespace Disasmo 11 | { 12 | internal class BenchmarkSuggestedAction : BaseSuggestedAction 13 | { 14 | public BenchmarkSuggestedAction(CommonSuggestedActionsSource actionsSource) : base(actionsSource) {} 15 | 16 | protected override async Task GetSymbol(Document document, int tokenPosition, CancellationToken cancellationToken) 17 | { 18 | SemanticModel semanticModel = await document.GetSemanticModelAsync(cancellationToken); 19 | 20 | var syntaxTree = await semanticModel.SyntaxTree.GetRootAsync(cancellationToken); 21 | var token = syntaxTree.FindToken(tokenPosition); 22 | 23 | if (token.Parent is MethodDeclarationSyntax method) 24 | return ModelExtensions.GetDeclaredSymbol(semanticModel, method); 25 | 26 | return null; 27 | } 28 | 29 | public override async void Invoke(CancellationToken cancellationToken) 30 | { 31 | DisasmWindow window = await IdeUtils.ShowWindowAsync(cancellationToken); 32 | SyntaxNode syntaxNode = await _symbol.DeclaringSyntaxReferences.FirstOrDefault().GetSyntaxAsync(); 33 | ITrackingSpan trackingSpan = SnapshotSpan.Snapshot.CreateTrackingSpan(new Span(syntaxNode.FullSpan.Start, syntaxNode.FullSpan.Length), SpanTrackingMode.EdgeInclusive); 34 | trackingSpan.TextBuffer.Insert(syntaxNode.SpanStart, "[BenchmarkDotNet.Attributes.Benchmark]" + Environment.NewLine + "\t\t"); 35 | 36 | window?.ViewModel?.RunOperationAsync(_symbol, _codeDoc, OperationType.Benchmark); 37 | } 38 | 39 | public override string DisplayText => $"Benchmark '{_symbol}' (Adds BenchmarkDotNet package)"; 40 | } 41 | } -------------------------------------------------------------------------------- /src/source.extension.vsixmanifest: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Disasmo 6 | VS2019 Add-in. Click on any method to see what ASM JIT will generate for it. 7 | http://github.com/EgorBo/disasmo 8 | ..\images\icon.png 9 | ..\images\screenshot.png 10 | .NET Core, disasm, asm, disassembler 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /src/app.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 |
6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | False 15 | 16 | 17 | True 18 | 19 | 20 | False 21 | 22 | 23 | COMPlus_JitDiffableDasm=1 24 | 25 | 26 | False 27 | 28 | 29 | False 30 | 31 | 32 | True 33 | 34 | 35 | False 36 | 37 | 38 | False 39 | 40 | 41 | 1 42 | 43 | 44 | 45 | -------------------------------------------------------------------------------- /src/Analyzers/ObjectLayoutSuggestedAction.cs: -------------------------------------------------------------------------------- 1 | using System.Threading; 2 | using System.Threading.Tasks; 3 | using Microsoft.CodeAnalysis; 4 | using Microsoft.CodeAnalysis.CSharp; 5 | using Microsoft.CodeAnalysis.CSharp.Syntax; 6 | 7 | namespace Disasmo 8 | { 9 | internal class ObjectLayoutSuggestedAction : BaseSuggestedAction 10 | { 11 | public ObjectLayoutSuggestedAction(CommonSuggestedActionsSource actionsSource) : base(actionsSource) {} 12 | 13 | protected override async Task GetSymbol(Document document, int tokenPosition, CancellationToken cancellationToken) 14 | { 15 | SemanticModel semanticModel = await document.GetSemanticModelAsync(cancellationToken); 16 | 17 | var syntaxTree = await semanticModel.SyntaxTree.GetRootAsync(cancellationToken); 18 | var token = syntaxTree.FindToken(tokenPosition); 19 | 20 | if (token.Parent is ClassDeclarationSyntax c) 21 | return ModelExtensions.GetDeclaredSymbol(semanticModel, c); 22 | 23 | var vds = token.Parent is VariableDeclarationSyntax variable ? variable : token.Parent?.Parent as VariableDeclarationSyntax; 24 | if (vds != null) 25 | { 26 | var info = semanticModel.GetSymbolInfo(vds.Type); 27 | if (string.IsNullOrWhiteSpace(info.Symbol.ToString())) 28 | return null; 29 | return info.Symbol; 30 | } 31 | 32 | if (token.Parent is ParameterSyntax parameterSyntax) 33 | { 34 | var info = semanticModel.GetSymbolInfo(parameterSyntax.Type); 35 | if (string.IsNullOrWhiteSpace(info.Symbol.ToString())) 36 | return null; 37 | return info.Symbol; 38 | } 39 | 40 | return null; 41 | } 42 | 43 | public override async void Invoke(CancellationToken cancellationToken) 44 | { 45 | var window = await IdeUtils.ShowWindowAsync(cancellationToken); 46 | window?.ViewModel?.RunOperationAsync(_symbol, _codeDoc, OperationType.ObjectLayout); 47 | } 48 | 49 | public override string DisplayText => $"Show memory layout for '{_symbol}' (Adds ObjectLayoutInspector package)"; 50 | } 51 | } -------------------------------------------------------------------------------- /src/Utils/ProcessUtils.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Diagnostics; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using Microsoft.VisualStudio.Threading; 7 | 8 | namespace Disasmo 9 | { 10 | public static class ProcessUtils 11 | { 12 | public static async Task RunProcess(string path, string args = "", Dictionary envVars = null, string workingDir = null) 13 | { 14 | var logger = new StringBuilder(); 15 | var loggerForErrors = new StringBuilder(); 16 | try 17 | { 18 | var processStartInfo = new ProcessStartInfo 19 | { 20 | FileName = path, 21 | UseShellExecute = false, 22 | CreateNoWindow = true, 23 | RedirectStandardError = true, 24 | RedirectStandardOutput = true, 25 | Arguments = args, 26 | }; 27 | 28 | if (workingDir != null) 29 | processStartInfo.WorkingDirectory = workingDir; 30 | 31 | if (envVars != null) 32 | { 33 | foreach (var envVar in envVars) 34 | processStartInfo.EnvironmentVariables[envVar.Key] = envVar.Value; 35 | } 36 | 37 | var process = Process.Start(processStartInfo); 38 | 39 | process.ErrorDataReceived += (sender, e) => 40 | { 41 | logger.AppendLine(e.Data); 42 | loggerForErrors.AppendLine(e.Data); 43 | }; 44 | process.OutputDataReceived += (sender, e) => logger.AppendLine(e.Data); 45 | process.BeginOutputReadLine(); 46 | process.BeginErrorReadLine(); 47 | await process.WaitForExitAsync(); 48 | 49 | return new ProcessResult { Error = loggerForErrors.ToString().Trim('\r', '\n'), Output = logger.ToString().Trim('\r', '\n') }; 50 | } 51 | catch (Exception e) 52 | { 53 | return new ProcessResult { Error = $"RunProcess failed:{e.Message}.\npath={path}\nargs={args}\nworkingdir={workingDir ?? Environment.CurrentDirectory}\n{loggerForErrors}" }; 54 | } 55 | } 56 | } 57 | 58 | public class ProcessResult 59 | { 60 | public string Output { get; set; } 61 | public string Error { get; set; } 62 | } 63 | } -------------------------------------------------------------------------------- /src/Analyzers/Base/CommonSuggestedActionsSource.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Threading; 5 | using System.Threading.Tasks; 6 | using Disasmo.Analyzers; 7 | using Microsoft.VisualStudio.Language.Intellisense; 8 | using Microsoft.VisualStudio.Text; 9 | using Microsoft.VisualStudio.Text.Editor; 10 | 11 | namespace Disasmo 12 | { 13 | internal class CommonSuggestedActionsSource : ISuggestedActionsSource 14 | { 15 | private BaseSuggestedAction[] _baseActions; 16 | 17 | public CommonSuggestedActionsSourceProvider SourceProvider { get; } 18 | 19 | public ITextView TextView { get; } 20 | public ITextBuffer TextBuffer { get; } 21 | 22 | public CommonSuggestedActionsSource(CommonSuggestedActionsSourceProvider sourceProvider, 23 | ITextView textView, ITextBuffer textBuffer) 24 | { 25 | SourceProvider = sourceProvider; 26 | TextView = textView; 27 | TextBuffer = textBuffer; 28 | _baseActions = new BaseSuggestedAction[] 29 | { 30 | new DisasmMethodOrClassAction(this), 31 | new ObjectLayoutSuggestedAction(this), 32 | new BenchmarkSuggestedAction(this), 33 | }; 34 | } 35 | 36 | public event EventHandler SuggestedActionsChanged; 37 | 38 | public void Dispose() {} 39 | 40 | public IEnumerable GetSuggestedActions( 41 | ISuggestedActionCategorySet requestedActionCategories, SnapshotSpan range, 42 | CancellationToken cancellationToken) 43 | { 44 | return _baseActions 45 | .Where(a => a.Symbol != null) 46 | .Select(a => 47 | { 48 | a.SnapshotSpan = range; 49 | return new SuggestedActionSet(a.GetType().Name, new[] {a}, priority: SuggestedActionSetPriority.Low); 50 | }); 51 | } 52 | 53 | public async Task HasSuggestedActionsAsync(ISuggestedActionCategorySet requestedActionCategories, 54 | SnapshotSpan range, CancellationToken cancellationToken) 55 | { 56 | return await await Task.WhenAny(_baseActions.Select(t => 57 | { 58 | t.SnapshotSpan = range; 59 | return t.Validate(cancellationToken); 60 | })); 61 | } 62 | 63 | public bool TryGetTelemetryId(out Guid telemetryId) 64 | { 65 | telemetryId = Guid.Empty; 66 | return false; 67 | } 68 | } 69 | } -------------------------------------------------------------------------------- /src/Analyzers/Base/BaseSuggestedAction.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Drawing; 4 | using System.Linq; 5 | using System.Threading; 6 | using System.Threading.Tasks; 7 | using Microsoft.CodeAnalysis; 8 | using Microsoft.CodeAnalysis.Text; 9 | using Microsoft.VisualStudio.Imaging; 10 | using Microsoft.VisualStudio.Imaging.Interop; 11 | using Microsoft.VisualStudio.Language.Intellisense; 12 | using Microsoft.VisualStudio.Shell; 13 | using Microsoft.VisualStudio.Text; 14 | using Point = System.Windows.Point; 15 | using Size = System.Windows.Size; 16 | using Task = System.Threading.Tasks.Task; 17 | 18 | namespace Disasmo 19 | { 20 | internal abstract class BaseSuggestedAction : ISuggestedAction 21 | { 22 | protected readonly CommonSuggestedActionsSource _actionsSource; 23 | protected ISymbol _symbol; 24 | protected Document _codeDoc; 25 | 26 | public BaseSuggestedAction(CommonSuggestedActionsSource actionsSource) => _actionsSource = actionsSource; 27 | 28 | public SnapshotSpan SnapshotSpan { get; set; } 29 | 30 | public async Task Validate(CancellationToken cancellationToken) 31 | { 32 | try 33 | { 34 | var document = SnapshotSpan.Snapshot.TextBuffer.GetRelatedDocuments().FirstOrDefault(); 35 | _codeDoc = document; 36 | _symbol = document != null ? await GetSymbol(document, SnapshotSpan.Start, cancellationToken) : null; 37 | return _symbol != null; 38 | } 39 | catch 40 | { 41 | return false; 42 | } 43 | } 44 | 45 | public ISymbol Symbol => _symbol; 46 | protected abstract Task GetSymbol(Document document, int tokenPosition, CancellationToken cancellationToken); 47 | public abstract string DisplayText { get; } 48 | public string IconAutomationText => "Disamo"; 49 | ImageMoniker ISuggestedAction.IconMoniker => KnownMonikers.CSLightswitch; 50 | public string InputGestureText => null; 51 | public bool HasActionSets => false; 52 | public Task> GetActionSetsAsync(CancellationToken cancellationToken) => null; 53 | public bool HasPreview => false; 54 | public Task GetPreviewAsync(CancellationToken cancellationToken) => Task.FromResult(null); 55 | public void Dispose() { } 56 | public abstract void Invoke(CancellationToken cancellationToken); 57 | public bool TryGetTelemetryId(out Guid telemetryId) 58 | { 59 | telemetryId = Guid.Empty; 60 | return false; 61 | } 62 | } 63 | } -------------------------------------------------------------------------------- /src/BenchmarkDotNet.Disassembler.x64/DataContracts.cs: -------------------------------------------------------------------------------- 1 | // This file was copied from https://github.com/dotnet/BenchmarkDotNet/tree/master/src/BenchmarkDotNet.Disassembler.x64 2 | // (c) BenchmarkDotNet 3 | 4 | using System; 5 | using System.Collections.Generic; 6 | using System.Xml.Serialization; 7 | 8 | namespace BenchmarkDotNet.Disassembler 9 | { 10 | public class Code 11 | { 12 | public string TextRepresentation { get; set; } 13 | public string Comment { get; set; } 14 | } 15 | 16 | public class Sharp : Code 17 | { 18 | public string FilePath { get; set; } 19 | public int LineNumber { get; set; } 20 | } 21 | 22 | public class IL : Code 23 | { 24 | public int Offset { get; set; } 25 | } 26 | 27 | public class Asm : Code 28 | { 29 | /// 30 | /// The native start offset of this ASM representation 31 | /// 32 | public ulong StartAddress { get; set; } 33 | 34 | /// 35 | /// The native end offset of this ASM representation 36 | /// 37 | public ulong EndAddress { get; set; } 38 | 39 | public uint SizeInBytes { get; set; } 40 | } 41 | 42 | public class Map 43 | { 44 | [XmlArray("Instructions")] 45 | [XmlArrayItem(nameof(Code), typeof(Code))] 46 | [XmlArrayItem(nameof(Sharp), typeof(Sharp))] 47 | [XmlArrayItem(nameof(IL), typeof(IL))] 48 | [XmlArrayItem(nameof(Asm), typeof(Asm))] 49 | public List Instructions { get; set; } 50 | } 51 | 52 | public class DisassembledMethod 53 | { 54 | public string Name { get; set; } 55 | 56 | public ulong NativeCode { get; set; } 57 | 58 | public string Problem { get; set; } 59 | 60 | public Map[] Maps { get; set; } 61 | 62 | public string CommandLine { get; set; } 63 | 64 | public static DisassembledMethod Empty(string fullSignature, ulong nativeCode, string problem) 65 | => new DisassembledMethod 66 | { 67 | Name = fullSignature, 68 | NativeCode = nativeCode, 69 | Maps = Array.Empty(), 70 | Problem = problem 71 | }; 72 | } 73 | 74 | public class DisassemblyResult 75 | { 76 | public DisassembledMethod[] Methods { get; set; } 77 | public string[] Errors { get; set; } 78 | 79 | public DisassemblyResult() 80 | { 81 | Methods = new DisassembledMethod[0]; 82 | Errors = new string[0]; 83 | } 84 | } 85 | 86 | public static class DisassemblerConstants 87 | { 88 | public const string NotManagedMethod = "not managed method"; 89 | 90 | public const string DisassemblerEntryMethodName = "__ForDisassemblyDiagnoser__"; 91 | } 92 | } -------------------------------------------------------------------------------- /src/Utils/Bdn/BdnDisassembler.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using BenchmarkDotNet.Disassembler; 4 | using System.Diagnostics; 5 | using System.IO; 6 | using System.Threading.Tasks; 7 | using System.Windows.Documents; 8 | using System.Xml.Serialization; 9 | using Microsoft.Diagnostics.RuntimeExt; 10 | 11 | namespace Disasmo 12 | { 13 | public class BdnDisassembler 14 | { 15 | // An alternative way to disasm C# code is to use ClrMD (BenchmarkDotNet impl): 16 | public static async Task Disasm(string path, string type, string method, Dictionary envVars, 17 | bool showAsm, bool showIl, bool showSource, bool prologueAndEpilogue, int recursionDepth) 18 | { 19 | string bdnDisasmer = typeof(ClrSourceExtensions).Assembly.Location; 20 | string tmpOutput = Path.GetTempFileName(); 21 | 22 | try 23 | { 24 | var appProcessParams = new ProcessStartInfo(path) 25 | { 26 | CreateNoWindow = true, 27 | UseShellExecute = false, 28 | RedirectStandardError = true, 29 | RedirectStandardOutput = true, 30 | RedirectStandardInput = true, 31 | }; 32 | 33 | foreach (var pair in envVars) 34 | appProcessParams.EnvironmentVariables[pair.Key] = pair.Value; 35 | 36 | var appProcess = Process.Start(appProcessParams); 37 | 38 | // wait while everything is being jitted 39 | await appProcess.StandardOutput.ReadLineAsync(); 40 | 41 | var bdnProcess = Process.Start( 42 | new ProcessStartInfo(bdnDisasmer) 43 | { 44 | CreateNoWindow = true, 45 | UseShellExecute = false, 46 | Arguments = $"{appProcess.Id} {type} {method} {showAsm} {showIl} {showSource} {prologueAndEpilogue} {recursionDepth} \"{tmpOutput}\"", 47 | RedirectStandardError = true, 48 | RedirectStandardOutput = true 49 | }); 50 | 51 | bdnProcess.WaitForExit(20000); 52 | 53 | appProcess.StandardInput.WriteLine("Attached!"); 54 | appProcess.Kill(); 55 | 56 | var output = bdnProcess.StandardOutput.ReadToEnd(); 57 | var error = bdnProcess.StandardError.ReadToEnd(); 58 | 59 | if (!string.IsNullOrWhiteSpace(output) || !string.IsNullOrWhiteSpace(error)) 60 | return new DisassemblyResult {Errors = new[] {output, error, "Output: " + tmpOutput}}; 61 | 62 | var xmlSerializer = new XmlSerializer(typeof(DisassemblyResult)); 63 | DisassemblyResult result; 64 | using (var stream = File.OpenRead(tmpOutput)) 65 | result = (DisassemblyResult) xmlSerializer.Deserialize(stream); 66 | 67 | File.Delete(tmpOutput); 68 | return result; 69 | } 70 | catch (Exception exc) 71 | { 72 | return new DisassemblyResult {Errors = new[] {exc.ToString()}}; 73 | } 74 | } 75 | } 76 | } 77 | -------------------------------------------------------------------------------- /src/Views/DisasmWindowControl.xaml.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Diagnostics; 3 | using System.IO; 4 | using System.Runtime.InteropServices; 5 | using System.Windows.Data; 6 | using System.Windows.Navigation; 7 | using System.Xml; 8 | using ICSharpCode.AvalonEdit.Highlighting; 9 | using ICSharpCode.AvalonEdit.Highlighting.Xshd; 10 | using Microsoft.CodeAnalysis; 11 | using Microsoft.VisualStudio.Shell; 12 | 13 | namespace Disasmo 14 | { 15 | using System.Windows; 16 | using System.Windows.Controls; 17 | 18 | /// 19 | /// Interaction logic for DisasmWindowControl. 20 | /// 21 | public partial class DisasmWindowControl : UserControl 22 | { 23 | private ISymbol _currentMethodSymbol; 24 | 25 | /// 26 | /// Initializes a new instance of the class. 27 | /// 28 | public DisasmWindowControl() 29 | { 30 | this.InitializeComponent(); 31 | MainViewModel.PropertyChanged += (s, e) => 32 | { 33 | // AvalonEdit is not bindable (lazy workaround) 34 | if (e.PropertyName == "Output") OutputEditor.Text = MainViewModel.Output; 35 | if (e.PropertyName == "PreviousOutput") OutputEditorPrev.Text = MainViewModel.PreviousOutput; 36 | if (e.PropertyName == "Success") ApplySyntaxHighlighting(MainViewModel.Success); 37 | }; 38 | } 39 | 40 | private void ApplySyntaxHighlighting(bool asm) 41 | { 42 | if (asm) 43 | { 44 | using (Stream stream = typeof(DisasmWindowControl).Assembly.GetManifestResourceStream("Disasmo.Resources.AsmSyntax.xshd")) 45 | using (var reader = new XmlTextReader(stream)) 46 | { 47 | var sh = HighlightingLoader.Load(reader, HighlightingManager.Instance); 48 | OutputEditor.SyntaxHighlighting = sh; 49 | OutputEditorPrev.SyntaxHighlighting = sh; 50 | } 51 | } 52 | else 53 | { 54 | var sh = (IHighlightingDefinition)new HighlightingDefinitionTypeConverter().ConvertFrom("txt"); 55 | OutputEditor.SyntaxHighlighting = sh; 56 | OutputEditorPrev.SyntaxHighlighting = sh; 57 | } 58 | } 59 | 60 | private void Hyperlink_OnRequestNavigate(object sender, RequestNavigateEventArgs e) 61 | { 62 | Process.Start(new ProcessStartInfo(e.Uri.AbsoluteUri)); 63 | e.Handled = true; 64 | } 65 | } 66 | 67 | [Guid("97cd0cd6-1d77-4848-8b6e-dc82cdccc6d7")] 68 | public class DisasmWindow : ToolWindowPane 69 | { 70 | public MainViewModel ViewModel => (MainViewModel) ((DisasmWindowControl) Content).DataContext; 71 | 72 | public DisasmWindow() : base(null) 73 | { 74 | this.Caption = "Disasmo"; 75 | this.Content = new DisasmWindowControl(); 76 | } 77 | } 78 | 79 | public class BooleanToVisibilityConverter : IValueConverter 80 | { 81 | public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) 82 | => value is bool b && b ? Visibility.Visible : Visibility.Collapsed; 83 | 84 | public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) 85 | => value is Visibility visibility && visibility == Visibility.Visible; 86 | } 87 | 88 | public class InverseBooleanConverter : IValueConverter 89 | { 90 | public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) => !(bool)value; 91 | 92 | public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) => throw new NotSupportedException(); 93 | } 94 | } -------------------------------------------------------------------------------- /src/Utils/IdeUtils.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.IO; 3 | using System.Linq; 4 | using System.Threading; 5 | using System.Windows; 6 | using EnvDTE; 7 | using Microsoft.VisualStudio.Shell; 8 | using Microsoft.VisualStudio.Shell.Interop; 9 | 10 | namespace Disasmo 11 | { 12 | public static class IdeUtils 13 | { 14 | public static Project GetActiveProject(this DTE dte) 15 | { 16 | var activeSolutionProjects = dte.ActiveSolutionProjects as Array; 17 | if (activeSolutionProjects != null && activeSolutionProjects.Length > 0) 18 | return activeSolutionProjects.GetValue(0) as Project; 19 | return null; 20 | } 21 | 22 | public static Configuration GetReleaseConfig(this Project project) 23 | { 24 | var allReleaseCfgs = project.ConfigurationManager.OfType().Where(c => c.ConfigurationName == "Release").ToList(); 25 | var cfg = allReleaseCfgs.FirstOrDefault(c => c.PlatformName?.Contains("64") == true); 26 | if (cfg == null) 27 | { 28 | cfg = allReleaseCfgs.FirstOrDefault(c => c.PlatformName?.Contains("Any") == true); 29 | if (cfg == null) 30 | { 31 | return null; 32 | } 33 | } 34 | 35 | return cfg; 36 | } 37 | 38 | public static string GetPropertyValueSafe(this Configuration c, string key, string defaultValue = "") 39 | { 40 | try { return c.Properties?.Item(key)?.Value?.ToString() ?? defaultValue; } 41 | catch { return defaultValue; } 42 | } 43 | 44 | public static void RunDiffTools(string contentLeft, string contentRight) 45 | { 46 | string tmpFileLeft = Path.GetTempFileName(); 47 | string tmpFileRight = Path.GetTempFileName(); 48 | 49 | File.WriteAllText(tmpFileLeft, contentLeft); 50 | File.WriteAllText(tmpFileRight, contentRight); 51 | 52 | try 53 | { 54 | // Copied from https://github.com/madskristensen/FileDiffer/blob/master/src/Commands/DiffFilesCommand.cs#L48-L56 (c) madskristensen 55 | object args = $"\"{tmpFileLeft}\" \"{tmpFileRight}\""; 56 | ((DTE)Package.GetGlobalService(typeof(SDTE))).Commands.Raise("5D4C0442-C0A2-4BE8-9B4D-AB1C28450942", 256, ref args, ref args); 57 | } 58 | catch (Exception e) 59 | { 60 | return; 61 | } 62 | finally 63 | { 64 | File.Delete(tmpFileLeft); 65 | File.Delete(tmpFileRight); 66 | } 67 | } 68 | 69 | public static async System.Threading.Tasks.Task ShowWindowAsync(CancellationToken cancellationToken) where T : class 70 | { 71 | try 72 | { 73 | await DisasmoPackage.Current.JoinableTaskFactory.SwitchToMainThreadAsync(cancellationToken); 74 | 75 | if (DisasmoPackage.Current == null) 76 | { 77 | MessageBox.Show("DisasmoPackage is loading... please try again later."); 78 | return null; 79 | } 80 | 81 | await DisasmoPackage.Current.ShowToolWindowAsync(typeof(DisasmWindow), 0, create: true, cancellationToken: cancellationToken); 82 | await DisasmoPackage.Current.JoinableTaskFactory.SwitchToMainThreadAsync(cancellationToken); 83 | // no idea why I have to call it twice, it doesn't work if I do it only once on the first usage 84 | var window = await DisasmoPackage.Current.ShowToolWindowAsync(typeof(T), 0, create: true, cancellationToken: cancellationToken); 85 | await DisasmoPackage.Current.JoinableTaskFactory.SwitchToMainThreadAsync(cancellationToken); 86 | return window as T; 87 | } 88 | catch 89 | { 90 | return null; 91 | } 92 | } 93 | } 94 | } 95 | -------------------------------------------------------------------------------- /src/DisasmoPackage.vsct: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 9 | 10 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 25 | 26 | 33 | 34 | 35 | 37 | 38 | 45 | 52 | 53 | 54 | 55 | 56 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | -------------------------------------------------------------------------------- /src/Utils/ComPlusDisassemblyPrettifier.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Text.RegularExpressions; 6 | 7 | namespace Disasmo.Utils 8 | { 9 | public class ComPlusDisassemblyPrettifier 10 | { 11 | /// 12 | /// Handles COMPlus_JitDisasm's asm format 13 | /// Unfortunately there is no option to hide prologues and epilogues 14 | /// in general, format is: 15 | /// 16 | /// ; Assembly listing for method Program:MyMethod() 17 | /// ; bla-bla 18 | /// ; bla-bla 19 | /// 20 | /// G_M42249_IG01: 21 | /// 0F1F440000 nop 22 | /// 23 | /// G_M42249_IG02: 24 | /// B82A000000 mov eax, 42 25 | /// 26 | /// G_M42249_IG03: 27 | /// C3 ret 28 | /// 29 | /// ; Total bytes of code 76, prolog size 5 for method Program:SelectBucketIndex_old(int):int 30 | /// ; ============================================================ 31 | /// 32 | public static string Prettify(string rawAsm, bool hidePrologueAndEpilogue, bool minimalComments) 33 | { 34 | if (!hidePrologueAndEpilogue && !minimalComments) 35 | return rawAsm; 36 | try 37 | { 38 | var lines = rawAsm.Split(new[] { "\r\n", "\n" }, StringSplitOptions.RemoveEmptyEntries); 39 | var blocks = new List(); 40 | 41 | var prevBlock = BlockType.Unknown; 42 | var currentMethod = ""; 43 | 44 | foreach (var line in lines) 45 | { 46 | if (line.Contains("; Assembly listing for method ")) 47 | currentMethod = line.Remove(0, "; Assembly listing for method ".Length); 48 | else if (currentMethod == "") 49 | return rawAsm; // in case if format is changed 50 | 51 | var currentBlock = BlockType.Unknown; 52 | 53 | if (line.StartsWith(";")) 54 | currentBlock = BlockType.Comments; 55 | else if (string.IsNullOrWhiteSpace(line)) 56 | { 57 | continue; 58 | } 59 | else 60 | { 61 | currentBlock = BlockType.Code; 62 | if (Regex.IsMatch(line, @"^\w+:")) 63 | { 64 | prevBlock = BlockType.Unknown; 65 | } 66 | } 67 | 68 | if (currentBlock != prevBlock) 69 | { 70 | blocks.Add(new Block { MethodName = currentMethod, Type = currentBlock, Data = $"\n{line}\n" }); 71 | prevBlock = currentBlock; 72 | } 73 | else 74 | blocks[blocks.Count - 1].Data += line + "\n"; 75 | } 76 | 77 | var blocksByMethods = blocks.GroupBy(b => b.MethodName); 78 | var output = new StringBuilder(); 79 | 80 | foreach (var method in blocksByMethods) 81 | { 82 | List methodBlocks = method.ToList(); 83 | int size = ParseMethodTotalSizes(methodBlocks); 84 | 85 | if (minimalComments) 86 | { 87 | methodBlocks = methodBlocks.Where(m => m.Type != BlockType.Comments).ToList(); 88 | output.AppendLine($"; Method {method.Key}"); 89 | } 90 | 91 | if (hidePrologueAndEpilogue) 92 | { 93 | var prologue = methodBlocks.First(b => b.Type == BlockType.Code); 94 | var epilogue = methodBlocks.Last(b => b.Type == BlockType.Code); 95 | methodBlocks.Remove(prologue); 96 | methodBlocks.Remove(epilogue); 97 | } 98 | 99 | foreach (var block in methodBlocks) 100 | output.Append(block.Data); 101 | 102 | if (minimalComments) 103 | { 104 | output.Append("; Total bytes of code: ") 105 | .Append(size) 106 | .AppendLine() 107 | .AppendLine(); 108 | } 109 | } 110 | 111 | return output.ToString(); 112 | } 113 | catch 114 | { 115 | return rawAsm; // format is change - leave it as is 116 | } 117 | } 118 | 119 | private static int ParseMethodTotalSizes(List methodBlocks) 120 | { 121 | const string marker = "; Total bytes of code "; 122 | string lineToParse = methodBlocks.First(b => b.Data.Contains(marker)).Data; 123 | string size = lineToParse.Substring(marker.Length, lineToParse.IndexOf(',') - marker.Length); 124 | return int.Parse(size); 125 | } 126 | 127 | private enum BlockType 128 | { 129 | Unknown, 130 | Comments, 131 | Code 132 | } 133 | 134 | private class Block 135 | { 136 | public string MethodName { get; set; } 137 | public BlockType Type { get; set; } 138 | public string Data { get; set; } 139 | } 140 | } 141 | } 142 | -------------------------------------------------------------------------------- /src/BenchmarkDotNet.Disassembler.x64/ClrSourceExtensions.cs: -------------------------------------------------------------------------------- 1 | // This file was copied from https://github.com/dotnet/BenchmarkDotNet/tree/master/src/BenchmarkDotNet.Disassembler.x64 2 | // (c) BenchmarkDotNet 3 | 4 | using Microsoft.Diagnostics.Runtime; 5 | using Microsoft.Diagnostics.Runtime.Utilities; 6 | using Microsoft.Diagnostics.Runtime.Utilities.Pdb; 7 | using System; 8 | using System.Collections.Generic; 9 | using System.IO; 10 | 11 | namespace Microsoft.Diagnostics.RuntimeExt 12 | { 13 | // This is taken from the Samples\FileAndLineNumbers projects from microsoft/clrmd, 14 | // and replaces the previously-available SourceLocation functionality. 15 | 16 | public class SourceLocation 17 | { 18 | public string FilePath; 19 | public int LineNumber; 20 | public int LineNumberEnd; 21 | public int ColStart; 22 | public int ColEnd; 23 | } 24 | 25 | public static class ClrSourceExtensions 26 | { 27 | // TODO Not sure we want this to be a shared dictionary, especially without 28 | // any synchronization. Probably want to put this hanging off the Context 29 | // somewhere, or inside SymbolCache. 30 | static Dictionary s_pdbReaders = new Dictionary(); 31 | 32 | public static SourceLocation GetSourceLocation(this ClrMethod method, int ilOffset) 33 | { 34 | PdbReader reader = GetReaderForMethod(method); 35 | if (reader == null) 36 | return null; 37 | 38 | PdbFunction function = reader.GetFunctionFromToken(method.MetadataToken); 39 | return FindNearestLine(function, ilOffset); 40 | } 41 | 42 | public static SourceLocation GetSourceLocation(this ClrStackFrame frame) 43 | { 44 | PdbReader reader = GetReaderForMethod(frame.Method); 45 | if (reader == null) 46 | return null; 47 | 48 | PdbFunction function = reader.GetFunctionFromToken(frame.Method.MetadataToken); 49 | int ilOffset = FindIlOffset(frame); 50 | 51 | return FindNearestLine(function, ilOffset); 52 | } 53 | 54 | private static SourceLocation FindNearestLine(PdbFunction function, int ilOffset) 55 | { 56 | if (function == null || function.SequencePoints == null) 57 | return null; 58 | 59 | int distance = int.MaxValue; 60 | SourceLocation nearest = null; 61 | 62 | foreach (PdbSequencePointCollection sequenceCollection in function.SequencePoints) 63 | { 64 | foreach (PdbSequencePoint point in sequenceCollection.Lines) 65 | { 66 | int dist = (int)Math.Abs(point.Offset - ilOffset); 67 | if (dist < distance) 68 | { 69 | if (nearest == null) 70 | nearest = new SourceLocation(); 71 | 72 | nearest.FilePath = sequenceCollection.File.Name; 73 | nearest.LineNumber = (int)point.LineBegin; 74 | nearest.LineNumberEnd = (int)point.LineEnd; 75 | nearest.ColStart = (int)point.ColBegin; 76 | nearest.ColEnd = (int)point.ColEnd; 77 | 78 | distance = dist; 79 | } 80 | } 81 | } 82 | 83 | return nearest; 84 | } 85 | 86 | private static int FindIlOffset(ClrStackFrame frame) 87 | { 88 | ulong ip = frame.InstructionPointer; 89 | int last = -1; 90 | foreach (ILToNativeMap item in frame.Method.ILOffsetMap) 91 | { 92 | if (item.StartAddress > ip) 93 | return last; 94 | 95 | if (ip <= item.EndAddress) 96 | return item.ILOffset; 97 | 98 | last = item.ILOffset; 99 | } 100 | 101 | return last; 102 | } 103 | 104 | private static PdbReader GetReaderForMethod(ClrMethod method) 105 | { 106 | ClrModule module = method?.Type?.Module; 107 | PdbInfo info = module?.Pdb; 108 | 109 | PdbReader reader = null; 110 | if (info != null) 111 | { 112 | if (!s_pdbReaders.TryGetValue(info, out reader)) 113 | { 114 | SymbolLocator locator = GetSymbolLocator(module); 115 | string pdbPath = locator.FindPdb(info); 116 | if (pdbPath != null) 117 | { 118 | try 119 | { 120 | reader = new PdbReader(pdbPath); 121 | } 122 | catch (IOException) 123 | { 124 | // This will typically happen when trying to load information 125 | // from public symbols, or symbol files generated by some weird 126 | // compiler. We can ignore this, but there's no need to load 127 | // this PDB anymore, so we will put null in the dictionary and 128 | // be done with it. 129 | reader = null; 130 | } 131 | } 132 | 133 | s_pdbReaders[info] = reader; 134 | } 135 | } 136 | 137 | return reader; 138 | } 139 | 140 | private static SymbolLocator GetSymbolLocator(ClrModule module) 141 | { 142 | return module.Runtime.DataTarget.SymbolLocator; 143 | } 144 | } 145 | } -------------------------------------------------------------------------------- /src/Properties/Settings.Designer.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // Runtime Version:4.0.30319.42000 5 | // 6 | // Changes to this file may cause incorrect behavior and will be lost if 7 | // the code is regenerated. 8 | // 9 | //------------------------------------------------------------------------------ 10 | 11 | namespace Disasmo.Properties { 12 | 13 | 14 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] 15 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "16.0.0.0")] 16 | internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase { 17 | 18 | private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); 19 | 20 | public static Settings Default { 21 | get { 22 | return defaultInstance; 23 | } 24 | } 25 | 26 | [global::System.Configuration.UserScopedSettingAttribute()] 27 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] 28 | [global::System.Configuration.DefaultSettingValueAttribute("")] 29 | public string PathToCoreCLR { 30 | get { 31 | return ((string)(this["PathToCoreCLR"])); 32 | } 33 | set { 34 | this["PathToCoreCLR"] = value; 35 | } 36 | } 37 | 38 | [global::System.Configuration.UserScopedSettingAttribute()] 39 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] 40 | [global::System.Configuration.DefaultSettingValueAttribute("False")] 41 | public bool JitDumpInsteadOfDisasm { 42 | get { 43 | return ((bool)(this["JitDumpInsteadOfDisasm"])); 44 | } 45 | set { 46 | this["JitDumpInsteadOfDisasm"] = value; 47 | } 48 | } 49 | 50 | [global::System.Configuration.UserScopedSettingAttribute()] 51 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] 52 | [global::System.Configuration.DefaultSettingValueAttribute("True")] 53 | public bool ShowAsmComments { 54 | get { 55 | return ((bool)(this["ShowAsmComments"])); 56 | } 57 | set { 58 | this["ShowAsmComments"] = value; 59 | } 60 | } 61 | 62 | [global::System.Configuration.UserScopedSettingAttribute()] 63 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] 64 | [global::System.Configuration.DefaultSettingValueAttribute("False")] 65 | public bool ShowPrologueEpilogue { 66 | get { 67 | return ((bool)(this["ShowPrologueEpilogue"])); 68 | } 69 | set { 70 | this["ShowPrologueEpilogue"] = value; 71 | } 72 | } 73 | 74 | [global::System.Configuration.UserScopedSettingAttribute()] 75 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] 76 | [global::System.Configuration.DefaultSettingValueAttribute("COMPlus_JitDiffableDasm=1")] 77 | public string CustomEnvVars { 78 | get { 79 | return ((string)(this["CustomEnvVars"])); 80 | } 81 | set { 82 | this["CustomEnvVars"] = value; 83 | } 84 | } 85 | 86 | [global::System.Configuration.UserScopedSettingAttribute()] 87 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] 88 | [global::System.Configuration.DefaultSettingValueAttribute("False")] 89 | public bool SkipDotnetRestoreStep { 90 | get { 91 | return ((bool)(this["SkipDotnetRestoreStep"])); 92 | } 93 | set { 94 | this["SkipDotnetRestoreStep"] = value; 95 | } 96 | } 97 | 98 | [global::System.Configuration.UserScopedSettingAttribute()] 99 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] 100 | [global::System.Configuration.DefaultSettingValueAttribute("False")] 101 | public bool UseBdnDisasm { 102 | get { 103 | return ((bool)(this["UseBdnDisasm"])); 104 | } 105 | set { 106 | this["UseBdnDisasm"] = value; 107 | } 108 | } 109 | 110 | [global::System.Configuration.UserScopedSettingAttribute()] 111 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] 112 | [global::System.Configuration.DefaultSettingValueAttribute("True")] 113 | public bool BdnShowAsm { 114 | get { 115 | return ((bool)(this["BdnShowAsm"])); 116 | } 117 | set { 118 | this["BdnShowAsm"] = value; 119 | } 120 | } 121 | 122 | [global::System.Configuration.UserScopedSettingAttribute()] 123 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] 124 | [global::System.Configuration.DefaultSettingValueAttribute("False")] 125 | public bool BdnShowIL { 126 | get { 127 | return ((bool)(this["BdnShowIL"])); 128 | } 129 | set { 130 | this["BdnShowIL"] = value; 131 | } 132 | } 133 | 134 | [global::System.Configuration.UserScopedSettingAttribute()] 135 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] 136 | [global::System.Configuration.DefaultSettingValueAttribute("False")] 137 | public bool BdnShowSource { 138 | get { 139 | return ((bool)(this["BdnShowSource"])); 140 | } 141 | set { 142 | this["BdnShowSource"] = value; 143 | } 144 | } 145 | 146 | [global::System.Configuration.UserScopedSettingAttribute()] 147 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] 148 | [global::System.Configuration.DefaultSettingValueAttribute("1")] 149 | public string BdnRecursionDepth { 150 | get { 151 | return ((string)(this["BdnRecursionDepth"])); 152 | } 153 | set { 154 | this["BdnRecursionDepth"] = value; 155 | } 156 | } 157 | } 158 | } 159 | -------------------------------------------------------------------------------- /src/ViewModels/SettingsViewModel.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using System.Windows.Forms; 7 | using System.Windows.Input; 8 | using Disasmo.Properties; 9 | using GalaSoft.MvvmLight; 10 | using GalaSoft.MvvmLight.CommandWpf; 11 | 12 | namespace Disasmo 13 | { 14 | public class SettingsViewModel : ViewModelBase 15 | { 16 | private string _pathToLocalCoreClr; 17 | private bool _jitDumpInsteadOfDisasm; 18 | private string _customEnvVars; 19 | private bool _showPrologueEpilogue; 20 | private bool _showAsmComments; 21 | private bool _skipDotnetRestoreStep; 22 | private bool _useBdnDisasm; 23 | private string _bdnRecursionDepth; 24 | private bool _bdnShowSource; 25 | private bool _bdnShowIl; 26 | private bool _bdnShowAsm; 27 | 28 | public SettingsViewModel() 29 | { 30 | PathToLocalCoreClr = Settings.Default.PathToCoreCLR; 31 | JitDumpInsteadOfDisasm = Settings.Default.JitDumpInsteadOfDisasm; 32 | ShowAsmComments = Settings.Default.ShowAsmComments; 33 | ShowPrologueEpilogue = Settings.Default.ShowPrologueEpilogue; 34 | CustomEnvVars = Settings.Default.CustomEnvVars; 35 | JitDumpInsteadOfDisasm = Settings.Default.JitDumpInsteadOfDisasm; 36 | SkipDotnetRestoreStep = Settings.Default.SkipDotnetRestoreStep; 37 | UseBdnDisasm = Settings.Default.UseBdnDisasm; 38 | BdnShowAsm = Settings.Default.BdnShowAsm; 39 | BdnShowIL = Settings.Default.BdnShowIL; 40 | BdnShowSource = Settings.Default.BdnShowSource; 41 | BdnRecursionDepth = Settings.Default.BdnRecursionDepth; 42 | } 43 | 44 | public string PathToLocalCoreClr 45 | { 46 | get => _pathToLocalCoreClr; 47 | set 48 | { 49 | Set(ref _pathToLocalCoreClr, value); 50 | Settings.Default.PathToCoreCLR = value; 51 | Settings.Default.Save(); 52 | } 53 | } 54 | 55 | public bool JitDumpInsteadOfDisasm 56 | { 57 | get => _jitDumpInsteadOfDisasm; 58 | set 59 | { 60 | Set(ref _jitDumpInsteadOfDisasm, value); 61 | Settings.Default.JitDumpInsteadOfDisasm = value; 62 | Settings.Default.Save(); 63 | } 64 | } 65 | 66 | public bool ShowAsmComments 67 | { 68 | get => _showAsmComments; 69 | set 70 | { 71 | Set(ref _showAsmComments, value); 72 | Settings.Default.ShowAsmComments = value; 73 | Settings.Default.Save(); 74 | } 75 | } 76 | 77 | public bool ShowPrologueEpilogue 78 | { 79 | get => _showPrologueEpilogue; 80 | set 81 | { 82 | Set(ref _showPrologueEpilogue, value); 83 | Settings.Default.ShowPrologueEpilogue = value; 84 | Settings.Default.Save(); 85 | } 86 | } 87 | 88 | public string CustomEnvVars 89 | { 90 | get => _customEnvVars; 91 | set 92 | { 93 | Set(ref _customEnvVars, value); 94 | Settings.Default.CustomEnvVars = value; 95 | Settings.Default.Save(); 96 | } 97 | } 98 | 99 | public bool SkipDotnetRestoreStep 100 | { 101 | get => _skipDotnetRestoreStep; 102 | set 103 | { 104 | Set(ref _skipDotnetRestoreStep, value); 105 | Settings.Default.SkipDotnetRestoreStep = value; 106 | Settings.Default.Save(); 107 | } 108 | } 109 | 110 | public bool UseBdnDisasm 111 | { 112 | get => _useBdnDisasm; 113 | set 114 | { 115 | Set(ref _useBdnDisasm, value); 116 | Settings.Default.UseBdnDisasm = value; 117 | Settings.Default.Save(); 118 | } 119 | } 120 | 121 | public bool BdnShowAsm 122 | { 123 | get => _bdnShowAsm; 124 | set 125 | { 126 | Set(ref _bdnShowAsm, value); 127 | Settings.Default.BdnShowAsm = value; 128 | Settings.Default.Save(); 129 | } 130 | } 131 | 132 | public bool BdnShowIL 133 | { 134 | get => _bdnShowIl; 135 | set 136 | { 137 | Set(ref _bdnShowIl, value); 138 | Settings.Default.BdnShowIL = value; 139 | Settings.Default.Save(); 140 | } 141 | } 142 | 143 | public bool BdnShowSource 144 | { 145 | get => _bdnShowSource; 146 | set 147 | { 148 | Set(ref _bdnShowSource, value); 149 | Settings.Default.BdnShowSource = value; 150 | Settings.Default.Save(); 151 | } 152 | } 153 | 154 | public int BdnRecursionDepthNumeric => byte.TryParse(BdnRecursionDepth, out byte value) ? value : 0; 155 | 156 | public string BdnRecursionDepth 157 | { 158 | get => _bdnRecursionDepth; 159 | set 160 | { 161 | if (byte.TryParse(value, out byte result)) // let's limit it with 0-255 range via byte 162 | { 163 | Set(ref _bdnRecursionDepth, value); 164 | Settings.Default.BdnRecursionDepth = value; 165 | Settings.Default.Save(); 166 | } 167 | else 168 | { 169 | Set(ref _bdnRecursionDepth, "0"); 170 | } 171 | } 172 | } 173 | 174 | public ICommand BrowseCommand => new RelayCommand(() => 175 | { 176 | var dialog = new FolderBrowserDialog(); 177 | var result = dialog.ShowDialog(); 178 | if (result == DialogResult.OK) 179 | PathToLocalCoreClr = dialog.SelectedPath; 180 | }); 181 | 182 | public void FillWithUserVars(Dictionary dictionary) 183 | { 184 | if (string.IsNullOrWhiteSpace(CustomEnvVars)) 185 | return; 186 | 187 | var pairs = CustomEnvVars.Split(new [] {",", ";"}, StringSplitOptions.RemoveEmptyEntries); 188 | foreach (var pair in pairs) 189 | { 190 | var parts = pair.Split('='); 191 | if (parts.Length == 2) 192 | dictionary[parts[0].Trim()] = parts[1].Trim(); 193 | } 194 | } 195 | } 196 | } 197 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | ## Ignore Visual Studio temporary files, build results, and 2 | ## files generated by popular Visual Studio add-ons. 3 | ## 4 | ## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore 5 | 6 | # User-specific files 7 | *.suo 8 | *.user 9 | *.userosscache 10 | *.sln.docstates 11 | 12 | # User-specific files (MonoDevelop/Xamarin Studio) 13 | *.userprefs 14 | 15 | # Build results 16 | [Dd]ebug/ 17 | [Dd]ebugPublic/ 18 | [Rr]elease/ 19 | [Rr]eleases/ 20 | x64/ 21 | x86/ 22 | bld/ 23 | [Bb]in/ 24 | [Oo]bj/ 25 | [Ll]og/ 26 | 27 | # Visual Studio 2015/2017 cache/options directory 28 | .vs/ 29 | # Uncomment if you have tasks that create the project's static files in wwwroot 30 | #wwwroot/ 31 | 32 | # Visual Studio 2017 auto generated files 33 | Generated\ Files/ 34 | 35 | # MSTest test Results 36 | [Tt]est[Rr]esult*/ 37 | [Bb]uild[Ll]og.* 38 | 39 | # NUNIT 40 | *.VisualState.xml 41 | TestResult.xml 42 | 43 | # Build Results of an ATL Project 44 | [Dd]ebugPS/ 45 | [Rr]eleasePS/ 46 | dlldata.c 47 | 48 | # Benchmark Results 49 | BenchmarkDotNet.Artifacts/ 50 | 51 | # .NET Core 52 | project.lock.json 53 | project.fragment.lock.json 54 | artifacts/ 55 | **/Properties/launchSettings.json 56 | 57 | # StyleCop 58 | StyleCopReport.xml 59 | 60 | # Files built by Visual Studio 61 | *_i.c 62 | *_p.c 63 | *_i.h 64 | *.ilk 65 | *.meta 66 | *.obj 67 | *.iobj 68 | *.pch 69 | *.pdb 70 | *.ipdb 71 | *.pgc 72 | *.pgd 73 | *.rsp 74 | *.sbr 75 | *.tlb 76 | *.tli 77 | *.tlh 78 | *.tmp 79 | *.tmp_proj 80 | *.log 81 | *.vspscc 82 | *.vssscc 83 | .builds 84 | *.pidb 85 | *.svclog 86 | *.scc 87 | 88 | # Chutzpah Test files 89 | _Chutzpah* 90 | 91 | # Visual C++ cache files 92 | ipch/ 93 | *.aps 94 | *.ncb 95 | *.opendb 96 | *.opensdf 97 | *.sdf 98 | *.cachefile 99 | *.VC.db 100 | *.VC.VC.opendb 101 | 102 | # Visual Studio profiler 103 | *.psess 104 | *.vsp 105 | *.vspx 106 | *.sap 107 | 108 | # Visual Studio Trace Files 109 | *.e2e 110 | 111 | # TFS 2012 Local Workspace 112 | $tf/ 113 | 114 | # Guidance Automation Toolkit 115 | *.gpState 116 | 117 | # ReSharper is a .NET coding add-in 118 | _ReSharper*/ 119 | *.[Rr]e[Ss]harper 120 | *.DotSettings.user 121 | 122 | # JustCode is a .NET coding add-in 123 | .JustCode 124 | 125 | # TeamCity is a build add-in 126 | _TeamCity* 127 | 128 | # DotCover is a Code Coverage Tool 129 | *.dotCover 130 | 131 | # AxoCover is a Code Coverage Tool 132 | .axoCover/* 133 | !.axoCover/settings.json 134 | 135 | # Visual Studio code coverage results 136 | *.coverage 137 | *.coveragexml 138 | 139 | # NCrunch 140 | _NCrunch_* 141 | .*crunch*.local.xml 142 | nCrunchTemp_* 143 | 144 | # MightyMoose 145 | *.mm.* 146 | AutoTest.Net/ 147 | 148 | # Web workbench (sass) 149 | .sass-cache/ 150 | 151 | # Installshield output folder 152 | [Ee]xpress/ 153 | 154 | # DocProject is a documentation generator add-in 155 | DocProject/buildhelp/ 156 | DocProject/Help/*.HxT 157 | DocProject/Help/*.HxC 158 | DocProject/Help/*.hhc 159 | DocProject/Help/*.hhk 160 | DocProject/Help/*.hhp 161 | DocProject/Help/Html2 162 | DocProject/Help/html 163 | 164 | # Click-Once directory 165 | publish/ 166 | 167 | # Publish Web Output 168 | *.[Pp]ublish.xml 169 | *.azurePubxml 170 | # Note: Comment the next line if you want to checkin your web deploy settings, 171 | # but database connection strings (with potential passwords) will be unencrypted 172 | *.pubxml 173 | *.publishproj 174 | 175 | # Microsoft Azure Web App publish settings. Comment the next line if you want to 176 | # checkin your Azure Web App publish settings, but sensitive information contained 177 | # in these scripts will be unencrypted 178 | PublishScripts/ 179 | 180 | # NuGet Packages 181 | *.nupkg 182 | # The packages folder can be ignored because of Package Restore 183 | **/[Pp]ackages/* 184 | # except build/, which is used as an MSBuild target. 185 | !**/[Pp]ackages/build/ 186 | # Uncomment if necessary however generally it will be regenerated when needed 187 | #!**/[Pp]ackages/repositories.config 188 | # NuGet v3's project.json files produces more ignorable files 189 | *.nuget.props 190 | *.nuget.targets 191 | 192 | # Microsoft Azure Build Output 193 | csx/ 194 | *.build.csdef 195 | 196 | # Microsoft Azure Emulator 197 | ecf/ 198 | rcf/ 199 | 200 | # Windows Store app package directories and files 201 | AppPackages/ 202 | BundleArtifacts/ 203 | Package.StoreAssociation.xml 204 | _pkginfo.txt 205 | *.appx 206 | 207 | # Visual Studio cache files 208 | # files ending in .cache can be ignored 209 | *.[Cc]ache 210 | # but keep track of directories ending in .cache 211 | !*.[Cc]ache/ 212 | 213 | # Others 214 | ClientBin/ 215 | ~$* 216 | *~ 217 | *.dbmdl 218 | *.dbproj.schemaview 219 | *.jfm 220 | *.pfx 221 | *.publishsettings 222 | orleans.codegen.cs 223 | 224 | # Including strong name files can present a security risk 225 | # (https://github.com/github/gitignore/pull/2483#issue-259490424) 226 | #*.snk 227 | 228 | # Since there are multiple workflows, uncomment next line to ignore bower_components 229 | # (https://github.com/github/gitignore/pull/1529#issuecomment-104372622) 230 | #bower_components/ 231 | 232 | # RIA/Silverlight projects 233 | Generated_Code/ 234 | 235 | # Backup & report files from converting an old project file 236 | # to a newer Visual Studio version. Backup files are not needed, 237 | # because we have git ;-) 238 | _UpgradeReport_Files/ 239 | Backup*/ 240 | UpgradeLog*.XML 241 | UpgradeLog*.htm 242 | ServiceFabricBackup/ 243 | *.rptproj.bak 244 | 245 | # SQL Server files 246 | *.mdf 247 | *.ldf 248 | *.ndf 249 | 250 | # Business Intelligence projects 251 | *.rdl.data 252 | *.bim.layout 253 | *.bim_*.settings 254 | *.rptproj.rsuser 255 | 256 | # Microsoft Fakes 257 | FakesAssemblies/ 258 | 259 | # GhostDoc plugin setting file 260 | *.GhostDoc.xml 261 | 262 | # Node.js Tools for Visual Studio 263 | .ntvs_analysis.dat 264 | node_modules/ 265 | 266 | # Visual Studio 6 build log 267 | *.plg 268 | 269 | # Visual Studio 6 workspace options file 270 | *.opt 271 | 272 | # Visual Studio 6 auto-generated workspace file (contains which files were open etc.) 273 | *.vbw 274 | 275 | # Visual Studio LightSwitch build output 276 | **/*.HTMLClient/GeneratedArtifacts 277 | **/*.DesktopClient/GeneratedArtifacts 278 | **/*.DesktopClient/ModelManifest.xml 279 | **/*.Server/GeneratedArtifacts 280 | **/*.Server/ModelManifest.xml 281 | _Pvt_Extensions 282 | 283 | # Paket dependency manager 284 | .paket/paket.exe 285 | paket-files/ 286 | 287 | # FAKE - F# Make 288 | .fake/ 289 | 290 | # JetBrains Rider 291 | .idea/ 292 | *.sln.iml 293 | 294 | # CodeRush 295 | .cr/ 296 | 297 | # Python Tools for Visual Studio (PTVS) 298 | __pycache__/ 299 | *.pyc 300 | 301 | # Cake - Uncomment if you are using it 302 | # tools/** 303 | # !tools/packages.config 304 | 305 | # Tabs Studio 306 | *.tss 307 | 308 | # Telerik's JustMock configuration file 309 | *.jmconfig 310 | 311 | # BizTalk build output 312 | *.btp.cs 313 | *.btm.cs 314 | *.odx.cs 315 | *.xsd.cs 316 | 317 | # OpenCover UI analysis results 318 | OpenCover/ 319 | 320 | # Azure Stream Analytics local run output 321 | ASALocalRun/ 322 | 323 | # MSBuild Binary and Structured Log 324 | *.binlog 325 | 326 | # NVidia Nsight GPU debugger configuration file 327 | *.nvuser 328 | 329 | # MFractors (Xamarin productivity tool) working folder 330 | .mfractor/ 331 | -------------------------------------------------------------------------------- /src/Views/DisasmWindowControl.xaml: -------------------------------------------------------------------------------- 1 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 |