1 //===-- ProcessPOSIX.h ------------------------------------------*- C++ -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 #ifndef liblldb_ProcessPOSIX_H_
11 #define liblldb_ProcessPOSIX_H_
19 // Other libraries and framework includes
20 #include "lldb/Target/Process.h"
21 #include "lldb/Target/UnixSignals.h"
22 #include "ProcessMessage.h"
28 public lldb_private::Process
32 //------------------------------------------------------------------
33 // Constructors and destructors
34 //------------------------------------------------------------------
35 ProcessPOSIX(lldb_private::Target& target,
36 lldb_private::Listener &listener);
41 //------------------------------------------------------------------
43 //------------------------------------------------------------------
48 CanDebug(lldb_private::Target &target, bool plugin_specified_by_name);
50 virtual lldb_private::Error
51 WillLaunch(lldb_private::Module *module);
53 virtual lldb_private::Error
54 DoAttachToProcessWithID(lldb::pid_t pid);
56 virtual lldb_private::Error
57 DoAttachToProcessWithID (lldb::pid_t pid, const lldb_private::ProcessAttachInfo &attach_info);
59 virtual lldb_private::Error
60 DoLaunch (lldb_private::Module *exe_module,
61 const lldb_private::ProcessLaunchInfo &launch_info);
66 virtual lldb_private::Error
69 virtual lldb_private::Error
70 DoHalt(bool &caused_stop);
72 virtual lldb_private::Error
73 DoDetach(bool keep_stopped);
75 virtual lldb_private::Error
78 virtual lldb_private::Error
82 RefreshStateAfterStop();
88 DoReadMemory(lldb::addr_t vm_addr,
91 lldb_private::Error &error);
94 DoWriteMemory(lldb::addr_t vm_addr, const void *buf, size_t size,
95 lldb_private::Error &error);
98 DoAllocateMemory(size_t size, uint32_t permissions,
99 lldb_private::Error &error);
101 virtual lldb_private::Error
102 DoDeallocateMemory(lldb::addr_t ptr);
105 ResolveIndirectFunction(const lldb_private::Address *address, lldb_private::Error &error);
108 GetSoftwareBreakpointTrapOpcode(lldb_private::BreakpointSite* bp_site);
110 virtual lldb_private::Error
111 EnableBreakpointSite(lldb_private::BreakpointSite *bp_site);
113 virtual lldb_private::Error
114 DisableBreakpointSite(lldb_private::BreakpointSite *bp_site);
116 virtual lldb_private::Error
117 EnableWatchpoint(lldb_private::Watchpoint *wp, bool notify = true);
119 virtual lldb_private::Error
120 DisableWatchpoint(lldb_private::Watchpoint *wp, bool notify = true);
122 virtual lldb_private::Error
123 GetWatchpointSupportInfo(uint32_t &num);
125 virtual lldb_private::Error
126 GetWatchpointSupportInfo(uint32_t &num, bool &after);
129 UpdateThreadListIfNeeded();
132 UpdateThreadList(lldb_private::ThreadList &old_thread_list,
133 lldb_private::ThreadList &new_thread_list) = 0;
135 virtual lldb::ByteOrder
136 GetByteOrder() const;
139 GetImageInfoAddress();
142 PutSTDIN(const char *buf, size_t len, lldb_private::Error &error);
144 //--------------------------------------------------------------------------
145 // ProcessPOSIX internal API.
147 /// Registers the given message with this process.
148 void SendMessage(const ProcessMessage &message);
151 GetMonitor() { assert(m_monitor); return *m_monitor; }
153 lldb_private::UnixSignals &
157 GetFilePath(const lldb_private::ProcessLaunchInfo::FileAction *file_action,
158 const char *default_path);
160 /// Stops all threads in the process.
161 /// The \p stop_tid parameter indicates the thread which initiated the stop.
163 StopAllThreads(lldb::tid_t stop_tid);
165 /// Adds the thread to the list of threads for which we have received the initial stopping signal.
166 /// The \p stop_tid paramter indicates the thread which the stop happened for.
168 AddThreadForInitialStopIfNeeded(lldb::tid_t stop_tid);
170 virtual POSIXThread *
171 CreateNewPOSIXThread(lldb_private::Process &process, lldb::tid_t tid);
174 /// Target byte order.
175 lldb::ByteOrder m_byte_order;
178 ProcessMonitor *m_monitor;
180 /// The module we are executing.
181 lldb_private::Module *m_module;
183 /// Message queue notifying this instance of inferior process state changes.
184 lldb_private::Mutex m_message_mutex;
185 std::queue<ProcessMessage> m_message_queue;
187 /// Drive any exit events to completion.
190 /// OS-specific signal set.
191 lldb_private::UnixSignals m_signals;
193 /// Returns true if the process has exited.
196 /// Returns true if the process is stopped.
199 /// Returns true if at least one running is currently running
200 bool IsAThreadRunning();
202 typedef std::map<lldb::addr_t, lldb::addr_t> MMapMap;
203 MMapMap m_addr_to_mmap_size;
205 typedef std::set<lldb::tid_t> ThreadStopSet;
206 /// Every thread begins with a stop signal. This keeps track
207 /// of the threads for which we have received the stop signal.
208 ThreadStopSet m_seen_initial_stop;
211 #endif // liblldb_MacOSXProcess_H_