43#include "llvm/ADT/STLExtras.h"
44#include "llvm/Support/Error.h"
45#include "llvm/Support/FileSystem.h"
46#include "llvm/Support/Threading.h"
47#include "llvm/Support/VersionTuple.h"
50#include <TargetConditionals.h>
58 llvm::StringRef str_ref(
string);
59 llvm::SmallVector<llvm::StringRef> candidates;
60 str_ref.split(candidates,
'|');
61 for (
auto candidate : candidates) {
62 if (!(candidate ==
"EXC_BAD_ACCESS"
63 || candidate ==
"EXC_BAD_INSTRUCTION"
64 || candidate ==
"EXC_ARITHMETIC"
65 || candidate ==
"EXC_RESOURCE"
66 || candidate ==
"EXC_GUARD"
67 || candidate ==
"EXC_SYSCALL")) {
68 error.SetErrorStringWithFormat(
"invalid exception type: '%s'",
69 candidate.str().c_str());
107 return "Darwin platform plug-in.";
115#define LLDB_PROPERTIES_platformdarwin
116#include "PlatformMacOSXProperties.inc"
118#define LLDB_PROPERTIES_platformdarwin
120#include "PlatformMacOSXPropertiesEnum.inc"
126 static constexpr llvm::StringLiteral g_setting_name(
"darwin");
127 return g_setting_name;
131 m_collection_sp = std::make_shared<OptionValueProperties>(GetSettingName());
132 m_collection_sp->Initialize(g_platformdarwin_properties);
138 const uint32_t idx = ePropertyIgnoredExceptions;
140 m_collection_sp->GetPropertyAtIndexAsOptionValueString(idx);
141 assert(option_value);
146 const uint32_t idx = ePropertyIgnoredExceptions;
148 m_collection_sp->GetPropertyAtIndexAsOptionValueString(idx);
149 assert(option_value);
163 const bool is_global_setting =
false;
166 "Properties for the Darwin platform plug-in.", is_global_setting);
174 std::string ignored_exceptions
176 if (ignored_exceptions.empty())
179 std::string packet =
"QSetIgnoredExceptions:";
180 packet.append(ignored_exceptions);
212 ObjectFile *objfile = symfile->GetObjectFile();
216 llvm::StringRef(symfile_spec.
GetPath())
217 .contains_insensitive(
".dSYM/Contents/Resources/DWARF") &&
220 std::string module_basename(
222 std::string original_module_basename(module_basename);
224 bool was_keyword =
false;
234 std::replace(module_basename.begin(), module_basename.end(),
'.',
236 std::replace(module_basename.begin(), module_basename.end(),
' ',
238 std::replace(module_basename.begin(), module_basename.end(),
'-',
242 if (script_interpreter &&
244 module_basename.insert(module_basename.begin(),
'_');
254 path_string.
Printf(
"%s/../Python/%s.py",
256 module_basename.c_str());
257 original_path_string.
Printf(
258 "%s/../Python/%s.py",
260 original_module_basename.c_str());
269 if (module_basename != original_module_basename &&
271 const char *reason_for_complaint =
272 was_keyword ?
"conflicts with a keyword"
273 :
"contains reserved characters";
276 "warning: the symbol file '%s' contains a debug "
277 "script. However, its name"
278 " '%s' %s and as such cannot be loaded. LLDB will"
279 " load '%s' instead. Consider removing the file with "
280 "the malformed name to"
281 " eliminate this warning.\n",
282 symfile_spec.
GetPath().c_str(),
283 original_path_string.
GetData(), reason_for_complaint,
287 "warning: the symbol file '%s' contains a debug "
288 "script. However, its name"
289 " %s and as such cannot be loaded. If you intend"
290 " to have this script loaded, please rename '%s' to "
292 symfile_spec.
GetPath().c_str(), reason_for_complaint,
297 file_list.
Append(script_fspec);
305 if (module_spec.
GetFilename() == filename_no_extension)
341 module_spec, process, module_sp, module_search_paths_ptr, old_modules,
349 module_search_paths_ptr, old_modules,
353 if (!module_sp && module_search_paths_ptr && platform_file) {
358 if (platform_file == bundle_directory) {
363 new_module_spec, process, module_sp,
nullptr, old_modules,
372 platform_file.
GetPath(platform_path,
sizeof(platform_path));
373 const size_t bundle_directory_len =
374 bundle_directory.
GetPath(bundle_dir,
sizeof(bundle_dir));
376 size_t num_module_search_paths = module_search_paths_ptr->
GetSize();
377 for (
size_t i = 0; i < num_module_search_paths; ++i) {
378 const size_t search_path_len =
380 new_path,
sizeof(new_path));
381 if (search_path_len <
sizeof(new_path)) {
382 snprintf(new_path + search_path_len,
383 sizeof(new_path) - search_path_len,
"/%s",
384 platform_path + bundle_directory_len);
390 new_module_spec, process, module_sp,
nullptr, old_modules,
394 module_sp->SetPlatformFileSpec(new_file_spec);
405 module_sp->SetPlatformFileSpec(module_spec.
GetFileSpec());
412 const uint8_t *trap_opcode =
nullptr;
413 uint32_t trap_opcode_size = 0;
414 bool bp_is_thumb =
false;
418 case llvm::Triple::aarch64_32:
419 case llvm::Triple::aarch64: {
421 static const uint8_t g_arm64_breakpoint_opcode[] = {0x00, 0x00, 0x20, 0xD4};
422 trap_opcode = g_arm64_breakpoint_opcode;
423 trap_opcode_size =
sizeof(g_arm64_breakpoint_opcode);
426 case llvm::Triple::thumb:
429 case llvm::Triple::arm: {
430 static const uint8_t g_arm_breakpoint_opcode[] = {0xFE, 0xDE, 0xFF, 0xE7};
431 static const uint8_t g_thumb_breakpooint_opcode[] = {0xFE, 0xDE};
437 bp_is_thumb = bp_loc_sp->GetAddress().GetAddressClass() ==
441 trap_opcode = g_thumb_breakpooint_opcode;
442 trap_opcode_size =
sizeof(g_thumb_breakpooint_opcode);
445 trap_opcode = g_arm_breakpoint_opcode;
446 trap_opcode_size =
sizeof(g_arm_breakpoint_opcode);
449 case llvm::Triple::ppc:
450 case llvm::Triple::ppc64: {
451 static const uint8_t g_ppc_breakpoint_opcode[] = {0x7F, 0xC0, 0x00, 0x08};
452 trap_opcode = g_ppc_breakpoint_opcode;
453 trap_opcode_size =
sizeof(g_ppc_breakpoint_opcode);
460 if (trap_opcode && trap_opcode_size) {
462 return trap_opcode_size;
472 ObjectFile *obj_file = module_sp->GetObjectFile();
481 std::vector<ArchSpec> &archs) {
482 ArchSpec host_arch = HostInfo::GetArchitecture(HostInfo::eArchKindDefault);
483 archs.push_back(host_arch);
486 archs.push_back(
ArchSpec(
"x86_64-apple-macosx"));
487 archs.push_back(HostInfo::GetArchitecture(HostInfo::eArchKind32));
489 ArchSpec host_arch64 = HostInfo::GetArchitecture(HostInfo::eArchKind64);
491 archs.push_back(HostInfo::GetArchitecture(HostInfo::eArchKind32));
500 static const char *g_arm64e_compatible_archs[] = {
501 "arm64e",
"arm64",
"armv7",
"armv7f",
"armv7k",
"armv7s",
502 "armv7m",
"armv7em",
"armv6m",
"armv6",
"armv5",
"armv4",
503 "arm",
"thumbv7",
"thumbv7f",
"thumbv7k",
"thumbv7s",
"thumbv7m",
504 "thumbv7em",
"thumbv6m",
"thumbv6",
"thumbv5",
"thumbv4t",
"thumb",
506 return {g_arm64e_compatible_archs};
509 static const char *g_arm64_compatible_archs[] = {
510 "arm64",
"armv7",
"armv7f",
"armv7k",
"armv7s",
"armv7m",
511 "armv7em",
"armv6m",
"armv6",
"armv5",
"armv4",
"arm",
512 "thumbv7",
"thumbv7f",
"thumbv7k",
"thumbv7s",
"thumbv7m",
"thumbv7em",
513 "thumbv6m",
"thumbv6",
"thumbv5",
"thumbv4t",
"thumb",
515 return {g_arm64_compatible_archs};
518 static const char *g_armv7_compatible_archs[] = {
519 "armv7",
"armv6m",
"armv6",
"armv5",
"armv4",
"arm",
520 "thumbv7",
"thumbv6m",
"thumbv6",
"thumbv5",
"thumbv4t",
"thumb",
522 return {g_armv7_compatible_archs};
525 static const char *g_armv7f_compatible_archs[] = {
526 "armv7f",
"armv7",
"armv6m",
"armv6",
"armv5",
527 "armv4",
"arm",
"thumbv7f",
"thumbv7",
"thumbv6m",
528 "thumbv6",
"thumbv5",
"thumbv4t",
"thumb",
530 return {g_armv7f_compatible_archs};
533 static const char *g_armv7k_compatible_archs[] = {
534 "armv7k",
"armv7",
"armv6m",
"armv6",
"armv5",
535 "armv4",
"arm",
"thumbv7k",
"thumbv7",
"thumbv6m",
536 "thumbv6",
"thumbv5",
"thumbv4t",
"thumb",
538 return {g_armv7k_compatible_archs};
541 static const char *g_armv7s_compatible_archs[] = {
542 "armv7s",
"armv7",
"armv6m",
"armv6",
"armv5",
543 "armv4",
"arm",
"thumbv7s",
"thumbv7",
"thumbv6m",
544 "thumbv6",
"thumbv5",
"thumbv4t",
"thumb",
546 return {g_armv7s_compatible_archs};
549 static const char *g_armv7m_compatible_archs[] = {
550 "armv7m",
"armv7",
"armv6m",
"armv6",
"armv5",
551 "armv4",
"arm",
"thumbv7m",
"thumbv7",
"thumbv6m",
552 "thumbv6",
"thumbv5",
"thumbv4t",
"thumb",
554 return {g_armv7m_compatible_archs};
557 static const char *g_armv7em_compatible_archs[] = {
558 "armv7em",
"armv7",
"armv6m",
"armv6",
"armv5",
559 "armv4",
"arm",
"thumbv7em",
"thumbv7",
"thumbv6m",
560 "thumbv6",
"thumbv5",
"thumbv4t",
"thumb",
562 return {g_armv7em_compatible_archs};
565 static const char *g_armv6m_compatible_archs[] = {
566 "armv6m",
"armv6",
"armv5",
"armv4",
"arm",
567 "thumbv6m",
"thumbv6",
"thumbv5",
"thumbv4t",
"thumb",
569 return {g_armv6m_compatible_archs};
572 static const char *g_armv6_compatible_archs[] = {
573 "armv6",
"armv5",
"armv4",
"arm",
574 "thumbv6",
"thumbv5",
"thumbv4t",
"thumb",
576 return {g_armv6_compatible_archs};
579 static const char *g_armv5_compatible_archs[] = {
580 "armv5",
"armv4",
"arm",
"thumbv5",
"thumbv4t",
"thumb",
582 return {g_armv5_compatible_archs};
585 static const char *g_armv4_compatible_archs[] = {
591 return {g_armv4_compatible_archs};
601 std::vector<ArchSpec> &archs, std::optional<llvm::Triple::OSType> os) {
606 triple.setArchName(arch);
607 triple.setVendor(llvm::Triple::VendorType::Apple);
615 static FileSpec g_xcode_select_filespec;
617 if (!g_xcode_select_filespec) {
618 FileSpec xcode_select_cmd(
"/usr/bin/xcode-select");
620 int exit_status = -1;
622 std::string command_output;
626 &exit_status, &signo, &command_output,
627 std::chrono::seconds(2),
629 if (status.
Success() && exit_status == 0 && !command_output.empty()) {
630 size_t first_non_newline = command_output.find_last_not_of(
"\r\n");
631 if (first_non_newline != std::string::npos) {
632 command_output.erase(first_non_newline + 1);
634 g_xcode_select_filespec =
FileSpec(command_output);
639 return g_xcode_select_filespec;
644 static const char *g_bp_names[] = {
645 "start_wqthread",
"_pthread_wqthread",
"_pthread_start",
648 static const char *g_bp_modules[] = {
"libsystem_c.dylib",
649 "libSystem.B.dylib"};
652 for (
size_t i = 0; i < std::size(g_bp_modules); i++) {
653 const char *bp_module = g_bp_modules[i];
657 bool internal =
true;
658 bool hardware =
false;
661 std::size(g_bp_names), eFunctionNameTypeFull,
664 bp_sp->SetBreakpointKind(
"thread-creation");
675 std::string shell_string = shell.
GetPath();
676 const char *shell_name = strrchr(shell_string.c_str(),
'/');
677 if (shell_name ==
nullptr)
678 shell_name = shell_string.c_str();
682 if (strcmp(shell_name,
"sh") == 0) {
686 if (launch_info.
GetEnvironment().lookup(
"COMMAND_MODE") ==
"legacy")
689 }
else if (strcmp(shell_name,
"csh") == 0 ||
690 strcmp(shell_name,
"tcsh") == 0 ||
691 strcmp(shell_name,
"zsh") == 0) {
716 error.SetErrorString(
"the platform is not currently connected");
726 static FileSpec g_command_line_tools_filespec;
728 if (!g_command_line_tools_filespec) {
732 g_command_line_tools_filespec = command_line_tools_path;
736 return g_command_line_tools_filespec;
740 void *baton, llvm::sys::fs::file_type file_type, llvm::StringRef path) {
760 const bool find_directories =
true;
761 const bool find_files =
false;
762 const bool find_other =
true;
766 enumerator_info.
sdk_type = sdk_type;
769 sdks_spec.
GetPath(), find_directories, find_files, find_other,
779 FileSpec sdks_spec = HostInfo::GetXcodeContentsDirectory();
803 llvm_unreachable(
"unsupported sdk");
810 llvm::VersionTuple version = HostInfo::GetOSVersion();
812 if (!version.empty()) {
824 FileSpec native_sdk_spec = sdks_spec;
826 native_sdk_name.
Printf(
"MacOSX%u.%u.sdk", version.getMajor(),
827 version.getMinor().value_or(0));
831 return native_sdk_spec;
840std::tuple<llvm::VersionTuple, llvm::StringRef>
842 llvm::StringRef build;
843 llvm::StringRef version_str;
844 llvm::StringRef build_str;
845 std::tie(version_str, build_str) = dir.split(
' ');
846 llvm::VersionTuple version;
847 if (!version.tryParse(version_str) ||
849 if (build_str.consume_front(
"(")) {
850 size_t pos = build_str.find(
')');
851 build = build_str.slice(0, pos);
855 return std::make_tuple(version, build);
858llvm::Expected<StructuredData::DictionarySP>
860 static constexpr llvm::StringLiteral crash_info_key(
"Crash-Info Annotations");
861 static constexpr llvm::StringLiteral asi_info_key(
862 "Application Specific Information");
869 if (!process_dict_sp->GetValueForKeyAsArray(crash_info_key, annotations)) {
871 if (new_annotations_sp && new_annotations_sp->GetSize()) {
872 process_dict_sp->AddItem(crash_info_key, new_annotations_sp);
873 annotations = new_annotations_sp.get();
879 if (!process_dict_sp->GetValueForKeyAsDictionary(asi_info_key,
880 app_specific_info)) {
882 if (new_app_specific_info_sp && new_app_specific_info_sp->GetSize()) {
883 process_dict_sp->AddItem(asi_info_key, new_app_specific_info_sp);
884 app_specific_info = new_app_specific_info_sp.get();
890 return process_dict_sp->
GetSize() ? process_dict_sp :
nullptr;
904 std::string module_name = module->GetSpecificationDescription();
908 if (module_name ==
"/usr/lib/dyld")
912 LLDB_LOG(log,
"Module {0} doesn't have any section!", module_name);
918 LLDB_LOG(log,
"Module {0} doesn't have section {1}!", module_name,
923 addr_t load_addr = crash_info->GetLoadBaseAddress(&target);
926 LLDB_LOG(log,
"Module {0} has an invalid '{1}' section load address: {2}",
927 module_name, section_name, load_addr);
935 expected_size,
error);
937 if (expected_size != bytes_read ||
error.Fail()) {
938 LLDB_LOG(log,
"Failed to read {0} section from memory in module {1}: {2}",
939 section_name, module_name,
error);
946 "Annotation version lower than 5 unsupported! Module {0} has "
947 "version {1} instead.",
948 module_name, annotations.
version);
953 LLDB_LOG(log,
"No message available for module {0}.", module_name);
961 if (message.empty() || bytes_read != message.size() ||
error.Fail()) {
962 LLDB_LOG(log,
"Failed to read the message from memory in module {0}: {1}",
968 if (message.back() ==
'\n')
972 LLDB_LOG(log,
"No message2 available for module {0}.", module_name);
974 std::string message2;
978 if (!message2.empty() && bytes_read == message2.size() &&
error.Success())
979 if (message2.back() ==
'\n')
983 std::make_shared<StructuredData::Dictionary>();
985 entry_sp->AddStringItem(
"image", module->GetFileSpec().GetPath(
false));
986 entry_sp->AddStringItem(
"uuid", module->GetUUID().GetAsString());
987 entry_sp->AddStringItem(
"message", message);
988 entry_sp->AddStringItem(
"message2", message2);
989 entry_sp->AddIntegerItem(
"abort-cause", annotations.
abort_cause);
991 array_sp->AddItem(entry_sp);
1001 if (!metadata_sp || !metadata_sp->GetSize() || !metadata_sp->HasKey(
"asi"))
1005 if (!metadata_sp->GetValueForKeyAsDictionary(
"asi", asi))
1009 std::make_shared<StructuredData::Dictionary>();
1011 auto flatten_asi_dict = [&dict_sp](llvm::StringRef key,
1024 asi->
ForEach(flatten_asi_dict);
1031 const std::vector<std::string> apple_arguments = {
1032 "-x",
"objective-c++",
"-fobjc-arc",
1033 "-fblocks",
"-D_ISO646_H",
"-D__ISO646_H",
1034 "-fgnuc-version=4.2.1"};
1036 options.insert(options.end(), apple_arguments.begin(), apple_arguments.end());
1039 bool use_current_os_version =
false;
1041 auto get_host_os = []() {
return HostInfo::GetTargetTriple().getOS(); };
1044 use_current_os_version = get_host_os() == llvm::Triple::MacOSX;
1047 use_current_os_version = get_host_os() == llvm::Triple::IOS;
1050 use_current_os_version = get_host_os() == llvm::Triple::TvOS;
1053 use_current_os_version = get_host_os() == llvm::Triple::WatchOS;
1056 use_current_os_version = get_host_os() == llvm::Triple::XROS;
1062 llvm::VersionTuple version;
1063 if (use_current_os_version)
1069 if (exe_module_sp) {
1070 ObjectFile *object_file = exe_module_sp->GetObjectFile();
1079#define OPTION(PREFIX, NAME, VAR, ...) \
1080 llvm::StringRef opt_##VAR = NAME; \
1082#include "clang/Driver/Options.inc"
1084 minimum_version_option <<
'-';
1087 minimum_version_option << opt_mmacos_version_min_EQ;
1090 minimum_version_option << opt_mios_simulator_version_min_EQ;
1093 minimum_version_option << opt_mios_version_min_EQ;
1096 minimum_version_option << opt_mtvos_simulator_version_min_EQ;
1099 minimum_version_option << opt_mtvos_version_min_EQ;
1102 minimum_version_option << opt_mwatchos_simulator_version_min_EQ;
1105 minimum_version_option << opt_mwatchos_version_min_EQ;
1115 info.
type = sdk_type;
1116 LLDB_LOGF(log,
"Clang modules on %s are not supported",
1121 minimum_version_option << version.getAsString();
1122 options.emplace_back(std::string(minimum_version_option.
GetString()));
1131 sysroot_spec =
FileSpec(*path_or_err);
1134 path_or_err.takeError(),
1135 "Failed to resolve SDK path: {0}");
1141 std::lock_guard<std::mutex> guard(
m_mutex);
1146 options.push_back(
"-isysroot");
1147 options.push_back(sysroot_spec.
GetPath());
1166 llvm::VersionTuple result;
1167 if (!result.tryParse(env.lookup(
"SIMULATOR_RUNTIME_VERSION")))
1170 std::string dyld_root_path = env.lookup(
"DYLD_ROOT_PATH");
1171 if (!dyld_root_path.empty()) {
1172 dyld_root_path +=
"/System/Library/CoreServices/SystemVersion.plist";
1174 std::string product_version;
1177 if (!result.tryParse(product_version))
1185 return llvm::VersionTuple();
1194 static std::vector<FileSpec> g_executable_dirs;
1198 static llvm::once_flag g_once_flag;
1199 llvm::call_once(g_once_flag, []() {
1202 FileSpec xcode_contents_dir = HostInfo::GetXcodeContentsDirectory();
1203 if (xcode_contents_dir) {
1204 FileSpec xcode_lldb_resources = xcode_contents_dir;
1211 g_executable_dirs.push_back(dir);
1216 if (command_line_tools_dir) {
1217 FileSpec cmd_line_lldb_resources = command_line_tools_dir;
1224 g_executable_dirs.push_back(dir);
1231 for (
const auto &executable_dir : g_executable_dirs) {
1233 executable_file.
SetDirectory(executable_dir.GetDirectory());
1236 return executable_file;
1251 const char *disable_env_var =
"IDE_DISABLED_OS_ACTIVITY_DT_MODE";
1253 if (!env_vars.count(disable_env_var)) {
1256 env_vars.try_emplace(
"OS_ACTIVITY_DT_MODE",
"enable");
1270 if (!module_sp && module_search_paths_ptr && platform_file) {
1279 std::vector<llvm::StringRef> path_parts = platform_file.
GetComponents();
1281 std::reverse(path_parts.begin(), path_parts.end());
1282 const size_t path_parts_size = path_parts.size();
1284 size_t num_module_search_paths = module_search_paths_ptr->
GetSize();
1285 for (
size_t i = 0; i < num_module_search_paths; ++i) {
1289 "PlatformRemoteDarwinDevice::GetSharedModule searching for binary in "
1297 for (
size_t j = 0; j < 4 && j < path_parts_size - 1; ++j) {
1311 for (
int k = j; k >= 0; --k) {
1320 nullptr, old_modules, did_create_ptr));
1323 module_sp->SetPlatformFileSpec(path_to_try);
1334 llvm::StringRef component) {
1335 auto begin = llvm::sys::path::begin(path);
1336 auto end = llvm::sys::path::end(path);
1337 for (
auto it = begin; it != end; ++it) {
1338 if (it->contains(component)) {
1339 llvm::SmallString<128> buffer;
1340 llvm::sys::path::append(buffer, begin, ++it,
1341 llvm::sys::path::Style::posix);
1342 return buffer.str().str();
1349 if (
FileSpec fspec = HostInfo::GetShlibDir())
1355 if (
FileSpec fspec = HostInfo::GetShlibDir())
1361#if !defined(__APPLE__)
1362 return llvm::Triple::MacOSX;
1365 return llvm::Triple::MacOSX;
1367 return llvm::Triple::IOS;
1368#elif TARGET_OS_WATCH
1369 return llvm::Triple::WatchOS;
1371 return llvm::Triple::TvOS;
1372#elif TARGET_OS_BRIDGE
1373 return llvm::Triple::BridgeOS;
1375 return llvm::Triple::XROS;
1377#error "LLDB being compiled for an unrecognized Darwin OS"
1382llvm::Expected<std::pair<XcodeSDK, bool>>
1386 return llvm::createStringError(
1387 llvm::inconvertibleErrorCode(),
1388 llvm::formatv(
"No symbol file available for module '{0}'",
1391 bool found_public_sdk =
false;
1392 bool found_internal_sdk =
false;
1398 found_public_sdk |= !is_internal_sdk;
1399 found_internal_sdk |= is_internal_sdk;
1401 merged_sdk.
Merge(cu_sdk);
1405 const bool found_mismatch = found_internal_sdk && found_public_sdk;
1407 return std::pair{std::move(merged_sdk), found_mismatch};
1410llvm::Expected<std::string>
1414 return llvm::createStringError(
1415 llvm::inconvertibleErrorCode(),
1416 llvm::formatv(
"Failed to parse SDK path from debug-info: {0}",
1417 llvm::toString(sdk_or_err.takeError())));
1419 auto [sdk, _] = std::move(*sdk_or_err);
1421 auto path_or_err = HostInfo::GetSDKRoot(HostInfo::SDKOptions{sdk});
1423 return llvm::createStringError(
1424 llvm::inconvertibleErrorCode(),
1425 llvm::formatv(
"Error while searching for SDK (XcodeSDK '{0}'): {1}",
1427 llvm::toString(path_or_err.takeError())));
1429 return path_or_err->str();
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.
#define LLDB_LOGF(log,...)
#define LLDB_LOG_ERROR(log, error,...)
bool GetValueAsString(const char *key, std::string &value) const
An architecture specification class.
bool IsExactMatch(const ArchSpec &rhs) const
Shorthand for IsMatch(rhs, ExactMatch).
llvm::Triple::ArchType GetMachine() const
Returns a machine family for the current architecture.
A command line argument class.
void AppendArgument(llvm::StringRef arg_str, char quote_char='\0')
Appends a new argument to the end of the list argument list.
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 uniqued constant string class.
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.
const char * GetCString() const
Get the string value as a C string.
A class to manage flag bits.
lldb::ScriptLanguage GetScriptLanguage() const
ScriptInterpreter * GetScriptInterpreter(bool can_create=true, std::optional< lldb::ScriptLanguage > language={})
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.
void Append(const FileSpec &file)
Append a FileSpec object to the list.
size_t GetSize() const
Get the number of files in the file list.
void AppendPathComponent(llvm::StringRef component)
void SetDirectory(ConstString directory)
Directory string set accessor.
const ConstString & GetFilename() const
Filename string const get accessor.
std::vector< llvm::StringRef > GetComponents() const
Gets the components of the FileSpec's path.
const ConstString & GetDirectory() const
Directory string const get accessor.
ConstString GetFileNameStrippingExtension() const
Return the filename without the extension part.
size_t GetPath(char *path, size_t max_path_length, bool denormalize=true) const
Extract the full path to the file.
ConstString GetPathAsConstString(bool denormalize=true) const
Get the full path as a ConstString.
void SetFilename(ConstString filename)
Filename string set accessor.
void Resolve(llvm::SmallVectorImpl< char > &path)
Resolve path to make it canonical.
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.
bool Exists(const FileSpec &file_spec) const
Returns whether the given file exists.
static FileSystem & Instance()
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, const Timeout< std::micro > &timeout, bool run_in_shell=true, bool hide_stderr=false)
Run a shell command.
static bool GetProcessInfo(lldb::pid_t pid, ProcessInstanceInfo &proc_info)
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...
ModuleIterable Modules() const
FileSpec & GetSymbolFileSpec()
ArchSpec * GetArchitecturePtr()
A class that describes an executable image and its associated object and symbol files.
virtual SymbolFile * GetSymbolFile(bool can_create=true, Stream *feedback_strm=nullptr)
Get the module's symbol file.
const FileSpec & GetFileSpec() const
Get const accessor for the module file specification.
A plug-in interface definition class for object file parsers.
@ eTypeDynamicLinker
The platform's dynamic linker executable.
virtual llvm::VersionTuple GetMinimumOSVersion()
Get the minimum OS version this object file can run on.
virtual FileSpec & GetFileSpec()
Get accessor to the object file specification.
void SetValidator(ValidatorCallback validator, void *baton=nullptr)
const char * GetCurrentValue() const
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()
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.
lldb::pid_t GetID() const
Returns the pid of the process or LLDB_INVALID_PROCESS_ID if there is no known pid.
size_t ReadMemoryFromInferior(lldb::addr_t vm_addr, void *buf, size_t size, Status &error)
Read of memory from a process.
virtual StructuredData::DictionarySP GetMetadata()
Fetch process defined metadata.
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.
StructuredData::DictionarySP GetExtendedCrashInfoDict()
Fetch extended crash information held by the process.
Target & GetTarget()
Get the target object pointer for this module.
virtual bool IsReservedWord(const char *word)
lldb::SectionSP FindSectionByName(ConstString section_dstr) const
bool Success() const
Test for success condition.
const char * GetData() const
llvm::StringRef GetString() const
A stream class that can stream formatted output to a file.
size_t Printf(const char *format,...) __attribute__((format(printf
Output printf formatted output to the stream.
void AddItem(const ObjectSP &item)
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.
virtual XcodeSDK ParseXcodeSDK(CompileUnit &comp_unit)
Return the Xcode SDK comp_unit was compiled against.
virtual uint32_t GetNumCompileUnits()=0
virtual lldb::CompUnitSP GetCompileUnitAtIndex(uint32_t idx)=0
lldb::ModuleSP GetExecutableModule()
Gets the module for the main executable.
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)
const ModuleList & GetImages() const
Get accessor for the images for this process.
const ArchSpec & GetArchitecture() const
An abstraction for Xcode-style SDKs that works like ArchSpec.
Type
Different types of Xcode SDKs.
void Merge(const XcodeSDK &other)
The merge function follows a strict order to maintain monotonicity:
static std::string GetCanonicalName(Info info)
Return the canonical SDK name, such as "macosx" for the macOS SDK.
bool IsAppleInternalSDK() const
static bool SDKSupportsModules(Type type, llvm::VersionTuple version)
Whether LLDB feels confident importing Clang modules from this SDK.
#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.
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
std::shared_ptr< lldb_private::Module > ModuleSP
A parsed SDK directory name.