blob: cd4930570d7e73ba722a179de7211648877593c2 [file] [log] [blame]
Chris Lattner30fdc8d2010-06-08 16:52:24 +00001//===-- MachProcess.h -------------------------------------------*- C++ -*-===//
2//
Chandler Carruth2946cd72019-01-19 08:50:56 +00003// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
Chris Lattner30fdc8d2010-06-08 16:52:24 +00006//
7//===----------------------------------------------------------------------===//
8//
9// Created by Greg Clayton on 6/15/07.
10//
11//===----------------------------------------------------------------------===//
12
13#ifndef __MachProcess_h__
14#define __MachProcess_h__
15
Kate Stoneb9c1b512016-09-06 20:57:50 +000016#include <CoreFoundation/CoreFoundation.h>
Jason Molendaa2992312016-07-07 01:09:23 +000017#include <mach-o/loader.h>
Kate Stoneb9c1b512016-09-06 20:57:50 +000018#include <mach/mach.h>
Jason Molendac611a742015-10-23 02:49:51 +000019#include <pthread.h>
Kate Stoneb9c1b512016-09-06 20:57:50 +000020#include <sys/signal.h>
Jason Molendaa2992312016-07-07 01:09:23 +000021#include <uuid/uuid.h>
Jason Molendac611a742015-10-23 02:49:51 +000022#include <vector>
Jason Molendac611a742015-10-23 02:49:51 +000023
Chris Lattner30fdc8d2010-06-08 16:52:24 +000024#include "DNBBreakpoint.h"
Kate Stoneb9c1b512016-09-06 20:57:50 +000025#include "DNBDefs.h"
Chris Lattner30fdc8d2010-06-08 16:52:24 +000026#include "DNBError.h"
Greg Claytonc4e411f2011-01-18 19:36:39 +000027#include "DNBThreadResumeActions.h"
Kate Stoneb9c1b512016-09-06 20:57:50 +000028#include "Genealogy.h"
29#include "JSONGenerator.h"
Chris Lattner30fdc8d2010-06-08 16:52:24 +000030#include "MachException.h"
Chris Lattner30fdc8d2010-06-08 16:52:24 +000031#include "MachTask.h"
32#include "MachThreadList.h"
Kate Stoneb9c1b512016-09-06 20:57:50 +000033#include "MachVMMemory.h"
Chris Lattner30fdc8d2010-06-08 16:52:24 +000034#include "PThreadCondition.h"
35#include "PThreadEvent.h"
36#include "PThreadMutex.h"
Jason Molenda705b1802014-06-13 02:37:02 +000037#include "ThreadInfo.h"
Chris Lattner30fdc8d2010-06-08 16:52:24 +000038
Chris Lattner30fdc8d2010-06-08 16:52:24 +000039class DNBThreadResumeActions;
40
Kate Stoneb9c1b512016-09-06 20:57:50 +000041class MachProcess {
Chris Lattner30fdc8d2010-06-08 16:52:24 +000042public:
Kate Stoneb9c1b512016-09-06 20:57:50 +000043 //----------------------------------------------------------------------
44 // Constructors and Destructors
45 //----------------------------------------------------------------------
46 MachProcess();
47 ~MachProcess();
Chris Lattner30fdc8d2010-06-08 16:52:24 +000048
Kate Stoneb9c1b512016-09-06 20:57:50 +000049 // A structure that can hold everything debugserver needs to know from
50 // a binary's Mach-O header / load commands.
Jason Molendaa2992312016-07-07 01:09:23 +000051
Kate Stoneb9c1b512016-09-06 20:57:50 +000052 struct mach_o_segment {
53 std::string name;
54 uint64_t vmaddr;
55 uint64_t vmsize;
56 uint64_t fileoff;
57 uint64_t filesize;
58 uint64_t maxprot;
59 uint64_t initprot;
60 uint64_t nsects;
61 uint64_t flags;
62 };
Jason Molendaa2992312016-07-07 01:09:23 +000063
Kate Stoneb9c1b512016-09-06 20:57:50 +000064 struct mach_o_information {
65 struct mach_header_64 mach_header;
66 std::vector<struct mach_o_segment> segments;
67 uuid_t uuid;
68 std::string min_version_os_name;
69 std::string min_version_os_version;
70 };
Jason Molendaa2992312016-07-07 01:09:23 +000071
Kate Stoneb9c1b512016-09-06 20:57:50 +000072 struct binary_image_information {
73 std::string filename;
74 uint64_t load_address;
75 uint64_t mod_date; // may not be available - 0 if so
76 struct mach_o_information macho_info;
Jason Molendaa2992312016-07-07 01:09:23 +000077
Kate Stoneb9c1b512016-09-06 20:57:50 +000078 binary_image_information()
79 : filename(), load_address(INVALID_NUB_ADDRESS), mod_date(0) {}
80 };
Jason Molendaa2992312016-07-07 01:09:23 +000081
Kate Stoneb9c1b512016-09-06 20:57:50 +000082 //----------------------------------------------------------------------
83 // Child process control
84 //----------------------------------------------------------------------
85 pid_t AttachForDebug(pid_t pid, char *err_str, size_t err_len);
86 pid_t LaunchForDebug(const char *path, char const *argv[], char const *envp[],
87 const char *working_directory, const char *stdin_path,
88 const char *stdout_path, const char *stderr_path,
89 bool no_stdio, nub_launch_flavor_t launch_flavor,
90 int disable_aslr, const char *event_data, DNBError &err);
Greg Clayton71337622011-02-24 22:24:29 +000091
Kate Stoneb9c1b512016-09-06 20:57:50 +000092 static uint32_t GetCPUTypeForLocalProcess(pid_t pid);
93 static pid_t ForkChildForPTraceDebugging(const char *path, char const *argv[],
94 char const *envp[],
95 MachProcess *process, DNBError &err);
96 static pid_t PosixSpawnChildForPTraceDebugging(
97 const char *path, cpu_type_t cpu_type, char const *argv[],
98 char const *envp[], const char *working_directory, const char *stdin_path,
99 const char *stdout_path, const char *stderr_path, bool no_stdio,
100 MachProcess *process, int disable_aslr, DNBError &err);
101 nub_addr_t GetDYLDAllImageInfosAddress();
102 static const void *PrepareForAttach(const char *path,
103 nub_launch_flavor_t launch_flavor,
104 bool waitfor, DNBError &err_str);
105 static void CleanupAfterAttach(const void *attach_token,
106 nub_launch_flavor_t launch_flavor,
107 bool success, DNBError &err_str);
108 static nub_process_t CheckForProcess(const void *attach_token,
109 nub_launch_flavor_t launch_flavor);
Jason Molendac611a742015-10-23 02:49:51 +0000110#if defined(WITH_BKS) || defined(WITH_FBS)
Kate Stoneb9c1b512016-09-06 20:57:50 +0000111 pid_t BoardServiceLaunchForDebug(const char *app_bundle_path,
112 char const *argv[], char const *envp[],
113 bool no_stdio, bool disable_aslr,
114 const char *event_data,
115 DNBError &launch_err);
116 pid_t BoardServiceForkChildForPTraceDebugging(
117 const char *path, char const *argv[], char const *envp[], bool no_stdio,
118 bool disable_aslr, const char *event_data, DNBError &launch_err);
119 bool BoardServiceSendEvent(const char *event, DNBError &error);
Jason Molendac611a742015-10-23 02:49:51 +0000120#endif
Kate Stoneb9c1b512016-09-06 20:57:50 +0000121 static bool GetOSVersionNumbers(uint64_t *major, uint64_t *minor,
122 uint64_t *patch);
Jason Molendaa3329782014-03-29 18:54:20 +0000123#ifdef WITH_BKS
Kate Stoneb9c1b512016-09-06 20:57:50 +0000124 static void BKSCleanupAfterAttach(const void *attach_token,
125 DNBError &err_str);
Jason Molendac611a742015-10-23 02:49:51 +0000126#endif // WITH_BKS
127#ifdef WITH_FBS
Kate Stoneb9c1b512016-09-06 20:57:50 +0000128 static void FBSCleanupAfterAttach(const void *attach_token,
129 DNBError &err_str);
130#endif // WITH_FBS
Jason Molenda42999a42012-02-22 02:18:59 +0000131#ifdef WITH_SPRINGBOARD
Kate Stoneb9c1b512016-09-06 20:57:50 +0000132 pid_t SBLaunchForDebug(const char *app_bundle_path, char const *argv[],
133 char const *envp[], bool no_stdio, bool disable_aslr,
134 DNBError &launch_err);
135 static pid_t SBForkChildForPTraceDebugging(const char *path,
136 char const *argv[],
137 char const *envp[], bool no_stdio,
138 MachProcess *process,
139 DNBError &launch_err);
140#endif // WITH_SPRINGBOARD
141 nub_addr_t LookupSymbol(const char *name, const char *shlib);
142 void SetNameToAddressCallback(DNBCallbackNameToAddress callback,
143 void *baton) {
144 m_name_to_addr_callback = callback;
145 m_name_to_addr_baton = baton;
146 }
147 void
148 SetSharedLibraryInfoCallback(DNBCallbackCopyExecutableImageInfos callback,
149 void *baton) {
150 m_image_infos_callback = callback;
151 m_image_infos_baton = baton;
152 }
Chris Lattner30fdc8d2010-06-08 16:52:24 +0000153
Kate Stoneb9c1b512016-09-06 20:57:50 +0000154 bool Resume(const DNBThreadResumeActions &thread_actions);
155 bool Signal(int signal, const struct timespec *timeout_abstime = NULL);
156 bool Interrupt();
157 bool SendEvent(const char *event, DNBError &send_err);
158 bool Kill(const struct timespec *timeout_abstime = NULL);
159 bool Detach();
160 nub_size_t ReadMemory(nub_addr_t addr, nub_size_t size, void *buf);
161 nub_size_t WriteMemory(nub_addr_t addr, nub_size_t size, const void *buf);
Chris Lattner30fdc8d2010-06-08 16:52:24 +0000162
Kate Stoneb9c1b512016-09-06 20:57:50 +0000163 //----------------------------------------------------------------------
164 // Path and arg accessors
165 //----------------------------------------------------------------------
166 const char *Path() const { return m_path.c_str(); }
167 size_t ArgumentCount() const { return m_args.size(); }
168 const char *ArgumentAtIndex(size_t arg_idx) const {
169 if (arg_idx < m_args.size())
170 return m_args[arg_idx].c_str();
171 return NULL;
172 }
Chris Lattner30fdc8d2010-06-08 16:52:24 +0000173
Kate Stoneb9c1b512016-09-06 20:57:50 +0000174 //----------------------------------------------------------------------
175 // Breakpoint functions
176 //----------------------------------------------------------------------
177 DNBBreakpoint *CreateBreakpoint(nub_addr_t addr, nub_size_t length,
178 bool hardware);
179 bool DisableBreakpoint(nub_addr_t addr, bool remove);
180 void DisableAllBreakpoints(bool remove);
181 bool EnableBreakpoint(nub_addr_t addr);
182 DNBBreakpointList &Breakpoints() { return m_breakpoints; }
183 const DNBBreakpointList &Breakpoints() const { return m_breakpoints; }
Chris Lattner30fdc8d2010-06-08 16:52:24 +0000184
Kate Stoneb9c1b512016-09-06 20:57:50 +0000185 //----------------------------------------------------------------------
186 // Watchpoint functions
187 //----------------------------------------------------------------------
188 DNBBreakpoint *CreateWatchpoint(nub_addr_t addr, nub_size_t length,
189 uint32_t watch_type, bool hardware);
190 bool DisableWatchpoint(nub_addr_t addr, bool remove);
191 void DisableAllWatchpoints(bool remove);
192 bool EnableWatchpoint(nub_addr_t addr);
193 uint32_t GetNumSupportedHardwareWatchpoints() const;
194 DNBBreakpointList &Watchpoints() { return m_watchpoints; }
195 const DNBBreakpointList &Watchpoints() const { return m_watchpoints; }
Chris Lattner30fdc8d2010-06-08 16:52:24 +0000196
Kate Stoneb9c1b512016-09-06 20:57:50 +0000197 //----------------------------------------------------------------------
198 // Exception thread functions
199 //----------------------------------------------------------------------
200 bool StartSTDIOThread();
201 static void *STDIOThread(void *arg);
202 void ExceptionMessageReceived(const MachException::Message &exceptionMessage);
203 task_t ExceptionMessageBundleComplete();
204 void SharedLibrariesUpdated();
205 nub_size_t CopyImageInfos(struct DNBExecutableImageInfo **image_infos,
206 bool only_changed);
Chris Lattner30fdc8d2010-06-08 16:52:24 +0000207
Kate Stoneb9c1b512016-09-06 20:57:50 +0000208 //----------------------------------------------------------------------
209 // Profile functions
210 //----------------------------------------------------------------------
211 void SetEnableAsyncProfiling(bool enable, uint64_t internal_usec,
212 DNBProfileDataScanType scan_type);
213 bool IsProfilingEnabled() { return m_profile_enabled; }
214 useconds_t ProfileInterval() { return m_profile_interval_usec; }
215 bool StartProfileThread();
216 static void *ProfileThread(void *arg);
217 void SignalAsyncProfileData(const char *info);
218 size_t GetAsyncProfileData(char *buf, size_t buf_size);
Chris Lattner30fdc8d2010-06-08 16:52:24 +0000219
Kate Stoneb9c1b512016-09-06 20:57:50 +0000220 //----------------------------------------------------------------------
221 // Accessors
222 //----------------------------------------------------------------------
223 pid_t ProcessID() const { return m_pid; }
224 bool ProcessIDIsValid() const { return m_pid > 0; }
225 pid_t SetProcessID(pid_t pid);
226 MachTask &Task() { return m_task; }
227 const MachTask &Task() const { return m_task; }
Jason Molendaa2992312016-07-07 01:09:23 +0000228
Kate Stoneb9c1b512016-09-06 20:57:50 +0000229 PThreadEvent &Events() { return m_events; }
230 const DNBRegisterSetInfo *GetRegisterSetInfo(nub_thread_t tid,
231 nub_size_t *num_reg_sets) const;
232 bool GetRegisterValue(nub_thread_t tid, uint32_t set, uint32_t reg,
233 DNBRegisterValue *reg_value) const;
234 bool SetRegisterValue(nub_thread_t tid, uint32_t set, uint32_t reg,
235 const DNBRegisterValue *value) const;
236 nub_bool_t SyncThreadState(nub_thread_t tid);
237 const char *ThreadGetName(nub_thread_t tid);
238 nub_state_t ThreadGetState(nub_thread_t tid);
239 ThreadInfo::QoS GetRequestedQoS(nub_thread_t tid, nub_addr_t tsd,
240 uint64_t dti_qos_class_index);
241 nub_addr_t GetPThreadT(nub_thread_t tid);
242 nub_addr_t GetDispatchQueueT(nub_thread_t tid);
243 nub_addr_t
244 GetTSDAddressForThread(nub_thread_t tid,
245 uint64_t plo_pthread_tsd_base_address_offset,
246 uint64_t plo_pthread_tsd_base_offset,
247 uint64_t plo_pthread_tsd_entry_size);
Frederic Risscd90f872018-04-06 04:28:12 +0000248 const char *
249 GetDeploymentInfo(const struct load_command&, uint64_t load_command_address,
250 uint32_t& major_version, uint32_t& minor_version,
251 uint32_t& patch_version);
Kate Stoneb9c1b512016-09-06 20:57:50 +0000252 bool GetMachOInformationFromMemory(nub_addr_t mach_o_header_addr,
253 int wordsize,
254 struct mach_o_information &inf);
255 JSONGenerator::ObjectSP FormatDynamicLibrariesIntoJSON(
256 const std::vector<struct binary_image_information> &image_infos);
257 void GetAllLoadedBinariesViaDYLDSPI(
258 std::vector<struct binary_image_information> &image_infos);
259 JSONGenerator::ObjectSP GetLoadedDynamicLibrariesInfos(
260 nub_process_t pid, nub_addr_t image_list_address, nub_addr_t image_count);
261 JSONGenerator::ObjectSP
262 GetLibrariesInfoForAddresses(nub_process_t pid,
263 std::vector<uint64_t> &macho_addresses);
264 JSONGenerator::ObjectSP GetAllLoadedLibrariesInfos(nub_process_t pid);
265 JSONGenerator::ObjectSP GetSharedCacheInfo(nub_process_t pid);
Jason Molenda705b1802014-06-13 02:37:02 +0000266
Kate Stoneb9c1b512016-09-06 20:57:50 +0000267 nub_size_t GetNumThreads() const;
268 nub_thread_t GetThreadAtIndex(nub_size_t thread_idx) const;
269 nub_thread_t GetCurrentThread();
270 nub_thread_t GetCurrentThreadMachPort();
271 nub_thread_t SetCurrentThread(nub_thread_t tid);
272 MachThreadList &GetThreadList() { return m_thread_list; }
273 bool GetThreadStoppedReason(nub_thread_t tid,
274 struct DNBThreadStopInfo *stop_info);
275 void DumpThreadStoppedReason(nub_thread_t tid) const;
276 const char *GetThreadInfo(nub_thread_t tid) const;
Chris Lattner30fdc8d2010-06-08 16:52:24 +0000277
Kate Stoneb9c1b512016-09-06 20:57:50 +0000278 nub_thread_t GetThreadIDForMachPortNumber(thread_t mach_port_number) const;
Jason Molenda1c739112013-02-22 07:27:08 +0000279
Kate Stoneb9c1b512016-09-06 20:57:50 +0000280 uint32_t GetCPUType();
281 nub_state_t GetState();
282 void SetState(nub_state_t state);
283 bool IsRunning(nub_state_t state) {
284 return state == eStateRunning || IsStepping(state);
285 }
286 bool IsStepping(nub_state_t state) { return state == eStateStepping; }
287 bool CanResume(nub_state_t state) { return state == eStateStopped; }
Chris Lattner30fdc8d2010-06-08 16:52:24 +0000288
Kate Stoneb9c1b512016-09-06 20:57:50 +0000289 bool GetExitStatus(int *status) {
290 if (GetState() == eStateExited) {
291 if (status)
292 *status = m_exit_status;
293 return true;
294 }
295 return false;
296 }
297 void SetExitStatus(int status) {
298 m_exit_status = status;
299 SetState(eStateExited);
300 }
301 const char *GetExitInfo() { return m_exit_info.c_str(); }
Chris Lattner30fdc8d2010-06-08 16:52:24 +0000302
Kate Stoneb9c1b512016-09-06 20:57:50 +0000303 void SetExitInfo(const char *info);
Chris Lattner30fdc8d2010-06-08 16:52:24 +0000304
Kate Stoneb9c1b512016-09-06 20:57:50 +0000305 uint32_t StopCount() const { return m_stop_count; }
306 void SetChildFileDescriptors(int stdin_fileno, int stdout_fileno,
307 int stderr_fileno) {
308 m_child_stdin = stdin_fileno;
309 m_child_stdout = stdout_fileno;
310 m_child_stderr = stderr_fileno;
311 }
Chris Lattner30fdc8d2010-06-08 16:52:24 +0000312
Kate Stoneb9c1b512016-09-06 20:57:50 +0000313 int GetStdinFileDescriptor() const { return m_child_stdin; }
314 int GetStdoutFileDescriptor() const { return m_child_stdout; }
315 int GetStderrFileDescriptor() const { return m_child_stderr; }
316 void AppendSTDOUT(char *s, size_t len);
317 size_t GetAvailableSTDOUT(char *buf, size_t buf_size);
318 size_t GetAvailableSTDERR(char *buf, size_t buf_size);
319 void CloseChildFileDescriptors() {
320 if (m_child_stdin >= 0) {
321 ::close(m_child_stdin);
322 m_child_stdin = -1;
323 }
324 if (m_child_stdout >= 0) {
325 ::close(m_child_stdout);
326 m_child_stdout = -1;
327 }
328 if (m_child_stderr >= 0) {
329 ::close(m_child_stderr);
330 m_child_stderr = -1;
331 }
332 }
Jason Molenda567b1542014-06-13 02:44:21 +0000333
Kate Stoneb9c1b512016-09-06 20:57:50 +0000334 bool ProcessUsingSpringBoard() const {
335 return (m_flags & eMachProcessFlagsUsingSBS) != 0;
336 }
337 bool ProcessUsingBackBoard() const {
338 return (m_flags & eMachProcessFlagsUsingBKS) != 0;
339 }
Jason Molenda705b1802014-06-13 02:37:02 +0000340
Kate Stoneb9c1b512016-09-06 20:57:50 +0000341 Genealogy::ThreadActivitySP GetGenealogyInfoForThread(nub_thread_t tid,
342 bool &timed_out);
Jason Molenda567b1542014-06-13 02:44:21 +0000343
Kate Stoneb9c1b512016-09-06 20:57:50 +0000344 Genealogy::ProcessExecutableInfoSP GetGenealogyImageInfo(size_t idx);
345
346 DNBProfileDataScanType GetProfileScanType() { return m_profile_scan_type; }
Jason Molenda567b1542014-06-13 02:44:21 +0000347
Chris Lattner30fdc8d2010-06-08 16:52:24 +0000348private:
Kate Stoneb9c1b512016-09-06 20:57:50 +0000349 enum {
350 eMachProcessFlagsNone = 0,
351 eMachProcessFlagsAttached = (1 << 0),
352 eMachProcessFlagsUsingSBS = (1 << 1),
353 eMachProcessFlagsUsingBKS = (1 << 2),
354 eMachProcessFlagsUsingFBS = (1 << 3)
355 };
356 void Clear(bool detaching = false);
357 void ReplyToAllExceptions();
358 void PrivateResume();
Chris Lattner30fdc8d2010-06-08 16:52:24 +0000359
Kate Stoneb9c1b512016-09-06 20:57:50 +0000360 uint32_t Flags() const { return m_flags; }
361 nub_state_t DoSIGSTOP(bool clear_bps_and_wps, bool allow_running,
362 uint32_t *thread_idx_ptr);
Chris Lattner30fdc8d2010-06-08 16:52:24 +0000363
Kate Stoneb9c1b512016-09-06 20:57:50 +0000364 pid_t m_pid; // Process ID of child process
365 cpu_type_t m_cpu_type; // The CPU type of this process
366 int m_child_stdin;
367 int m_child_stdout;
368 int m_child_stderr;
369 std::string m_path; // A path to the executable if we have one
370 std::vector<std::string>
371 m_args; // The arguments with which the process was lauched
372 int m_exit_status; // The exit status for the process
373 std::string m_exit_info; // Any extra info that we may have about the exit
374 MachTask m_task; // The mach task for this process
375 uint32_t m_flags; // Process specific flags (see eMachProcessFlags enums)
376 uint32_t m_stop_count; // A count of many times have we stopped
377 pthread_t m_stdio_thread; // Thread ID for the thread that watches for child
378 // process stdio
379 PThreadMutex m_stdio_mutex; // Multithreaded protection for stdio
380 std::string m_stdout_data;
Chris Lattner30fdc8d2010-06-08 16:52:24 +0000381
Kate Stoneb9c1b512016-09-06 20:57:50 +0000382 bool m_profile_enabled; // A flag to indicate if profiling is enabled
383 useconds_t m_profile_interval_usec; // If enable, the profiling interval in
384 // microseconds
385 DNBProfileDataScanType
386 m_profile_scan_type; // Indicates what needs to be profiled
387 pthread_t
388 m_profile_thread; // Thread ID for the thread that profiles the inferior
389 PThreadMutex
390 m_profile_data_mutex; // Multithreaded protection for profile info data
391 std::vector<std::string>
392 m_profile_data; // Profile data, must be protected by m_profile_data_mutex
Jason Molendaa2992312016-07-07 01:09:23 +0000393
Kate Stoneb9c1b512016-09-06 20:57:50 +0000394 DNBThreadResumeActions m_thread_actions; // The thread actions for the current
395 // MachProcess::Resume() call
396 MachException::Message::collection m_exception_messages; // A collection of
397 // exception messages
398 // caught when
399 // listening to the
400 // exception port
401 PThreadMutex m_exception_messages_mutex; // Multithreaded protection for
402 // m_exception_messages
403
404 MachThreadList m_thread_list; // A list of threads that is maintained/updated
405 // after each stop
406 Genealogy m_activities; // A list of activities that is updated after every
407 // stop lazily
408 nub_state_t m_state; // The state of our process
409 PThreadMutex m_state_mutex; // Multithreaded protection for m_state
410 PThreadEvent m_events; // Process related events in the child processes
411 // lifetime can be waited upon
412 PThreadEvent m_private_events; // Used to coordinate running and stopping the
413 // process without affecting m_events
414 DNBBreakpointList m_breakpoints; // Breakpoint list for this process
415 DNBBreakpointList m_watchpoints; // Watchpoint list for this process
416 DNBCallbackNameToAddress m_name_to_addr_callback;
417 void *m_name_to_addr_baton;
418 DNBCallbackCopyExecutableImageInfos m_image_infos_callback;
419 void *m_image_infos_baton;
420 std::string
421 m_bundle_id; // If we are a SB or BKS process, this will be our bundle ID.
422 int m_sent_interrupt_signo; // When we call MachProcess::Interrupt(), we want
423 // to send a single signal
424 // to the inferior and only send the signal if we aren't already stopped.
425 // If we end up sending a signal to stop the process we store it until we
426 // receive an exception with this signal. This helps us to verify we got
427 // the signal that interrupted the process. We might stop due to another
428 // reason after an interrupt signal is sent, so this helps us ensure that
429 // we don't report a spurious stop on the next resume.
430 int m_auto_resume_signo; // If we resume the process and still haven't
431 // received our interrupt signal
432 // acknownledgement, we will shortly after the next resume. We store the
433 // interrupt signal in this variable so when we get the interrupt signal
434 // as the sole reason for the process being stopped, we can auto resume
435 // the process.
436 bool m_did_exec;
437
438 void *(*m_dyld_process_info_create)(task_t task, uint64_t timestamp,
439 kern_return_t *kernelError);
440 void (*m_dyld_process_info_for_each_image)(
441 void *info, void (^callback)(uint64_t machHeaderAddress,
442 const uuid_t uuid, const char *path));
443 void (*m_dyld_process_info_release)(void *info);
444 void (*m_dyld_process_info_get_cache)(void *info, void *cacheInfo);
Chris Lattner30fdc8d2010-06-08 16:52:24 +0000445};
446
Chris Lattner30fdc8d2010-06-08 16:52:24 +0000447#endif // __MachProcess_h__