From: Amy Yu Date: Fri, 15 Jun 2018 18:46:49 +0000 (-0700) Subject: Use DumpInstruction instead of code block X-Git-Tag: submit/tizen/20210909.063632~11030^2~4567^2~3 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=710f31fc472c1b5103bdcbf5346a2c31f1c2ae7a;p=platform%2Fupstream%2Fdotnet%2Fruntime.git Use DumpInstruction instead of code block Commit migrated from https://github.com/dotnet/coreclr/commit/1df3d7978e69166fa366c5788d114acf1c743d70 --- diff --git a/src/coreclr/src/tools/r2rdump/CoreDisTools.cs b/src/coreclr/src/tools/r2rdump/CoreDisTools.cs index a3739c0..16fef7e 100644 --- a/src/coreclr/src/tools/r2rdump/CoreDisTools.cs +++ b/src/coreclr/src/tools/r2rdump/CoreDisTools.cs @@ -26,6 +26,10 @@ namespace R2RDump public static extern void DumpCodeBlock(IntPtr Disasm, ulong Address, IntPtr Bytes, int Size); [DllImport("coredistools.dll")] + [return: MarshalAs(UnmanagedType.I4)] + public static extern int DumpInstruction(IntPtr Disasm, ulong Address, IntPtr Bytes, int Size); + + [DllImport("coredistools.dll")] public static extern IntPtr GetOutputBuffer(); [DllImport("coredistools.dll")] @@ -36,10 +40,11 @@ namespace R2RDump public unsafe static string GetCodeBlock(IntPtr Disasm, int Address, int Offset, byte[] image, int Size) { + int len; fixed (byte* p = image) { IntPtr ptr = (IntPtr)(p + Offset); - DumpCodeBlock(Disasm, (ulong)Address, ptr, Size); + len = DumpInstruction(Disasm, (ulong)Address, ptr, Size); //DumpCodeBlock(Disasm, (ulong)Address, ptr, Size); } IntPtr pBuffer = GetOutputBuffer(); string buffer = Marshal.PtrToStringAnsi(pBuffer);