diff options
author | Yi Zhang (CLR) <yizhang82@users.noreply.github.com> | 2017-05-31 06:48:58 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-05-31 06:48:58 +0300 |
commit | 12dd8bec2eec70aac8cd273f94c6c717e89b9416 (patch) | |
tree | ff3b79cb6c5111972e74441f0c5954a2353eda3d | |
parent | 7a06b302581f7c56eff2ab9fa5561686ffe7077d (diff) |
Adding a repro.ilproj and update instructions to enable writing repro in IL
-rw-r--r-- | Documentation/how-to-build-and-run-ilcompiler-in-visual-studio.md | 4 | ||||
-rw-r--r-- | src/ILCompiler/repro/repro.il | 50 | ||||
-rw-r--r-- | src/ILCompiler/repro/repro.ilproj | 28 |
3 files changed, 82 insertions, 0 deletions
diff --git a/Documentation/how-to-build-and-run-ilcompiler-in-visual-studio.md b/Documentation/how-to-build-and-run-ilcompiler-in-visual-studio.md index e5d430f5b..908fe2c84 100644 --- a/Documentation/how-to-build-and-run-ilcompiler-in-visual-studio.md +++ b/Documentation/how-to-build-and-run-ilcompiler-in-visual-studio.md @@ -63,3 +63,7 @@ _Note: The size of NuGet packages is approximately 2.75 GB, so download might ta - Set breakpoint at repro::Program::Main in main.cpp - Build, run & step through as with any other C++ program + +## Writing your repro code in IL ## + +If you want to write your repro code using IL (instead of C#), you can search/replace `"repro\repro.csproj"` to `"repro\repro.ilproj"` in ILCompiler.sln which switches to repro.ilproj instead of repro.csproj. Just write your IL code in `repro.il` and build/debug as usual. All the instructions above still would work as expected. Just make sure don't check-in that change. diff --git a/src/ILCompiler/repro/repro.il b/src/ILCompiler/repro/repro.il new file mode 100644 index 000000000..94f9aac84 --- /dev/null +++ b/src/ILCompiler/repro/repro.il @@ -0,0 +1,50 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +.assembly extern System.Runtime +{ + .publickeytoken = (B7 7A 5C 56 19 34 E0 89 ) // .z\V.4.. + .ver 4:0:0:0 +} +.assembly extern System.Console +{ + .publickeytoken = (B7 7A 5C 56 19 34 E0 89 ) // .z\V.4.. + .ver 4:0:0:0 +} + +.assembly repro +{ + .hash algorithm 0x00008004 + .ver 0:0:0:0 +} + +.module repro.exe +.imagebase 0x00400000 +.file alignment 0x00000200 +.stackreserve 0x00100000 +.subsystem 0x0003 // WINDOWS_CUI +.corflags 0x00000001 // ILONLY + +.class private auto ansi beforefieldinit Program + extends [System.Runtime]System.Object +{ + .method private hidebysig static void Main(string[] args) cil managed + { + .entrypoint + .maxstack 8 + + ldstr "Hello world from MSIL!" + call void [System.Console]System.Console::WriteLine(string) + ret + } + + .method public hidebysig specialname rtspecialname + instance void .ctor() cil managed + { + .maxstack 8 + ldarg.0 + call instance void [System.Runtime]System.Object::.ctor() + ret + } +} diff --git a/src/ILCompiler/repro/repro.ilproj b/src/ILCompiler/repro/repro.ilproj new file mode 100644 index 000000000..f60af9310 --- /dev/null +++ b/src/ILCompiler/repro/repro.ilproj @@ -0,0 +1,28 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" /> + <PropertyGroup> + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> + <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> + <ProjectGuid>{FBA029C3-B184-4457-AEEC-38D0C2523067}</ProjectGuid> + <OutputType>Exe</OutputType> + <AssemblyName>repro</AssemblyName> + <NuGetTargetMoniker>.NETStandard,Version=v1.6</NuGetTargetMoniker> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> + <OutputPath>bin\Debug</OutputPath> + <ErrorReport>prompt</ErrorReport> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> + <OutputPath>bin\Release</OutputPath> + <ErrorReport>prompt</ErrorReport> + </PropertyGroup> + <ItemGroup> + <Compile Include="repro.il" /> + </ItemGroup> + <ItemGroup> + <None Include="project.json" /> + </ItemGroup> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" /> + <Import Project="$(MSBuildThisFileDirectory)\..\..\BuildIntegration\Microsoft.NETCore.Native.targets" /> +</Project> |