Skip to content

Commit

Permalink
Upgrade to ClrMD 3
Browse files Browse the repository at this point in the history
  • Loading branch information
kevingosse committed Mar 8, 2024
1 parent 8b6d51f commit 3a00e6a
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 12 deletions.
4 changes: 2 additions & 2 deletions src/DynaMD.Tests/DynaMD.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.Diagnostics.Runtime" Version="2.0.217201" />
<PackageReference Include="Microsoft.Diagnostics.Runtime" Version="3.1.512801" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.6.1" />
<PackageReference Include="NUnit" Version="3.12.0" PrivateAssets="All" />
<PackageReference Include="NUnit3TestAdapter" Version="3.17.0" />
<PackageReference Include="System.Runtime.CompilerServices.Unsafe" Version="4.7.1" />
<PackageReference Include="System.Runtime.CompilerServices.Unsafe" Version="6.0.0" />
</ItemGroup>

</Project>
12 changes: 6 additions & 6 deletions src/DynaMD/DynaMD.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>net471;netstandard2.0;netcoreapp3.1</TargetFrameworks>
<TargetFrameworks>net48;netstandard2.0;netcoreapp3.1</TargetFrameworks>
<RootNamespace>DynaMD</RootNamespace>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
Expand All @@ -11,27 +11,27 @@

<ItemGroup>
<PackageReference Include="Microsoft.CSharp" Version="4.5.0" />
<PackageReference Include="System.Runtime.CompilerServices.Unsafe" Version="4.7.1" />
<PackageReference Include="Microsoft.Diagnostics.Runtime" Version="2.0.217201" />
<PackageReference Include="System.Runtime.CompilerServices.Unsafe" Version="6.0.0" />
<PackageReference Include="Microsoft.Diagnostics.Runtime" Version="3.1.512801" />
</ItemGroup>

<PropertyGroup>
<PackageId>DynaMD</PackageId>
<PackageVersion>1.0.9.1</PackageVersion>
<PackageVersion>1.1.0.0</PackageVersion>
<Title>DynaMD</Title>
<Authors>Kevin Gosse</Authors>
<Owners>KooKiz</Owners>
<PackageProjectUrl>https://github.com/kevingosse/DynaMD</PackageProjectUrl>
<RepositoryUrl>https://github.com/kevingosse/DynaMD</RepositoryUrl>
<PackageLicenseUrl>https://github.com/kevingosse/DynaMD/blob/master/LICENSE</PackageLicenseUrl>
<Description>Helper objects to browse complex structures returned by ClrMD</Description>
<PackageReleaseNotes>Added Readme.md</PackageReleaseNotes>
<PackageReleaseNotes>Upgrade to ClrMD 3</PackageReleaseNotes>
<Copyright>Copyright 2017-$([System.DateTime]::UtcNow.ToString(yyyy))</Copyright>
<PackageTags>ClrMD WinDBG SOS</PackageTags>
<PackageOutputPath>..\..\nugets</PackageOutputPath>
<PackageReadmeFile>README.md</PackageReadmeFile>
</PropertyGroup>
<ItemGroup>
<None Include="..\..\README.md" Pack="true" PackagePath="\"/>
<None Include="..\..\README.md" Pack="true" PackagePath="\" />
</ItemGroup>
</Project>
9 changes: 6 additions & 3 deletions src/DynaMD/DynamicProxy.cs
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ public override bool TryGetIndex(GetIndexBinder binder, object[] indexes, out ob

var index = (int)indexes[0];

result = GetElementAt(new ClrArray(_address, Type), index);
result = GetElementAt(new ClrObject(_address, Type).AsArray(), index);
return true;
}

Expand Down Expand Up @@ -234,9 +234,12 @@ private object ConvertIfPrimitive(ClrValueType value)

private object Read(ulong address, Type type)
{
var m = typeof(IMemoryReader).GetMethod("Read", new[] { typeof(ulong) }).MakeGenericMethod(type);
// Module.DataReader.Read<T>(address, out obj)
var dataReader = ClrObject.Type.Heap.Runtime.DataTarget.DataReader;

return m.Invoke(Type.ClrObjectHelpers.DataReader, new object[] { address });
var m = typeof(IMemoryReader).GetMethod("Read", new[] { typeof(ulong) }).MakeGenericMethod(type);

return m.Invoke(dataReader, new object[] { address });
}

private object GetElementAt(ClrArray array, int index)
Expand Down
3 changes: 2 additions & 1 deletion src/DynaMD/Extensions.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using DynaMD;
using System.Collections.Generic;
using System.Text;
using Microsoft.Diagnostics.Runtime.Interfaces;

// ReSharper disable once CheckNamespace
namespace Microsoft.Diagnostics.Runtime
Expand Down Expand Up @@ -37,7 +38,7 @@ public static IEnumerable<dynamic> GetProxies(this ClrHeap heap, string typeName
}
}

public static dynamic AsDynamic<T>(this T clrObject) where T : IAddressableTypedEntity
public static dynamic AsDynamic(this ClrObject clrObject)
{
if (clrObject.Address == 0)
{
Expand Down

0 comments on commit 3a00e6a

Please sign in to comment.