Revert "[NativeProcessLinux] Integrate MainLoop"
This seems to be causing major slowdows on the android buildbot. Reverting while I investigate.
llvm-svn: 242391
diff --git a/lldb/source/Plugins/Process/Linux/NativeProcessLinux.h b/lldb/source/Plugins/Process/Linux/NativeProcessLinux.h
index 1632f7f..e3832d6 100644
--- a/lldb/source/Plugins/Process/Linux/NativeProcessLinux.h
+++ b/lldb/source/Plugins/Process/Linux/NativeProcessLinux.h
@@ -43,16 +43,25 @@
friend Error
NativeProcessProtocol::Launch (ProcessLaunchInfo &launch_info,
NativeDelegate &native_delegate,
- MainLoop &mainloop,
NativeProcessProtocolSP &process_sp);
friend Error
NativeProcessProtocol::Attach (lldb::pid_t pid,
- NativeProcessProtocol::NativeDelegate &native_delegate,
- MainLoop &mainloop,
- NativeProcessProtocolSP &process_sp);
+ NativeProcessProtocol::NativeDelegate &native_delegate,
+ NativeProcessProtocolSP &native_process_sp);
public:
+ //------------------------------------------------------------------------------
+ /// @class Operation
+ /// @brief Represents a NativeProcessLinux operation.
+ ///
+ /// Under Linux, it is not possible to ptrace() from any other thread but the
+ /// one that spawned or attached to the process from the start. Therefore, when
+ /// a NativeProcessLinux is asked to deliver or change the state of an inferior
+ /// process the operation must be "funneled" to a specific thread to perform the
+ /// task.
+ typedef std::function<Error()> Operation;
+
// ---------------------------------------------------------------------
// NativeProcessProtocol Interface
// ---------------------------------------------------------------------
@@ -104,9 +113,18 @@
Error
SetBreakpoint (lldb::addr_t addr, uint32_t size, bool hardware) override;
+ Error
+ SetWatchpoint (lldb::addr_t addr, size_t size, uint32_t watch_flags, bool hardware) override;
+
+ Error
+ RemoveWatchpoint (lldb::addr_t addr) override;
+
void
DoStopIDBumped (uint32_t newBumpId) override;
+ void
+ Terminate () override;
+
Error
GetLoadedModuleFileSpec(const char* module_path, FileSpec& file_spec) override;
@@ -116,6 +134,9 @@
// ---------------------------------------------------------------------
// Interface used by NativeRegisterContext-derived classes.
// ---------------------------------------------------------------------
+ Error
+ DoOperation(const Operation &op);
+
static Error
PtraceWrapper(int req,
lldb::pid_t pid,
@@ -133,9 +154,12 @@
private:
- MainLoop::SignalHandleUP m_sigchld_handle;
+ class Monitor;
+
ArchSpec m_arch;
+ std::unique_ptr<Monitor> m_monitor_up;
+
LazyBool m_supports_mem_region;
std::vector<MemoryRegionInfo> m_mem_region_cache;
Mutex m_mem_region_cache_mutex;
@@ -182,7 +206,6 @@
/// implementation of Process::DoLaunch.
void
LaunchInferior (
- MainLoop &mainloop,
Module *module,
char const *argv[],
char const *envp[],
@@ -196,7 +219,10 @@
/// Attaches to an existing process. Forms the
/// implementation of Process::DoAttach
void
- AttachToInferior (MainLoop &mainloop, lldb::pid_t pid, Error &error);
+ AttachToInferior (lldb::pid_t pid, Error &error);
+
+ void
+ StartMonitorThread(const InitialOperation &operation, Error &error);
::pid_t
Launch(LaunchArgs *args, Error &error);
@@ -344,9 +370,6 @@
void
ThreadWasCreated (lldb::tid_t tid);
- void
- SigchldHandler();
-
// Member variables.
PendingNotificationUP m_pending_notification_up;
};