1af245d11STodd Fiala //===-- NativeProcessLinux.h ---------------------------------- -*- C++ -*-===//
2af245d11STodd Fiala //
3af245d11STodd Fiala //                     The LLVM Compiler Infrastructure
4af245d11STodd Fiala //
5af245d11STodd Fiala // This file is distributed under the University of Illinois Open Source
6af245d11STodd Fiala // License. See LICENSE.TXT for details.
7af245d11STodd Fiala //
8af245d11STodd Fiala //===----------------------------------------------------------------------===//
9af245d11STodd Fiala 
10af245d11STodd Fiala #ifndef liblldb_NativeProcessLinux_H_
11af245d11STodd Fiala #define liblldb_NativeProcessLinux_H_
12af245d11STodd Fiala 
13af245d11STodd Fiala // C Includes
14af245d11STodd Fiala #include <semaphore.h>
15af245d11STodd Fiala #include <signal.h>
16af245d11STodd Fiala 
17af245d11STodd Fiala // C++ Includes
18af245d11STodd Fiala #include <unordered_set>
19af245d11STodd Fiala 
20af245d11STodd Fiala // Other libraries and framework includes
21af245d11STodd Fiala #include "lldb/Core/ArchSpec.h"
22af245d11STodd Fiala #include "lldb/lldb-types.h"
23af245d11STodd Fiala #include "lldb/Host/Debug.h"
2439de3110SZachary Turner #include "lldb/Host/HostThread.h"
25af245d11STodd Fiala #include "lldb/Host/Mutex.h"
26af245d11STodd Fiala #include "lldb/Target/MemoryRegionInfo.h"
27af245d11STodd Fiala 
282fe1d0abSChaoren Lin #include "lldb/Host/common/NativeProcessProtocol.h"
29af245d11STodd Fiala 
30db264a6dSTamas Berghammer namespace lldb_private {
31af245d11STodd Fiala     class Error;
32af245d11STodd Fiala     class Module;
33af245d11STodd Fiala     class Scalar;
34af245d11STodd Fiala 
35db264a6dSTamas Berghammer namespace process_linux {
36db264a6dSTamas Berghammer     class ThreadStateCoordinator;
37db264a6dSTamas Berghammer 
38af245d11STodd Fiala     /// @class NativeProcessLinux
39af245d11STodd Fiala     /// @brief Manages communication with the inferior (debugee) process.
40af245d11STodd Fiala     ///
41af245d11STodd Fiala     /// Upon construction, this class prepares and launches an inferior process for
42af245d11STodd Fiala     /// debugging.
43af245d11STodd Fiala     ///
44af245d11STodd Fiala     /// Changes in the inferior process state are broadcasted.
45af245d11STodd Fiala     class NativeProcessLinux: public NativeProcessProtocol
46af245d11STodd Fiala     {
47af245d11STodd Fiala     public:
48af245d11STodd Fiala 
49db264a6dSTamas Berghammer         static Error
50af245d11STodd Fiala         LaunchProcess (
51af245d11STodd Fiala             Module *exe_module,
52af245d11STodd Fiala             ProcessLaunchInfo &launch_info,
53db264a6dSTamas Berghammer             NativeProcessProtocol::NativeDelegate &native_delegate,
54af245d11STodd Fiala             NativeProcessProtocolSP &native_process_sp);
55af245d11STodd Fiala 
56db264a6dSTamas Berghammer         static Error
57af245d11STodd Fiala         AttachToProcess (
58af245d11STodd Fiala             lldb::pid_t pid,
59db264a6dSTamas Berghammer             NativeProcessProtocol::NativeDelegate &native_delegate,
60af245d11STodd Fiala             NativeProcessProtocolSP &native_process_sp);
61af245d11STodd Fiala 
62af245d11STodd Fiala         // ---------------------------------------------------------------------
63af245d11STodd Fiala         // NativeProcessProtocol Interface
64af245d11STodd Fiala         // ---------------------------------------------------------------------
65af245d11STodd Fiala         Error
66af245d11STodd Fiala         Resume (const ResumeActionList &resume_actions) override;
67af245d11STodd Fiala 
68af245d11STodd Fiala         Error
69af245d11STodd Fiala         Halt () override;
70af245d11STodd Fiala 
71af245d11STodd Fiala         Error
72af245d11STodd Fiala         Detach () override;
73af245d11STodd Fiala 
74af245d11STodd Fiala         Error
75af245d11STodd Fiala         Signal (int signo) override;
76af245d11STodd Fiala 
77af245d11STodd Fiala         Error
78e9547b80SChaoren Lin         Interrupt () override;
79e9547b80SChaoren Lin 
80e9547b80SChaoren Lin         Error
81af245d11STodd Fiala         Kill () override;
82af245d11STodd Fiala 
83af245d11STodd Fiala         Error
84af245d11STodd Fiala         GetMemoryRegionInfo (lldb::addr_t load_addr, MemoryRegionInfo &range_info) override;
85af245d11STodd Fiala 
86af245d11STodd Fiala         Error
87af245d11STodd Fiala         ReadMemory (lldb::addr_t addr, void *buf, lldb::addr_t size, lldb::addr_t &bytes_read) override;
88af245d11STodd Fiala 
89af245d11STodd Fiala         Error
90af245d11STodd Fiala         WriteMemory (lldb::addr_t addr, const void *buf, lldb::addr_t size, lldb::addr_t &bytes_written) override;
91af245d11STodd Fiala 
92af245d11STodd Fiala         Error
93af245d11STodd Fiala         AllocateMemory (lldb::addr_t size, uint32_t permissions, lldb::addr_t &addr) override;
94af245d11STodd Fiala 
95af245d11STodd Fiala         Error
96af245d11STodd Fiala         DeallocateMemory (lldb::addr_t addr) override;
97af245d11STodd Fiala 
98af245d11STodd Fiala         lldb::addr_t
99af245d11STodd Fiala         GetSharedLibraryInfoAddress () override;
100af245d11STodd Fiala 
101af245d11STodd Fiala         size_t
102af245d11STodd Fiala         UpdateThreads () override;
103af245d11STodd Fiala 
104af245d11STodd Fiala         bool
105af245d11STodd Fiala         GetArchitecture (ArchSpec &arch) const override;
106af245d11STodd Fiala 
107af245d11STodd Fiala         Error
108af245d11STodd Fiala         SetBreakpoint (lldb::addr_t addr, uint32_t size, bool hardware) override;
109af245d11STodd Fiala 
110af245d11STodd Fiala         void
111af245d11STodd Fiala         DoStopIDBumped (uint32_t newBumpId) override;
112af245d11STodd Fiala 
1138bc34f4dSOleksiy Vyalov         void
1148bc34f4dSOleksiy Vyalov         Terminate () override;
1158bc34f4dSOleksiy Vyalov 
116af245d11STodd Fiala         // ---------------------------------------------------------------------
117af245d11STodd Fiala         // Interface used by NativeRegisterContext-derived classes.
118af245d11STodd Fiala         // ---------------------------------------------------------------------
119af245d11STodd Fiala 
120af245d11STodd Fiala         /// Reads the contents from the register identified by the given (architecture
121af245d11STodd Fiala         /// dependent) offset.
122af245d11STodd Fiala         ///
123af245d11STodd Fiala         /// This method is provided for use by RegisterContextLinux derivatives.
12497ccc294SChaoren Lin         Error
125af245d11STodd Fiala         ReadRegisterValue(lldb::tid_t tid, unsigned offset, const char *reg_name,
126db264a6dSTamas Berghammer                           unsigned size, RegisterValue &value);
127af245d11STodd Fiala 
128af245d11STodd Fiala         /// Writes the given value to the register identified by the given
129af245d11STodd Fiala         /// (architecture dependent) offset.
130af245d11STodd Fiala         ///
131af245d11STodd Fiala         /// This method is provided for use by RegisterContextLinux derivatives.
13297ccc294SChaoren Lin         Error
133af245d11STodd Fiala         WriteRegisterValue(lldb::tid_t tid, unsigned offset, const char *reg_name,
134db264a6dSTamas Berghammer                            const RegisterValue &value);
135af245d11STodd Fiala 
136af245d11STodd Fiala         /// Reads all general purpose registers into the specified buffer.
13797ccc294SChaoren Lin         Error
138af245d11STodd Fiala         ReadGPR(lldb::tid_t tid, void *buf, size_t buf_size);
139af245d11STodd Fiala 
140af245d11STodd Fiala         /// Reads generic floating point registers into the specified buffer.
14197ccc294SChaoren Lin         Error
142af245d11STodd Fiala         ReadFPR(lldb::tid_t tid, void *buf, size_t buf_size);
143af245d11STodd Fiala 
144af245d11STodd Fiala         /// Reads the specified register set into the specified buffer.
145af245d11STodd Fiala         /// For instance, the extended floating-point register set.
14697ccc294SChaoren Lin         Error
147af245d11STodd Fiala         ReadRegisterSet(lldb::tid_t tid, void *buf, size_t buf_size, unsigned int regset);
148af245d11STodd Fiala 
149af245d11STodd Fiala         /// Writes all general purpose registers into the specified buffer.
15097ccc294SChaoren Lin         Error
151af245d11STodd Fiala         WriteGPR(lldb::tid_t tid, void *buf, size_t buf_size);
152af245d11STodd Fiala 
153af245d11STodd Fiala         /// Writes generic floating point registers into the specified buffer.
15497ccc294SChaoren Lin         Error
155af245d11STodd Fiala         WriteFPR(lldb::tid_t tid, void *buf, size_t buf_size);
156af245d11STodd Fiala 
157af245d11STodd Fiala         /// Writes the specified register set into the specified buffer.
158af245d11STodd Fiala         /// For instance, the extended floating-point register set.
15997ccc294SChaoren Lin         Error
160af245d11STodd Fiala         WriteRegisterSet(lldb::tid_t tid, void *buf, size_t buf_size, unsigned int regset);
161af245d11STodd Fiala 
1627cb18bf5STamas Berghammer         Error
1637cb18bf5STamas Berghammer         GetLoadedModuleFileSpec(const char* module_path, FileSpec& file_spec) override;
1647cb18bf5STamas Berghammer 
165af245d11STodd Fiala     protected:
166af245d11STodd Fiala         // ---------------------------------------------------------------------
167af245d11STodd Fiala         // NativeProcessProtocol protected interface
168af245d11STodd Fiala         // ---------------------------------------------------------------------
169af245d11STodd Fiala         Error
170af245d11STodd Fiala         GetSoftwareBreakpointTrapOpcode (size_t trap_opcode_size_hint, size_t &actual_opcode_size, const uint8_t *&trap_opcode_bytes) override;
171af245d11STodd Fiala 
172af245d11STodd Fiala     private:
173af245d11STodd Fiala 
174db264a6dSTamas Berghammer         ArchSpec m_arch;
175af245d11STodd Fiala 
17639de3110SZachary Turner         HostThread m_operation_thread;
17739de3110SZachary Turner         HostThread m_monitor_thread;
178af245d11STodd Fiala 
179af245d11STodd Fiala         // current operation which must be executed on the priviliged thread
180af245d11STodd Fiala         void *m_operation;
181db264a6dSTamas Berghammer         Mutex m_operation_mutex;
182af245d11STodd Fiala 
183af245d11STodd Fiala         // semaphores notified when Operation is ready to be processed and when
184af245d11STodd Fiala         // the operation is complete.
185af245d11STodd Fiala         sem_t m_operation_pending;
186af245d11STodd Fiala         sem_t m_operation_done;
187af245d11STodd Fiala 
188db264a6dSTamas Berghammer         LazyBool m_supports_mem_region;
189af245d11STodd Fiala         std::vector<MemoryRegionInfo> m_mem_region_cache;
190db264a6dSTamas Berghammer         Mutex m_mem_region_cache_mutex;
191af245d11STodd Fiala 
192fa03ad2eSChaoren Lin         std::unique_ptr<ThreadStateCoordinator> m_coordinator_up;
193fa03ad2eSChaoren Lin         HostThread m_coordinator_thread;
194af245d11STodd Fiala 
195af245d11STodd Fiala         struct OperationArgs
196af245d11STodd Fiala         {
197af245d11STodd Fiala             OperationArgs(NativeProcessLinux *monitor);
198af245d11STodd Fiala 
199af245d11STodd Fiala             ~OperationArgs();
200af245d11STodd Fiala 
201af245d11STodd Fiala             NativeProcessLinux *m_monitor;      // The monitor performing the attach.
202af245d11STodd Fiala             sem_t m_semaphore;              // Posted to once operation complete.
203db264a6dSTamas Berghammer             Error m_error;    // Set if process operation failed.
204af245d11STodd Fiala         };
205af245d11STodd Fiala 
206af245d11STodd Fiala         /// @class LauchArgs
207af245d11STodd Fiala         ///
208af245d11STodd Fiala         /// @brief Simple structure to pass data to the thread responsible for
209af245d11STodd Fiala         /// launching a child process.
210af245d11STodd Fiala         struct LaunchArgs : OperationArgs
211af245d11STodd Fiala         {
212af245d11STodd Fiala             LaunchArgs(NativeProcessLinux *monitor,
213db264a6dSTamas Berghammer                     Module *module,
214af245d11STodd Fiala                     char const **argv,
215af245d11STodd Fiala                     char const **envp,
21675f47c3aSTodd Fiala                     const std::string &stdin_path,
21775f47c3aSTodd Fiala                     const std::string &stdout_path,
21875f47c3aSTodd Fiala                     const std::string &stderr_path,
2190bce1b67STodd Fiala                     const char *working_dir,
220db264a6dSTamas Berghammer                     const ProcessLaunchInfo &launch_info);
221af245d11STodd Fiala 
222af245d11STodd Fiala             ~LaunchArgs();
223af245d11STodd Fiala 
224db264a6dSTamas Berghammer             Module *m_module;                 // The executable image to launch.
225af245d11STodd Fiala             char const **m_argv;              // Process arguments.
226af245d11STodd Fiala             char const **m_envp;              // Process environment.
22775f47c3aSTodd Fiala             const std::string &m_stdin_path;  // Redirect stdin if not empty.
22875f47c3aSTodd Fiala             const std::string &m_stdout_path; // Redirect stdout if not empty.
22975f47c3aSTodd Fiala             const std::string &m_stderr_path; // Redirect stderr if not empty.
230af245d11STodd Fiala             const char *m_working_dir;        // Working directory or NULL.
231db264a6dSTamas Berghammer             const ProcessLaunchInfo &m_launch_info;
232af245d11STodd Fiala         };
233af245d11STodd Fiala 
234af245d11STodd Fiala         struct AttachArgs : OperationArgs
235af245d11STodd Fiala         {
236af245d11STodd Fiala             AttachArgs(NativeProcessLinux *monitor,
237af245d11STodd Fiala                        lldb::pid_t pid);
238af245d11STodd Fiala 
239af245d11STodd Fiala             ~AttachArgs();
240af245d11STodd Fiala 
241af245d11STodd Fiala             lldb::pid_t m_pid;              // pid of the process to be attached.
242af245d11STodd Fiala         };
243af245d11STodd Fiala 
244af245d11STodd Fiala         // ---------------------------------------------------------------------
245af245d11STodd Fiala         // Private Instance Methods
246af245d11STodd Fiala         // ---------------------------------------------------------------------
247af245d11STodd Fiala         NativeProcessLinux ();
248af245d11STodd Fiala 
249af245d11STodd Fiala         /// Launches an inferior process ready for debugging.  Forms the
250af245d11STodd Fiala         /// implementation of Process::DoLaunch.
251af245d11STodd Fiala         void
252af245d11STodd Fiala         LaunchInferior (
253af245d11STodd Fiala             Module *module,
254af245d11STodd Fiala             char const *argv[],
255af245d11STodd Fiala             char const *envp[],
25675f47c3aSTodd Fiala             const std::string &stdin_path,
25775f47c3aSTodd Fiala             const std::string &stdout_path,
25875f47c3aSTodd Fiala             const std::string &stderr_path,
259af245d11STodd Fiala             const char *working_dir,
260db264a6dSTamas Berghammer             const ProcessLaunchInfo &launch_info,
261af245d11STodd Fiala             Error &error);
262af245d11STodd Fiala 
263af245d11STodd Fiala         /// Attaches to an existing process.  Forms the
2640cbf0b13STamas Berghammer         /// implementation of Process::DoAttach
265af245d11STodd Fiala         void
266af245d11STodd Fiala         AttachToInferior (lldb::pid_t pid, Error &error);
267af245d11STodd Fiala 
268af245d11STodd Fiala         void
269db264a6dSTamas Berghammer         StartLaunchOpThread(LaunchArgs *args, Error &error);
270af245d11STodd Fiala 
271af245d11STodd Fiala         static void *
272af245d11STodd Fiala         LaunchOpThread(void *arg);
273af245d11STodd Fiala 
274af245d11STodd Fiala         static bool
275af245d11STodd Fiala         Launch(LaunchArgs *args);
276af245d11STodd Fiala 
277af245d11STodd Fiala         void
278db264a6dSTamas Berghammer         StartAttachOpThread(AttachArgs *args, Error &error);
279af245d11STodd Fiala 
280af245d11STodd Fiala         static void *
281af245d11STodd Fiala         AttachOpThread(void *args);
282af245d11STodd Fiala 
283af245d11STodd Fiala         static bool
284af245d11STodd Fiala         Attach(AttachArgs *args);
285af245d11STodd Fiala 
28697ccc294SChaoren Lin         static Error
287af245d11STodd Fiala         SetDefaultPtraceOpts(const lldb::pid_t);
288af245d11STodd Fiala 
289af245d11STodd Fiala         static void
290af245d11STodd Fiala         ServeOperation(OperationArgs *args);
291af245d11STodd Fiala 
292af245d11STodd Fiala         static bool
293af245d11STodd Fiala         DupDescriptor(const char *path, int fd, int flags);
294af245d11STodd Fiala 
295af245d11STodd Fiala         static bool
296af245d11STodd Fiala         MonitorCallback(void *callback_baton,
297af245d11STodd Fiala                 lldb::pid_t pid, bool exited, int signal, int status);
298af245d11STodd Fiala 
299af245d11STodd Fiala         void
300af245d11STodd Fiala         MonitorSIGTRAP(const siginfo_t *info, lldb::pid_t pid);
301af245d11STodd Fiala 
302af245d11STodd Fiala         void
303c16f5dcaSChaoren Lin         MonitorTrace(lldb::pid_t pid, NativeThreadProtocolSP thread_sp);
304c16f5dcaSChaoren Lin 
305c16f5dcaSChaoren Lin         void
306c16f5dcaSChaoren Lin         MonitorBreakpoint(lldb::pid_t pid, NativeThreadProtocolSP thread_sp);
307c16f5dcaSChaoren Lin 
308c16f5dcaSChaoren Lin         void
309c16f5dcaSChaoren Lin         MonitorWatchpoint(lldb::pid_t pid, NativeThreadProtocolSP thread_sp, uint32_t wp_index);
310c16f5dcaSChaoren Lin 
311c16f5dcaSChaoren Lin         void
312af245d11STodd Fiala         MonitorSignal(const siginfo_t *info, lldb::pid_t pid, bool exited);
313af245d11STodd Fiala 
314af245d11STodd Fiala #if 0
315af245d11STodd Fiala         static ::ProcessMessage::CrashReason
316af245d11STodd Fiala         GetCrashReasonForSIGSEGV(const siginfo_t *info);
317af245d11STodd Fiala 
318af245d11STodd Fiala         static ::ProcessMessage::CrashReason
319af245d11STodd Fiala         GetCrashReasonForSIGILL(const siginfo_t *info);
320af245d11STodd Fiala 
321af245d11STodd Fiala         static ::ProcessMessage::CrashReason
322af245d11STodd Fiala         GetCrashReasonForSIGFPE(const siginfo_t *info);
323af245d11STodd Fiala 
324af245d11STodd Fiala         static ::ProcessMessage::CrashReason
325af245d11STodd Fiala         GetCrashReasonForSIGBUS(const siginfo_t *info);
326af245d11STodd Fiala #endif
327af245d11STodd Fiala 
328af245d11STodd Fiala         void
329af245d11STodd Fiala         DoOperation(void *op);
330af245d11STodd Fiala 
331af245d11STodd Fiala         /// Stops the child monitor thread.
332af245d11STodd Fiala         void
3330cbf0b13STamas Berghammer         StopMonitorThread();
334af245d11STodd Fiala 
335af245d11STodd Fiala         /// Stops the operation thread used to attach/launch a process.
336af245d11STodd Fiala         void
337af245d11STodd Fiala         StopOpThread();
338af245d11STodd Fiala 
339fa03ad2eSChaoren Lin         Error
340fa03ad2eSChaoren Lin         StartCoordinatorThread ();
341fa03ad2eSChaoren Lin 
342fa03ad2eSChaoren Lin         static void*
343fa03ad2eSChaoren Lin         CoordinatorThread (void *arg);
344fa03ad2eSChaoren Lin 
345fa03ad2eSChaoren Lin         void
346fa03ad2eSChaoren Lin         StopCoordinatorThread ();
347fa03ad2eSChaoren Lin 
348af245d11STodd Fiala         /// Stops monitoring the child process thread.
349af245d11STodd Fiala         void
350af245d11STodd Fiala         StopMonitor();
351af245d11STodd Fiala 
352af245d11STodd Fiala         bool
353af245d11STodd Fiala         HasThreadNoLock (lldb::tid_t thread_id);
354af245d11STodd Fiala 
355af245d11STodd Fiala         NativeThreadProtocolSP
356af245d11STodd Fiala         MaybeGetThreadNoLock (lldb::tid_t thread_id);
357af245d11STodd Fiala 
358af245d11STodd Fiala         bool
359af245d11STodd Fiala         StopTrackingThread (lldb::tid_t thread_id);
360af245d11STodd Fiala 
361af245d11STodd Fiala         NativeThreadProtocolSP
362af245d11STodd Fiala         AddThread (lldb::tid_t thread_id);
363af245d11STodd Fiala 
364af245d11STodd Fiala         NativeThreadProtocolSP
365af245d11STodd Fiala         GetOrCreateThread (lldb::tid_t thread_id, bool &created);
366af245d11STodd Fiala 
367af245d11STodd Fiala         Error
368*63c8be95STamas Berghammer         GetSoftwareBreakpointPCOffset (NativeRegisterContextSP context_sp, uint32_t &actual_opcode_size);
369af245d11STodd Fiala 
370af245d11STodd Fiala         Error
371af245d11STodd Fiala         FixupBreakpointPCAsNeeded (NativeThreadProtocolSP &thread_sp);
372af245d11STodd Fiala 
373af245d11STodd Fiala         /// Writes a siginfo_t structure corresponding to the given thread ID to the
374af245d11STodd Fiala         /// memory region pointed to by @p siginfo.
37597ccc294SChaoren Lin         Error
37697ccc294SChaoren Lin         GetSignalInfo(lldb::tid_t tid, void *siginfo);
377af245d11STodd Fiala 
378af245d11STodd Fiala         /// Writes the raw event message code (vis-a-vis PTRACE_GETEVENTMSG)
379af245d11STodd Fiala         /// corresponding to the given thread ID to the memory pointed to by @p
380af245d11STodd Fiala         /// message.
38197ccc294SChaoren Lin         Error
382af245d11STodd Fiala         GetEventMessage(lldb::tid_t tid, unsigned long *message);
383af245d11STodd Fiala 
384af245d11STodd Fiala         /// Resumes the given thread.  If @p signo is anything but
385af245d11STodd Fiala         /// LLDB_INVALID_SIGNAL_NUMBER, deliver that signal to the thread.
38697ccc294SChaoren Lin         Error
387af245d11STodd Fiala         Resume(lldb::tid_t tid, uint32_t signo);
388af245d11STodd Fiala 
389af245d11STodd Fiala         /// Single steps the given thread.  If @p signo is anything but
390af245d11STodd Fiala         /// LLDB_INVALID_SIGNAL_NUMBER, deliver that signal to the thread.
39197ccc294SChaoren Lin         Error
392af245d11STodd Fiala         SingleStep(lldb::tid_t tid, uint32_t signo);
393af245d11STodd Fiala 
394fa03ad2eSChaoren Lin         // ThreadStateCoordinator helper methods.
395511e5cdcSTodd Fiala         void
396fa03ad2eSChaoren Lin         NotifyThreadCreateStopped (lldb::tid_t tid);
397511e5cdcSTodd Fiala 
398511e5cdcSTodd Fiala         void
399fa03ad2eSChaoren Lin         NotifyThreadCreateRunning (lldb::tid_t tid);
400fa03ad2eSChaoren Lin 
401fa03ad2eSChaoren Lin         void
402fa03ad2eSChaoren Lin         NotifyThreadDeath (lldb::tid_t tid);
403fa03ad2eSChaoren Lin 
404fa03ad2eSChaoren Lin         void
405fa03ad2eSChaoren Lin         NotifyThreadStop (lldb::tid_t tid);
406fa03ad2eSChaoren Lin 
407fa03ad2eSChaoren Lin         void
408fa03ad2eSChaoren Lin         CallAfterRunningThreadsStop (lldb::tid_t tid,
409fa03ad2eSChaoren Lin                                      const std::function<void (lldb::tid_t tid)> &call_after_function);
410511e5cdcSTodd Fiala 
41103f12d6bSChaoren Lin         void
41203f12d6bSChaoren Lin         CallAfterRunningThreadsStopWithSkipTID (lldb::tid_t deferred_signal_tid,
41303f12d6bSChaoren Lin                                                 lldb::tid_t skip_stop_request_tid,
41403f12d6bSChaoren Lin                                                 const std::function<void (lldb::tid_t tid)> &call_after_function);
41503f12d6bSChaoren Lin 
416db264a6dSTamas Berghammer         Error
417af245d11STodd Fiala         Detach(lldb::tid_t tid);
41886fd8e45SChaoren Lin 
419db264a6dSTamas Berghammer         Error
42086fd8e45SChaoren Lin         RequestThreadStop (const lldb::pid_t pid, const lldb::tid_t tid);
421af245d11STodd Fiala     };
422db264a6dSTamas Berghammer 
423db264a6dSTamas Berghammer } // namespace process_linux
424db264a6dSTamas Berghammer } // namespace lldb_private
425af245d11STodd Fiala 
426af245d11STodd Fiala #endif // #ifndef liblldb_NativeProcessLinux_H_
427