blob: cb6a3cf97f10235a29bd6f144b4b6cbf81b2eb7f [file] [log] [blame]
Greg Clayton8f3b21d2010-09-07 20:11:56 +00001//===-- Host.cpp ------------------------------------------------*- 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#include "lldb/Host/Host.h"
11#include "lldb/Core/ArchSpec.h"
12#include "lldb/Core/ConstString.h"
13#include "lldb/Core/Error.h"
Greg Clayton5f54ac32011-02-08 05:05:52 +000014#include "lldb/Host/FileSpec.h"
Greg Clayton8f3b21d2010-09-07 20:11:56 +000015#include "lldb/Core/Log.h"
16#include "lldb/Core/StreamString.h"
Greg Clayton14ef59f2011-02-08 00:35:34 +000017#include "lldb/Host/Config.h"
Greg Claytoncd548032011-02-01 01:31:41 +000018#include "lldb/Host/Endian.h"
Greg Clayton8f3b21d2010-09-07 20:11:56 +000019#include "lldb/Host/Mutex.h"
20
Stephen Wilson7f513ba2011-02-24 19:15:09 +000021#include "llvm/Support/Host.h"
22
Greg Clayton8f3b21d2010-09-07 20:11:56 +000023#include <dlfcn.h>
24#include <errno.h>
Greg Clayton8f3b21d2010-09-07 20:11:56 +000025
26#if defined (__APPLE__)
Greg Clayton14ef59f2011-02-08 00:35:34 +000027
Greg Clayton49ce6822010-10-31 03:01:06 +000028#include <dispatch/dispatch.h>
Greg Clayton8f3b21d2010-09-07 20:11:56 +000029#include <libproc.h>
30#include <mach-o/dyld.h>
Greg Claytonb5f67fb2011-02-05 06:36:35 +000031#include <sys/sysctl.h>
Greg Clayton14ef59f2011-02-08 00:35:34 +000032
Greg Clayton0f577c22011-02-07 17:43:47 +000033#elif defined (__linux__)
Greg Clayton14ef59f2011-02-08 00:35:34 +000034
Greg Clayton0f577c22011-02-07 17:43:47 +000035#include <sys/wait.h>
Greg Clayton14ef59f2011-02-08 00:35:34 +000036
Greg Clayton8f3b21d2010-09-07 20:11:56 +000037#endif
38
39using namespace lldb;
40using namespace lldb_private;
41
42struct MonitorInfo
43{
44 lldb::pid_t pid; // The process ID to monitor
45 Host::MonitorChildProcessCallback callback; // The callback function to call when "pid" exits or signals
46 void *callback_baton; // The callback baton for the callback function
47 bool monitor_signals; // If true, call the callback when "pid" gets signaled.
48};
49
50static void *
51MonitorChildProcessThreadFunction (void *arg);
52
53lldb::thread_t
54Host::StartMonitoringChildProcess
55(
56 Host::MonitorChildProcessCallback callback,
57 void *callback_baton,
58 lldb::pid_t pid,
59 bool monitor_signals
60)
61{
62 lldb::thread_t thread = LLDB_INVALID_HOST_THREAD;
63 if (callback)
64 {
65 std::auto_ptr<MonitorInfo> info_ap(new MonitorInfo);
66
67 info_ap->pid = pid;
68 info_ap->callback = callback;
69 info_ap->callback_baton = callback_baton;
70 info_ap->monitor_signals = monitor_signals;
71
72 char thread_name[256];
73 ::snprintf (thread_name, sizeof(thread_name), "<lldb.host.wait4(pid=%i)>", pid);
74 thread = ThreadCreate (thread_name,
75 MonitorChildProcessThreadFunction,
76 info_ap.get(),
77 NULL);
78
Greg Clayton09c81ef2011-02-08 01:34:25 +000079 if (IS_VALID_LLDB_HOST_THREAD(thread))
Greg Clayton8f3b21d2010-09-07 20:11:56 +000080 info_ap.release();
81 }
82 return thread;
83}
84
85//------------------------------------------------------------------
86// Scoped class that will disable thread canceling when it is
87// constructed, and exception safely restore the previous value it
88// when it goes out of scope.
89//------------------------------------------------------------------
90class ScopedPThreadCancelDisabler
91{
92public:
93 ScopedPThreadCancelDisabler()
94 {
95 // Disable the ability for this thread to be cancelled
96 int err = ::pthread_setcancelstate (PTHREAD_CANCEL_DISABLE, &m_old_state);
97 if (err != 0)
98 m_old_state = -1;
99
100 }
101
102 ~ScopedPThreadCancelDisabler()
103 {
104 // Restore the ability for this thread to be cancelled to what it
105 // previously was.
106 if (m_old_state != -1)
107 ::pthread_setcancelstate (m_old_state, 0);
108 }
109private:
110 int m_old_state; // Save the old cancelability state.
111};
112
113static void *
114MonitorChildProcessThreadFunction (void *arg)
115{
Greg Claytone005f2c2010-11-06 01:53:30 +0000116 LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_PROCESS));
Greg Clayton8f3b21d2010-09-07 20:11:56 +0000117 const char *function = __FUNCTION__;
118 if (log)
119 log->Printf ("%s (arg = %p) thread starting...", function, arg);
120
121 MonitorInfo *info = (MonitorInfo *)arg;
122
123 const Host::MonitorChildProcessCallback callback = info->callback;
124 void * const callback_baton = info->callback_baton;
125 const lldb::pid_t pid = info->pid;
126 const bool monitor_signals = info->monitor_signals;
127
128 delete info;
129
130 int status = -1;
131 const int options = 0;
132 struct rusage *rusage = NULL;
133 while (1)
134 {
Caroline Tice926060e2010-10-29 21:48:37 +0000135 log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_PROCESS);
Greg Clayton8f3b21d2010-09-07 20:11:56 +0000136 if (log)
137 log->Printf("%s ::wait4 (pid = %i, &status, options = %i, rusage = %p)...", function, pid, options, rusage);
138
139 // Wait for all child processes
140 ::pthread_testcancel ();
141 const lldb::pid_t wait_pid = ::wait4 (pid, &status, options, rusage);
142 ::pthread_testcancel ();
143
144 if (wait_pid == -1)
145 {
146 if (errno == EINTR)
147 continue;
148 else
149 break;
150 }
151 else if (wait_pid == pid)
152 {
153 bool exited = false;
154 int signal = 0;
155 int exit_status = 0;
156 const char *status_cstr = NULL;
157 if (WIFSTOPPED(status))
158 {
159 signal = WSTOPSIG(status);
160 status_cstr = "STOPPED";
161 }
162 else if (WIFEXITED(status))
163 {
164 exit_status = WEXITSTATUS(status);
165 status_cstr = "EXITED";
166 exited = true;
167 }
168 else if (WIFSIGNALED(status))
169 {
170 signal = WTERMSIG(status);
171 status_cstr = "SIGNALED";
172 exited = true;
173 exit_status = -1;
174 }
175 else
176 {
177 status_cstr = "(???)";
178 }
179
180 // Scope for pthread_cancel_disabler
181 {
182 ScopedPThreadCancelDisabler pthread_cancel_disabler;
183
Caroline Tice926060e2010-10-29 21:48:37 +0000184 log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_PROCESS);
Greg Clayton8f3b21d2010-09-07 20:11:56 +0000185 if (log)
186 log->Printf ("%s ::wait4 (pid = %i, &status, options = %i, rusage = %p) => pid = %i, status = 0x%8.8x (%s), signal = %i, exit_state = %i",
187 function,
188 wait_pid,
189 options,
190 rusage,
191 pid,
192 status,
193 status_cstr,
194 signal,
195 exit_status);
196
197 if (exited || (signal != 0 && monitor_signals))
198 {
199 bool callback_return = callback (callback_baton, pid, signal, exit_status);
200
201 // If our process exited, then this thread should exit
202 if (exited)
203 break;
204 // If the callback returns true, it means this process should
205 // exit
206 if (callback_return)
207 break;
208 }
209 }
210 }
211 }
212
Caroline Tice926060e2010-10-29 21:48:37 +0000213 log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_PROCESS);
Greg Clayton8f3b21d2010-09-07 20:11:56 +0000214 if (log)
215 log->Printf ("%s (arg = %p) thread exiting...", __FUNCTION__, arg);
216
217 return NULL;
218}
219
220size_t
221Host::GetPageSize()
222{
223 return ::getpagesize();
224}
225
Greg Clayton8f3b21d2010-09-07 20:11:56 +0000226const ArchSpec &
Greg Clayton395fc332011-02-15 21:59:32 +0000227Host::GetArchitecture (SystemDefaultArchitecture arch_kind)
Greg Clayton8f3b21d2010-09-07 20:11:56 +0000228{
Greg Clayton395fc332011-02-15 21:59:32 +0000229 static bool g_supports_32 = false;
230 static bool g_supports_64 = false;
231 static ArchSpec g_host_arch_32;
232 static ArchSpec g_host_arch_64;
233
Greg Clayton8f3b21d2010-09-07 20:11:56 +0000234#if defined (__APPLE__)
Greg Clayton395fc332011-02-15 21:59:32 +0000235
236 // Apple is different in that it can support both 32 and 64 bit executables
237 // in the same operating system running concurrently. Here we detect the
238 // correct host architectures for both 32 and 64 bit including if 64 bit
239 // executables are supported on the system.
240
241 if (g_supports_32 == false && g_supports_64 == false)
242 {
243 // All apple systems support 32 bit execution.
244 g_supports_32 = true;
Greg Clayton8f3b21d2010-09-07 20:11:56 +0000245 uint32_t cputype, cpusubtype;
Greg Clayton395fc332011-02-15 21:59:32 +0000246 uint32_t is_64_bit_capable = false;
Greg Clayton8f3b21d2010-09-07 20:11:56 +0000247 size_t len = sizeof(cputype);
Greg Clayton395fc332011-02-15 21:59:32 +0000248 ArchSpec host_arch;
249 // These will tell us about the kernel architecture, which even on a 64
250 // bit machine can be 32 bit...
Greg Clayton8f3b21d2010-09-07 20:11:56 +0000251 if (::sysctlbyname("hw.cputype", &cputype, &len, NULL, 0) == 0)
252 {
Greg Clayton395fc332011-02-15 21:59:32 +0000253 len = sizeof (cpusubtype);
254 if (::sysctlbyname("hw.cpusubtype", &cpusubtype, &len, NULL, 0) != 0)
255 cpusubtype = CPU_TYPE_ANY;
256
Greg Clayton8f3b21d2010-09-07 20:11:56 +0000257 len = sizeof (is_64_bit_capable);
258 if (::sysctlbyname("hw.cpu64bit_capable", &is_64_bit_capable, &len, NULL, 0) == 0)
259 {
260 if (is_64_bit_capable)
Greg Clayton395fc332011-02-15 21:59:32 +0000261 g_supports_64 = true;
262 }
263
264 if (is_64_bit_capable)
265 {
Greg Clayton75c703d2011-02-16 04:46:07 +0000266#if defined (__i386__) || defined (__x86_64__)
267 if (cpusubtype == CPU_SUBTYPE_486)
268 cpusubtype = CPU_SUBTYPE_I386_ALL;
269#endif
Greg Clayton395fc332011-02-15 21:59:32 +0000270 if (cputype & CPU_ARCH_ABI64)
Greg Clayton8f3b21d2010-09-07 20:11:56 +0000271 {
Greg Clayton395fc332011-02-15 21:59:32 +0000272 // We have a 64 bit kernel on a 64 bit system
Greg Clayton940b1032011-02-23 00:35:02 +0000273 g_host_arch_32.SetArchitecture (lldb::eArchTypeMachO, ~(CPU_ARCH_MASK) & cputype, cpusubtype);
274 g_host_arch_64.SetArchitecture (lldb::eArchTypeMachO, cputype, cpusubtype);
Greg Clayton395fc332011-02-15 21:59:32 +0000275 }
276 else
277 {
278 // We have a 32 bit kernel on a 64 bit system
Greg Clayton940b1032011-02-23 00:35:02 +0000279 g_host_arch_32.SetArchitecture (lldb::eArchTypeMachO, cputype, cpusubtype);
Greg Clayton8f3b21d2010-09-07 20:11:56 +0000280 cputype |= CPU_ARCH_ABI64;
Greg Clayton940b1032011-02-23 00:35:02 +0000281 g_host_arch_64.SetArchitecture (lldb::eArchTypeMachO, cputype, cpusubtype);
Greg Clayton8f3b21d2010-09-07 20:11:56 +0000282 }
283 }
Greg Clayton395fc332011-02-15 21:59:32 +0000284 else
285 {
Greg Clayton940b1032011-02-23 00:35:02 +0000286 g_host_arch_32.SetArchitecture (lldb::eArchTypeMachO, cputype, cpusubtype);
Greg Clayton395fc332011-02-15 21:59:32 +0000287 g_host_arch_64.Clear();
288 }
Greg Clayton8f3b21d2010-09-07 20:11:56 +0000289 }
Greg Clayton395fc332011-02-15 21:59:32 +0000290 }
291
292#else // #if defined (__APPLE__)
Stephen Wilson7f513ba2011-02-24 19:15:09 +0000293
Greg Clayton395fc332011-02-15 21:59:32 +0000294 if (g_supports_32 == false && g_supports_64 == false)
295 {
Stephen Wilson7f513ba2011-02-24 19:15:09 +0000296 llvm::Triple triple(llvm::sys::getHostTriple());
Greg Clayton395fc332011-02-15 21:59:32 +0000297
Stephen Wilson7f513ba2011-02-24 19:15:09 +0000298 g_host_arch_32.Clear();
299 g_host_arch_64.Clear();
Greg Clayton395fc332011-02-15 21:59:32 +0000300
Stephen Wilson7f513ba2011-02-24 19:15:09 +0000301 switch (triple.getArch())
302 {
303 default:
304 g_host_arch_32.SetTriple(triple);
305 g_supports_32 = true;
306 break;
Greg Clayton395fc332011-02-15 21:59:32 +0000307
Stephen Wilson7f513ba2011-02-24 19:15:09 +0000308 case llvm::Triple::alpha:
309 case llvm::Triple::x86_64:
310 case llvm::Triple::sparcv9:
311 case llvm::Triple::ppc64:
312 case llvm::Triple::systemz:
313 case llvm::Triple::cellspu:
314 g_host_arch_64.SetTriple(triple);
315 g_supports_64 = true;
316 break;
317 }
Greg Clayton4fefe322011-02-17 02:05:38 +0000318
319 g_supports_32 = g_host_arch_32.IsValid();
320 g_supports_64 = g_host_arch_64.IsValid();
Greg Clayton8f3b21d2010-09-07 20:11:56 +0000321 }
Greg Clayton395fc332011-02-15 21:59:32 +0000322
323#endif // #else for #if defined (__APPLE__)
324
325 if (arch_kind == eSystemDefaultArchitecture32)
326 return g_host_arch_32;
327 else if (arch_kind == eSystemDefaultArchitecture64)
328 return g_host_arch_64;
329
330 if (g_supports_64)
331 return g_host_arch_64;
332
333 return g_host_arch_32;
Greg Clayton8f3b21d2010-09-07 20:11:56 +0000334}
335
336const ConstString &
337Host::GetVendorString()
338{
339 static ConstString g_vendor;
340 if (!g_vendor)
341 {
342#if defined (__APPLE__)
343 char ostype[64];
344 size_t len = sizeof(ostype);
345 if (::sysctlbyname("kern.ostype", &ostype, &len, NULL, 0) == 0)
346 g_vendor.SetCString (ostype);
347 else
348 g_vendor.SetCString("apple");
349#elif defined (__linux__)
350 g_vendor.SetCString("gnu");
351#endif
352 }
353 return g_vendor;
354}
355
356const ConstString &
357Host::GetOSString()
358{
359 static ConstString g_os_string;
360 if (!g_os_string)
361 {
362#if defined (__APPLE__)
363 g_os_string.SetCString("darwin");
364#elif defined (__linux__)
365 g_os_string.SetCString("linux");
366#endif
367 }
368 return g_os_string;
369}
370
371const ConstString &
372Host::GetTargetTriple()
373{
374 static ConstString g_host_triple;
375 if (!(g_host_triple))
376 {
377 StreamString triple;
378 triple.Printf("%s-%s-%s",
Greg Clayton940b1032011-02-23 00:35:02 +0000379 GetArchitecture().GetArchitectureName(),
Greg Clayton8f3b21d2010-09-07 20:11:56 +0000380 GetVendorString().AsCString(),
381 GetOSString().AsCString());
382
383 std::transform (triple.GetString().begin(),
384 triple.GetString().end(),
385 triple.GetString().begin(),
386 ::tolower);
387
388 g_host_triple.SetCString(triple.GetString().c_str());
389 }
390 return g_host_triple;
391}
392
393lldb::pid_t
394Host::GetCurrentProcessID()
395{
396 return ::getpid();
397}
398
399lldb::tid_t
400Host::GetCurrentThreadID()
401{
402#if defined (__APPLE__)
403 return ::mach_thread_self();
404#else
405 return lldb::tid_t(pthread_self());
406#endif
407}
408
409const char *
410Host::GetSignalAsCString (int signo)
411{
412 switch (signo)
413 {
414 case SIGHUP: return "SIGHUP"; // 1 hangup
415 case SIGINT: return "SIGINT"; // 2 interrupt
416 case SIGQUIT: return "SIGQUIT"; // 3 quit
417 case SIGILL: return "SIGILL"; // 4 illegal instruction (not reset when caught)
418 case SIGTRAP: return "SIGTRAP"; // 5 trace trap (not reset when caught)
419 case SIGABRT: return "SIGABRT"; // 6 abort()
420#if defined(_POSIX_C_SOURCE)
421 case SIGPOLL: return "SIGPOLL"; // 7 pollable event ([XSR] generated, not supported)
422#else // !_POSIX_C_SOURCE
423 case SIGEMT: return "SIGEMT"; // 7 EMT instruction
424#endif // !_POSIX_C_SOURCE
425 case SIGFPE: return "SIGFPE"; // 8 floating point exception
426 case SIGKILL: return "SIGKILL"; // 9 kill (cannot be caught or ignored)
427 case SIGBUS: return "SIGBUS"; // 10 bus error
428 case SIGSEGV: return "SIGSEGV"; // 11 segmentation violation
429 case SIGSYS: return "SIGSYS"; // 12 bad argument to system call
430 case SIGPIPE: return "SIGPIPE"; // 13 write on a pipe with no one to read it
431 case SIGALRM: return "SIGALRM"; // 14 alarm clock
432 case SIGTERM: return "SIGTERM"; // 15 software termination signal from kill
433 case SIGURG: return "SIGURG"; // 16 urgent condition on IO channel
434 case SIGSTOP: return "SIGSTOP"; // 17 sendable stop signal not from tty
435 case SIGTSTP: return "SIGTSTP"; // 18 stop signal from tty
436 case SIGCONT: return "SIGCONT"; // 19 continue a stopped process
437 case SIGCHLD: return "SIGCHLD"; // 20 to parent on child stop or exit
438 case SIGTTIN: return "SIGTTIN"; // 21 to readers pgrp upon background tty read
439 case SIGTTOU: return "SIGTTOU"; // 22 like TTIN for output if (tp->t_local&LTOSTOP)
440#if !defined(_POSIX_C_SOURCE)
441 case SIGIO: return "SIGIO"; // 23 input/output possible signal
442#endif
443 case SIGXCPU: return "SIGXCPU"; // 24 exceeded CPU time limit
444 case SIGXFSZ: return "SIGXFSZ"; // 25 exceeded file size limit
445 case SIGVTALRM: return "SIGVTALRM"; // 26 virtual time alarm
446 case SIGPROF: return "SIGPROF"; // 27 profiling time alarm
447#if !defined(_POSIX_C_SOURCE)
448 case SIGWINCH: return "SIGWINCH"; // 28 window size changes
449 case SIGINFO: return "SIGINFO"; // 29 information request
450#endif
451 case SIGUSR1: return "SIGUSR1"; // 30 user defined signal 1
452 case SIGUSR2: return "SIGUSR2"; // 31 user defined signal 2
453 default:
454 break;
455 }
456 return NULL;
457}
458
459void
460Host::WillTerminate ()
461{
462}
463
464#if !defined (__APPLE__) // see macosx/Host.mm
465void
466Host::ThreadCreated (const char *thread_name)
467{
468}
Greg Claytonb749a262010-12-03 06:02:24 +0000469
470void
471Host::Backtrace (Stream &strm, uint32_t max_frames)
472{
Greg Clayton52fd9842011-02-02 02:24:04 +0000473 // TODO: Is there a way to backtrace the current process on linux? Other systems?
Greg Claytonb749a262010-12-03 06:02:24 +0000474}
475
Greg Clayton638351a2010-12-04 00:10:17 +0000476
477size_t
478Host::GetEnvironment (StringList &env)
479{
Greg Clayton52fd9842011-02-02 02:24:04 +0000480 // TODO: Is there a way to the host environment for this process on linux? Other systems?
Greg Clayton638351a2010-12-04 00:10:17 +0000481 return 0;
482}
483
Greg Clayton8f3b21d2010-09-07 20:11:56 +0000484#endif
485
486struct HostThreadCreateInfo
487{
488 std::string thread_name;
489 thread_func_t thread_fptr;
490 thread_arg_t thread_arg;
491
492 HostThreadCreateInfo (const char *name, thread_func_t fptr, thread_arg_t arg) :
493 thread_name (name ? name : ""),
494 thread_fptr (fptr),
495 thread_arg (arg)
496 {
497 }
498};
499
500static thread_result_t
501ThreadCreateTrampoline (thread_arg_t arg)
502{
503 HostThreadCreateInfo *info = (HostThreadCreateInfo *)arg;
504 Host::ThreadCreated (info->thread_name.c_str());
505 thread_func_t thread_fptr = info->thread_fptr;
506 thread_arg_t thread_arg = info->thread_arg;
507
Greg Claytone005f2c2010-11-06 01:53:30 +0000508 LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_THREAD));
Greg Clayton8f3b21d2010-09-07 20:11:56 +0000509 if (log)
510 log->Printf("thread created");
511
512 delete info;
513 return thread_fptr (thread_arg);
514}
515
516lldb::thread_t
517Host::ThreadCreate
518(
519 const char *thread_name,
520 thread_func_t thread_fptr,
521 thread_arg_t thread_arg,
522 Error *error
523)
524{
525 lldb::thread_t thread = LLDB_INVALID_HOST_THREAD;
526
527 // Host::ThreadCreateTrampoline will delete this pointer for us.
528 HostThreadCreateInfo *info_ptr = new HostThreadCreateInfo (thread_name, thread_fptr, thread_arg);
529
530 int err = ::pthread_create (&thread, NULL, ThreadCreateTrampoline, info_ptr);
531 if (err == 0)
532 {
533 if (error)
534 error->Clear();
535 return thread;
536 }
537
538 if (error)
539 error->SetError (err, eErrorTypePOSIX);
540
541 return LLDB_INVALID_HOST_THREAD;
542}
543
544bool
545Host::ThreadCancel (lldb::thread_t thread, Error *error)
546{
547 int err = ::pthread_cancel (thread);
548 if (error)
549 error->SetError(err, eErrorTypePOSIX);
550 return err == 0;
551}
552
553bool
554Host::ThreadDetach (lldb::thread_t thread, Error *error)
555{
556 int err = ::pthread_detach (thread);
557 if (error)
558 error->SetError(err, eErrorTypePOSIX);
559 return err == 0;
560}
561
562bool
563Host::ThreadJoin (lldb::thread_t thread, thread_result_t *thread_result_ptr, Error *error)
564{
565 int err = ::pthread_join (thread, thread_result_ptr);
566 if (error)
567 error->SetError(err, eErrorTypePOSIX);
568 return err == 0;
569}
570
571//------------------------------------------------------------------
572// Control access to a static file thread name map using a single
573// static function to avoid a static constructor.
574//------------------------------------------------------------------
575static const char *
576ThreadNameAccessor (bool get, lldb::pid_t pid, lldb::tid_t tid, const char *name)
577{
578 uint64_t pid_tid = ((uint64_t)pid << 32) | (uint64_t)tid;
579
580 static pthread_mutex_t g_mutex = PTHREAD_MUTEX_INITIALIZER;
581 Mutex::Locker locker(&g_mutex);
582
583 typedef std::map<uint64_t, std::string> thread_name_map;
584 // rdar://problem/8153284
585 // Fixed a crasher where during shutdown, loggings attempted to access the
586 // thread name but the static map instance had already been destructed.
587 // Another approach is to introduce a static guard object which monitors its
588 // own destruction and raises a flag, but this incurs more overhead.
589 static thread_name_map *g_thread_names_ptr = new thread_name_map();
590 thread_name_map &g_thread_names = *g_thread_names_ptr;
591
592 if (get)
593 {
594 // See if the thread name exists in our thread name pool
595 thread_name_map::iterator pos = g_thread_names.find(pid_tid);
596 if (pos != g_thread_names.end())
597 return pos->second.c_str();
598 }
599 else
600 {
601 // Set the thread name
602 g_thread_names[pid_tid] = name;
603 }
604 return NULL;
605}
606
607const char *
608Host::GetThreadName (lldb::pid_t pid, lldb::tid_t tid)
609{
610 const char *name = ThreadNameAccessor (true, pid, tid, NULL);
611 if (name == NULL)
612 {
613#if defined(__APPLE__) && MAC_OS_X_VERSION_MAX_ALLOWED > MAC_OS_X_VERSION_10_5
614 // We currently can only get the name of a thread in the current process.
615 if (pid == Host::GetCurrentProcessID())
616 {
617 char pthread_name[1024];
618 if (::pthread_getname_np (::pthread_from_mach_thread_np (tid), pthread_name, sizeof(pthread_name)) == 0)
619 {
620 if (pthread_name[0])
621 {
622 // Set the thread in our string pool
623 ThreadNameAccessor (false, pid, tid, pthread_name);
624 // Get our copy of the thread name string
625 name = ThreadNameAccessor (true, pid, tid, NULL);
626 }
627 }
Greg Clayton49ce6822010-10-31 03:01:06 +0000628
629 if (name == NULL)
630 {
631 dispatch_queue_t current_queue = ::dispatch_get_current_queue ();
632 if (current_queue != NULL)
633 name = dispatch_queue_get_label (current_queue);
634 }
Greg Clayton8f3b21d2010-09-07 20:11:56 +0000635 }
636#endif
637 }
638 return name;
639}
640
641void
642Host::SetThreadName (lldb::pid_t pid, lldb::tid_t tid, const char *name)
643{
644 lldb::pid_t curr_pid = Host::GetCurrentProcessID();
645 lldb::tid_t curr_tid = Host::GetCurrentThreadID();
646 if (pid == LLDB_INVALID_PROCESS_ID)
647 pid = curr_pid;
648
649 if (tid == LLDB_INVALID_THREAD_ID)
650 tid = curr_tid;
651
652#if defined(__APPLE__) && MAC_OS_X_VERSION_MAX_ALLOWED > MAC_OS_X_VERSION_10_5
653 // Set the pthread name if possible
654 if (pid == curr_pid && tid == curr_tid)
655 {
656 ::pthread_setname_np (name);
657 }
658#endif
659 ThreadNameAccessor (false, pid, tid, name);
660}
661
662FileSpec
663Host::GetProgramFileSpec ()
664{
665 static FileSpec g_program_filespec;
666 if (!g_program_filespec)
667 {
668#if defined (__APPLE__)
669 char program_fullpath[PATH_MAX];
670 // If DST is NULL, then return the number of bytes needed.
671 uint32_t len = sizeof(program_fullpath);
672 int err = _NSGetExecutablePath (program_fullpath, &len);
673 if (err == 0)
Greg Clayton20fbf8d2011-01-13 01:23:43 +0000674 g_program_filespec.SetFile (program_fullpath, false);
Greg Clayton8f3b21d2010-09-07 20:11:56 +0000675 else if (err == -1)
676 {
677 char *large_program_fullpath = (char *)::malloc (len + 1);
678
679 err = _NSGetExecutablePath (large_program_fullpath, &len);
680 if (err == 0)
Greg Clayton20fbf8d2011-01-13 01:23:43 +0000681 g_program_filespec.SetFile (large_program_fullpath, false);
Greg Clayton8f3b21d2010-09-07 20:11:56 +0000682
683 ::free (large_program_fullpath);
684 }
685#elif defined (__linux__)
686 char exe_path[PATH_MAX];
Stephen Wilsonf302a9e2011-01-12 04:21:21 +0000687 ssize_t len = readlink("/proc/self/exe", exe_path, sizeof(exe_path) - 1);
688 if (len > 0) {
689 exe_path[len] = 0;
Greg Clayton20fbf8d2011-01-13 01:23:43 +0000690 g_program_filespec.SetFile(exe_path, false);
Stephen Wilsonf302a9e2011-01-12 04:21:21 +0000691 }
Greg Clayton8f3b21d2010-09-07 20:11:56 +0000692#elif defined (__FreeBSD__)
693 int exe_path_mib[4] = { CTL_KERN, KERN_PROC, KERN_PROC_PATHNAME, getpid() };
694 size_t exe_path_size;
695 if (sysctl(exe_path_mib, 4, NULL, &exe_path_size, NULL, 0) == 0)
696 {
Greg Clayton366795e2011-01-13 01:27:55 +0000697 char *exe_path = new char[exe_path_size];
698 if (sysctl(exe_path_mib, 4, exe_path, &exe_path_size, NULL, 0) == 0)
699 g_program_filespec.SetFile(exe_path, false);
700 delete[] exe_path;
Greg Clayton8f3b21d2010-09-07 20:11:56 +0000701 }
702#endif
703 }
704 return g_program_filespec;
705}
706
707FileSpec
708Host::GetModuleFileSpecForHostAddress (const void *host_addr)
709{
710 FileSpec module_filespec;
711 Dl_info info;
712 if (::dladdr (host_addr, &info))
713 {
714 if (info.dli_fname)
Greg Clayton537a7a82010-10-20 20:54:39 +0000715 module_filespec.SetFile(info.dli_fname, true);
Greg Clayton8f3b21d2010-09-07 20:11:56 +0000716 }
717 return module_filespec;
718}
719
720#if !defined (__APPLE__) // see Host.mm
721bool
Greg Clayton24b48ff2010-10-17 22:03:32 +0000722Host::ResolveExecutableInBundle (FileSpec &file)
Greg Clayton8f3b21d2010-09-07 20:11:56 +0000723{
Greg Clayton24b48ff2010-10-17 22:03:32 +0000724 return false;
Greg Clayton8f3b21d2010-09-07 20:11:56 +0000725}
726#endif
727
Greg Clayton14ef59f2011-02-08 00:35:34 +0000728// Opaque info that tracks a dynamic library that was loaded
729struct DynamicLibraryInfo
Greg Clayton52fd9842011-02-02 02:24:04 +0000730{
Greg Clayton14ef59f2011-02-08 00:35:34 +0000731 DynamicLibraryInfo (const FileSpec &fs, int o, void *h) :
732 file_spec (fs),
733 open_options (o),
734 handle (h)
735 {
736 }
737
738 const FileSpec file_spec;
739 uint32_t open_options;
740 void * handle;
741};
742
743void *
744Host::DynamicLibraryOpen (const FileSpec &file_spec, uint32_t options, Error &error)
745{
Greg Clayton52fd9842011-02-02 02:24:04 +0000746 char path[PATH_MAX];
747 if (file_spec.GetPath(path, sizeof(path)))
748 {
Greg Clayton14ef59f2011-02-08 00:35:34 +0000749 int mode = 0;
750
751 if (options & eDynamicLibraryOpenOptionLazy)
752 mode |= RTLD_LAZY;
Greg Claytonbf467b02011-02-08 05:24:57 +0000753 else
754 mode |= RTLD_NOW;
755
Greg Clayton14ef59f2011-02-08 00:35:34 +0000756
757 if (options & eDynamicLibraryOpenOptionLocal)
758 mode |= RTLD_LOCAL;
759 else
760 mode |= RTLD_GLOBAL;
761
762#ifdef LLDB_CONFIG_DLOPEN_RTLD_FIRST_SUPPORTED
763 if (options & eDynamicLibraryOpenOptionLimitGetSymbol)
764 mode |= RTLD_FIRST;
Greg Clayton0f577c22011-02-07 17:43:47 +0000765#endif
Greg Clayton14ef59f2011-02-08 00:35:34 +0000766
767 void * opaque = ::dlopen (path, mode);
768
769 if (opaque)
Greg Clayton52fd9842011-02-02 02:24:04 +0000770 {
771 error.Clear();
Greg Clayton14ef59f2011-02-08 00:35:34 +0000772 return new DynamicLibraryInfo (file_spec, options, opaque);
Greg Clayton52fd9842011-02-02 02:24:04 +0000773 }
774 else
775 {
776 error.SetErrorString(::dlerror());
777 }
778 }
779 else
780 {
781 error.SetErrorString("failed to extract path");
782 }
Greg Clayton14ef59f2011-02-08 00:35:34 +0000783 return NULL;
Greg Clayton52fd9842011-02-02 02:24:04 +0000784}
785
786Error
Greg Clayton14ef59f2011-02-08 00:35:34 +0000787Host::DynamicLibraryClose (void *opaque)
Greg Clayton52fd9842011-02-02 02:24:04 +0000788{
789 Error error;
Greg Clayton14ef59f2011-02-08 00:35:34 +0000790 if (opaque == NULL)
Greg Clayton52fd9842011-02-02 02:24:04 +0000791 {
792 error.SetErrorString ("invalid dynamic library handle");
793 }
Greg Clayton14ef59f2011-02-08 00:35:34 +0000794 else
Greg Clayton52fd9842011-02-02 02:24:04 +0000795 {
Greg Clayton14ef59f2011-02-08 00:35:34 +0000796 DynamicLibraryInfo *dylib_info = (DynamicLibraryInfo *) opaque;
797 if (::dlclose (dylib_info->handle) != 0)
798 {
799 error.SetErrorString(::dlerror());
800 }
801
802 dylib_info->open_options = 0;
803 dylib_info->handle = 0;
804 delete dylib_info;
Greg Clayton52fd9842011-02-02 02:24:04 +0000805 }
806 return error;
807}
808
809void *
Greg Clayton14ef59f2011-02-08 00:35:34 +0000810Host::DynamicLibraryGetSymbol (void *opaque, const char *symbol_name, Error &error)
Greg Clayton52fd9842011-02-02 02:24:04 +0000811{
Greg Clayton14ef59f2011-02-08 00:35:34 +0000812 if (opaque == NULL)
Greg Clayton52fd9842011-02-02 02:24:04 +0000813 {
814 error.SetErrorString ("invalid dynamic library handle");
Greg Clayton52fd9842011-02-02 02:24:04 +0000815 }
Greg Clayton52fd9842011-02-02 02:24:04 +0000816 else
Greg Clayton14ef59f2011-02-08 00:35:34 +0000817 {
818 DynamicLibraryInfo *dylib_info = (DynamicLibraryInfo *) opaque;
819
820 void *symbol_addr = ::dlsym (dylib_info->handle, symbol_name);
821 if (symbol_addr)
822 {
823#ifndef LLDB_CONFIG_DLOPEN_RTLD_FIRST_SUPPORTED
824 // This host doesn't support limiting searches to this shared library
825 // so we need to verify that the match came from this shared library
826 // if it was requested in the Host::DynamicLibraryOpen() function.
Greg Claytonbf467b02011-02-08 05:24:57 +0000827 if (dylib_info->open_options & eDynamicLibraryOpenOptionLimitGetSymbol)
Greg Clayton14ef59f2011-02-08 00:35:34 +0000828 {
829 FileSpec match_dylib_spec (Host::GetModuleFileSpecForHostAddress (symbol_addr));
830 if (match_dylib_spec != dylib_info->file_spec)
831 {
832 char dylib_path[PATH_MAX];
833 if (dylib_info->file_spec.GetPath (dylib_path, sizeof(dylib_path)))
834 error.SetErrorStringWithFormat ("symbol not found in \"%s\"", dylib_path);
835 else
836 error.SetErrorString ("symbol not found");
837 return NULL;
838 }
839 }
840#endif
841 error.Clear();
842 return symbol_addr;
843 }
844 else
845 {
846 error.SetErrorString(::dlerror());
847 }
848 }
849 return NULL;
Greg Clayton52fd9842011-02-02 02:24:04 +0000850}
Greg Clayton24b48ff2010-10-17 22:03:32 +0000851
852bool
853Host::GetLLDBPath (PathType path_type, FileSpec &file_spec)
854{
Greg Clayton5d187e52011-01-08 20:28:42 +0000855 // To get paths related to LLDB we get the path to the executable that
Greg Clayton24b48ff2010-10-17 22:03:32 +0000856 // contains this function. On MacOSX this will be "LLDB.framework/.../LLDB",
857 // on linux this is assumed to be the "lldb" main executable. If LLDB on
858 // linux is actually in a shared library (lldb.so??) then this function will
859 // need to be modified to "do the right thing".
860
861 switch (path_type)
862 {
863 case ePathTypeLLDBShlibDir:
864 {
865 static ConstString g_lldb_so_dir;
866 if (!g_lldb_so_dir)
867 {
868 FileSpec lldb_file_spec (Host::GetModuleFileSpecForHostAddress ((void *)Host::GetLLDBPath));
869 g_lldb_so_dir = lldb_file_spec.GetDirectory();
870 }
871 file_spec.GetDirectory() = g_lldb_so_dir;
872 return file_spec.GetDirectory();
873 }
874 break;
875
876 case ePathTypeSupportExecutableDir:
877 {
878 static ConstString g_lldb_support_exe_dir;
879 if (!g_lldb_support_exe_dir)
880 {
881 FileSpec lldb_file_spec;
882 if (GetLLDBPath (ePathTypeLLDBShlibDir, lldb_file_spec))
883 {
884 char raw_path[PATH_MAX];
885 char resolved_path[PATH_MAX];
886 lldb_file_spec.GetPath(raw_path, sizeof(raw_path));
887
888#if defined (__APPLE__)
889 char *framework_pos = ::strstr (raw_path, "LLDB.framework");
890 if (framework_pos)
891 {
892 framework_pos += strlen("LLDB.framework");
893 ::strncpy (framework_pos, "/Resources", PATH_MAX - (framework_pos - raw_path));
894 }
895#endif
896 FileSpec::Resolve (raw_path, resolved_path, sizeof(resolved_path));
897 g_lldb_support_exe_dir.SetCString(resolved_path);
898 }
899 }
900 file_spec.GetDirectory() = g_lldb_support_exe_dir;
901 return file_spec.GetDirectory();
902 }
903 break;
904
905 case ePathTypeHeaderDir:
906 {
907 static ConstString g_lldb_headers_dir;
908 if (!g_lldb_headers_dir)
909 {
910#if defined (__APPLE__)
911 FileSpec lldb_file_spec;
912 if (GetLLDBPath (ePathTypeLLDBShlibDir, lldb_file_spec))
913 {
914 char raw_path[PATH_MAX];
915 char resolved_path[PATH_MAX];
916 lldb_file_spec.GetPath(raw_path, sizeof(raw_path));
917
918 char *framework_pos = ::strstr (raw_path, "LLDB.framework");
919 if (framework_pos)
920 {
921 framework_pos += strlen("LLDB.framework");
922 ::strncpy (framework_pos, "/Headers", PATH_MAX - (framework_pos - raw_path));
923 }
924 FileSpec::Resolve (raw_path, resolved_path, sizeof(resolved_path));
925 g_lldb_headers_dir.SetCString(resolved_path);
926 }
927#else
Greg Clayton52fd9842011-02-02 02:24:04 +0000928 // TODO: Anyone know how we can determine this for linux? Other systems??
Greg Clayton24b48ff2010-10-17 22:03:32 +0000929 g_lldb_headers_dir.SetCString ("/opt/local/include/lldb");
930#endif
931 }
932 file_spec.GetDirectory() = g_lldb_headers_dir;
933 return file_spec.GetDirectory();
934 }
935 break;
936
937 case ePathTypePythonDir:
938 {
Greg Clayton52fd9842011-02-02 02:24:04 +0000939 // TODO: Anyone know how we can determine this for linux? Other systems?
Greg Clayton24b48ff2010-10-17 22:03:32 +0000940 // For linux we are currently assuming the location of the lldb
941 // binary that contains this function is the directory that will
942 // contain lldb.so, lldb.py and embedded_interpreter.py...
943
944 static ConstString g_lldb_python_dir;
945 if (!g_lldb_python_dir)
946 {
947 FileSpec lldb_file_spec;
948 if (GetLLDBPath (ePathTypeLLDBShlibDir, lldb_file_spec))
949 {
950 char raw_path[PATH_MAX];
951 char resolved_path[PATH_MAX];
952 lldb_file_spec.GetPath(raw_path, sizeof(raw_path));
953
954#if defined (__APPLE__)
955 char *framework_pos = ::strstr (raw_path, "LLDB.framework");
956 if (framework_pos)
957 {
958 framework_pos += strlen("LLDB.framework");
959 ::strncpy (framework_pos, "/Resources/Python", PATH_MAX - (framework_pos - raw_path));
960 }
961#endif
962 FileSpec::Resolve (raw_path, resolved_path, sizeof(resolved_path));
963 g_lldb_python_dir.SetCString(resolved_path);
964 }
965 }
966 file_spec.GetDirectory() = g_lldb_python_dir;
967 return file_spec.GetDirectory();
968 }
969 break;
970
Greg Clayton52fd9842011-02-02 02:24:04 +0000971 case ePathTypeLLDBSystemPlugins: // System plug-ins directory
972 {
973#if defined (__APPLE__)
974 static ConstString g_lldb_system_plugin_dir;
975 if (!g_lldb_system_plugin_dir)
976 {
977 FileSpec lldb_file_spec;
978 if (GetLLDBPath (ePathTypeLLDBShlibDir, lldb_file_spec))
979 {
980 char raw_path[PATH_MAX];
981 char resolved_path[PATH_MAX];
982 lldb_file_spec.GetPath(raw_path, sizeof(raw_path));
983
984 char *framework_pos = ::strstr (raw_path, "LLDB.framework");
985 if (framework_pos)
986 {
987 framework_pos += strlen("LLDB.framework");
988 ::strncpy (framework_pos, "/Resources/PlugIns", PATH_MAX - (framework_pos - raw_path));
989 }
990 FileSpec::Resolve (raw_path, resolved_path, sizeof(resolved_path));
991 g_lldb_system_plugin_dir.SetCString(resolved_path);
992 }
993 }
994 file_spec.GetDirectory() = g_lldb_system_plugin_dir;
995 return file_spec.GetDirectory();
996#endif
997 // TODO: where would system LLDB plug-ins be located on linux? Other systems?
998 return false;
999 }
1000 break;
1001
1002 case ePathTypeLLDBUserPlugins: // User plug-ins directory
1003 {
1004#if defined (__APPLE__)
1005 static ConstString g_lldb_user_plugin_dir;
1006 if (!g_lldb_user_plugin_dir)
1007 {
1008 char user_plugin_path[PATH_MAX];
1009 if (FileSpec::Resolve ("~/Library/Application Support/LLDB/PlugIns",
1010 user_plugin_path,
1011 sizeof(user_plugin_path)))
1012 {
1013 g_lldb_user_plugin_dir.SetCString(user_plugin_path);
1014 }
1015 }
1016 file_spec.GetDirectory() = g_lldb_user_plugin_dir;
1017 return file_spec.GetDirectory();
1018#endif
1019 // TODO: where would user LLDB plug-ins be located on linux? Other systems?
1020 return false;
1021 }
Greg Clayton24b48ff2010-10-17 22:03:32 +00001022 default:
1023 assert (!"Unhandled PathType");
1024 break;
1025 }
1026
1027 return false;
1028}
1029
Greg Clayton8f3b21d2010-09-07 20:11:56 +00001030uint32_t
1031Host::ListProcessesMatchingName (const char *name, StringList &matches, std::vector<lldb::pid_t> &pids)
1032{
1033 uint32_t num_matches = 0;
1034
1035#if defined (__APPLE__)
1036 int num_pids;
1037 int size_of_pids;
Greg Claytonfb8876d2010-10-10 22:07:18 +00001038 std::vector<int> pid_list;
Greg Clayton8f3b21d2010-09-07 20:11:56 +00001039
1040 size_of_pids = proc_listpids(PROC_ALL_PIDS, 0, NULL, 0);
1041 if (size_of_pids == -1)
1042 return 0;
1043
1044 num_pids = size_of_pids/sizeof(int);
Greg Claytonfb8876d2010-10-10 22:07:18 +00001045
1046 pid_list.resize (size_of_pids);
1047 size_of_pids = proc_listpids(PROC_ALL_PIDS, 0, &pid_list[0], size_of_pids);
Greg Clayton8f3b21d2010-09-07 20:11:56 +00001048 if (size_of_pids == -1)
1049 return 0;
1050
1051 lldb::pid_t our_pid = getpid();
1052
1053 for (int i = 0; i < num_pids; i++)
1054 {
1055 struct proc_bsdinfo bsd_info;
1056 int error = proc_pidinfo (pid_list[i], PROC_PIDTBSDINFO, (uint64_t) 0, &bsd_info, PROC_PIDTBSDINFO_SIZE);
1057 if (error == 0)
1058 continue;
1059
1060 // Don't offer to attach to zombie processes, already traced or exiting
1061 // processes, and of course, ourselves... It looks like passing the second arg of
1062 // 0 to proc_listpids will exclude zombies anyway, but that's not documented so...
1063 if (((bsd_info.pbi_flags & (PROC_FLAG_TRACED | PROC_FLAG_INEXIT)) != 0)
1064 || (bsd_info.pbi_status == SZOMB)
1065 || (bsd_info.pbi_pid == our_pid))
1066 continue;
1067 char pid_name[MAXCOMLEN * 2 + 1];
1068 int name_len;
1069 name_len = proc_name(bsd_info.pbi_pid, pid_name, MAXCOMLEN * 2);
1070 if (name_len == 0)
1071 continue;
1072
1073 if (strstr(pid_name, name) != pid_name)
1074 continue;
1075 matches.AppendString (pid_name);
1076 pids.push_back (bsd_info.pbi_pid);
1077 num_matches++;
1078 }
1079#endif
1080
1081 return num_matches;
1082}
1083
1084ArchSpec
1085Host::GetArchSpecForExistingProcess (lldb::pid_t pid)
1086{
1087 ArchSpec return_spec;
1088
1089#if defined (__APPLE__)
1090 struct proc_bsdinfo bsd_info;
1091 int error = proc_pidinfo (pid, PROC_PIDTBSDINFO, (uint64_t) 0, &bsd_info, PROC_PIDTBSDINFO_SIZE);
1092 if (error == 0)
1093 return return_spec;
1094 if (bsd_info.pbi_flags & PROC_FLAG_LP64)
Greg Clayton940b1032011-02-23 00:35:02 +00001095 return_spec.SetTriple (LLDB_ARCH_DEFAULT_64BIT);
Greg Clayton8f3b21d2010-09-07 20:11:56 +00001096 else
Greg Clayton940b1032011-02-23 00:35:02 +00001097 return_spec.SetTriple (LLDB_ARCH_DEFAULT_32BIT);
Greg Clayton8f3b21d2010-09-07 20:11:56 +00001098#endif
1099
1100 return return_spec;
1101}
1102
1103ArchSpec
1104Host::GetArchSpecForExistingProcess (const char *process_name)
1105{
1106 ArchSpec returnSpec;
1107 StringList matches;
1108 std::vector<lldb::pid_t> pids;
1109 if (ListProcessesMatchingName(process_name, matches, pids))
1110 {
1111 if (matches.GetSize() == 1)
1112 {
1113 return GetArchSpecForExistingProcess(pids[0]);
1114 }
1115 }
1116 return returnSpec;
1117}
1118
1119#if !defined (__APPLE__) // see macosx/Host.mm
1120bool
Greg Claytonb73620c2010-12-18 01:54:34 +00001121Host::OpenFileInExternalEditor (const FileSpec &file_spec, uint32_t line_no)
Greg Clayton8f3b21d2010-09-07 20:11:56 +00001122{
1123 return false;
1124}
Greg Clayton24b48ff2010-10-17 22:03:32 +00001125
Greg Claytone98ac252010-11-10 04:57:04 +00001126void
1127Host::SetCrashDescriptionWithFormat (const char *format, ...)
1128{
1129}
1130
1131void
1132Host::SetCrashDescription (const char *description)
1133{
1134}
Greg Clayton24b48ff2010-10-17 22:03:32 +00001135
1136lldb::pid_t
1137LaunchApplication (const FileSpec &app_file_spec)
1138{
1139 return LLDB_INVALID_PROCESS_ID;
1140}
1141
1142lldb::pid_t
1143Host::LaunchInNewTerminal
1144(
Greg Claytonb73620c2010-12-18 01:54:34 +00001145 const char *tty_name,
Greg Clayton24b48ff2010-10-17 22:03:32 +00001146 const char **argv,
1147 const char **envp,
Greg Claytonde915be2011-01-23 05:56:20 +00001148 const char *working_dir,
Greg Clayton24b48ff2010-10-17 22:03:32 +00001149 const ArchSpec *arch_spec,
1150 bool stop_at_entry,
1151 bool disable_aslr
1152)
1153{
1154 return LLDB_INVALID_PROCESS_ID;
1155}
1156
Greg Clayton8f3b21d2010-09-07 20:11:56 +00001157#endif