Chris Lattner | 30fdc8d | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 1 | //===-- MachProcess.h -------------------------------------------*- C++ -*-===// |
| 2 | // |
| 3 | // The LLVM Compiler Infrastructure |
| 4 | // |
| 5 | // This file is distributed under the University of Illinois Open Source |
| 6 | // License. See LICENSE.TXT for details. |
| 7 | // |
| 8 | //===----------------------------------------------------------------------===// |
| 9 | // |
| 10 | // Created by Greg Clayton on 6/15/07. |
| 11 | // |
| 12 | //===----------------------------------------------------------------------===// |
| 13 | |
| 14 | #ifndef __MachProcess_h__ |
| 15 | #define __MachProcess_h__ |
| 16 | |
| 17 | #include "DNBDefs.h" |
| 18 | #include "DNBBreakpoint.h" |
| 19 | #include "DNBError.h" |
Greg Clayton | c4e411f | 2011-01-18 19:36:39 +0000 | [diff] [blame] | 20 | #include "DNBThreadResumeActions.h" |
Chris Lattner | 30fdc8d | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 21 | #include "MachException.h" |
| 22 | #include "MachVMMemory.h" |
| 23 | #include "MachTask.h" |
| 24 | #include "MachThreadList.h" |
| 25 | #include "PThreadCondition.h" |
| 26 | #include "PThreadEvent.h" |
| 27 | #include "PThreadMutex.h" |
Jason Molenda | 705b180 | 2014-06-13 02:37:02 +0000 | [diff] [blame^] | 28 | #include "Genealogy.h" |
| 29 | #include "ThreadInfo.h" |
Chris Lattner | 30fdc8d | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 30 | |
| 31 | #include <mach/mach.h> |
| 32 | #include <sys/signal.h> |
| 33 | #include <pthread.h> |
| 34 | #include <vector> |
| 35 | |
| 36 | class DNBThreadResumeActions; |
| 37 | |
| 38 | class MachProcess |
| 39 | { |
| 40 | public: |
| 41 | //---------------------------------------------------------------------- |
| 42 | // Constructors and Destructors |
| 43 | //---------------------------------------------------------------------- |
| 44 | MachProcess (); |
| 45 | ~MachProcess (); |
| 46 | |
| 47 | //---------------------------------------------------------------------- |
| 48 | // Child process control |
| 49 | //---------------------------------------------------------------------- |
| 50 | pid_t AttachForDebug (pid_t pid, char *err_str, size_t err_len); |
Greg Clayton | 6779606a | 2011-01-22 23:43:18 +0000 | [diff] [blame] | 51 | pid_t LaunchForDebug (const char *path, |
| 52 | char const *argv[], |
| 53 | char const *envp[], |
| 54 | const char *working_directory, |
| 55 | const char *stdin_path, |
| 56 | const char *stdout_path, |
| 57 | const char *stderr_path, |
| 58 | bool no_stdio, |
| 59 | nub_launch_flavor_t launch_flavor, |
Jason Molenda | a332978 | 2014-03-29 18:54:20 +0000 | [diff] [blame] | 60 | int disable_aslr, |
| 61 | const char *event_data, |
Greg Clayton | 6779606a | 2011-01-22 23:43:18 +0000 | [diff] [blame] | 62 | DNBError &err); |
Greg Clayton | 7133762 | 2011-02-24 22:24:29 +0000 | [diff] [blame] | 63 | |
| 64 | static uint32_t GetCPUTypeForLocalProcess (pid_t pid); |
Chris Lattner | 30fdc8d | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 65 | static pid_t ForkChildForPTraceDebugging (const char *path, char const *argv[], char const *envp[], MachProcess* process, DNBError &err); |
Greg Clayton | 6779606a | 2011-01-22 23:43:18 +0000 | [diff] [blame] | 66 | static pid_t PosixSpawnChildForPTraceDebugging (const char *path, |
| 67 | cpu_type_t cpu_type, |
| 68 | char const *argv[], |
| 69 | char const *envp[], |
| 70 | const char *working_directory, |
| 71 | const char *stdin_path, |
| 72 | const char *stdout_path, |
| 73 | const char *stderr_path, |
| 74 | bool no_stdio, |
| 75 | MachProcess* process, |
| 76 | int disable_aslr, |
| 77 | DNBError& err); |
Chris Lattner | 30fdc8d | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 78 | nub_addr_t GetDYLDAllImageInfosAddress (); |
| 79 | static const void * PrepareForAttach (const char *path, nub_launch_flavor_t launch_flavor, bool waitfor, DNBError &err_str); |
| 80 | static void CleanupAfterAttach (const void *attach_token, bool success, DNBError &err_str); |
| 81 | static nub_process_t CheckForProcess (const void *attach_token); |
Jason Molenda | a332978 | 2014-03-29 18:54:20 +0000 | [diff] [blame] | 82 | #ifdef WITH_BKS |
| 83 | pid_t BKSLaunchForDebug (const char *app_bundle_path, char const *argv[], char const *envp[], bool no_stdio, bool disable_aslr, const char *event_data, DNBError &launch_err); |
| 84 | pid_t BKSForkChildForPTraceDebugging (const char *path, char const *argv[], char const *envp[], bool no_stdio, bool disable_aslr, const char *event_data, DNBError &launch_err); |
| 85 | bool BKSSendEvent (const char *event, DNBError &error); |
| 86 | static void BKSCleanupAfterAttach (const void *attach_token, DNBError &err_str); |
| 87 | #endif |
Jason Molenda | 42999a4 | 2012-02-22 02:18:59 +0000 | [diff] [blame] | 88 | #ifdef WITH_SPRINGBOARD |
Jason Molenda | a332978 | 2014-03-29 18:54:20 +0000 | [diff] [blame] | 89 | pid_t SBLaunchForDebug (const char *app_bundle_path, char const *argv[], char const *envp[], bool no_stdio, bool disable_aslr, DNBError &launch_err); |
Caroline Tice | f8da863 | 2010-12-03 18:46:09 +0000 | [diff] [blame] | 90 | static pid_t SBForkChildForPTraceDebugging (const char *path, char const *argv[], char const *envp[], bool no_stdio, MachProcess* process, DNBError &launch_err); |
Chris Lattner | 30fdc8d | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 91 | #endif |
| 92 | nub_addr_t LookupSymbol (const char *name, const char *shlib); |
| 93 | void SetNameToAddressCallback (DNBCallbackNameToAddress callback, void *baton) |
| 94 | { |
| 95 | m_name_to_addr_callback = callback; |
| 96 | m_name_to_addr_baton = baton; |
| 97 | } |
| 98 | void SetSharedLibraryInfoCallback (DNBCallbackCopyExecutableImageInfos callback, void *baton) |
| 99 | { |
| 100 | m_image_infos_callback = callback; |
| 101 | m_image_infos_baton = baton; |
| 102 | } |
| 103 | |
| 104 | bool Resume (const DNBThreadResumeActions& thread_actions); |
| 105 | bool Signal (int signal, const struct timespec *timeout_abstime = NULL); |
Greg Clayton | 4296c22 | 2014-04-24 19:54:32 +0000 | [diff] [blame] | 106 | bool Interrupt(); |
Jason Molenda | a332978 | 2014-03-29 18:54:20 +0000 | [diff] [blame] | 107 | bool SendEvent (const char *event, DNBError &send_err); |
Chris Lattner | 30fdc8d | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 108 | bool Kill (const struct timespec *timeout_abstime = NULL); |
| 109 | bool Detach (); |
| 110 | nub_size_t ReadMemory (nub_addr_t addr, nub_size_t size, void *buf); |
| 111 | nub_size_t WriteMemory (nub_addr_t addr, nub_size_t size, const void *buf); |
| 112 | |
| 113 | //---------------------------------------------------------------------- |
| 114 | // Path and arg accessors |
| 115 | //---------------------------------------------------------------------- |
| 116 | const char * Path () const { return m_path.c_str(); } |
| 117 | size_t ArgumentCount () const { return m_args.size(); } |
| 118 | const char * ArgumentAtIndex (size_t arg_idx) const |
| 119 | { |
| 120 | if (arg_idx < m_args.size()) |
| 121 | return m_args[arg_idx].c_str(); |
| 122 | return NULL; |
| 123 | } |
| 124 | |
| 125 | //---------------------------------------------------------------------- |
| 126 | // Breakpoint functions |
| 127 | //---------------------------------------------------------------------- |
Greg Clayton | d8cf1a1 | 2013-06-12 00:46:38 +0000 | [diff] [blame] | 128 | DNBBreakpoint * CreateBreakpoint (nub_addr_t addr, nub_size_t length, bool hardware); |
| 129 | bool DisableBreakpoint (nub_addr_t addr, bool remove); |
| 130 | void DisableAllBreakpoints (bool remove); |
| 131 | bool EnableBreakpoint (nub_addr_t addr); |
Chris Lattner | 30fdc8d | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 132 | DNBBreakpointList& Breakpoints() { return m_breakpoints; } |
| 133 | const DNBBreakpointList& Breakpoints() const { return m_breakpoints; } |
| 134 | |
| 135 | //---------------------------------------------------------------------- |
| 136 | // Watchpoint functions |
| 137 | //---------------------------------------------------------------------- |
Greg Clayton | d8cf1a1 | 2013-06-12 00:46:38 +0000 | [diff] [blame] | 138 | DNBBreakpoint * CreateWatchpoint (nub_addr_t addr, nub_size_t length, uint32_t watch_type, bool hardware); |
| 139 | bool DisableWatchpoint (nub_addr_t addr, bool remove); |
| 140 | void DisableAllWatchpoints (bool remove); |
| 141 | bool EnableWatchpoint (nub_addr_t addr); |
Johnny Chen | 6463720 | 2012-05-23 21:09:52 +0000 | [diff] [blame] | 142 | uint32_t GetNumSupportedHardwareWatchpoints () const; |
Chris Lattner | 30fdc8d | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 143 | DNBBreakpointList& Watchpoints() { return m_watchpoints; } |
| 144 | const DNBBreakpointList& Watchpoints() const { return m_watchpoints; } |
| 145 | |
| 146 | //---------------------------------------------------------------------- |
| 147 | // Exception thread functions |
| 148 | //---------------------------------------------------------------------- |
| 149 | bool StartSTDIOThread (); |
| 150 | static void * STDIOThread (void *arg); |
| 151 | void ExceptionMessageReceived (const MachException::Message& exceptionMessage); |
Greg Clayton | bb49289 | 2014-04-30 20:27:01 +0000 | [diff] [blame] | 152 | task_t ExceptionMessageBundleComplete (); |
Chris Lattner | 30fdc8d | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 153 | void SharedLibrariesUpdated (); |
| 154 | nub_size_t CopyImageInfos (struct DNBExecutableImageInfo **image_infos, bool only_changed); |
Han Ming Ong | ab3b8b2 | 2012-11-17 00:21:04 +0000 | [diff] [blame] | 155 | |
| 156 | //---------------------------------------------------------------------- |
| 157 | // Profile functions |
| 158 | //---------------------------------------------------------------------- |
Han Ming Ong | 8764fe7 | 2013-03-04 21:25:51 +0000 | [diff] [blame] | 159 | void SetEnableAsyncProfiling (bool enable, uint64_t internal_usec, DNBProfileDataScanType scan_type); |
Han Ming Ong | ab3b8b2 | 2012-11-17 00:21:04 +0000 | [diff] [blame] | 160 | bool IsProfilingEnabled () { return m_profile_enabled; } |
| 161 | uint64_t ProfileInterval () { return m_profile_interval_usec; } |
| 162 | bool StartProfileThread (); |
| 163 | static void * ProfileThread (void *arg); |
| 164 | void SignalAsyncProfileData (const char *info); |
| 165 | size_t GetAsyncProfileData (char *buf, size_t buf_size); |
Chris Lattner | 30fdc8d | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 166 | |
| 167 | //---------------------------------------------------------------------- |
| 168 | // Accessors |
| 169 | //---------------------------------------------------------------------- |
| 170 | pid_t ProcessID () const { return m_pid; } |
| 171 | bool ProcessIDIsValid () const { return m_pid > 0; } |
| 172 | pid_t SetProcessID (pid_t pid); |
| 173 | MachTask& Task() { return m_task; } |
| 174 | const MachTask& Task() const { return m_task; } |
| 175 | |
| 176 | PThreadEvent& Events() { return m_events; } |
| 177 | const DNBRegisterSetInfo * |
| 178 | GetRegisterSetInfo (nub_thread_t tid, nub_size_t *num_reg_sets) const; |
| 179 | bool GetRegisterValue (nub_thread_t tid, uint32_t set, uint32_t reg, DNBRegisterValue *reg_value) const; |
| 180 | bool SetRegisterValue (nub_thread_t tid, uint32_t set, uint32_t reg, const DNBRegisterValue *value) const; |
Jim Ingham | 279ceec | 2012-07-25 21:12:43 +0000 | [diff] [blame] | 181 | nub_bool_t SyncThreadState (nub_thread_t tid); |
Chris Lattner | 30fdc8d | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 182 | const char * ThreadGetName (nub_thread_t tid); |
| 183 | nub_state_t ThreadGetState (nub_thread_t tid); |
Jason Molenda | 705b180 | 2014-06-13 02:37:02 +0000 | [diff] [blame^] | 184 | ThreadInfo::QoS GetRequestedQoS (nub_thread_t tid, nub_addr_t tsd, uint64_t dti_qos_class_index); |
| 185 | nub_addr_t GetPThreadT (nub_thread_t tid); |
| 186 | nub_addr_t GetDispatchQueueT (nub_thread_t tid); |
| 187 | nub_addr_t GetTSDAddressForThread (nub_thread_t tid, uint64_t plo_pthread_tsd_base_address_offset, uint64_t plo_pthread_tsd_base_offset, uint64_t plo_pthread_tsd_entry_size); |
| 188 | |
Chris Lattner | 30fdc8d | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 189 | nub_size_t GetNumThreads () const; |
| 190 | nub_thread_t GetThreadAtIndex (nub_size_t thread_idx) const; |
Chris Lattner | 30fdc8d | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 191 | nub_thread_t GetCurrentThread (); |
Jason Molenda | d5318c0 | 2013-04-03 04:18:47 +0000 | [diff] [blame] | 192 | nub_thread_t GetCurrentThreadMachPort (); |
Chris Lattner | 30fdc8d | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 193 | nub_thread_t SetCurrentThread (nub_thread_t tid); |
Greg Clayton | 58d1c9a | 2010-10-18 04:14:23 +0000 | [diff] [blame] | 194 | MachThreadList & GetThreadList() { return m_thread_list; } |
Greg Clayton | 15fc2be | 2013-05-21 01:00:52 +0000 | [diff] [blame] | 195 | bool GetThreadStoppedReason(nub_thread_t tid, struct DNBThreadStopInfo *stop_info); |
Chris Lattner | 30fdc8d | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 196 | void DumpThreadStoppedReason(nub_thread_t tid) const; |
| 197 | const char * GetThreadInfo (nub_thread_t tid) const; |
| 198 | |
Jason Molenda | 1c73911 | 2013-02-22 07:27:08 +0000 | [diff] [blame] | 199 | nub_thread_t GetThreadIDForMachPortNumber (thread_t mach_port_number) const; |
| 200 | |
Greg Clayton | 7133762 | 2011-02-24 22:24:29 +0000 | [diff] [blame] | 201 | uint32_t GetCPUType (); |
Chris Lattner | 30fdc8d | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 202 | nub_state_t GetState (); |
| 203 | void SetState (nub_state_t state); |
| 204 | bool IsRunning (nub_state_t state) |
| 205 | { |
| 206 | return state == eStateRunning || IsStepping(state); |
| 207 | } |
| 208 | bool IsStepping (nub_state_t state) |
| 209 | { |
| 210 | return state == eStateStepping; |
| 211 | } |
| 212 | bool CanResume (nub_state_t state) |
| 213 | { |
| 214 | return state == eStateStopped; |
| 215 | } |
| 216 | |
Chris Lattner | 30fdc8d | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 217 | bool GetExitStatus(int* status) |
| 218 | { |
| 219 | if (GetState() == eStateExited) |
| 220 | { |
| 221 | if (status) |
| 222 | *status = m_exit_status; |
| 223 | return true; |
| 224 | } |
| 225 | return false; |
| 226 | } |
| 227 | void SetExitStatus(int status) |
| 228 | { |
| 229 | m_exit_status = status; |
| 230 | SetState(eStateExited); |
| 231 | } |
Jason Molenda | a332978 | 2014-03-29 18:54:20 +0000 | [diff] [blame] | 232 | const char * GetExitInfo () |
| 233 | { |
| 234 | return m_exit_info.c_str(); |
| 235 | } |
| 236 | |
Greg Clayton | bb49289 | 2014-04-30 20:27:01 +0000 | [diff] [blame] | 237 | void SetExitInfo (const char *info); |
Chris Lattner | 30fdc8d | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 238 | |
| 239 | uint32_t StopCount() const { return m_stop_count; } |
| 240 | void SetChildFileDescriptors (int stdin_fileno, int stdout_fileno, int stderr_fileno) |
| 241 | { |
| 242 | m_child_stdin = stdin_fileno; |
| 243 | m_child_stdout = stdout_fileno; |
| 244 | m_child_stderr = stderr_fileno; |
| 245 | } |
| 246 | |
| 247 | int GetStdinFileDescriptor () const { return m_child_stdin; } |
| 248 | int GetStdoutFileDescriptor () const { return m_child_stdout; } |
| 249 | int GetStderrFileDescriptor () const { return m_child_stderr; } |
| 250 | void AppendSTDOUT (char* s, size_t len); |
| 251 | size_t GetAvailableSTDOUT (char *buf, size_t buf_size); |
| 252 | size_t GetAvailableSTDERR (char *buf, size_t buf_size); |
| 253 | void CloseChildFileDescriptors () |
| 254 | { |
| 255 | if (m_child_stdin >= 0) |
| 256 | { |
| 257 | ::close (m_child_stdin); |
| 258 | m_child_stdin = -1; |
| 259 | } |
| 260 | if (m_child_stdout >= 0) |
| 261 | { |
| 262 | ::close (m_child_stdout); |
| 263 | m_child_stdout = -1; |
| 264 | } |
| 265 | if (m_child_stderr >= 0) |
| 266 | { |
| 267 | ::close (m_child_stderr); |
| 268 | m_child_stderr = -1; |
| 269 | } |
| 270 | } |
| 271 | |
| 272 | bool ProcessUsingSpringBoard() const { return (m_flags & eMachProcessFlagsUsingSBS) != 0; } |
Jason Molenda | a332978 | 2014-03-29 18:54:20 +0000 | [diff] [blame] | 273 | bool ProcessUsingBackBoard() const { return (m_flags & eMachProcessFlagsUsingBKS) != 0; } |
Han Ming Ong | 8764fe7 | 2013-03-04 21:25:51 +0000 | [diff] [blame] | 274 | |
Jason Molenda | 705b180 | 2014-06-13 02:37:02 +0000 | [diff] [blame^] | 275 | Genealogy::ThreadActivitySP GetGenealogyInfoForThread (nub_thread_t tid, bool &timed_out); |
| 276 | |
| 277 | Genealogy::ProcessExecutableInfoSP GetGenealogyImageInfo (size_t idx); |
| 278 | |
Han Ming Ong | 8764fe7 | 2013-03-04 21:25:51 +0000 | [diff] [blame] | 279 | DNBProfileDataScanType GetProfileScanType () { return m_profile_scan_type; } |
| 280 | |
Chris Lattner | 30fdc8d | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 281 | private: |
| 282 | enum |
| 283 | { |
| 284 | eMachProcessFlagsNone = 0, |
| 285 | eMachProcessFlagsAttached = (1 << 0), |
Jason Molenda | a332978 | 2014-03-29 18:54:20 +0000 | [diff] [blame] | 286 | eMachProcessFlagsUsingSBS = (1 << 1), |
| 287 | eMachProcessFlagsUsingBKS = (1 << 2) |
Chris Lattner | 30fdc8d | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 288 | }; |
Jim Ingham | 5881318 | 2014-02-25 04:53:13 +0000 | [diff] [blame] | 289 | void Clear (bool detaching = false); |
Greg Clayton | c4e411f | 2011-01-18 19:36:39 +0000 | [diff] [blame] | 290 | void ReplyToAllExceptions (); |
| 291 | void PrivateResume (); |
Chris Lattner | 30fdc8d | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 292 | |
| 293 | uint32_t Flags () const { return m_flags; } |
Jim Ingham | 5d2735e | 2012-04-25 17:45:26 +0000 | [diff] [blame] | 294 | nub_state_t DoSIGSTOP (bool clear_bps_and_wps, bool allow_running, uint32_t *thread_idx_ptr); |
Chris Lattner | 30fdc8d | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 295 | |
| 296 | pid_t m_pid; // Process ID of child process |
Greg Clayton | 7133762 | 2011-02-24 22:24:29 +0000 | [diff] [blame] | 297 | cpu_type_t m_cpu_type; // The CPU type of this process |
Chris Lattner | 30fdc8d | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 298 | int m_child_stdin; |
| 299 | int m_child_stdout; |
| 300 | int m_child_stderr; |
| 301 | std::string m_path; // A path to the executable if we have one |
| 302 | std::vector<std::string> m_args; // The arguments with which the process was lauched |
| 303 | int m_exit_status; // The exit status for the process |
Jason Molenda | a332978 | 2014-03-29 18:54:20 +0000 | [diff] [blame] | 304 | std::string m_exit_info; // Any extra info that we may have about the exit |
Chris Lattner | 30fdc8d | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 305 | MachTask m_task; // The mach task for this process |
| 306 | uint32_t m_flags; // Process specific flags (see eMachProcessFlags enums) |
| 307 | uint32_t m_stop_count; // A count of many times have we stopped |
| 308 | pthread_t m_stdio_thread; // Thread ID for the thread that watches for child process stdio |
| 309 | PThreadMutex m_stdio_mutex; // Multithreaded protection for stdio |
| 310 | std::string m_stdout_data; |
Han Ming Ong | ab3b8b2 | 2012-11-17 00:21:04 +0000 | [diff] [blame] | 311 | |
| 312 | bool m_profile_enabled; // A flag to indicate if profiling is enabled |
| 313 | uint64_t m_profile_interval_usec; // If enable, the profiling interval in microseconds |
Han Ming Ong | 8764fe7 | 2013-03-04 21:25:51 +0000 | [diff] [blame] | 314 | DNBProfileDataScanType m_profile_scan_type; // Indicates what needs to be profiled |
Han Ming Ong | ab3b8b2 | 2012-11-17 00:21:04 +0000 | [diff] [blame] | 315 | pthread_t m_profile_thread; // Thread ID for the thread that profiles the inferior |
| 316 | PThreadMutex m_profile_data_mutex; // Multithreaded protection for profile info data |
Han Ming Ong | 929a94f | 2012-11-29 22:14:45 +0000 | [diff] [blame] | 317 | std::vector<std::string> m_profile_data; // Profile data, must be protected by m_profile_data_mutex |
Han Ming Ong | ab3b8b2 | 2012-11-17 00:21:04 +0000 | [diff] [blame] | 318 | |
Greg Clayton | c4e411f | 2011-01-18 19:36:39 +0000 | [diff] [blame] | 319 | DNBThreadResumeActions m_thread_actions; // The thread actions for the current MachProcess::Resume() call |
Chris Lattner | 30fdc8d | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 320 | MachException::Message::collection |
| 321 | m_exception_messages; // A collection of exception messages caught when listening to the exception port |
| 322 | PThreadMutex m_exception_messages_mutex; // Multithreaded protection for m_exception_messages |
| 323 | |
Greg Clayton | 58d1c9a | 2010-10-18 04:14:23 +0000 | [diff] [blame] | 324 | MachThreadList m_thread_list; // A list of threads that is maintained/updated after each stop |
Jason Molenda | 705b180 | 2014-06-13 02:37:02 +0000 | [diff] [blame^] | 325 | Genealogy m_activities; // A list of activities that is updated after every stop lazily |
Chris Lattner | 30fdc8d | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 326 | nub_state_t m_state; // The state of our process |
| 327 | PThreadMutex m_state_mutex; // Multithreaded protection for m_state |
| 328 | PThreadEvent m_events; // Process related events in the child processes lifetime can be waited upon |
Greg Clayton | 8b2a1d6 | 2013-05-16 16:56:02 +0000 | [diff] [blame] | 329 | PThreadEvent m_private_events; // Used to coordinate running and stopping the process without affecting m_events |
Chris Lattner | 30fdc8d | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 330 | DNBBreakpointList m_breakpoints; // Breakpoint list for this process |
| 331 | DNBBreakpointList m_watchpoints; // Watchpoint list for this process |
| 332 | DNBCallbackNameToAddress m_name_to_addr_callback; |
| 333 | void * m_name_to_addr_baton; |
| 334 | DNBCallbackCopyExecutableImageInfos |
| 335 | m_image_infos_callback; |
| 336 | void * m_image_infos_baton; |
Jason Molenda | a332978 | 2014-03-29 18:54:20 +0000 | [diff] [blame] | 337 | std::string m_bundle_id; // If we are a SB or BKS process, this will be our bundle ID. |
Greg Clayton | 4296c22 | 2014-04-24 19:54:32 +0000 | [diff] [blame] | 338 | int m_sent_interrupt_signo; // When we call MachProcess::Interrupt(), we want to send a single signal |
| 339 | // to the inferior and only send the signal if we aren't already stopped. |
| 340 | // If we end up sending a signal to stop the process we store it until we |
| 341 | // receive an exception with this signal. This helps us to verify we got |
| 342 | // the signal that interrupted the process. We might stop due to another |
| 343 | // reason after an interrupt signal is sent, so this helps us ensure that |
| 344 | // we don't report a spurious stop on the next resume. |
| 345 | int m_auto_resume_signo; // If we resume the process and still haven't received our interrupt signal |
| 346 | // acknownledgement, we will shortly after the next resume. We store the |
| 347 | // interrupt signal in this variable so when we get the interrupt signal |
| 348 | // as the sole reason for the process being stopped, we can auto resume |
| 349 | // the process. |
Greg Clayton | 15fc2be | 2013-05-21 01:00:52 +0000 | [diff] [blame] | 350 | bool m_did_exec; |
Chris Lattner | 30fdc8d | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 351 | }; |
| 352 | |
| 353 | |
| 354 | #endif // __MachProcess_h__ |