public static uint GetILOffset(this CorFrame frame) { var ip = frame.ILFrameIP; if (ip.IsExact || ip.IsApproximate) { return(ip.Offset); } if (ip.IsProlog) { return(0); } if (ip.IsEpilog) { var asm = frame.GetSerializedDnModuleWithAssembly(); if (asm != null) { var loadedAsm = MainWindow.Instance.LoadAssembly(asm.Value.Assembly, asm.Value.Module); var mod = loadedAsm == null ? null : loadedAsm.ModuleDefinition as ModuleDefMD; var md = mod == null ? null : mod.ResolveToken(frame.Token) as MethodDef; if (md != null && md.Body != null && md.Body.Instructions.Count > 0) { return(md.Body.Instructions[md.Body.Instructions.Count - 1].Offset); } } } return(uint.MaxValue); }
public static bool GoToIL(CorFrame frame, bool newTab) { if (!CanGoToIL(frame)) { return(false); } var serAsm = frame.GetSerializedDnModuleWithAssembly(); if (serAsm == null) { return(false); } return(DebugUtils.GoToIL(serAsm.Value, frame.Token, frame.GetILOffset(), newTab)); }
CodeLocation? GetCodeLocation(CorFrame frame) { if (ProcessState != DebuggerProcessState.Stopped) return null; if (frame == null) return null; var sma = frame.GetSerializedDnModuleWithAssembly(); if (sma == null) return null; uint token = frame.Token; if (token == 0) return null; return new CodeLocation(sma.Value, token, frame.GetILOffset(), frame.ILFrameIP.Mapping); }
static MethodKey? CreateMethodKey(DnDebugger debugger, CorFrame frame) { var sma = frame.GetSerializedDnModuleWithAssembly(); if (sma == null) return null; return MethodKey.Create(frame.Token, sma.Value.Module); }