bool
UnregisterNativeDelegate (NativeDelegate &native_delegate);
+ // Called before termination of NativeProcessProtocol's instance.
+ virtual void
+ Terminate ();
+
protected:
lldb::pid_t m_pid;
{
// Default implementation does nothing.
}
+
+void
+NativeProcessProtocol::Terminate ()
+{
+ // Default implementation does nothing.
+}
}
}
-NativeProcessLinux::~NativeProcessLinux()
+void
+NativeProcessLinux::Terminate ()
{
StopMonitor();
}
// Tell the coordinator we're done. This will cause the coordinator
// run loop thread to exit when the processing queue hits this message.
m_coordinator_up->StopCoordinator ();
+ m_coordinator_thread.Join (nullptr);
}
bool
NativeProcessProtocolSP &native_process_sp);
// ---------------------------------------------------------------------
- // Public Instance Methods
- // ---------------------------------------------------------------------
-
- ~NativeProcessLinux() override;
-
- // ---------------------------------------------------------------------
// NativeProcessProtocol Interface
// ---------------------------------------------------------------------
Error
void
DoStopIDBumped (uint32_t newBumpId) override;
+ void
+ Terminate () override;
+
// ---------------------------------------------------------------------
// Interface used by NativeRegisterContext-derived classes.
// ---------------------------------------------------------------------
// then this is a new thread. So set all existing watchpoints.
if (m_watchpoint_index_map.empty())
{
- const auto &watchpoint_map = GetProcess()->GetWatchpointMap();
- if (watchpoint_map.empty()) return;
- GetRegisterContext()->ClearAllHardwareWatchpoints();
- for (const auto &pair : watchpoint_map)
+ const auto process_sp = GetProcess();
+ if (process_sp)
{
- const auto& wp = pair.second;
- SetWatchpoint(wp.m_addr, wp.m_size, wp.m_watch_flags, wp.m_hardware);
+ const auto &watchpoint_map = process_sp->GetWatchpointMap();
+ if (watchpoint_map.empty()) return;
+ GetRegisterContext()->ClearAllHardwareWatchpoints();
+ for (const auto &pair : watchpoint_map)
+ {
+ const auto& wp = pair.second;
+ SetWatchpoint(wp.m_addr, wp.m_size, wp.m_watch_flags, wp.m_hardware);
+ }
}
}
}
//----------------------------------------------------------------------
GDBRemoteCommunicationServerLLGS::~GDBRemoteCommunicationServerLLGS()
{
+ Mutex::Locker locker (m_debugged_process_mutex);
+
+ if (m_debugged_process_sp)
+ {
+ m_debugged_process_sp->Terminate ();
+ m_debugged_process_sp.reset ();
+ }
}
void