private void HandleException(object sender, ExceptionEventArgs e) { if (e.SuspendPolicy == SuspendPolicy.All) Interlocked.Increment(ref _suspended); JavaDebugThread thread; lock (_threads) { this._threads.TryGetValue(e.Thread.GetUniqueId(), out thread); } bool stop; bool firstChance = e.CatchLocation != null; EXCEPTION_INFO exceptionInfo; if (DebugEngine.TryGetException(e.Exception.GetReferenceType().GetName(), out exceptionInfo)) { if (firstChance && (exceptionInfo.dwState & enum_EXCEPTION_STATE.EXCEPTION_STOP_FIRST_CHANCE) != 0) stop = true; else if (!firstChance && (exceptionInfo.dwState & enum_EXCEPTION_STATE.EXCEPTION_STOP_SECOND_CHANCE) != 0) stop = true; else stop = !firstChance; } else { stop = !firstChance; } JavaDebugExceptionEvent exceptionEvent = new JavaDebugExceptionEvent(GetAttributesForEvent(e), this, e.Thread, e.Exception, e.Location, e.CatchLocation); if (stop) { SetEventProperties(exceptionEvent, e, false); Callback.Event(DebugEngine, Process, this, thread, exceptionEvent); } else { string message = exceptionEvent.GetDescription() + Environment.NewLine; DebugEvent debugEvent = new DebugOutputStringEvent(message); SetEventProperties(debugEvent, e, true); Callback.Event(DebugEngine, Process, this, thread, debugEvent); ManualContinueFromEvent(e); } }
private void HandleClassPrepare(object sender, ClassPrepareEventArgs e) { if (e.SuspendPolicy == SuspendPolicy.All) Interlocked.Increment(ref _suspended); JavaDebugThread thread; lock (_threads) { this._threads.TryGetValue(e.Thread.GetUniqueId(), out thread); } try { ReadOnlyCollection<string> sourceFiles = e.Type.GetSourcePaths(e.Type.GetDefaultStratum()); DebugEngine.BindVirtualizedBreakpoints(this, thread, e.Type, sourceFiles); } catch (MissingInformationException) { // Can't bind debug information for classes that don't contain debug information } // The format of the message created by the .NET debugger is this: // 'devenv.exe' (Managed (v4.0.30319)): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\Microsoft.VisualStudio.Windows.Forms\v4.0_10.0.0.0__b03f5f7f11d50a3a\Microsoft.VisualStudio.Windows.Forms.dll' string message = string.Format("'{0}' ({1}): Loaded '{2}'\n", Process.GetName(enum_GETNAME_TYPE.GN_BASENAME), Java.Constants.JavaLanguageName, e.Type.GetName()); DebugEvent outputEvent = new DebugOutputStringEvent(message); SetEventProperties(outputEvent, e, true); Callback.Event(DebugEngine, Process, this, thread, outputEvent); ManualContinueFromEvent(e); }