Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update deps for JitBuddy to eventually run on Linux #4

Merged
merged 1 commit into from
Nov 8, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions src/JitBuddy/JitBuddy.cs
Original file line number Diff line number Diff line change
Expand Up @@ -68,14 +68,14 @@ private static void DecodeMethod(IntPtr ptr, uint size, StringBuilder builder, F
// reading data from a file or memory etc
var codeReader = new UnmanagedCodeReader(ptr, size);
var decoder = Decoder.Create(IntPtr.Size * 8, codeReader);
decoder.InstructionPointer = (ulong)ptr.ToInt64();
ulong endRip = decoder.InstructionPointer + (uint)size;
decoder.IP = (ulong)ptr.ToInt64();
ulong endRip = decoder.IP + (uint)size;

// This list is faster than List<Instruction> since it uses refs to the Instructions
// instead of copying them (each Instruction is 32 bytes in size). It has a ref indexer,
// and a ref iterator. Add() uses 'in' (ref readonly).
var instructions = new InstructionList();
while (decoder.InstructionPointer < endRip)
while (decoder.IP < endRip)
{
// The method allocates an uninitialized element at the end of the list and
// returns a reference to it which is initialized by Decode().
Expand All @@ -94,8 +94,8 @@ private static void DecodeMethod(IntPtr ptr, uint size, StringBuilder builder, F
foreach (ref var instr in instructions)
{
// Don't use instr.ToString(), it allocates more, uses masm syntax and default options
formatter.Format(ref instr, output);
builder.AppendLine($"{instr.IP64:X16} {output.ToStringAndReset()}");
formatter.Format(in instr, output);
builder.AppendLine($"{instr.IP:X16} {output.ToStringAndReset()}");
}
}

Expand Down
8 changes: 6 additions & 2 deletions src/JitBuddy/JitBuddy.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,11 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Iced" Version="1.1.1" />
<PackageReference Include="Microsoft.Diagnostics.Runtime" Version="1.0.2" />
<PackageReference Include="Iced" Version="1.4.0" />
<PackageReference Include="Microsoft.Diagnostics.Runtime" Version="1.1.46104" />
<PackageReference Include="Microsoft.NETFramework.ReferenceAssemblies" Version="1.0.0-preview.2">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>
</ItemGroup>
</Project>