LLDB mainline
PlatformDarwin.cpp
Go to the documentation of this file.
1//===-- PlatformDarwin.cpp ------------------------------------------------===//
2//
3// 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
6//
7//===----------------------------------------------------------------------===//
8
9#include "PlatformDarwin.h"
10
11#include <cstring>
12
13#include <algorithm>
14#include <memory>
15#include <mutex>
16#include <optional>
17
20#include "lldb/Core/Debugger.h"
21#include "lldb/Core/Module.h"
24#include "lldb/Core/Section.h"
25#include "lldb/Host/Host.h"
26#include "lldb/Host/HostInfo.h"
27#include "lldb/Host/XML.h"
38#include "lldb/Target/Process.h"
39#include "lldb/Target/Target.h"
41#include "lldb/Utility/Log.h"
43#include "lldb/Utility/Status.h"
44#include "lldb/Utility/Timer.h"
45#include "llvm/ADT/STLExtras.h"
46#include "llvm/ADT/StringTable.h"
47#include "llvm/Support/Error.h"
48#include "llvm/Support/FileSystem.h"
49#include "llvm/Support/Threading.h"
50#include "llvm/Support/VersionTuple.h"
51
52#if defined(__APPLE__)
53#include <TargetConditionals.h>
54#endif
55
56using namespace lldb;
57using namespace lldb_private;
58
59#define OPTTABLE_STR_TABLE_CODE
60#include "clang/Options/Options.inc"
61#undef OPTTABLE_STR_TABLE_CODE
62
63static Status ExceptionMaskValidator(const char *string, void *unused) {
65 llvm::StringRef str_ref(string);
66 llvm::SmallVector<llvm::StringRef> candidates;
67 str_ref.split(candidates, '|');
68 for (auto candidate : candidates) {
69 if (!(candidate == "EXC_BAD_ACCESS"
70 || candidate == "EXC_BAD_INSTRUCTION"
71 || candidate == "EXC_ARITHMETIC"
72 || candidate == "EXC_RESOURCE"
73 || candidate == "EXC_GUARD"
74 || candidate == "EXC_SYSCALL")) {
75 error = Status::FromErrorStringWithFormat("invalid exception type: '%s'",
76 candidate.str().c_str());
77 return error;
78 }
79 }
80 return {};
81}
82
83/// Destructor.
84///
85/// The destructor is virtual since this class is designed to be
86/// inherited from by the plug-in instance.
88
89// Static Variables
90static uint32_t g_initialize_count = 0;
91
100
108
110 return "Darwin platform plug-in.";
111}
112
114 // We only create subclasses of the PlatformDarwin plugin.
115 return PlatformSP();
116}
117
118#define LLDB_PROPERTIES_platformdarwin
119#include "PlatformMacOSXProperties.inc"
120
121#define LLDB_PROPERTIES_platformdarwin
122enum {
123#include "PlatformMacOSXPropertiesEnum.inc"
124};
125
127public:
128 static llvm::StringRef GetSettingName() {
129 static constexpr llvm::StringLiteral g_setting_name("darwin");
130 return g_setting_name;
131 }
132
134 m_collection_sp = std::make_shared<OptionValueProperties>(GetSettingName());
135 m_collection_sp->Initialize(g_platformdarwin_properties_def);
136 }
137
138 ~PlatformDarwinProperties() override = default;
139
140 const char *GetIgnoredExceptions() const {
141 const uint32_t idx = ePropertyIgnoredExceptions;
142 const OptionValueString *option_value =
143 m_collection_sp->GetPropertyAtIndexAsOptionValueString(idx);
144 assert(option_value);
145 return option_value->GetCurrentValue();
146 }
147
149 const uint32_t idx = ePropertyIgnoredExceptions;
150 OptionValueString *option_value =
151 m_collection_sp->GetPropertyAtIndexAsOptionValueString(idx);
152 assert(option_value);
153 return option_value;
154 }
155};
156
158 static PlatformDarwinProperties g_settings;
159 return g_settings;
160}
161
163 lldb_private::Debugger &debugger) {
166 const bool is_global_setting = false;
168 debugger, GetGlobalProperties().GetValueProperties(),
169 "Properties for the Darwin platform plug-in.", is_global_setting);
170 OptionValueString *value = GetGlobalProperties().GetIgnoredExceptionValue();
172 }
173}
174
175Args
177 std::string ignored_exceptions
178 = GetGlobalProperties().GetIgnoredExceptions();
179 if (ignored_exceptions.empty())
180 return {};
181 Args ret_args;
182 std::string packet = "QSetIgnoredExceptions:";
183 packet.append(ignored_exceptions);
184 ret_args.AppendArgument(packet);
185 return ret_args;
186}
187
190 const lldb_private::FileSpec &destination, uint32_t uid,
191 uint32_t gid) {
192 // Unconditionally unlink the destination. If it is an executable,
193 // simply opening it and truncating its contents would invalidate
194 // its cached code signature.
195 Unlink(destination);
196 return PlatformPOSIX::PutFile(source, destination, uid, gid);
197}
198
199llvm::SmallDenseMap<FileSpec, LoadScriptFromSymFile>
201 Stream &feedback_stream, FileSpec module_spec, const Target &target,
202 const FileSpec &symfile_spec) {
203
204 assert(target.GetDebugger().GetScriptInterpreter() &&
205 "Trying to locate scripting resources but no ScriptInterpreter is "
206 "available.");
207
208 llvm::SmallDenseMap<FileSpec, LoadScriptFromSymFile> file_specs;
209 while (module_spec.GetFilename()) {
211 target.GetDebugger()
214 module_spec.GetFilename().GetStringRef());
215
216 StreamString path_string;
217 StreamString original_path_string;
218 // for OSX we are going to be in
219 // .dSYM/Contents/Resources/DWARF/<basename> let us go to
220 // .dSYM/Contents/Resources/Python/<basename>.py and see if the
221 // file exists
222 path_string.Format("{0}/../Python/{1}.py",
223 symfile_spec.GetDirectory().GetStringRef(),
224 sanitized_name.GetSanitizedName());
225 original_path_string.Format("{0}/../Python/{1}.py",
226 symfile_spec.GetDirectory().GetStringRef(),
227 sanitized_name.GetOriginalName());
228
229 FileSpec script_fspec(path_string.GetString());
230 FileSystem::Instance().Resolve(script_fspec);
231 FileSpec orig_script_fspec(original_path_string.GetString());
232 FileSystem::Instance().Resolve(orig_script_fspec);
233
234 WarnIfInvalidUnsanitizedScriptExists(feedback_stream, sanitized_name,
235 orig_script_fspec, script_fspec);
236
237 if (FileSystem::Instance().Exists(script_fspec)) {
238 file_specs.try_emplace(std::move(script_fspec),
240 break;
241 }
242
243 // If we didn't find the python file, then keep stripping the
244 // extensions and try again
245 ConstString filename_no_extension(
246 module_spec.GetFileNameStrippingExtension());
247 if (module_spec.GetFilename() == filename_no_extension)
248 break;
249
250 module_spec.SetFilename(filename_no_extension);
251 }
252
253 return file_specs;
254}
255
256llvm::SmallDenseMap<FileSpec, LoadScriptFromSymFile>
258 Target *target, Module &module, Stream &feedback_stream) {
259 llvm::SmallDenseMap<FileSpec, LoadScriptFromSymFile> empty;
260 if (!target)
261 return empty;
262
263 // For now only Python scripts supported for auto-loading.
265 return empty;
266
267 // NB some extensions might be meaningful and should not be stripped -
268 // "this.binary.file"
269 // should not lose ".file" but GetFileNameStrippingExtension() will do
270 // precisely that. Ideally, we should have a per-platform list of
271 // extensions (".exe", ".app", ".dSYM", ".framework") which should be
272 // stripped while leaving "this.binary.file" as-is.
273
274 const FileSpec &module_spec = module.GetFileSpec();
275
276 if (!module_spec)
277 return empty;
278
279 SymbolFile *symfile = module.GetSymbolFile();
280 if (!symfile)
281 return empty;
282
283 ObjectFile *objfile = symfile->GetObjectFile();
284 if (!objfile)
285 return empty;
286
287 const FileSpec &symfile_spec = objfile->GetFileSpec();
288 if (symfile_spec &&
289 llvm::StringRef(symfile_spec.GetPath())
290 .contains_insensitive(".dSYM/Contents/Resources/DWARF") &&
291 FileSystem::Instance().Exists(symfile_spec))
293 feedback_stream, module_spec, *target, symfile_spec);
294
295 return empty;
296}
297
299 const ModuleSpec &sym_spec,
300 FileSpec &sym_file) {
301 sym_file = sym_spec.GetSymbolFileSpec();
302 if (FileSystem::Instance().IsDirectory(sym_file)) {
304 sym_file, sym_spec.GetUUIDPtr(), sym_spec.GetArchitecturePtr());
305 }
306 return {};
307}
308
310 const ModuleSpec &module_spec, Process *process, ModuleSP &module_sp,
311 llvm::SmallVectorImpl<ModuleSP> *old_modules, bool *did_create_ptr) {
313 module_sp.reset();
314
315 if (IsRemote()) {
316 // If we have a remote platform always, let it try and locate the shared
317 // module first.
319 error = m_remote_platform_sp->GetSharedModule(
320 module_spec, process, module_sp, old_modules, did_create_ptr);
321 }
322 }
323
324 if (!module_sp) {
325 // Fall back to the local platform and find the file locally
326 error = Platform::GetSharedModule(module_spec, process, module_sp,
327 old_modules, did_create_ptr);
328
329 const FileSpec &platform_file = module_spec.GetFileSpec();
330 // Get module search paths from the target if available.
331 TargetSP target_sp = module_spec.GetTargetSP();
332 FileSpecList module_search_paths;
333 if (target_sp)
334 module_search_paths = target_sp->GetExecutableSearchPaths();
335 if (!module_sp && !module_search_paths.IsEmpty() && platform_file) {
336 // We can try to pull off part of the file path up to the bundle
337 // directory level and try any module search paths...
338 FileSpec bundle_directory;
339 if (Host::GetBundleDirectory(platform_file, bundle_directory)) {
340 if (platform_file == bundle_directory) {
341 ModuleSpec new_module_spec(module_spec);
342 new_module_spec.GetFileSpec() = bundle_directory;
343 if (Host::ResolveExecutableInBundle(new_module_spec.GetFileSpec())) {
344 Status new_error(Platform::GetSharedModule(new_module_spec, process,
345 module_sp, old_modules,
346 did_create_ptr));
347
348 if (module_sp)
349 return new_error;
350 }
351 } else {
352 char platform_path[PATH_MAX];
353 char bundle_dir[PATH_MAX];
354 platform_file.GetPath(platform_path, sizeof(platform_path));
355 const size_t bundle_directory_len =
356 bundle_directory.GetPath(bundle_dir, sizeof(bundle_dir));
357 char new_path[PATH_MAX];
358 size_t num_module_search_paths = module_search_paths.GetSize();
359 for (size_t i = 0; i < num_module_search_paths; ++i) {
360 const size_t search_path_len =
361 module_search_paths.GetFileSpecAtIndex(i).GetPath(
362 new_path, sizeof(new_path));
363 if (search_path_len < sizeof(new_path)) {
364 snprintf(new_path + search_path_len,
365 sizeof(new_path) - search_path_len, "/%s",
366 platform_path + bundle_directory_len);
367 FileSpec new_file_spec(new_path);
368 if (FileSystem::Instance().Exists(new_file_spec)) {
369 ModuleSpec new_module_spec(module_spec);
370 new_module_spec.GetFileSpec() = new_file_spec;
372 new_module_spec, process, module_sp, old_modules,
373 did_create_ptr));
374
375 if (module_sp) {
376 module_sp->SetPlatformFileSpec(new_file_spec);
377 return new_error;
378 }
379 }
380 }
381 }
382 }
383 }
384 }
385 }
386 if (module_sp)
387 module_sp->SetPlatformFileSpec(module_spec.GetFileSpec());
388 return error;
389}
391 const ModuleSpec &module_spec, Process *process, ModuleSP &module_sp,
392 llvm::SmallVectorImpl<ModuleSP> *old_modules, bool *did_create_ptr) {
393 Status err;
394
395 SymbolSharedCacheUse sc_mode =
397 SharedCacheImageInfo image_info;
398 if (process && process->GetDynamicLoader()) {
399 addr_t sc_base_addr;
400 UUID sc_uuid;
401 LazyBool using_sc, private_sc;
402 FileSpec sc_path;
403 std::optional<uint64_t> size;
405 sc_base_addr, sc_uuid, using_sc, private_sc, sc_path, size)) {
406 if (module_spec.GetUUID())
407 image_info = HostInfo::GetSharedCacheImageInfo(module_spec.GetUUID(),
408 sc_uuid, sc_mode);
409 else
410 image_info = HostInfo::GetSharedCacheImageInfo(
411 module_spec.GetFileSpec().GetPathAsConstString(), sc_uuid, sc_mode);
412 }
413 }
414 // Fall back to looking for the file in lldb's own shared cache.
415 if (!image_info.GetUUID())
416 image_info = HostInfo::GetSharedCacheImageInfo(
417 module_spec.GetFileSpec().GetPathAsConstString(), sc_mode);
418
419 // If we found it and it has the correct UUID, let's proceed with
420 // creating a module from the memory contents.
421 if (image_info.GetUUID() && (!module_spec.GetUUID() ||
422 module_spec.GetUUID() == image_info.GetUUID())) {
423 ModuleSpec shared_cache_spec(module_spec.GetFileSpec(),
424 image_info.GetUUID(),
425 image_info.GetExtractor());
426 err = ModuleList::GetSharedModule(shared_cache_spec, module_sp, old_modules,
427 did_create_ptr);
428 if (module_sp) {
430 LLDB_LOGF(log, "module %s was found in a shared cache",
431 module_spec.GetFileSpec().GetPath().c_str());
432 }
433 }
434 return err;
435}
436
437size_t
439 BreakpointSite *bp_site) {
440 const uint8_t *trap_opcode = nullptr;
441 uint32_t trap_opcode_size = 0;
442 bool bp_is_thumb = false;
443
444 llvm::Triple::ArchType machine = target.GetArchitecture().GetMachine();
445 switch (machine) {
446 case llvm::Triple::aarch64_32:
447 case llvm::Triple::aarch64: {
448 // 'brk #0' or 0xd4200000 in BE byte order
449 static const uint8_t g_arm64_breakpoint_opcode[] = {0x00, 0x00, 0x20, 0xD4};
450 trap_opcode = g_arm64_breakpoint_opcode;
451 trap_opcode_size = sizeof(g_arm64_breakpoint_opcode);
452 } break;
453
454 case llvm::Triple::thumb:
455 bp_is_thumb = true;
456 [[fallthrough]];
457 case llvm::Triple::arm: {
458 static const uint8_t g_arm_breakpoint_opcode[] = {0xFE, 0xDE, 0xFF, 0xE7};
459 static const uint8_t g_thumb_breakpooint_opcode[] = {0xFE, 0xDE};
460
461 // Auto detect arm/thumb if it wasn't explicitly specified
462 if (!bp_is_thumb) {
464 if (bp_loc_sp)
465 bp_is_thumb = bp_loc_sp->GetAddress().GetAddressClass() ==
467 }
468 if (bp_is_thumb) {
469 trap_opcode = g_thumb_breakpooint_opcode;
470 trap_opcode_size = sizeof(g_thumb_breakpooint_opcode);
471 break;
472 }
473 trap_opcode = g_arm_breakpoint_opcode;
474 trap_opcode_size = sizeof(g_arm_breakpoint_opcode);
475 } break;
476
477 case llvm::Triple::ppc:
478 case llvm::Triple::ppc64: {
479 static const uint8_t g_ppc_breakpoint_opcode[] = {0x7F, 0xC0, 0x00, 0x08};
480 trap_opcode = g_ppc_breakpoint_opcode;
481 trap_opcode_size = sizeof(g_ppc_breakpoint_opcode);
482 } break;
483
484 default:
485 return Platform::GetSoftwareBreakpointTrapOpcode(target, bp_site);
486 }
487
488 if (trap_opcode && trap_opcode_size) {
489 if (bp_site->SetTrapOpcode(trap_opcode, trap_opcode_size))
490 return trap_opcode_size;
491 }
492 return 0;
493}
494
496 lldb_private::Target &target, const lldb::ModuleSP &module_sp) {
497 if (!module_sp)
498 return false;
499
500 ObjectFile *obj_file = module_sp->GetObjectFile();
501 if (!obj_file)
502 return false;
503
504 ObjectFile::Type obj_type = obj_file->GetType();
505 return obj_type == ObjectFile::eTypeDynamicLinker;
506}
507
509 std::vector<ArchSpec> &archs) {
510 ArchSpec host_arch = HostInfo::GetArchitecture(HostInfo::eArchKindDefault);
511 archs.push_back(host_arch);
512
513 if (host_arch.GetCore() == ArchSpec::eCore_x86_64_x86_64h) {
514 archs.push_back(ArchSpec("x86_64-apple-macosx"));
515 archs.push_back(HostInfo::GetArchitecture(HostInfo::eArchKind32));
516 } else {
517 ArchSpec host_arch64 = HostInfo::GetArchitecture(HostInfo::eArchKind64);
518 if (host_arch.IsExactMatch(host_arch64))
519 archs.push_back(HostInfo::GetArchitecture(HostInfo::eArchKind32));
520 }
521}
522
523static llvm::ArrayRef<const char *> GetCompatibleArchs(ArchSpec::Core core) {
524 switch (core) {
525 default:
526 [[fallthrough]];
528 static const char *g_arm64e_compatible_archs[] = {
529 "arm64e", "arm64", "armv7", "armv7f", "armv7k", "armv7s",
530 "armv7m", "armv7em", "armv6m", "armv6", "armv5", "armv4",
531 "arm", "thumbv7", "thumbv7f", "thumbv7k", "thumbv7s", "thumbv7m",
532 "thumbv7em", "thumbv6m", "thumbv6", "thumbv5", "thumbv4t", "thumb",
533 };
534 return {g_arm64e_compatible_archs};
535 }
537 static const char *g_arm64_compatible_archs[] = {
538 "arm64", "armv7", "armv7f", "armv7k", "armv7s", "armv7m",
539 "armv7em", "armv6m", "armv6", "armv5", "armv4", "arm",
540 "thumbv7", "thumbv7f", "thumbv7k", "thumbv7s", "thumbv7m", "thumbv7em",
541 "thumbv6m", "thumbv6", "thumbv5", "thumbv4t", "thumb",
542 };
543 return {g_arm64_compatible_archs};
544 }
546 static const char *g_armv7_compatible_archs[] = {
547 "armv7", "armv6m", "armv6", "armv5", "armv4", "arm",
548 "thumbv7", "thumbv6m", "thumbv6", "thumbv5", "thumbv4t", "thumb",
549 };
550 return {g_armv7_compatible_archs};
551 }
553 static const char *g_armv7f_compatible_archs[] = {
554 "armv7f", "armv7", "armv6m", "armv6", "armv5",
555 "armv4", "arm", "thumbv7f", "thumbv7", "thumbv6m",
556 "thumbv6", "thumbv5", "thumbv4t", "thumb",
557 };
558 return {g_armv7f_compatible_archs};
559 }
561 static const char *g_armv7k_compatible_archs[] = {
562 "armv7k", "armv7", "armv6m", "armv6", "armv5",
563 "armv4", "arm", "thumbv7k", "thumbv7", "thumbv6m",
564 "thumbv6", "thumbv5", "thumbv4t", "thumb",
565 };
566 return {g_armv7k_compatible_archs};
567 }
569 static const char *g_armv7s_compatible_archs[] = {
570 "armv7s", "armv7", "armv6m", "armv6", "armv5",
571 "armv4", "arm", "thumbv7s", "thumbv7", "thumbv6m",
572 "thumbv6", "thumbv5", "thumbv4t", "thumb",
573 };
574 return {g_armv7s_compatible_archs};
575 }
577 static const char *g_armv7m_compatible_archs[] = {
578 "armv7m", "armv7", "armv6m", "armv6", "armv5",
579 "armv4", "arm", "thumbv7m", "thumbv7", "thumbv6m",
580 "thumbv6", "thumbv5", "thumbv4t", "thumb",
581 };
582 return {g_armv7m_compatible_archs};
583 }
585 static const char *g_armv7em_compatible_archs[] = {
586 "armv7em", "armv7", "armv6m", "armv6", "armv5",
587 "armv4", "arm", "thumbv7em", "thumbv7", "thumbv6m",
588 "thumbv6", "thumbv5", "thumbv4t", "thumb",
589 };
590 return {g_armv7em_compatible_archs};
591 }
593 static const char *g_armv6m_compatible_archs[] = {
594 "armv6m", "armv6", "armv5", "armv4", "arm",
595 "thumbv6m", "thumbv6", "thumbv5", "thumbv4t", "thumb",
596 };
597 return {g_armv6m_compatible_archs};
598 }
600 static const char *g_armv6_compatible_archs[] = {
601 "armv6", "armv5", "armv4", "arm",
602 "thumbv6", "thumbv5", "thumbv4t", "thumb",
603 };
604 return {g_armv6_compatible_archs};
605 }
607 static const char *g_armv5_compatible_archs[] = {
608 "armv5", "armv4", "arm", "thumbv5", "thumbv4t", "thumb",
609 };
610 return {g_armv5_compatible_archs};
611 }
613 static const char *g_armv4_compatible_archs[] = {
614 "armv4",
615 "arm",
616 "thumbv4t",
617 "thumb",
618 };
619 return {g_armv4_compatible_archs};
620 }
621 }
622 return {};
623}
624
625/// The architecture selection rules for arm processors These cpu subtypes have
626/// distinct names (e.g. armv7f) but armv7 binaries run fine on an armv7f
627/// processor.
629 std::vector<ArchSpec> &archs, std::optional<llvm::Triple::OSType> os) {
630 const ArchSpec system_arch = GetSystemArchitecture();
631 const ArchSpec::Core system_core = system_arch.GetCore();
632 for (const char *arch : GetCompatibleArchs(system_core)) {
633 llvm::Triple triple;
634 triple.setArchName(arch);
635 triple.setVendor(llvm::Triple::VendorType::Apple);
636 if (os)
637 triple.setOS(*os);
638 archs.push_back(ArchSpec(triple));
639 }
640}
641
643 static FileSpec g_xcode_select_filespec;
644
645 if (!g_xcode_select_filespec) {
646 FileSpec xcode_select_cmd("/usr/bin/xcode-select");
647 if (FileSystem::Instance().Exists(xcode_select_cmd)) {
648 int exit_status = -1;
649 int signo = -1;
650 std::string command_output;
651 Status status =
652 Host::RunShellCommand("/usr/bin/xcode-select --print-path",
653 FileSpec(), // current working directory
654 &exit_status, &signo, &command_output, nullptr,
655 std::chrono::seconds(2), // short timeout
656 false); // don't run in a shell
657 if (status.Success() && exit_status == 0 && !command_output.empty()) {
658 size_t first_non_newline = command_output.find_last_not_of("\r\n");
659 if (first_non_newline != std::string::npos) {
660 command_output.erase(first_non_newline + 1);
661 }
662 g_xcode_select_filespec = FileSpec(command_output);
663 }
664 }
665 }
666
667 return g_xcode_select_filespec;
668}
669
671 BreakpointSP bp_sp;
672 static const char *g_bp_names[] = {
673 "start_wqthread", "_pthread_wqthread", "_pthread_start",
674 };
675
676 static const char *g_bp_modules[] = {"libsystem_c.dylib", "libSystem.B.dylib",
677 "libsystem_pthread.dylib"};
678
679 FileSpecList bp_modules;
680 for (size_t i = 0; i < std::size(g_bp_modules); i++) {
681 const char *bp_module = g_bp_modules[i];
682 bp_modules.EmplaceBack(bp_module);
683 }
684
685 bool internal = true;
686 bool hardware = false;
687 LazyBool skip_prologue = eLazyBoolNo;
688 bp_sp = target.CreateBreakpoint(&bp_modules, nullptr, g_bp_names,
689 std::size(g_bp_names), eFunctionNameTypeFull,
690 eLanguageTypeUnknown, 0, skip_prologue,
691 internal, hardware);
692 bp_sp->SetBreakpointKind("thread-creation");
693
694 return bp_sp;
695}
696
697uint32_t
699 const FileSpec &shell = launch_info.GetShell();
700 if (!shell)
701 return 1;
702
703 std::string shell_string = shell.GetPath();
704 const char *shell_name = strrchr(shell_string.c_str(), '/');
705 if (shell_name == nullptr)
706 shell_name = shell_string.c_str();
707 else
708 shell_name++;
709
710 if (strcmp(shell_name, "sh") == 0) {
711 // /bin/sh re-exec's itself as /bin/bash requiring another resume. But it
712 // only does this if the COMMAND_MODE environment variable is set to
713 // "legacy".
714 if (launch_info.GetEnvironment().lookup("COMMAND_MODE") == "legacy")
715 return 2;
716 return 1;
717 } else if (strcmp(shell_name, "csh") == 0 ||
718 strcmp(shell_name, "tcsh") == 0 ||
719 strcmp(shell_name, "zsh") == 0) {
720 // csh and tcsh always seem to re-exec themselves.
721 return 2;
722 } else
723 return 1;
724}
725
727 Debugger &debugger, Target &target,
728 Status &error) {
729 ProcessSP process_sp;
730
731 if (IsHost()) {
732 // We are going to hand this process off to debugserver which will be in
733 // charge of setting the exit status. However, we still need to reap it
734 // from lldb. So, make sure we use a exit callback which does not set exit
735 // status.
736 launch_info.SetMonitorProcessCallback(
738 process_sp = Platform::DebugProcess(launch_info, debugger, target, error);
739 } else {
741 process_sp = m_remote_platform_sp->DebugProcess(launch_info, debugger,
742 target, error);
743 else
744 error =
745 Status::FromErrorString("the platform is not currently connected");
746 }
747 return process_sp;
748}
749
753
755 static FileSpec g_command_line_tools_filespec;
756
757 if (!g_command_line_tools_filespec) {
758 FileSpec command_line_tools_path(GetXcodeSelectPath());
759 command_line_tools_path.AppendPathComponent("Library");
760 if (FileSystem::Instance().Exists(command_line_tools_path)) {
761 g_command_line_tools_filespec = command_line_tools_path;
762 }
763 }
764
765 return g_command_line_tools_filespec;
766}
767
769 void *baton, llvm::sys::fs::file_type file_type, llvm::StringRef path) {
770 SDKEnumeratorInfo *enumerator_info = static_cast<SDKEnumeratorInfo *>(baton);
771
772 FileSpec spec(path);
773 if (XcodeSDK::SDKSupportsModules(enumerator_info->sdk_type, spec)) {
774 enumerator_info->found_path = spec;
776 }
777
779}
780
782 const FileSpec &sdks_spec) {
783 // Look inside Xcode for the required installed iOS SDK version
784
785 if (!FileSystem::Instance().IsDirectory(sdks_spec)) {
786 return FileSpec();
787 }
788
789 const bool find_directories = true;
790 const bool find_files = false;
791 const bool find_other = true; // include symlinks
792
793 SDKEnumeratorInfo enumerator_info;
794
795 enumerator_info.sdk_type = sdk_type;
796
798 sdks_spec.GetPath(), find_directories, find_files, find_other,
799 DirectoryEnumerator, &enumerator_info);
800
801 if (FileSystem::Instance().IsDirectory(enumerator_info.found_path))
802 return enumerator_info.found_path;
803 else
804 return FileSpec();
805}
806
808 FileSpec sdks_spec = HostInfo::GetXcodeContentsDirectory();
809 sdks_spec.AppendPathComponent("Developer");
810 sdks_spec.AppendPathComponent("Platforms");
811
812 switch (sdk_type) {
814 sdks_spec.AppendPathComponent("MacOSX.platform");
815 break;
817 sdks_spec.AppendPathComponent("iPhoneSimulator.platform");
818 break;
820 sdks_spec.AppendPathComponent("iPhoneOS.platform");
821 break;
823 sdks_spec.AppendPathComponent("WatchSimulator.platform");
824 break;
826 sdks_spec.AppendPathComponent("AppleTVSimulator.platform");
827 break;
829 sdks_spec.AppendPathComponent("XRSimulator.platform");
830 break;
831 default:
832 llvm_unreachable("unsupported sdk");
833 }
834
835 sdks_spec.AppendPathComponent("Developer");
836 sdks_spec.AppendPathComponent("SDKs");
837
838 if (sdk_type == XcodeSDK::Type::MacOSX) {
839 llvm::VersionTuple version = HostInfo::GetOSVersion();
840
841 if (!version.empty()) {
843 // If the Xcode SDKs are not available then try to use the
844 // Command Line Tools one which is only for MacOSX.
845 if (!FileSystem::Instance().Exists(sdks_spec)) {
846 sdks_spec = GetCommandLineToolsLibraryPath();
847 sdks_spec.AppendPathComponent("SDKs");
848 }
849
850 // We slightly prefer the exact SDK for this machine. See if it is
851 // there.
852
853 FileSpec native_sdk_spec = sdks_spec;
854 StreamString native_sdk_name;
855 native_sdk_name.Printf("MacOSX%u.%u.sdk", version.getMajor(),
856 version.getMinor().value_or(0));
857 native_sdk_spec.AppendPathComponent(native_sdk_name.GetString());
858
859 if (FileSystem::Instance().Exists(native_sdk_spec)) {
860 return native_sdk_spec;
861 }
862 }
863 }
864 }
865
866 return FindSDKInXcodeForModules(sdk_type, sdks_spec);
867}
868
869// Discovering the correct version and build can help us
870// identify the most likely SDK directory when looking for
871// files.
872//
873// The directory name can be one of many formats, such as
874// 10.0 (21R329) universal
875// 17.0 (23A200) arm64e
876// 17.0 (20A352)
877// Watch4,2 10.0 (21R329)
878std::tuple<llvm::VersionTuple, llvm::StringRef>
880 llvm::StringRef build;
881 llvm::VersionTuple version;
882
883 llvm::SmallVector<llvm::StringRef> parts;
884 dir.split(parts, ' ');
885 for (llvm::StringRef part : parts) {
886 // Look for an OS version number, eg "17.0"
887 if (isdigit(part[0]))
888 version.tryParse(part);
889 // Look for a build number, eg "(20A352)"
890 if (part.consume_front("(")) {
891 size_t pos = part.find(')');
892 build = part.slice(0, pos);
893 }
894 }
895
896 return std::make_tuple(version, build);
897}
898
899llvm::Expected<StructuredData::DictionarySP>
901 static constexpr llvm::StringLiteral crash_info_key("Crash-Info Annotations");
902 static constexpr llvm::StringLiteral asi_info_key(
903 "Application Specific Information");
904
905 // We cache the information we find in the process extended info dict:
906 StructuredData::DictionarySP process_dict_sp =
907 process.GetExtendedCrashInfoDict();
908 StructuredData::Array *annotations = nullptr;
909 StructuredData::ArraySP new_annotations_sp;
910 if (!process_dict_sp->GetValueForKeyAsArray(crash_info_key, annotations)) {
911 new_annotations_sp = ExtractCrashInfoAnnotations(process);
912 if (new_annotations_sp && new_annotations_sp->GetSize()) {
913 process_dict_sp->AddItem(crash_info_key, new_annotations_sp);
914 annotations = new_annotations_sp.get();
915 }
916 }
917
918 StructuredData::Dictionary *app_specific_info;
919 StructuredData::DictionarySP new_app_specific_info_sp;
920 if (!process_dict_sp->GetValueForKeyAsDictionary(asi_info_key,
921 app_specific_info)) {
922 new_app_specific_info_sp = ExtractAppSpecificInfo(process);
923 if (new_app_specific_info_sp && new_app_specific_info_sp->GetSize()) {
924 process_dict_sp->AddItem(asi_info_key, new_app_specific_info_sp);
925 app_specific_info = new_app_specific_info_sp.get();
926 }
927 }
928
929 // Now get anything else that was in the process info dict, and add it to the
930 // return here:
931 return process_dict_sp->GetSize() ? process_dict_sp : nullptr;
932}
933
937
938 ConstString section_name("__crash_info");
939 Target &target = process.GetTarget();
940 StructuredData::ArraySP array_sp = std::make_shared<StructuredData::Array>();
941
942 for (ModuleSP module : target.GetImages().Modules()) {
943 SectionList *sections = module->GetSectionList();
944
945 std::string module_name = module->GetSpecificationDescription();
946
947 // The DYDL module is skipped since it's always loaded when running the
948 // binary.
949 if (module_name == "/usr/lib/dyld")
950 continue;
951
952 if (!sections) {
953 LLDB_LOG(log, "Module {0} doesn't have any section!", module_name);
954 continue;
955 }
956
957 SectionSP crash_info = sections->FindSectionByName(section_name);
958 if (!crash_info) {
959 LLDB_LOG(log, "Module {0} doesn't have section {1}!", module_name,
960 section_name);
961 continue;
962 }
963
964 addr_t load_addr = crash_info->GetLoadBaseAddress(&target);
965
966 if (load_addr == LLDB_INVALID_ADDRESS) {
967 LLDB_LOG(log, "Module {0} has an invalid '{1}' section load address: {2}",
968 module_name, section_name, load_addr);
969 continue;
970 }
971
973 CrashInfoAnnotations annotations;
974 size_t expected_size = sizeof(CrashInfoAnnotations);
975 size_t bytes_read = process.ReadMemoryFromInferior(load_addr, &annotations,
976 expected_size, error);
977
978 if (expected_size != bytes_read || error.Fail()) {
979 LLDB_LOG(log, "Failed to read {0} section from memory in module {1}: {2}",
980 section_name, module_name, error);
981 continue;
982 }
983
984 // initial support added for version 5
985 if (annotations.version < 5) {
986 LLDB_LOG(log,
987 "Annotation version lower than 5 unsupported! Module {0} has "
988 "version {1} instead.",
989 module_name, annotations.version);
990 continue;
991 }
992
993 if (!annotations.message) {
994 LLDB_LOG(log, "No message available for module {0}.", module_name);
995 continue;
996 }
997
998 std::string message;
999 bytes_read =
1000 process.ReadCStringFromMemory(annotations.message, message, error);
1001
1002 if (message.empty() || bytes_read != message.size() || error.Fail()) {
1003 LLDB_LOG(log, "Failed to read the message from memory in module {0}: {1}",
1004 module_name, error);
1005 continue;
1006 }
1007
1008 // Remove trailing newline from message
1009 if (message.back() == '\n')
1010 message.pop_back();
1011
1012 if (!annotations.message2)
1013 LLDB_LOG(log, "No message2 available for module {0}.", module_name);
1014
1015 std::string message2;
1016 bytes_read =
1017 process.ReadCStringFromMemory(annotations.message2, message2, error);
1018
1019 if (!message2.empty() && bytes_read == message2.size() && error.Success())
1020 if (message2.back() == '\n')
1021 message2.pop_back();
1022
1024 std::make_shared<StructuredData::Dictionary>();
1025
1026 entry_sp->AddStringItem("image", module->GetFileSpec().GetPath(false));
1027 entry_sp->AddStringItem("uuid", module->GetUUID().GetAsString());
1028 entry_sp->AddStringItem("message", message);
1029 entry_sp->AddStringItem("message2", message2);
1030 entry_sp->AddIntegerItem("abort-cause", annotations.abort_cause);
1031
1032 array_sp->AddItem(entry_sp);
1033 }
1034
1035 return array_sp;
1036}
1037
1040 StructuredData::DictionarySP metadata_sp = process.GetMetadata();
1041
1042 if (!metadata_sp || !metadata_sp->GetSize() || !metadata_sp->HasKey("asi"))
1043 return {};
1044
1046 if (!metadata_sp->GetValueForKeyAsDictionary("asi", asi))
1047 return {};
1048
1050 std::make_shared<StructuredData::Dictionary>();
1051
1052 auto flatten_asi_dict = [&dict_sp](llvm::StringRef key,
1053 StructuredData::Object *val) -> bool {
1054 if (!val)
1055 return false;
1056
1057 StructuredData::Array *arr = val->GetAsArray();
1058 if (!arr || !arr->GetSize())
1059 return false;
1060
1061 dict_sp->AddItem(key, arr->GetItemAtIndex(0));
1062 return true;
1063 };
1064
1065 asi->ForEach(flatten_asi_dict);
1066
1067 return dict_sp;
1068}
1069
1070static llvm::Expected<lldb_private::FileSpec>
1072
1073 ModuleSP exe_module_sp = target->GetExecutableModule();
1074 if (!exe_module_sp)
1075 return llvm::createStringError("Failed to get module from target");
1076
1077 SymbolFile *sym_file = exe_module_sp->GetSymbolFile();
1078 if (!sym_file)
1079 return llvm::createStringError("Failed to get symbol file from executable");
1080
1081 if (sym_file->GetNumCompileUnits() == 0)
1082 return llvm::createStringError(
1083 "Failed to resolve SDK for target: executable's symbol file has no "
1084 "compile units");
1085
1086 XcodeSDK merged_sdk;
1087 for (unsigned i = 0; i < sym_file->GetNumCompileUnits(); ++i) {
1088 if (auto cu_sp = sym_file->GetCompileUnitAtIndex(i)) {
1089 auto cu_sdk = sym_file->ParseXcodeSDK(*cu_sp);
1090 merged_sdk.Merge(cu_sdk);
1091 }
1092 }
1093
1094 // TODO: The result of this loop is almost equivalent to deriving the SDK
1095 // from the target triple, which would be a lot cheaper.
1096 FileSpec sdk_path = merged_sdk.GetSysroot();
1097 if (FileSystem::Instance().Exists(sdk_path)) {
1098 return sdk_path;
1099 }
1100 auto path_or_err = HostInfo::GetSDKRoot(HostInfo::SDKOptions{merged_sdk});
1101 if (!path_or_err)
1102 return llvm::createStringError(
1103 llvm::formatv("Failed to resolve SDK path: {0}",
1104 llvm::toString(path_or_err.takeError())));
1105
1106 return FileSpec(*path_or_err);
1107}
1108
1110 Target *target, std::vector<std::string> &options, XcodeSDK::Type sdk_type) {
1111 const std::vector<std::string> apple_arguments = {
1112 "-x", "objective-c++", "-fobjc-arc",
1113 "-fblocks", "-D_ISO646_H", "-D__ISO646_H",
1114 "-fgnuc-version=4.2.1"};
1115
1116 options.insert(options.end(), apple_arguments.begin(), apple_arguments.end());
1117
1118 StreamString minimum_version_option;
1119 bool use_current_os_version = false;
1120 // If the SDK type is for the host OS, use its version number.
1121 auto get_host_os = []() { return HostInfo::GetTargetTriple().getOS(); };
1122 switch (sdk_type) {
1124 use_current_os_version = get_host_os() == llvm::Triple::MacOSX;
1125 break;
1127 use_current_os_version = get_host_os() == llvm::Triple::IOS;
1128 break;
1130 use_current_os_version = get_host_os() == llvm::Triple::TvOS;
1131 break;
1133 use_current_os_version = get_host_os() == llvm::Triple::WatchOS;
1134 break;
1136 use_current_os_version = get_host_os() == llvm::Triple::XROS;
1137 break;
1138 default:
1139 break;
1140 }
1141
1142 llvm::VersionTuple version;
1143 if (use_current_os_version)
1144 version = GetOSVersion();
1145 else if (target) {
1146 // Our OS doesn't match our executable so we need to get the min OS version
1147 // from the object file
1148 ModuleSP exe_module_sp = target->GetExecutableModule();
1149 if (exe_module_sp) {
1150 ObjectFile *object_file = exe_module_sp->GetObjectFile();
1151 if (object_file)
1152 version = object_file->GetMinimumOSVersion();
1153 }
1154 }
1155 // Only add the version-min options if we got a version from somewhere.
1156 // clang has no version-min clang flag for XROS.
1157 if (!version.empty() && sdk_type != XcodeSDK::Type::Linux &&
1158 sdk_type != XcodeSDK::Type::XROS) {
1159#define OPTION(PREFIX_OFFSET, NAME_OFFSET, VAR, ...) \
1160 llvm::StringRef opt_##VAR = OptionStrTable[NAME_OFFSET]; \
1161 (void)opt_##VAR;
1162#include "clang/Options/Options.inc"
1163#undef OPTION
1164 minimum_version_option << '-';
1165 switch (sdk_type) {
1167 minimum_version_option << opt_mmacos_version_min_EQ;
1168 break;
1170 minimum_version_option << opt_mios_simulator_version_min_EQ;
1171 break;
1173 minimum_version_option << opt_mios_version_min_EQ;
1174 break;
1176 minimum_version_option << opt_mtvos_simulator_version_min_EQ;
1177 break;
1179 minimum_version_option << opt_mtvos_version_min_EQ;
1180 break;
1182 minimum_version_option << opt_mwatchos_simulator_version_min_EQ;
1183 break;
1185 minimum_version_option << opt_mwatchos_version_min_EQ;
1186 break;
1189 // FIXME: Pass the right argument once it exists.
1193 if (Log *log = GetLog(LLDBLog::Host)) {
1194 XcodeSDK::Info info;
1195 info.type = sdk_type;
1196 LLDB_LOGF(log, "Clang modules on %s are not supported",
1197 XcodeSDK::GetCanonicalName(info).c_str());
1198 }
1199 return;
1200 }
1201 minimum_version_option << version.getAsString();
1202 options.emplace_back(std::string(minimum_version_option.GetString()));
1203 }
1204
1205 FileSpec sysroot_spec;
1206
1207 if (target) {
1208 auto sysroot_spec_or_err = ::ResolveSDKPathFromDebugInfo(target);
1209 if (!sysroot_spec_or_err) {
1211 sysroot_spec_or_err.takeError(),
1212 "Failed to resolve sysroot: {0}");
1213 } else {
1214 sysroot_spec = *sysroot_spec_or_err;
1215 }
1216 }
1217
1218 if (!FileSystem::Instance().IsDirectory(sysroot_spec.GetPath())) {
1219 std::lock_guard<std::mutex> guard(m_mutex);
1220 sysroot_spec = GetSDKDirectoryForModules(sdk_type);
1221 }
1222
1223 if (FileSystem::Instance().IsDirectory(sysroot_spec.GetPath())) {
1224 options.push_back("-isysroot");
1225 options.push_back(sysroot_spec.GetPath());
1226 }
1227}
1228
1230 if (basename.IsEmpty())
1231 return basename;
1232
1233 StreamString stream;
1234 stream.Printf("lib%s.dylib", basename.GetCString());
1235 return ConstString(stream.GetString());
1236}
1237
1238llvm::VersionTuple PlatformDarwin::GetOSVersion(Process *process) {
1239 if (process && GetPluginName().contains("-simulator")) {
1241 if (Host::GetProcessInfo(process->GetID(), proc_info)) {
1242 const Environment &env = proc_info.GetEnvironment();
1243
1244 llvm::VersionTuple result;
1245 if (!result.tryParse(env.lookup("SIMULATOR_RUNTIME_VERSION")))
1246 return result;
1247
1248 std::string dyld_root_path = env.lookup("DYLD_ROOT_PATH");
1249 if (!dyld_root_path.empty()) {
1250 dyld_root_path += "/System/Library/CoreServices/SystemVersion.plist";
1251 ApplePropertyList system_version_plist(dyld_root_path.c_str());
1252 std::string product_version;
1253 if (system_version_plist.GetValueAsString("ProductVersion",
1254 product_version)) {
1255 if (!result.tryParse(product_version))
1256 return result;
1257 }
1258 }
1259 }
1260 // For simulator platforms, do NOT call back through
1261 // Platform::GetOSVersion() as it might call Process::GetHostOSVersion()
1262 // which we don't want as it will be incorrect
1263 return llvm::VersionTuple();
1264 }
1265
1266 return Platform::GetOSVersion(process);
1267}
1268
1270 // A collection of SBFileSpec whose SBFileSpec.m_directory members are filled
1271 // in with any executable directories that should be searched.
1272 static std::vector<FileSpec> g_executable_dirs;
1273
1274 // Find the global list of directories that we will search for executables
1275 // once so we don't keep doing the work over and over.
1276 static llvm::once_flag g_once_flag;
1277 llvm::call_once(g_once_flag, []() {
1278
1279 // When locating executables, trust the DEVELOPER_DIR first if it is set
1280 FileSpec xcode_contents_dir = HostInfo::GetXcodeContentsDirectory();
1281 if (xcode_contents_dir) {
1282 FileSpec xcode_lldb_resources = xcode_contents_dir;
1283 xcode_lldb_resources.AppendPathComponent("SharedFrameworks");
1284 xcode_lldb_resources.AppendPathComponent("LLDB.framework");
1285 xcode_lldb_resources.AppendPathComponent("Resources");
1286 if (FileSystem::Instance().Exists(xcode_lldb_resources)) {
1287 FileSpec dir;
1288 dir.SetDirectory(xcode_lldb_resources.GetPathAsConstString());
1289 g_executable_dirs.push_back(dir);
1290 }
1291 }
1292 // Xcode might not be installed so we also check for the Command Line Tools.
1293 FileSpec command_line_tools_dir = GetCommandLineToolsLibraryPath();
1294 if (command_line_tools_dir) {
1295 FileSpec cmd_line_lldb_resources = command_line_tools_dir;
1296 cmd_line_lldb_resources.AppendPathComponent("PrivateFrameworks");
1297 cmd_line_lldb_resources.AppendPathComponent("LLDB.framework");
1298 cmd_line_lldb_resources.AppendPathComponent("Resources");
1299 if (FileSystem::Instance().Exists(cmd_line_lldb_resources)) {
1300 FileSpec dir;
1301 dir.SetDirectory(cmd_line_lldb_resources.GetPathAsConstString());
1302 g_executable_dirs.push_back(dir);
1303 }
1304 }
1305 });
1306
1307 // Now search the global list of executable directories for the executable we
1308 // are looking for
1309 for (const auto &executable_dir : g_executable_dirs) {
1310 FileSpec executable_file;
1311 executable_file.SetDirectory(executable_dir.GetDirectory());
1312 executable_file.SetFilename(basename);
1313 if (FileSystem::Instance().Exists(executable_file))
1314 return executable_file;
1315 }
1316
1317 return FileSpec();
1318}
1319
1322 // Starting in Fall 2016 OSes, NSLog messages only get mirrored to stderr if
1323 // the OS_ACTIVITY_DT_MODE environment variable is set. (It doesn't require
1324 // any specific value; rather, it just needs to exist). We will set it here
1325 // as long as the IDE_DISABLED_OS_ACTIVITY_DT_MODE flag is not set. Xcode
1326 // makes use of IDE_DISABLED_OS_ACTIVITY_DT_MODE to tell
1327 // LLDB *not* to muck with the OS_ACTIVITY_DT_MODE flag when they
1328 // specifically want it unset.
1329 const char *disable_env_var = "IDE_DISABLED_OS_ACTIVITY_DT_MODE";
1330 auto &env_vars = launch_info.GetEnvironment();
1331 if (!env_vars.count(disable_env_var)) {
1332 // We want to make sure that OS_ACTIVITY_DT_MODE is set so that we get
1333 // os_log and NSLog messages mirrored to the target process stderr.
1334 env_vars.try_emplace("OS_ACTIVITY_DT_MODE", "enable");
1335 }
1336
1337 // Let our parent class do the real launching.
1338 return PlatformPOSIX::LaunchProcess(launch_info);
1339}
1340
1342 const ModuleSpec &module_spec, Process *process, ModuleSP &module_sp,
1343 llvm::SmallVectorImpl<ModuleSP> *old_modules, bool *did_create_ptr) {
1344 const FileSpec &platform_file = module_spec.GetFileSpec();
1345 TargetSP target_sp = module_spec.GetTargetSP();
1346 FileSpecList module_search_paths;
1347 if (target_sp)
1348 module_search_paths = target_sp->GetExecutableSearchPaths();
1349 // See if the file is present in any of the module_search_paths
1350 // directories.
1351 if (!module_sp && !module_search_paths.IsEmpty() && platform_file) {
1352 // create a vector of all the file / directory names in platform_file e.g.
1353 // this might be
1354 // /System/Library/PrivateFrameworks/UIFoundation.framework/UIFoundation
1355 //
1356 // We'll need to look in the module_search_paths_ptr directories for both
1357 // "UIFoundation" and "UIFoundation.framework" -- most likely the latter
1358 // will be the one we find there.
1359
1360 std::vector<llvm::StringRef> path_parts = platform_file.GetComponents();
1361 // We want the components in reverse order.
1362 std::reverse(path_parts.begin(), path_parts.end());
1363 const size_t path_parts_size = path_parts.size();
1364
1365 size_t num_module_search_paths = module_search_paths.GetSize();
1366 for (size_t i = 0; i < num_module_search_paths; ++i) {
1367 Log *log_verbose = GetLog(LLDBLog::Host);
1368 LLDB_LOGF(
1369 log_verbose,
1370 "PlatformRemoteDarwinDevice::GetSharedModule searching for binary in "
1371 "search-path %s",
1372 module_search_paths.GetFileSpecAtIndex(i).GetPath().c_str());
1373 // Create a new FileSpec with this module_search_paths_ptr plus just the
1374 // filename ("UIFoundation"), then the parent dir plus filename
1375 // ("UIFoundation.framework/UIFoundation") etc - up to four names (to
1376 // handle "Foo.framework/Contents/MacOS/Foo")
1377
1378 for (size_t j = 0; j < 4 && j < path_parts_size - 1; ++j) {
1379 FileSpec path_to_try(module_search_paths.GetFileSpecAtIndex(i));
1380
1381 // Add the components backwards. For
1382 // .../PrivateFrameworks/UIFoundation.framework/UIFoundation path_parts
1383 // is
1384 // [0] UIFoundation
1385 // [1] UIFoundation.framework
1386 // [2] PrivateFrameworks
1387 //
1388 // and if 'j' is 2, we want to append path_parts[1] and then
1389 // path_parts[0], aka 'UIFoundation.framework/UIFoundation', to the
1390 // module_search_paths_ptr path.
1391
1392 for (int k = j; k >= 0; --k) {
1393 path_to_try.AppendPathComponent(path_parts[k]);
1394 }
1395
1396 if (FileSystem::Instance().Exists(path_to_try)) {
1397 ModuleSpec new_module_spec(module_spec);
1398 new_module_spec.GetFileSpec() = path_to_try;
1399 Status new_error(Platform::GetSharedModule(new_module_spec, process,
1400 module_sp, old_modules,
1401 did_create_ptr));
1402
1403 if (module_sp) {
1404 module_sp->SetPlatformFileSpec(path_to_try);
1405 return new_error;
1406 }
1407 }
1408 }
1409 }
1410 }
1411 return Status();
1412}
1413
1414llvm::Triple::OSType PlatformDarwin::GetHostOSType() {
1415#if !defined(__APPLE__)
1416 return llvm::Triple::MacOSX;
1417#else
1418#if TARGET_OS_OSX
1419 return llvm::Triple::MacOSX;
1420#elif TARGET_OS_IOS
1421 return llvm::Triple::IOS;
1422#elif TARGET_OS_WATCH
1423 return llvm::Triple::WatchOS;
1424#elif TARGET_OS_TV
1425 return llvm::Triple::TvOS;
1426#elif TARGET_OS_BRIDGE
1427 return llvm::Triple::BridgeOS;
1428#elif TARGET_OS_XR
1429 return llvm::Triple::XROS;
1430#else
1431#error "LLDB being compiled for an unrecognized Darwin OS"
1432#endif
1433#endif // __APPLE__
1434}
1435
1436llvm::Expected<std::pair<XcodeSDK, bool>>
1438 SymbolFile *sym_file = module.GetSymbolFile();
1439 if (!sym_file)
1440 return llvm::createStringError(
1441 llvm::inconvertibleErrorCode(),
1442 llvm::formatv("No symbol file available for module '{0}'",
1443 module.GetFileSpec().GetFilename().AsCString("")));
1444
1445 if (sym_file->GetNumCompileUnits() == 0)
1446 return llvm::createStringError(
1447 llvm::formatv("Could not resolve SDK for module '{0}'. Symbol file has "
1448 "no compile units.",
1449 module.GetFileSpec()));
1450
1451 bool found_public_sdk = false;
1452 bool found_internal_sdk = false;
1453 XcodeSDK merged_sdk;
1454 for (unsigned i = 0; i < sym_file->GetNumCompileUnits(); ++i) {
1455 if (auto cu_sp = sym_file->GetCompileUnitAtIndex(i)) {
1456 auto cu_sdk = sym_file->ParseXcodeSDK(*cu_sp);
1457 bool is_internal_sdk = cu_sdk.IsAppleInternalSDK();
1458 found_public_sdk |= !is_internal_sdk;
1459 found_internal_sdk |= is_internal_sdk;
1460
1461 merged_sdk.Merge(cu_sdk);
1462 }
1463 }
1464
1465 const bool found_mismatch = found_internal_sdk && found_public_sdk;
1466
1467 return std::pair{std::move(merged_sdk), found_mismatch};
1468}
1469
1470llvm::Expected<std::string>
1472 auto sdk_or_err = GetSDKPathFromDebugInfo(module);
1473 if (!sdk_or_err)
1474 return llvm::createStringError(
1475 llvm::inconvertibleErrorCode(),
1476 llvm::formatv("Failed to parse SDK path from debug-info: {0}",
1477 llvm::toString(sdk_or_err.takeError())));
1478
1479 auto [sdk, _] = std::move(*sdk_or_err);
1480
1481 if (FileSystem::Instance().Exists(sdk.GetSysroot()))
1482 return sdk.GetSysroot().GetPath();
1483
1484 auto path_or_err = HostInfo::GetSDKRoot(HostInfo::SDKOptions{sdk});
1485 if (!path_or_err)
1486 return llvm::createStringError(
1487 llvm::inconvertibleErrorCode(),
1488 llvm::formatv("Error while searching for SDK (XcodeSDK '{0}'): {1}",
1489 sdk.GetString(),
1490 llvm::toString(path_or_err.takeError())));
1491
1492 return path_or_err->str();
1493}
1494
1495llvm::Expected<XcodeSDK>
1497 ModuleSP module_sp = unit.CalculateSymbolContextModule();
1498 if (!module_sp)
1499 return llvm::createStringError("compile unit has no module");
1500 SymbolFile *sym_file = module_sp->GetSymbolFile();
1501 if (!sym_file)
1502 return llvm::createStringError(
1503 llvm::formatv("No symbol file available for module '{0}'",
1504 module_sp->GetFileSpec().GetFilename()));
1505
1506 return sym_file->ParseXcodeSDK(unit);
1507}
1508
1509llvm::Expected<std::string>
1511 auto sdk_or_err = GetSDKPathFromDebugInfo(unit);
1512 if (!sdk_or_err)
1513 return llvm::createStringError(
1514 llvm::inconvertibleErrorCode(),
1515 llvm::formatv("Failed to parse SDK path from debug-info: {0}",
1516 llvm::toString(sdk_or_err.takeError())));
1517
1518 auto sdk = std::move(*sdk_or_err);
1519
1520 auto path_or_err = HostInfo::GetSDKRoot(HostInfo::SDKOptions{sdk});
1521 if (!path_or_err)
1522 return llvm::createStringError(
1523 llvm::inconvertibleErrorCode(),
1524 llvm::formatv("Error while searching for SDK (XcodeSDK '{0}'): {1}",
1525 sdk.GetString(),
1526 llvm::toString(path_or_err.takeError())));
1527
1528 return path_or_err->str();
1529}
static llvm::raw_ostream & error(Stream &strm)
static DynamicLoaderDarwinKernelProperties & GetGlobalProperties()
#define LLDB_LOG(log,...)
The LLDB_LOG* macros defined below are the way to emit log messages.
Definition Log.h:369
#define LLDB_LOGF(log,...)
Definition Log.h:383
#define LLDB_LOG_ERROR(log, error,...)
Definition Log.h:399
static uint32_t g_initialize_count
static llvm::Expected< lldb_private::FileSpec > ResolveSDKPathFromDebugInfo(lldb_private::Target *target)
static Status ExceptionMaskValidator(const char *string, void *unused)
static llvm::ArrayRef< const char * > GetCompatibleArchs(ArchSpec::Core core)
static FileSpec GetXcodeSelectPath()
static FileSpec GetCommandLineToolsLibraryPath()
static llvm::StringRef GetSettingName()
OptionValueString * GetIgnoredExceptionValue()
const char * GetIgnoredExceptions() const
~PlatformDarwinProperties() override=default
lldb_private::Status PutFile(const lldb_private::FileSpec &source, const lldb_private::FileSpec &destination, uint32_t uid=UINT32_MAX, uint32_t gid=UINT32_MAX) override
bool GetValueAsString(const char *key, std::string &value) const
Definition XML.cpp:404
An architecture specification class.
Definition ArchSpec.h:32
bool IsExactMatch(const ArchSpec &rhs) const
Shorthand for IsMatch(rhs, ExactMatch).
Definition ArchSpec.h:504
llvm::Triple::ArchType GetMachine() const
Returns a machine family for the current architecture.
Definition ArchSpec.cpp:673
Core GetCore() const
Definition ArchSpec.h:448
A command line argument class.
Definition Args.h:33
void AppendArgument(llvm::StringRef arg_str, char quote_char='\0')
Appends a new argument to the end of the list argument list.
Definition Args.cpp:332
Class that manages the actual breakpoint that will be inserted into the running program.
bool SetTrapOpcode(const uint8_t *trap_opcode, uint32_t trap_opcode_size)
Sets the trap opcode.
lldb::BreakpointLocationSP GetConstituentAtIndex(size_t idx)
This method returns the breakpoint location at index index located at this breakpoint site.
A class that describes a compilation unit.
Definition CompileUnit.h:43
lldb::ModuleSP CalculateSymbolContextModule() override
A uniqued constant string class.
Definition ConstString.h:40
const char * AsCString(const char *value_if_empty=nullptr) const
Get the string value as a C string.
bool IsEmpty() const
Test for empty string.
llvm::StringRef GetStringRef() const
Get the string value as a llvm::StringRef.
const char * GetCString() const
Get the string value as a C string.
A class to manage flag bits.
Definition Debugger.h:101
lldb::ScriptLanguage GetScriptLanguage() const
Definition Debugger.cpp:436
ScriptInterpreter * GetScriptInterpreter(bool can_create=true, std::optional< lldb::ScriptLanguage > language={})
virtual bool GetSharedCacheInformation(lldb::addr_t &base_address, UUID &uuid, LazyBool &using_shared_cache, LazyBool &private_shared_cache, lldb_private::FileSpec &shared_cache_path, std::optional< uint64_t > &size)
Get information about the shared cache for a process, if possible.
A file collection class.
const FileSpec & GetFileSpecAtIndex(size_t idx) const
Get file at index.
void EmplaceBack(Args &&...args)
Inserts a new FileSpec into the FileSpecList constructed in-place with the given arguments.
size_t GetSize() const
Get the number of files in the file list.
A file utility class.
Definition FileSpec.h:57
void AppendPathComponent(llvm::StringRef component)
Definition FileSpec.cpp:454
void SetDirectory(ConstString directory)
Directory string set accessor.
Definition FileSpec.cpp:342
const ConstString & GetFilename() const
Filename string const get accessor.
Definition FileSpec.h:250
std::vector< llvm::StringRef > GetComponents() const
Gets the components of the FileSpec's path.
Definition FileSpec.cpp:475
const ConstString & GetDirectory() const
Directory string const get accessor.
Definition FileSpec.h:234
ConstString GetFileNameStrippingExtension() const
Return the filename without the extension part.
Definition FileSpec.cpp:414
size_t GetPath(char *path, size_t max_path_length, bool denormalize=true) const
Extract the full path to the file.
Definition FileSpec.cpp:374
ConstString GetPathAsConstString(bool denormalize=true) const
Get the full path as a ConstString.
Definition FileSpec.cpp:390
void SetFilename(ConstString filename)
Filename string set accessor.
Definition FileSpec.cpp:352
void EnumerateDirectory(llvm::Twine path, bool find_directories, bool find_files, bool find_other, EnumerateDirectoryCallbackType callback, void *callback_baton)
@ eEnumerateDirectoryResultNext
Enumerate next entry in the current directory.
Definition FileSystem.h:182
static FileSystem & Instance()
void Resolve(llvm::SmallVectorImpl< char > &path, bool force_make_absolute=false)
Resolve path to make it canonical.
static bool ResolveExecutableInBundle(FileSpec &file)
When executable files may live within a directory, where the directory represents an executable bundl...
static Status RunShellCommand(llvm::StringRef command, const FileSpec &working_dir, int *status_ptr, int *signo_ptr, std::string *command_output, std::string *error_output, const Timeout< std::micro > &timeout, bool run_in_shell=true)
Run a shell command.
static bool GetProcessInfo(lldb::pid_t pid, ProcessInstanceInfo &proc_info)
Definition aix/Host.cpp:177
static bool GetBundleDirectory(const FileSpec &file, FileSpec &bundle_directory)
If you have an executable that is in a bundle and want to get back to the bundle directory from the p...
lldb::SymbolSharedCacheUse GetSharedCacheBinaryLoading() const
static Status GetSharedModule(const ModuleSpec &module_spec, lldb::ModuleSP &module_sp, llvm::SmallVectorImpl< lldb::ModuleSP > *old_modules, bool *did_create_ptr, bool invoke_locate_callback=true)
static ModuleListProperties & GetGlobalModuleListProperties()
ModuleIterable Modules() const
Definition ModuleList.h:565
FileSpec & GetFileSpec()
Definition ModuleSpec.h:57
FileSpec & GetSymbolFileSpec()
Definition ModuleSpec.h:81
ArchSpec * GetArchitecturePtr()
Definition ModuleSpec.h:85
lldb::TargetSP GetTargetSP() const
Definition ModuleSpec.h:133
A class that describes an executable image and its associated object and symbol files.
Definition Module.h:90
const FileSpec & GetFileSpec() const
Get const accessor for the module file specification.
Definition Module.h:446
A plug-in interface definition class for object file parsers.
Definition ObjectFile.h:46
@ eTypeDynamicLinker
The platform's dynamic linker executable.
Definition ObjectFile.h:59
virtual llvm::VersionTuple GetMinimumOSVersion()
Get the minimum OS version this object file can run on.
Definition ObjectFile.h:616
virtual FileSpec & GetFileSpec()
Get accessor to the object file specification.
Definition ObjectFile.h:280
void SetValidator(ValidatorCallback validator, void *baton=nullptr)
const char * GetCurrentValue() const
StructuredData::ArraySP ExtractCrashInfoAnnotations(Process &process)
Extract the __crash_info annotations from each of the target's modules.
llvm::Expected< StructuredData::DictionarySP > FetchExtendedCrashInformation(Process &process) override
Gather all of crash informations into a structured data dictionary.
~PlatformDarwin() override
Destructor.
static FileSpec GetSDKDirectoryForModules(XcodeSDK::Type sdk_type)
Status GetModuleFromSharedCaches(const ModuleSpec &module_spec, Process *process, lldb::ModuleSP &module_sp, llvm::SmallVectorImpl< lldb::ModuleSP > *old_modules, bool *did_create_ptr)
Status ResolveSymbolFile(Target &target, const ModuleSpec &sym_spec, FileSpec &sym_file) override
Find a symbol file given a symbol file module specification.
void CalculateTrapHandlerSymbolNames() override
Ask the Platform subclass to fill in the list of trap handler names.
static std::tuple< llvm::VersionTuple, llvm::StringRef > ParseVersionBuildDir(llvm::StringRef str)
static lldb::PlatformSP CreateInstance(bool force, const ArchSpec *arch)
llvm::VersionTuple GetOSVersion(Process *process=nullptr) override
Get the OS version from a connected platform.
Status GetSharedModule(const ModuleSpec &module_spec, Process *process, lldb::ModuleSP &module_sp, llvm::SmallVectorImpl< lldb::ModuleSP > *old_modules, bool *did_create_ptr) override
static FileSystem::EnumerateDirectoryResult DirectoryEnumerator(void *baton, llvm::sys::fs::file_type file_type, llvm::StringRef path)
static FileSpec FindSDKInXcodeForModules(XcodeSDK::Type sdk_type, const FileSpec &sdks_spec)
ConstString GetFullNameForDylib(ConstString basename) override
static void DebuggerInitialize(lldb_private::Debugger &debugger)
static llvm::StringRef GetPluginNameStatic()
static llvm::Triple::OSType GetHostOSType()
StructuredData::DictionarySP ExtractAppSpecificInfo(Process &process)
Extract the Application Specific Information messages from a crash report.
lldb::ProcessSP DebugProcess(ProcessLaunchInfo &launch_info, Debugger &debugger, Target &target, Status &error) override
Subclasses do not need to implement this function as it uses the Platform::LaunchProcess() followed b...
lldb::BreakpointSP SetThreadCreationBreakpoint(Target &target) override
static llvm::StringRef GetDescriptionStatic()
Status FindBundleBinaryInExecSearchPaths(const ModuleSpec &module_spec, Process *process, lldb::ModuleSP &module_sp, llvm::SmallVectorImpl< lldb::ModuleSP > *old_modules, bool *did_create_ptr)
Status LaunchProcess(ProcessLaunchInfo &launch_info) override
Launch a new process on a platform, not necessarily for debugging, it could be just for running the p...
uint32_t GetResumeCountForLaunchInfo(ProcessLaunchInfo &launch_info) override
llvm::Expected< std::string > ResolveSDKPathFromDebugInfo(Module &module) override
Returns the full path of the most appropriate SDK for the specified 'module'.
size_t GetSoftwareBreakpointTrapOpcode(Target &target, BreakpointSite *bp_site) override
void AddClangModuleCompilationOptionsForSDKType(Target *target, std::vector< std::string > &options, XcodeSDK::Type sdk_type)
Args GetExtraStartupCommands() override
Status PutFile(const FileSpec &source, const FileSpec &destination, uint32_t uid=UINT32_MAX, uint32_t gid=UINT32_MAX) override
static llvm::SmallDenseMap< FileSpec, LoadScriptFromSymFile > LocateExecutableScriptingResourcesFromDSYM(Stream &feedback_stream, FileSpec module_spec, const Target &target, const FileSpec &symfile_spec)
Helper function for LocateExecutableScriptingResources which gathers FileSpecs for executable scripts...
FileSpec LocateExecutable(const char *basename) override
Find a support executable that may not live within in the standard locations related to LLDB.
void x86GetSupportedArchitectures(std::vector< ArchSpec > &archs)
llvm::Expected< std::pair< XcodeSDK, bool > > GetSDKPathFromDebugInfo(Module &module) override
Search each CU associated with the specified 'module' for the SDK paths the CUs were compiled against...
llvm::SmallDenseMap< FileSpec, LoadScriptFromSymFile > LocateExecutableScriptingResourcesForPlatform(Target *target, Module &module_spec, Stream &feedback_stream) override
Locate the platform-specific scripting resource given a module specification.
bool ModuleIsExcludedForUnconstrainedSearches(Target &target, const lldb::ModuleSP &module_sp) override
void ARMGetSupportedArchitectures(std::vector< ArchSpec > &archs, std::optional< llvm::Triple::OSType > os={})
The architecture selection rules for arm processors These cpu subtypes have distinct names (e....
std::vector< ConstString > m_trap_handlers
Definition Platform.h:1050
virtual size_t GetSoftwareBreakpointTrapOpcode(Target &target, BreakpointSite *bp_site)
virtual lldb::ProcessSP DebugProcess(ProcessLaunchInfo &launch_info, Debugger &debugger, Target &target, Status &error)
Subclasses do not need to implement this function as it uses the Platform::LaunchProcess() followed b...
virtual Status GetSharedModule(const ModuleSpec &module_spec, Process *process, lldb::ModuleSP &module_sp, llvm::SmallVectorImpl< lldb::ModuleSP > *old_modules, bool *did_create_ptr)
Definition Platform.cpp:241
const ArchSpec & GetSystemArchitecture()
Definition Platform.cpp:889
static void WarnIfInvalidUnsanitizedScriptExists(Stream &os, const ScriptInterpreter::SanitizedScriptingModuleName &sanitized_name, const FileSpec &original_fspec, const FileSpec &fspec)
If we did some replacements of reserved characters, and a file with the untampered name exists,...
virtual llvm::VersionTuple GetOSVersion(Process *process=nullptr)
Get the OS version from a connected platform.
Definition Platform.cpp:373
virtual Status LaunchProcess(ProcessLaunchInfo &launch_info)
Launch a new process on a platform, not necessarily for debugging, it could be just for running the p...
bool IsRemote() const
Definition Platform.h:527
bool IsHost() const
Definition Platform.h:523
virtual llvm::StringRef GetPluginName()=0
static bool RegisterPlugin(llvm::StringRef name, llvm::StringRef description, ABICreateInstance create_callback)
static lldb::OptionValuePropertiesSP GetSettingForPlatformPlugin(Debugger &debugger, llvm::StringRef setting_name)
static bool CreateSettingForPlatformPlugin(Debugger &debugger, const lldb::OptionValuePropertiesSP &properties_sp, llvm::StringRef description, bool is_global_property)
static bool UnregisterPlugin(ABICreateInstance create_callback)
static FileSpec FindSymbolFileInBundle(const FileSpec &dsym_bundle_fspec, const UUID *uuid, const ArchSpec *arch)
Environment & GetEnvironment()
Definition ProcessInfo.h:88
const FileSpec & GetShell() const
static void NoOpMonitorCallback(lldb::pid_t pid, int signal, int status)
A Monitor callback which does not take any action on process events.
void SetMonitorProcessCallback(Host::MonitorChildProcessCallback callback)
A plug-in interface definition class for debugging a process.
Definition Process.h:354
lldb::pid_t GetID() const
Returns the pid of the process or LLDB_INVALID_PROCESS_ID if there is no known pid.
Definition Process.h:537
size_t ReadMemoryFromInferior(lldb::addr_t vm_addr, void *buf, size_t size, Status &error)
Read of memory from a process.
Definition Process.cpp:2234
virtual StructuredData::DictionarySP GetMetadata()
Fetch process defined metadata.
Definition Process.h:2668
size_t ReadCStringFromMemory(lldb::addr_t vm_addr, char *cstr, size_t cstr_max_len, Status &error)
Read a NULL terminated C string from memory.
Definition Process.cpp:2188
StructuredData::DictionarySP GetExtendedCrashInfoDict()
Fetch extended crash information held by the process.
Definition Process.h:2673
virtual DynamicLoader * GetDynamicLoader()
Get the dynamic loader plug-in for this process.
Definition Process.cpp:2908
Target & GetTarget()
Get the target object pointer for this module.
Definition Process.h:1250
lldb::OptionValuePropertiesSP m_collection_sp
Status Unlink(const FileSpec &file_spec) override
Holds an lldb_private::Module name and a "sanitized" version of it for the purposes of loading a scri...
virtual SanitizedScriptingModuleName GetSanitizedScriptingModuleName(llvm::StringRef name)
lldb::SectionSP FindSectionByName(ConstString section_dstr) const
Definition Section.cpp:559
An error handling class.
Definition Status.h:118
static Status FromErrorStringWithFormat(const char *format,...) __attribute__((format(printf
Definition Status.cpp:106
static Status FromErrorString(const char *str)
Definition Status.h:141
bool Success() const
Test for success condition.
Definition Status.cpp:303
llvm::StringRef GetString() const
A stream class that can stream formatted output to a file.
Definition Stream.h:28
void Format(const char *format, Args &&... args)
Forwards the arguments to llvm::formatv and writes to the stream.
Definition Stream.h:376
size_t Printf(const char *format,...) __attribute__((format(printf
Output printf formatted output to the stream.
Definition Stream.cpp:134
ObjectSP GetItemAtIndex(size_t idx) const
void ForEach(std::function< bool(llvm::StringRef key, Object *object)> const &callback) const
std::shared_ptr< Dictionary > DictionarySP
std::shared_ptr< Array > ArraySP
Provides public interface for all SymbolFiles.
Definition SymbolFile.h:51
virtual XcodeSDK ParseXcodeSDK(CompileUnit &comp_unit)
Return the Xcode SDK comp_unit was compiled against.
Definition SymbolFile.h:152
virtual uint32_t GetNumCompileUnits()=0
virtual lldb::CompUnitSP GetCompileUnitAtIndex(uint32_t idx)=0
virtual ObjectFile * GetObjectFile()=0
LoadScriptFromSymFile GetLoadScriptFromSymbolFile() const
Definition Target.cpp:5104
Debugger & GetDebugger() const
Definition Target.h:1223
lldb::ModuleSP GetExecutableModule()
Gets the module for the main executable.
Definition Target.cpp:1525
lldb::BreakpointSP CreateBreakpoint(const FileSpecList *containingModules, const FileSpec &file, uint32_t line_no, uint32_t column, lldb::addr_t offset, LazyBool check_inlines, LazyBool skip_prologue, bool internal, bool request_hardware, LazyBool move_to_nearest_code)
Definition Target.cpp:489
const ModuleList & GetImages() const
Get accessor for the images for this process.
Definition Target.h:1140
const ArchSpec & GetArchitecture() const
Definition Target.h:1182
Represents UUID's of various sizes.
Definition UUID.h:27
An abstraction for Xcode-style SDKs that works like ArchSpec.
Definition XcodeSDK.h:25
Type
Different types of Xcode SDKs.
Definition XcodeSDK.h:31
const FileSpec & GetSysroot() const
Definition XcodeSDK.cpp:145
void Merge(const XcodeSDK &other)
The merge function follows a strict order to maintain monotonicity:
Definition XcodeSDK.cpp:157
static std::string GetCanonicalName(Info info)
Return the canonical SDK name, such as "macosx" for the macOS SDK.
Definition XcodeSDK.cpp:177
bool IsAppleInternalSDK() const
Definition XcodeSDK.cpp:125
static bool SDKSupportsModules(Type type, llvm::VersionTuple version)
Whether LLDB feels confident importing Clang modules from this SDK.
Definition XcodeSDK.cpp:223
#define LLDB_INVALID_ADDRESS
A class that represents a running process on the host machine.
Log * GetLog(Cat mask)
Retrieve the Log object for the channel associated with the given log enum.
Definition Log.h:332
@ eScriptLanguagePython
std::shared_ptr< lldb_private::BreakpointLocation > BreakpointLocationSP
std::shared_ptr< lldb_private::Platform > PlatformSP
@ eLanguageTypeUnknown
Unknown or invalid language value.
std::shared_ptr< lldb_private::Breakpoint > BreakpointSP
std::shared_ptr< lldb_private::Process > ProcessSP
std::shared_ptr< lldb_private::Section > SectionSP
uint64_t addr_t
Definition lldb-types.h:80
std::shared_ptr< lldb_private::Target > TargetSP
std::shared_ptr< lldb_private::Module > ModuleSP
lldb::DataExtractorSP GetExtractor()
A parsed SDK directory name.
Definition XcodeSDK.h:48
#define PATH_MAX