The issue is that the function pointer we get from RuntimeMethodHandle.GetFunctionPointer() points to the prestub for the method, but the instruction pointer we have (of course) points to the actual JIT'd method that was executed.
One way we might solve this is by disassembling the prestub and following the jump to the actual method. But we would need to know for sure that RuntimeMethodHandle.GetFunctionPointer() always returns a pointer to a prestub.
https://github.com/vezel-dev/ruptura/blob/70168266ca273ec99eee6baba89522c896150db6/src/memory/Diagnostics/CallFrame.cs#L43-L45
The issue is that the function pointer we get from
RuntimeMethodHandle.GetFunctionPointer()
points to the prestub for the method, but the instruction pointer we have (of course) points to the actual JIT'd method that was executed.One way we might solve this is by disassembling the prestub and following the jump to the actual method. But we would need to know for sure that
RuntimeMethodHandle.GetFunctionPointer()
always returns a pointer to a prestub.