I'm trying to use ClrMD to print out the assembly code of a method, as part of a Benchmarking library I'm working on
At the moment I use code similar to the Machine Code sample to get the memory address, then I use code like this to get the assembly code (where debugControl is of type IDebugControl from IDebugControl.cs):
var bufferSize = 500; // per-line
var lineOfAssembly = new StringBuilder(bufferSize);
ulong startOffset = startAddress, endOffset;
uint disassemblySize;
do
{
var flags = DEBUG_DISASM.EFFECTIVE_ADDRESS; // DEBUG_DISASM.SOURCE_FILE_NAME | DEBUG_DISASM.SOURCE_LINE_NUMBER;
var result = debugControl.Disassemble(startOffset, flags, lineOfAssembly, bufferSize, out disassemblySize, out endOffset);
startOffset = endOffset;
Console.WriteLine(lineOfAssembly.ToString());
} while (disassemblySize > 0 && endOffset <= endAddress);
That works okay and I get an output like so, but the call instructions aren't resolved to a method name, they just have the memory address:

However if I run the -u command in WinDbg, it's able to resolve the method name of the call instruction, even with JIT methods such as mscorwks!JIT_Throw.
Is there a way I can replicate this with ClrMD?
I'm trying to use ClrMD to print out the assembly code of a method, as part of a Benchmarking library I'm working on
At the moment I use code similar to the Machine Code sample to get the memory address, then I use code like this to get the assembly code (where
debugControlis of typeIDebugControlfrom IDebugControl.cs):That works okay and I get an output like so, but the
callinstructions aren't resolved to a method name, they just have the memory address:However if I run the -u command in WinDbg, it's able to resolve the method name of the
callinstruction, even with JIT methods such asmscorwks!JIT_Throw.Is there a way I can replicate this with ClrMD?