private string BuildTimerCallbackMethodName(ClrObject timerCallback) { var methodPtr = timerCallback.ReadField <ulong>("_methodPtr"); if (methodPtr != 0) { var method = _clr.GetMethodByInstructionPointer(methodPtr); if (method != null) { // look for "this" to figure out the real callback implementor type var thisTypeName = "?"; var thisPtr = timerCallback.ReadObjectField("_target"); if (thisPtr.IsValid) { var thisRef = thisPtr.Address; var thisType = _heap.GetObjectType(thisRef); if (thisType != null) { thisTypeName = thisType.Name; } } else { thisTypeName = (method.Type != null) ? method.Type.Name : "?"; } return($"{thisTypeName}.{method.Name}"); } else { return(""); } } else { return(""); } }
private static string?ResolveSymbol(ClrRuntime runtime, Instruction instruction, long addr, ulong currentMethodAddress) { var operand = instruction.Operands.Length > 0 ? instruction.Operands[0] : null; if (operand?.PtrOffset == 0) { var lvalue = GetOperandLValue(operand !); if (lvalue == null) { return($"{operand!.RawValue} ; failed to resolve lval ({operand.Size}), please report at https://github.com/ashmind/SharpLab/issues"); } var baseOffset = instruction.PC - currentMethodAddress; return($"L{baseOffset + lvalue:x4}"); } return(runtime.GetMethodByInstructionPointer(unchecked ((ulong)addr))?.Signature); }