public CorValue GetStaticFieldValue(int fieldToken, CorFunctionFrame frame) { ICorDebugValue dv = null; m_type.GetStaticFieldValue((uint)fieldToken, frame.frame, out dv); return dv == null ? null : new CorValue(dv); }
internal void PostExceptionNotification( CorThread thread, CorFunctionFrame frame, Interfaces.CorDebugExceptionCallbackType exState, uint offset ) { if (m_ExceptionNotification == null) return; ExceptioNotificationResult expRes = new ExceptioNotificationResult(); string strException = thread.ExceptionString; string sourceLine = string.Empty; if (frame.Function != null && exState == CorDebugExceptionCallbackType.DEBUG_EXCEPTION_FIRST_CHANCE){ try{ CorSourcePosition src = frame.Function.GetSourcePositionFromIP((int)offset); //expRes.SourceLine = GetCurrentSourceCode(src); }catch{ /*Ignore*/ } } expRes.ExceptionType = strException; expRes.StackTrace = GetCallStack(thread); expRes.ThreadID = thread.ID; switch (exState){ case Interfaces.CorDebugExceptionCallbackType.DEBUG_EXCEPTION_FIRST_CHANCE: case Interfaces.CorDebugExceptionCallbackType.DEBUG_EXCEPTION_USER_FIRST_CHANCE: expRes.State = ExceptioNotificationResult.EXCEPTIONSTATE.FIRSTCHANCE; break; case Interfaces.CorDebugExceptionCallbackType.DEBUG_EXCEPTION_CATCH_HANDLER_FOUND: expRes.State = ExceptioNotificationResult.EXCEPTIONSTATE.HANDLED; break; case Interfaces.CorDebugExceptionCallbackType.DEBUG_EXCEPTION_UNHANDLED: expRes.State = ExceptioNotificationResult.EXCEPTIONSTATE.UNHANDLED;break; } ThreadPool.QueueUserWorkItem( new WaitCallback(SendNotifications), new InnerObject(m_ExceptionNotification, expRes) ); }
//public string SourceLine { // get { // string source = string.Empty; // corThread.GetActiveFrame(out threadFrame); // return source; // } //} private List<CorFunctionFrame> CreateFrames(ICorDebugFrame frame) { List<CorFunctionFrame> frames = new List<CorFunctionFrame>(); if (frame is ICorDebugILFrame){ CorFunctionFrame corFrame = new CorFunctionFrame(frame); frames.Add(corFrame); } else if (frame is ICorDebugNativeFrame) { //DthreadFrame. } ICorDebugFrame callerframe = null; frame.GetCaller(out callerframe); if (callerframe != null) { frames.AddRange(CreateFrames(callerframe)); } return frames; }