void get_thread_info(Inferior inferior, SingleSteppingEngine engine) { if (thread_db == null) { if (mono_manager == null) { return; } Report.Error("Failed to initialize thread_db on {0}: {1} {2}", start.CommandLine, start, Environment.StackTrace); throw new InternalError(); } bool found = false; thread_db.GetThreadInfo(inferior, delegate(int lwp, long tid) { if (lwp != engine.PID) { return; } engine.SetTID(tid); found = true; }); if (!found) { Report.Error("Cannot find thread {0:x} in {1}", engine.PID, start.CommandLine); } }
private async Task Connect(string hostname, int port, uint timeout = 5000) { long endTime = DateTime.Now.Ticks + timeout * 10000; while (DateTime.Now.Ticks < endTime) { try { Inferior = new Inferior(); Inferior.Attached += duktape_Attached; Inferior.Detached += duktape_Detached; Inferior.Throw += duktape_ErrorThrown; Inferior.Print += duktape_Print; Inferior.Status += duktape_Status; await Inferior.Connect(hostname, port); return; } catch (SocketException) { // a SocketException in this situation just means we failed to connect, // likely due to nobody listening. we can safely ignore it; just keep trying // until the timeout expires. } } throw new TimeoutException(); }
protected void initialize_notifications(Inferior inferior) { TargetAddress executable_code_buffer = inferior.ReadAddress( debugger_info.ExecutableCodeBuffer); HasCodeBuffer = !executable_code_buffer.IsNull; mono_runtime_info = mono_debugger_server_initialize_mono_runtime( inferior.TargetAddressSize, debugger_info.NotificationAddress.Address, executable_code_buffer.Address, debugger_info.ExecutableCodeBufferSize, debugger_info.BreakpointInfo.Address, debugger_info.BreakpointInfoIndex.Address, debugger_info.BreakpointArraySize); inferior.SetRuntimeInfo(mono_runtime_info); debugger_version = inferior.ReadInteger(debugger_info.DebuggerVersion); if (notification_bpt != null) { notification_bpt.Remove(inferior); notification_bpt = null; } if (debugger_info.HasThreadAbortSignal) { thread_abort_signal = inferior.ReadInteger(debugger_info.ThreadAbortSignal); } else { thread_abort_signal = inferior.MonoThreadAbortSignal; } }
internal void ChildForked(Inferior inferior, int pid) { Process new_process = new Process(this, pid); new_process.ProcessStart.StopInMain = false; Inferior new_inferior = Inferior.CreateInferior( manager, new_process, new_process.ProcessStart); new_inferior.InitializeThread(pid); if (!manager.Debugger.Configuration.FollowFork) { new_inferior.DetachAfterFork(); return; } SingleSteppingEngine new_thread = new SingleSteppingEngine( manager, new_process, new_inferior, pid); Report.Debug(DebugFlags.Threads, "Child forked: {0} {1}", pid, new_thread); new_process.main_thread = new_thread; manager.Debugger.OnProcessCreatedEvent(new_process); new_process.OnThreadCreatedEvent(new_thread); CommandResult result = new_process.CloneParentOperation(new_thread); new_thread.StartForkedChild(result); }
internal override bool BreakpointHandler(Inferior inferior, out bool remain_stopped) { inferior.Architecture.Hack_ReturnNull(inferior); remain_stopped = false; return(true); }
void check_for_mono_runtime(Inferior inferior, Bfd bfd) { TargetAddress info = bfd.GetSectionAddress(".mdb_debug_info"); if (info.IsNull) { return; } TargetAddress data = inferior.ReadAddress(info); if (data.IsNull) { // // See CheckForPendingMonoInit() below - this should only happen when // the Mono runtime is embedded - for instance Moonlight inside Firefox. // // Note that we have to do a symbol lookup for it because we do not know // whether the mono runtime is recent enough to have this variable. // data = bfd.LookupSymbol("MONO_DEBUGGER__using_debugger"); if (data.IsNull) { Report.Error("Failed to initialize the Mono runtime!"); return; } inferior.WriteInteger(data, 1); pending_mono_init = info; return; } Process.InitializeMono(inferior, data); }
void check_nptl_setxid(Inferior inferior, Bfd bfd) { if (setxid_breakpoint != null) { return; } TargetAddress vtable = bfd.LookupSymbol("__libc_pthread_functions"); if (vtable.IsNull) { return; } /* * Big big hack to allow debugging gnome-vfs: * We intercept any calls to __nptl_setxid() and make it * return 0. This is safe to do since we do not allow * debugging setuid programs or running as root, so setxid() * will always be a no-op anyways. */ TargetAddress nptl_setxid = inferior.ReadAddress(vtable + 51 * inferior.TargetAddressSize); if (!nptl_setxid.IsNull) { setxid_breakpoint = new SetXidBreakpoint(this, nptl_setxid); setxid_breakpoint.Insert(inferior); } }
protected CoreFile(ThreadManager manager, ProcessStart start) : base(manager, start) { info = Inferior.GetTargetMemoryInfo(manager.AddressDomain); bfd = (Bfd)NativeLanguage.OperatingSystem.LoadExecutable( info, start.TargetApplication, true); core_file = start.CoreFile; core_bfd = bfd.OpenCoreFile(core_file); #if FIXME string crash_program = core_bfd.CrashProgram; string[] crash_program_args = crash_program.Split(' '); if (crash_program_args [0] != application) { throw new TargetException( TargetError.CannotStartTarget, "Core file (generated from {0}) doesn't match executable {1}.", crash_program, application); } bool ok; try { DateTime core_date = Directory.GetLastWriteTime(core_file); DateTime app_date = Directory.GetLastWriteTime(application); ok = app_date < core_date; } catch { ok = false; } if (!ok) { throw new TargetException( TargetError.CannotStartTarget, "Executable {0} is more recent than core file {1}.", application, core_file); } #endif read_note_section(); main_thread = (CoreFileThread)threads [0]; TargetMemoryAccess target_access = ((CoreFileThread)threads [0]).TargetAccess; // bfd.UpdateSharedLibraryInfo (null, target_access); TargetAddress mdb_debug_info = bfd.GetSectionAddress(".mdb_debug_info"); if (!mdb_debug_info.IsNull) { mdb_debug_info = main_thread.ReadAddress(mdb_debug_info); debugger_info = MonoDebuggerInfo.Create(target_access, mdb_debug_info); read_thread_table(); CreateMonoLanguage(debugger_info); mono_language.InitializeCoreFile(target_access); mono_language.Update(target_access); } }
public async Task Detach() { expectDetach = true; await Inferior.Detach(); Dispose(); }
internal override bool BreakpointHandler(Inferior inferior, out bool remain_stopped) { manager.initialize_notifications(inferior); remain_stopped = false; return(true); }
internal void InitCodeBuffer(Inferior inferior, TargetAddress code_buffer) { HasCodeBuffer = true; mono_debugger_server_initialize_code_buffer( mono_runtime_info, code_buffer.Address, debugger_info.ExecutableCodeBufferSize); }
internal void ThreadCreated(Inferior inferior, int pid, bool do_attach, bool resume_thread) { Inferior new_inferior = inferior.CreateThread(pid, do_attach); SingleSteppingEngine new_thread = new SingleSteppingEngine(manager, this, new_inferior, pid); Report.Debug(DebugFlags.Threads, "Thread created: {0} {1} {2}", pid, new_thread, do_attach); if (mono_manager != null) { mono_manager.ThreadCreated(new_thread); } if (!do_attach && !is_execed) { get_thread_info(inferior, new_thread); } OnThreadCreatedEvent(new_thread); if (resume_thread) { CommandResult result = current_operation != null ? current_operation : new ThreadCommandResult(new_thread.Thread); new_thread.StartThread(result); } else { new_thread.StartSuspended(); } }
public void InitializeAfterFork(Inferior inferior) { Lock(); try { int[] indices = new int [index_hash.Count]; index_hash.Keys.CopyTo(indices, 0); for (int i = 0; i < indices.Length; i++) { int idx = indices [i]; BreakpointEntry entry = (BreakpointEntry)index_hash [idx]; SourceBreakpoint bpt = entry.Handle.Breakpoint as SourceBreakpoint; if (!entry.Handle.Breakpoint.ThreadGroup.IsGlobal) { try { inferior.RemoveBreakpoint(idx); } catch (Exception ex) { Report.Error("Removing breakpoint {0} failed: {1}", idx, ex); } } } } finally { Unlock(); } }
internal SingleSteppingEngine GetEngineByTID(Inferior inferior, long tid) { foreach (SingleSteppingEngine engine in thread_hash.Values) { if (engine.TID == tid) { return(engine); } } if (thread_db == null) { Report.Error("Failed to initialize thread_db on {0}: {1}", start.CommandLine, start); return(null); } SingleSteppingEngine result = null; thread_db.GetThreadInfo(inferior, delegate(int t_lwp, long t_tid) { if (tid != t_tid) { return; } result = (SingleSteppingEngine)thread_hash [t_lwp]; }); if (result == null) { Report.Error("Cannot find thread {0:x} in {1}", tid, start.CommandLine); } return(result); }
public static MonoThreadManager Initialize(Process process, Inferior inferior, TargetAddress info, bool attach) { MonoDebuggerInfo debugger_info = MonoDebuggerInfo.Create(inferior, info); if (debugger_info == null) { return(null); } if (attach) { if (!debugger_info.CheckRuntimeVersion(81, 2)) { Report.Error("The Mono runtime of the target application is too old to support attaching,\n" + "attaching as a native application."); return(null); } if ((debugger_info.RuntimeFlags & 1) != 1) { Report.Error("The Mono runtime of the target application does not support attaching,\n" + "attaching as a native application."); return(null); } } return(new MonoThreadManager(process, inferior, debugger_info)); }
protected void check_loaded_library(Inferior inferior, Bfd bfd) { if (!Process.MonoRuntimeFound) { check_for_mono_runtime(inferior, bfd); } }
internal void InitializeThreads(Inferior inferior) { TargetAddress ptr = inferior.ReadAddress(MonoDebuggerInfo.ThreadTable); while (!ptr.IsNull) { int size; if (MonoDebuggerInfo.CheckRuntimeVersion(81, 3)) { size = 60 + inferior.TargetMemoryInfo.TargetAddressSize; } else { size = 32 + inferior.TargetMemoryInfo.TargetAddressSize; } TargetReader reader = new TargetReader(inferior.ReadMemory(ptr, size)); long tid = reader.ReadLongInteger(); TargetAddress lmf_addr = reader.ReadAddress(); TargetAddress end_stack = reader.ReadAddress(); TargetAddress extended_notifications_addr = ptr + 24; if (inferior.TargetMemoryInfo.TargetAddressSize == 4) { tid &= 0x00000000ffffffffL; } reader.Offset += 8; ptr = reader.ReadAddress(); ThreadFlags flags = ThreadFlags.None; if (MonoDebuggerInfo.CheckRuntimeVersion(81, 3)) { reader.Offset = 56 + inferior.TargetAddressSize; flags = (ThreadFlags)reader.ReadInteger(); } bool found = false; foreach (SingleSteppingEngine engine in process.Engines) { if (engine.TID != tid) { continue; } engine.SetManagedThreadData(lmf_addr, extended_notifications_addr); engine.OnManagedThreadCreated(end_stack); check_thread_flags(engine, flags); found = true; break; } if (!found) { Report.Error("Cannot find thread {0:x} in {1}", tid, process.ProcessStart.CommandLine); } } }
internal void Remove(Inferior inferior) { if (handle != null) { handle.Remove(inferior); handle = null; } }
internal Queue <ManagedCallbackData> ClearManagedCallbacks(Inferior inferior) { inferior.WriteInteger(MonoDebuggerInfo.InterruptionRequest, 0); Queue <ManagedCallbackData> retval = managed_callbacks; managed_callbacks = new Queue <ManagedCallbackData> (); return(retval); }
internal void Insert(Inferior inferior) { if (handle == null) { handle = new AddressBreakpointHandle(this, address); } handle.Insert(inferior); }
internal override void UpdateSharedLibraries(Inferior inferior) { // This fails if it's a statically linked executable. try { read_dynamic_info(inferior); } catch (Exception ex) { Report.Error("Failed to read shared libraries: {0}", ex); return; } }
bool dynlink_handler(Inferior inferior) { if (inferior.ReadInteger(rdebug_state_addr) != 0) { return(false); } do_update_shlib_info(inferior); return(false); }
protected X86_Opcodes(Process process) { this.process = process; target_info = Inferior.GetTargetMemoryInfo(AddressDomain.Global); if (!Inferior.IsRunningOnWindows) { disassembler = new BfdDisassembler(null, Is64BitMode); } }
public static ThreadDB Create(Process process, Inferior target) { ThreadDB db = new ThreadDB(process); if (!db.Initialize(target)) { return(null); } return(db); }
protected MonoThreadManager(Process process, Inferior inferior, MonoDebuggerInfo debugger_info) { this.process = process; this.debugger_info = debugger_info; inferior.WriteInteger(debugger_info.UsingMonoDebugger, 1); notification_bpt = new InitializeBreakpoint(this, debugger_info.Initialize); notification_bpt.Insert(inferior); }
internal override bool BreakpointHandler(Inferior inferior, out bool remain_stopped) { OS.do_update_shlib_info(inferior); if (!Instruction.InterpretInstruction(inferior)) { throw new InternalError(); } remain_stopped = false; return(true); }
void read_dynamic_info(Inferior inferior) { if (has_dynlink_info) { if (!first_link_map.IsNull) { do_update_shlib_info(inferior); } return; } TargetAddress debug_base = main_bfd.ReadDynamicInfo(inferior); if (debug_base.IsNull) { return; } int size = 2 * inferior.TargetLongIntegerSize + 3 * inferior.TargetAddressSize; TargetReader reader = new TargetReader(inferior.ReadMemory(debug_base, size)); if (reader.ReadLongInteger() != 1) { return; } first_link_map = reader.ReadAddress(); dynlink_breakpoint_addr = reader.ReadAddress(); rdebug_state_addr = debug_base + reader.Offset; if (reader.ReadLongInteger() != 0) { return; } has_dynlink_info = true; Instruction insn = inferior.Architecture.ReadInstruction(inferior, dynlink_breakpoint_addr); if ((insn == null) || !insn.CanInterpretInstruction) { throw new InternalError("Unknown dynlink breakpoint: {0}", dynlink_breakpoint_addr); } dynlink_breakpoint = new DynlinkBreakpoint(this, insn); dynlink_breakpoint.Insert(inferior); do_update_shlib_info(inferior); check_loaded_library(inferior, main_bfd); }
public ObjectViewer(Inferior inferior, string objectName, DValue value) { InitializeComponent(); ObjectNameTextBox.Text = string.Format("eval('{0}') = {1};", objectName.Replace(@"\", @"\\").Replace("'", @"\'").Replace("\n", @"\n").Replace("\r", @"\r"), value.ToString()); TreeIconImageList.Images.Add("object", Resources.StackIcon); TreeIconImageList.Images.Add("prop", Resources.VisibleIcon); TreeIconImageList.Images.Add("hiddenProp", Resources.InvisibleIcon); _inferior = inferior; _value = value; }
void check_for_mono_runtime(Inferior inferior, Bfd bfd) { TargetAddress info = bfd.LookupSymbol("MONO_DEBUGGER__debugger_info_ptr"); if (info.IsNull) { return; } TargetAddress data = inferior.ReadAddress(info); if (data.IsNull) { // // See CheckForPendingMonoInit() below - this should only happen when // the Mono runtime is embedded - for instance Moonlight inside Firefox. // // Note that we have to do a symbol lookup for it because we do not know // whether the mono runtime is recent enough to have this variable. // data = bfd.LookupSymbol("MONO_DEBUGGER__using_debugger"); if (data.IsNull) { Report.Error("Failed to initialize the Mono runtime!"); return; } inferior.WriteInteger(data, 1); pending_mono_init = info; // Add a breakpoint in mini_debugger_init, to make sure that InitializeMono() // gets called in time to set the breakpoint at debugger_initialize, needed to // initialize the notifications. TargetAddress mini_debugger_init = bfd.LookupSymbol("mini_debugger_init"); if (!mini_debugger_init.IsNull) { Instruction insn = inferior.Architecture.ReadInstruction(inferior, mini_debugger_init); if ((insn == null) || !insn.CanInterpretInstruction) { throw new InternalError("Unknown dynlink breakpoint: {0}", mini_debugger_init); } DynlinkBreakpoint init_breakpoint = new DynlinkBreakpoint(this, insn); init_breakpoint.Insert(inferior); } return; } Process.InitializeMono(inferior, data); }
void do_update_shlib_info(Inferior inferior) { bool first = true; TargetAddress map = first_link_map; while (!map.IsNull) { int the_size = 4 * inferior.TargetAddressSize; TargetReader map_reader = new TargetReader(inferior.ReadMemory(map, the_size)); TargetAddress l_addr = map_reader.ReadAddress(); TargetAddress l_name = map_reader.ReadAddress(); map_reader.ReadAddress(); string name; try { name = inferior.ReadString(l_name); // glibc 2.3.x uses the empty string for the virtual // "linux-gate.so.1". if ((name != null) && (name == "")) { name = null; } } catch { name = null; } map = map_reader.ReadAddress(); if (first) { first = false; continue; } if (name == null) { continue; } if (bfd_hash.Contains(name)) { continue; } bool step_into = Process.ProcessStart.LoadNativeSymbolTable; AddExecutableFile(inferior, name, l_addr, step_into, true); } }
internal override bool BreakpointHandler(Inferior inferior, out bool remain_stopped) { manager.initialize_notifications (inferior); remain_stopped = false; return true; }
protected void initialize_notifications(Inferior inferior) { TargetAddress executable_code_buffer = inferior.ReadAddress ( debugger_info.ExecutableCodeBuffer); HasCodeBuffer = !executable_code_buffer.IsNull; mono_runtime_info = mono_debugger_server_initialize_mono_runtime ( inferior.TargetAddressSize, debugger_info.NotificationAddress.Address, executable_code_buffer.Address, debugger_info.ExecutableCodeBufferSize, debugger_info.BreakpointInfo.Address, debugger_info.BreakpointInfoIndex.Address, debugger_info.BreakpointArraySize); inferior.SetRuntimeInfo (mono_runtime_info); debugger_version = inferior.ReadInteger (debugger_info.DebuggerVersion); if (notification_bpt != null) { notification_bpt.Remove (inferior); notification_bpt = null; } if (debugger_info.HasThreadAbortSignal) thread_abort_signal = inferior.ReadInteger (debugger_info.ThreadAbortSignal); else thread_abort_signal = inferior.MonoThreadAbortSignal; }
internal void InitializeThreads(Inferior inferior) { TargetAddress ptr = inferior.ReadAddress (MonoDebuggerInfo.ThreadTable); while (!ptr.IsNull) { int size; if (MonoDebuggerInfo.CheckRuntimeVersion (81, 3)) size = 60 + inferior.TargetMemoryInfo.TargetAddressSize; else size = 32 + inferior.TargetMemoryInfo.TargetAddressSize; TargetReader reader = new TargetReader (inferior.ReadMemory (ptr, size)); long tid = reader.ReadLongInteger (); TargetAddress lmf_addr = reader.ReadAddress (); TargetAddress end_stack = reader.ReadAddress (); TargetAddress extended_notifications_addr = ptr + 24; if (inferior.TargetMemoryInfo.TargetAddressSize == 4) tid &= 0x00000000ffffffffL; reader.Offset += 8; ptr = reader.ReadAddress (); ThreadFlags flags = ThreadFlags.None; if (MonoDebuggerInfo.CheckRuntimeVersion (81, 3)) { reader.Offset = 56 + inferior.TargetAddressSize; flags = (ThreadFlags) reader.ReadInteger (); } bool found = false; foreach (SingleSteppingEngine engine in process.Engines) { if (engine.TID != tid) continue; engine.SetManagedThreadData (lmf_addr, extended_notifications_addr); engine.OnManagedThreadCreated (end_stack); check_thread_flags (engine, flags); found = true; break; } if (!found) Report.Error ("Cannot find thread {0:x} in {1}", tid, process.ProcessStart.CommandLine); } }
internal bool InitializeAfterAttach(Inferior inferior) { initialize_notifications (inferior); inferior.WriteAddress (debugger_info.ThreadVTablePtr, debugger_info.ThreadVTable); inferior.WriteAddress (debugger_info.EventHandlerPtr, debugger_info.EventHandler); inferior.WriteInteger (debugger_info.UsingMonoDebugger, 1); csharp_language = inferior.Process.CreateMonoLanguage (debugger_info); csharp_language.InitializeAttach (inferior); return true; }
internal void InitCodeBuffer(Inferior inferior, TargetAddress code_buffer) { HasCodeBuffer = true; mono_debugger_server_initialize_code_buffer ( mono_runtime_info, code_buffer.Address, debugger_info.ExecutableCodeBufferSize); }
internal void Detach(Inferior inferior) { inferior.WriteAddress (debugger_info.ThreadVTablePtr, TargetAddress.Null); inferior.WriteAddress (debugger_info.EventHandler, TargetAddress.Null); inferior.WriteInteger (debugger_info.UsingMonoDebugger, 0); }
internal void AddManagedCallback(Inferior inferior, ManagedCallbackData data) { inferior.WriteInteger (MonoDebuggerInfo.InterruptionRequest, 1); managed_callbacks.Enqueue (data); }
public static MonoThreadManager Initialize(Process process, Inferior inferior, TargetAddress info, bool attach) { MonoDebuggerInfo debugger_info = MonoDebuggerInfo.Create (inferior, info); if (debugger_info == null) return null; if (attach) { if (!debugger_info.CheckRuntimeVersion (81, 2)) { Report.Error ("The Mono runtime of the target application is too old to support attaching,\n" + "attaching as a native application."); return null; } if ((debugger_info.RuntimeFlags & 1) != 1) { Report.Error ("The Mono runtime of the target application does not support attaching,\n" + "attaching as a native application."); return null; } } return new MonoThreadManager (process, inferior, debugger_info); }
protected MonoThreadManager(Process process, Inferior inferior, MonoDebuggerInfo debugger_info) { this.process = process; this.debugger_info = debugger_info; inferior.WriteInteger (debugger_info.UsingMonoDebugger, 1); notification_bpt = new InitializeBreakpoint (this, debugger_info.Initialize); notification_bpt.Insert (inferior); }
internal Queue<ManagedCallbackData> ClearManagedCallbacks(Inferior inferior) { inferior.WriteInteger (MonoDebuggerInfo.InterruptionRequest, 0); Queue<ManagedCallbackData> retval = managed_callbacks; managed_callbacks = new Queue<ManagedCallbackData> (); return retval; }
internal bool HandleChildEvent(SingleSteppingEngine engine, Inferior inferior, ref Inferior.ChildEvent cevent, out bool resume_target) { if (cevent.Type == Inferior.ChildEventType.CHILD_NOTIFICATION) { NotificationType type = (NotificationType) cevent.Argument; Report.Debug (DebugFlags.EventLoop, "{0} received notification {1}: {2}", engine, type, cevent); switch (type) { case NotificationType.AcquireGlobalThreadLock: Report.Debug (DebugFlags.Threads, "{0} received notification {1}", engine, type); engine.Process.AcquireGlobalThreadLock (engine); break; case NotificationType.ReleaseGlobalThreadLock: Report.Debug (DebugFlags.Threads, "{0} received notification {1}", engine, type); engine.Process.ReleaseGlobalThreadLock (engine); break; case NotificationType.ThreadCreated: { TargetAddress data = new TargetAddress ( inferior.AddressDomain, cevent.Data2); TargetAddress lmf = inferior.ReadAddress (data + 8); engine.SetManagedThreadData (lmf, data + 24); if (MonoDebuggerInfo.CheckRuntimeVersion (81, 3)) { int flags_offset = 56 + inferior.TargetAddressSize; ThreadFlags flags = (ThreadFlags) inferior.ReadInteger (data + flags_offset); check_thread_flags (engine, flags); } Report.Debug (DebugFlags.Threads, "{0} managed thread created: {1:x} {2} {3} - {4}", engine, cevent.Data1, data, lmf, engine.LMFAddress); break; } case NotificationType.ThreadCleanup: { TargetAddress data = new TargetAddress ( inferior.AddressDomain, cevent.Data1); Report.Debug (DebugFlags.Threads, "{0} managed thread cleanup: {1:x} {2}", engine, cevent.Data2, data); break; } case NotificationType.GcThreadCreated: { TargetAddress data = new TargetAddress ( inferior.AddressDomain, cevent.Data1); long tid = cevent.Data2; Report.Debug (DebugFlags.Threads, "{0} created gc thread: {1:x} {2}", engine, tid, data); engine = engine.Process.GetEngineByTID (inferior, tid); if (engine == null) throw new InternalError (); engine.OnManagedThreadCreated (data); break; } case NotificationType.GcThreadExited: Report.Debug (DebugFlags.Threads, "{0} gc thread exited", engine); engine.OnManagedThreadExited (); try { inferior.Continue (); } catch { // Ignore errors; for some reason, the thread may have died // already by the time get this notification. } resume_target = false; return true; case NotificationType.InitializeThreadManager: csharp_language = inferior.Process.CreateMonoLanguage ( debugger_info); if (engine.Process.IsAttached) csharp_language.InitializeAttach (inferior); else csharp_language.Initialize (inferior); break; case NotificationType.ReachedMain: { Inferior.StackFrame iframe = inferior.GetCurrentFrame (false); engine.SetMainReturnAddress (iframe.StackPointer); engine.Process.OnProcessReachedMainEvent (); resume_target = !engine.InitializeBreakpoints (); return true; } case NotificationType.WrapperMain: break; case NotificationType.MainExited: engine.SetMainReturnAddress (TargetAddress.Null); break; case NotificationType.UnhandledException: cevent = new Inferior.ChildEvent ( Inferior.ChildEventType.UNHANDLED_EXCEPTION, 0, cevent.Data1, cevent.Data2); resume_target = false; return false; case NotificationType.HandleException: cevent = new Inferior.ChildEvent ( Inferior.ChildEventType.HANDLE_EXCEPTION, 0, cevent.Data1, cevent.Data2); resume_target = false; return false; case NotificationType.ThrowException: cevent = new Inferior.ChildEvent ( Inferior.ChildEventType.THROW_EXCEPTION, 0, cevent.Data1, cevent.Data2); resume_target = false; return false; case NotificationType.FinalizeManagedCode: mono_debugger_server_finalize_mono_runtime (mono_runtime_info); mono_runtime_info = IntPtr.Zero; csharp_language = null; break; case NotificationType.OldTrampoline: case NotificationType.Trampoline: resume_target = false; return false; case NotificationType.ClassInitialized: break; case NotificationType.InterruptionRequest: inferior.WriteInteger (MonoDebuggerInfo.InterruptionRequest, 0); var callbacks = managed_callbacks; managed_callbacks = new Queue<ManagedCallbackData> (); resume_target = !engine.OnManagedCallback (callbacks); return true; default: { TargetAddress data = new TargetAddress ( inferior.AddressDomain, cevent.Data1); resume_target = csharp_language.Notification ( engine, inferior, type, data, cevent.Data2); return true; } } resume_target = true; return true; } if ((cevent.Type == Inferior.ChildEventType.CHILD_STOPPED) && (cevent.Argument == thread_abort_signal)) { resume_target = true; return true; } if ((cevent.Type == Inferior.ChildEventType.CHILD_STOPPED) && (cevent.Argument != 0) && ! engine.Process.Session.Config.StopOnManagedSignals) { if (inferior.IsManagedSignal ((int) cevent.Argument)) { resume_target = true; return true; } } resume_target = false; return false; }