44#include "llvm/ADT/STLExtras.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 error.SetErrorStringWithFormat(
"invalid exception type: '%s'",
68 candidate.str().c_str());
106 return "Darwin platform plug-in.";
114#define LLDB_PROPERTIES_platformdarwin
115#include "PlatformMacOSXProperties.inc"
117#define LLDB_PROPERTIES_platformdarwin
119#include "PlatformMacOSXPropertiesEnum.inc"
126 return g_setting_name;
130 m_collection_sp = std::make_shared<OptionValueProperties>(GetSettingName());
131 m_collection_sp->Initialize(g_platformdarwin_properties);
137 const uint32_t idx = ePropertyIgnoredExceptions;
139 m_collection_sp->GetPropertyAtIndexAsOptionValueString(
nullptr,
false,
141 assert(option_value);
146 const uint32_t idx = ePropertyIgnoredExceptions;
148 m_collection_sp->GetPropertyAtIndexAsOptionValueString(
nullptr,
false,
150 assert(option_value);
164 const bool is_global_setting =
false;
167 ConstString(
"Properties for the Darwin platform plug-in."),
176 std::string ignored_exceptions
178 if (ignored_exceptions.empty())
181 std::string packet =
"QSetIgnoredExceptions:";
182 packet.append(ignored_exceptions);
200 FileSpecList file_list;
214 ObjectFile *objfile = symfile->GetObjectFile();
218 llvm::StringRef(symfile_spec.
GetPath())
219 .contains_insensitive(
".dSYM/Contents/Resources/DWARF") &&
222 std::string module_basename(
224 std::string original_module_basename(module_basename);
226 bool was_keyword =
false;
236 std::replace(module_basename.begin(), module_basename.end(),
'.',
238 std::replace(module_basename.begin(), module_basename.end(),
' ',
240 std::replace(module_basename.begin(), module_basename.end(),
'-',
244 if (script_interpreter &&
246 module_basename.insert(module_basename.begin(),
'_');
256 path_string.
Printf(
"%s/../Python/%s.py",
258 module_basename.c_str());
259 original_path_string.
Printf(
260 "%s/../Python/%s.py",
262 original_module_basename.c_str());
271 if (feedback_stream) {
272 if (module_basename != original_module_basename &&
274 const char *reason_for_complaint =
275 was_keyword ?
"conflicts with a keyword"
276 :
"contains reserved characters";
279 "warning: the symbol file '%s' contains a debug "
280 "script. However, its name"
281 " '%s' %s and as such cannot be loaded. LLDB will"
282 " load '%s' instead. Consider removing the file with "
283 "the malformed name to"
284 " eliminate this warning.\n",
285 symfile_spec.
GetPath().c_str(),
286 original_path_string.
GetData(), reason_for_complaint,
290 "warning: the symbol file '%s' contains a debug "
291 "script. However, its name"
292 " %s and as such cannot be loaded. If you intend"
293 " to have this script loaded, please rename '%s' to "
295 symfile_spec.
GetPath().c_str(), reason_for_complaint,
301 file_list.Append(script_fspec);
309 if (module_spec.
GetFilename() == filename_no_extension)
335 const FileSpecList *module_search_paths_ptr,
345 module_spec, process, module_sp, module_search_paths_ptr, old_modules,
353 module_search_paths_ptr, old_modules,
357 if (!module_sp && module_search_paths_ptr && platform_file) {
362 if (platform_file == bundle_directory) {
367 new_module_spec, process, module_sp,
nullptr, old_modules,
376 platform_file.
GetPath(platform_path,
sizeof(platform_path));
377 const size_t bundle_directory_len =
378 bundle_directory.
GetPath(bundle_dir,
sizeof(bundle_dir));
380 size_t num_module_search_paths = module_search_paths_ptr->GetSize();
381 for (
size_t i = 0; i < num_module_search_paths; ++i) {
382 const size_t search_path_len =
383 module_search_paths_ptr->GetFileSpecAtIndex(i).GetPath(
384 new_path,
sizeof(new_path));
385 if (search_path_len <
sizeof(new_path)) {
386 snprintf(new_path + search_path_len,
387 sizeof(new_path) - search_path_len,
"/%s",
388 platform_path + bundle_directory_len);
394 new_module_spec, process, module_sp,
nullptr, old_modules,
398 module_sp->SetPlatformFileSpec(new_file_spec);
409 module_sp->SetPlatformFileSpec(module_spec.
GetFileSpec());
416 const uint8_t *trap_opcode =
nullptr;
418 bool bp_is_thumb =
false;
422 case llvm::Triple::aarch64_32:
423 case llvm::Triple::aarch64: {
425 static const uint8_t g_arm64_breakpoint_opcode[] = {0x00, 0x00, 0x20, 0xD4};
426 trap_opcode = g_arm64_breakpoint_opcode;
427 trap_opcode_size =
sizeof(g_arm64_breakpoint_opcode);
430 case llvm::Triple::thumb:
433 case llvm::Triple::arm: {
434 static const uint8_t g_arm_breakpoint_opcode[] = {0xFE, 0xDE, 0xFF, 0xE7};
435 static const uint8_t g_thumb_breakpooint_opcode[] = {0xFE, 0xDE};
441 bp_is_thumb = bp_loc_sp->GetAddress().GetAddressClass() ==
445 trap_opcode = g_thumb_breakpooint_opcode;
446 trap_opcode_size =
sizeof(g_thumb_breakpooint_opcode);
449 trap_opcode = g_arm_breakpoint_opcode;
450 trap_opcode_size =
sizeof(g_arm_breakpoint_opcode);
453 case llvm::Triple::ppc:
454 case llvm::Triple::ppc64: {
455 static const uint8_t g_ppc_breakpoint_opcode[] = {0x7F, 0xC0, 0x00, 0x08};
456 trap_opcode = g_ppc_breakpoint_opcode;
457 trap_opcode_size =
sizeof(g_ppc_breakpoint_opcode);
464 if (trap_opcode && trap_opcode_size) {
466 return trap_opcode_size;
476 ObjectFile *obj_file = module_sp->GetObjectFile();
485 std::vector<ArchSpec> &archs) {
486 ArchSpec host_arch = HostInfo::GetArchitecture(HostInfo::eArchKindDefault);
487 archs.push_back(host_arch);
490 archs.push_back(
ArchSpec(
"x86_64-apple-macosx"));
491 archs.push_back(HostInfo::GetArchitecture(HostInfo::eArchKind32));
493 ArchSpec host_arch64 = HostInfo::GetArchitecture(HostInfo::eArchKind64);
495 archs.push_back(HostInfo::GetArchitecture(HostInfo::eArchKind32));
504 static const char *g_arm64e_compatible_archs[] = {
505 "arm64e",
"arm64",
"armv7",
"armv7f",
"armv7k",
"armv7s",
506 "armv7m",
"armv7em",
"armv6m",
"armv6",
"armv5",
"armv4",
507 "arm",
"thumbv7",
"thumbv7f",
"thumbv7k",
"thumbv7s",
"thumbv7m",
508 "thumbv7em",
"thumbv6m",
"thumbv6",
"thumbv5",
"thumbv4t",
"thumb",
510 return {g_arm64e_compatible_archs};
513 static const char *g_arm64_compatible_archs[] = {
514 "arm64",
"armv7",
"armv7f",
"armv7k",
"armv7s",
"armv7m",
515 "armv7em",
"armv6m",
"armv6",
"armv5",
"armv4",
"arm",
516 "thumbv7",
"thumbv7f",
"thumbv7k",
"thumbv7s",
"thumbv7m",
"thumbv7em",
517 "thumbv6m",
"thumbv6",
"thumbv5",
"thumbv4t",
"thumb",
519 return {g_arm64_compatible_archs};
522 static const char *g_armv7_compatible_archs[] = {
523 "armv7",
"armv6m",
"armv6",
"armv5",
"armv4",
"arm",
524 "thumbv7",
"thumbv6m",
"thumbv6",
"thumbv5",
"thumbv4t",
"thumb",
526 return {g_armv7_compatible_archs};
529 static const char *g_armv7f_compatible_archs[] = {
530 "armv7f",
"armv7",
"armv6m",
"armv6",
"armv5",
531 "armv4",
"arm",
"thumbv7f",
"thumbv7",
"thumbv6m",
532 "thumbv6",
"thumbv5",
"thumbv4t",
"thumb",
534 return {g_armv7f_compatible_archs};
537 static const char *g_armv7k_compatible_archs[] = {
538 "armv7k",
"armv7",
"armv6m",
"armv6",
"armv5",
539 "armv4",
"arm",
"thumbv7k",
"thumbv7",
"thumbv6m",
540 "thumbv6",
"thumbv5",
"thumbv4t",
"thumb",
542 return {g_armv7k_compatible_archs};
545 static const char *g_armv7s_compatible_archs[] = {
546 "armv7s",
"armv7",
"armv6m",
"armv6",
"armv5",
547 "armv4",
"arm",
"thumbv7s",
"thumbv7",
"thumbv6m",
548 "thumbv6",
"thumbv5",
"thumbv4t",
"thumb",
550 return {g_armv7s_compatible_archs};
553 static const char *g_armv7m_compatible_archs[] = {
554 "armv7m",
"armv7",
"armv6m",
"armv6",
"armv5",
555 "armv4",
"arm",
"thumbv7m",
"thumbv7",
"thumbv6m",
556 "thumbv6",
"thumbv5",
"thumbv4t",
"thumb",
558 return {g_armv7m_compatible_archs};
561 static const char *g_armv7em_compatible_archs[] = {
562 "armv7em",
"armv7",
"armv6m",
"armv6",
"armv5",
563 "armv4",
"arm",
"thumbv7em",
"thumbv7",
"thumbv6m",
564 "thumbv6",
"thumbv5",
"thumbv4t",
"thumb",
566 return {g_armv7em_compatible_archs};
569 static const char *g_armv6m_compatible_archs[] = {
570 "armv6m",
"armv6",
"armv5",
"armv4",
"arm",
571 "thumbv6m",
"thumbv6",
"thumbv5",
"thumbv4t",
"thumb",
573 return {g_armv6m_compatible_archs};
576 static const char *g_armv6_compatible_archs[] = {
577 "armv6",
"armv5",
"armv4",
"arm",
578 "thumbv6",
"thumbv5",
"thumbv4t",
"thumb",
580 return {g_armv6_compatible_archs};
583 static const char *g_armv5_compatible_archs[] = {
584 "armv5",
"armv4",
"arm",
"thumbv5",
"thumbv4t",
"thumb",
586 return {g_armv5_compatible_archs};
589 static const char *g_armv4_compatible_archs[] = {
595 return {g_armv4_compatible_archs};
605 std::vector<ArchSpec> &archs, std::optional<llvm::Triple::OSType> os) {
610 triple.setArchName(arch);
611 triple.setVendor(llvm::Triple::VendorType::Apple);
619 static FileSpec g_xcode_select_filespec;
621 if (!g_xcode_select_filespec) {
622 FileSpec xcode_select_cmd(
"/usr/bin/xcode-select");
624 int exit_status = -1;
626 std::string command_output;
630 &exit_status, &signo, &command_output,
631 std::chrono::seconds(2),
633 if (status.
Success() && exit_status == 0 && !command_output.empty()) {
634 size_t first_non_newline = command_output.find_last_not_of(
"\r\n");
635 if (first_non_newline != std::string::npos) {
636 command_output.erase(first_non_newline + 1);
638 g_xcode_select_filespec =
FileSpec(command_output);
643 return g_xcode_select_filespec;
648 static const char *g_bp_names[] = {
649 "start_wqthread",
"_pthread_wqthread",
"_pthread_start",
652 static const char *g_bp_modules[] = {
"libsystem_c.dylib",
653 "libSystem.B.dylib"};
655 FileSpecList bp_modules;
656 for (
size_t i = 0; i < std::size(g_bp_modules); i++) {
657 const char *bp_module = g_bp_modules[i];
658 bp_modules.EmplaceBack(bp_module);
661 bool internal =
true;
662 bool hardware =
false;
665 std::size(g_bp_names), eFunctionNameTypeFull,
668 bp_sp->SetBreakpointKind(
"thread-creation");
679 std::string shell_string = shell.
GetPath();
680 const char *shell_name = strrchr(shell_string.c_str(),
'/');
681 if (shell_name ==
nullptr)
682 shell_name = shell_string.c_str();
686 if (strcmp(shell_name,
"sh") == 0) {
690 if (launch_info.
GetEnvironment().lookup(
"COMMAND_MODE") ==
"legacy")
693 }
else if (strcmp(shell_name,
"csh") == 0 ||
694 strcmp(shell_name,
"tcsh") == 0 ||
695 strcmp(shell_name,
"zsh") == 0) {
705 ProcessSP process_sp;
720 error.SetErrorString(
"the platform is not currently connected");
730 static FileSpec g_command_line_tools_filespec;
732 if (!g_command_line_tools_filespec) {
736 g_command_line_tools_filespec = command_line_tools_path;
740 return g_command_line_tools_filespec;
744 void *baton, llvm::sys::fs::file_type file_type, llvm::StringRef path) {
764 const bool find_directories =
true;
765 const bool find_files =
false;
766 const bool find_other =
true;
770 enumerator_info.
sdk_type = sdk_type;
773 sdks_spec.
GetPath(), find_directories, find_files, find_other,
783 FileSpec sdks_spec = HostInfo::GetXcodeContentsDirectory();
804 llvm_unreachable(
"unsupported sdk");
811 llvm::VersionTuple version = HostInfo::GetOSVersion();
813 if (!version.empty()) {
825 FileSpec native_sdk_spec = sdks_spec;
827 native_sdk_name.
Printf(
"MacOSX%u.%u.sdk", version.getMajor(),
828 version.getMinor().value_or(0));
832 return native_sdk_spec;
841std::tuple<llvm::VersionTuple, llvm::StringRef>
843 llvm::StringRef build;
844 llvm::StringRef version_str;
845 llvm::StringRef build_str;
846 std::tie(version_str, build_str) = dir.split(
' ');
847 llvm::VersionTuple version;
848 if (!version.tryParse(version_str) ||
850 if (build_str.consume_front(
"(")) {
851 size_t pos = build_str.find(
')');
852 build = build_str.slice(0, pos);
856 return std::make_tuple(version, build);
859llvm::Expected<StructuredData::DictionarySP>
862 std::make_shared<StructuredData::Dictionary>();
865 if (annotations && annotations->GetSize())
866 extended_crash_info->AddItem(
"Crash-Info Annotations", annotations);
870 if (app_specific_info && app_specific_info->GetSize())
871 extended_crash_info->AddItem(
"Application Specific Information",
874 return extended_crash_info->GetSize() ? extended_crash_info :
nullptr;
888 std::string module_name = module->GetSpecificationDescription();
892 if (module_name ==
"/usr/lib/dyld")
896 LLDB_LOG(log,
"Module {0} doesn't have any section!", module_name);
902 LLDB_LOG(log,
"Module {0} doesn't have section {1}!", module_name,
907 addr_t load_addr = crash_info->GetLoadBaseAddress(&target);
910 LLDB_LOG(log,
"Module {0} has an invalid '{1}' section load address: {2}",
911 module_name, section_name, load_addr);
919 expected_size,
error);
921 if (expected_size != bytes_read ||
error.Fail()) {
922 LLDB_LOG(log,
"Failed to read {0} section from memory in module {1}: {2}",
923 section_name, module_name,
error);
930 "Annotation version lower than 5 unsupported! Module {0} has "
931 "version {1} instead.",
932 module_name, annotations.
version);
937 LLDB_LOG(log,
"No message available for module {0}.", module_name);
945 if (message.empty() || bytes_read != message.size() ||
error.Fail()) {
946 LLDB_LOG(log,
"Failed to read the message from memory in module {0}: {1}",
952 if (message.back() ==
'\n')
956 LLDB_LOG(log,
"No message2 available for module {0}.", module_name);
958 std::string message2;
962 if (!message2.empty() && bytes_read == message2.size() &&
error.Success())
963 if (message2.back() ==
'\n')
967 std::make_shared<StructuredData::Dictionary>();
969 entry_sp->AddStringItem(
"image", module->GetFileSpec().GetPath(
false));
970 entry_sp->AddStringItem(
"uuid", module->GetUUID().GetAsString());
971 entry_sp->AddStringItem(
"message", message);
972 entry_sp->AddStringItem(
"message2", message2);
973 entry_sp->AddIntegerItem(
"abort-cause", annotations.
abort_cause);
975 array_sp->AddItem(entry_sp);
985 if (!metadata_sp || !metadata_sp->GetSize() || !metadata_sp->HasKey(
"asi"))
989 if (!metadata_sp->GetValueForKeyAsDictionary(
"asi", asi))
993 std::make_shared<StructuredData::Dictionary>();
995 auto flatten_asi_dict = [&dict_sp](
ConstString key,
1008 asi->
ForEach(flatten_asi_dict);
1015 const std::vector<std::string> apple_arguments = {
1016 "-x",
"objective-c++",
"-fobjc-arc",
1017 "-fblocks",
"-D_ISO646_H",
"-D__ISO646_H",
1018 "-fgnuc-version=4.2.1"};
1020 options.insert(options.end(), apple_arguments.begin(), apple_arguments.end());
1023 bool use_current_os_version =
false;
1025 auto get_host_os = []() {
return HostInfo::GetTargetTriple().getOS(); };
1028 use_current_os_version = get_host_os() == llvm::Triple::MacOSX;
1031 use_current_os_version = get_host_os() == llvm::Triple::IOS;
1034 use_current_os_version = get_host_os() == llvm::Triple::TvOS;
1037 use_current_os_version = get_host_os() == llvm::Triple::WatchOS;
1043 llvm::VersionTuple version;
1044 if (use_current_os_version)
1050 if (exe_module_sp) {
1051 ObjectFile *object_file = exe_module_sp->GetObjectFile();
1058#define OPTION(PREFIX, NAME, VAR, ...) \
1059 llvm::StringRef opt_##VAR = NAME; \
1061#include "clang/Driver/Options.inc"
1063 minimum_version_option <<
'-';
1066 minimum_version_option << opt_mmacos_version_min_EQ;
1069 minimum_version_option << opt_mios_simulator_version_min_EQ;
1072 minimum_version_option << opt_mios_version_min_EQ;
1075 minimum_version_option << opt_mtvos_simulator_version_min_EQ;
1078 minimum_version_option << opt_mtvos_version_min_EQ;
1081 minimum_version_option << opt_mwatchos_simulator_version_min_EQ;
1084 minimum_version_option << opt_mwatchos_version_min_EQ;
1091 info.
type = sdk_type;
1092 LLDB_LOGF(log,
"Clang modules on %s are not supported",
1097 minimum_version_option << version.getAsString();
1098 options.emplace_back(std::string(minimum_version_option.
GetString()));
1104 std::lock_guard<std::mutex> guard(
m_mutex);
1109 options.push_back(
"-isysroot");
1110 options.push_back(sysroot_spec.
GetPath());
1129 llvm::VersionTuple result;
1130 if (!result.tryParse(env.lookup(
"SIMULATOR_RUNTIME_VERSION")))
1133 std::string dyld_root_path = env.lookup(
"DYLD_ROOT_PATH");
1134 if (!dyld_root_path.empty()) {
1135 dyld_root_path +=
"/System/Library/CoreServices/SystemVersion.plist";
1137 std::string product_version;
1140 if (!result.tryParse(product_version))
1148 return llvm::VersionTuple();
1157 static std::vector<FileSpec> g_executable_dirs;
1161 static llvm::once_flag g_once_flag;
1162 llvm::call_once(g_once_flag, []() {
1165 FileSpec xcode_contents_dir = HostInfo::GetXcodeContentsDirectory();
1166 if (xcode_contents_dir) {
1167 FileSpec xcode_lldb_resources = xcode_contents_dir;
1174 g_executable_dirs.push_back(dir);
1179 if (command_line_tools_dir) {
1180 FileSpec cmd_line_lldb_resources = command_line_tools_dir;
1187 g_executable_dirs.push_back(dir);
1194 for (
const auto &executable_dir : g_executable_dirs) {
1196 executable_file.
SetDirectory(executable_dir.GetDirectory());
1199 return executable_file;
1214 const char *disable_env_var =
"IDE_DISABLED_OS_ACTIVITY_DT_MODE";
1216 if (!env_vars.count(disable_env_var)) {
1219 env_vars.try_emplace(
"OS_ACTIVITY_DT_MODE",
"enable");
1228 const FileSpecList *module_search_paths_ptr,
1233 if (!module_sp && module_search_paths_ptr && platform_file) {
1242 FileSpec platform_pull_upart(platform_file);
1243 std::vector<std::string> path_parts;
1244 path_parts.push_back(
1250 const size_t path_parts_size = path_parts.size();
1252 size_t num_module_search_paths = module_search_paths_ptr->GetSize();
1253 for (
size_t i = 0; i < num_module_search_paths; ++i) {
1257 "PlatformRemoteDarwinDevice::GetSharedModule searching for binary in "
1259 module_search_paths_ptr->GetFileSpecAtIndex(i).GetPath().c_str());
1265 for (
size_t j = 0; j < 4 && j < path_parts_size - 1; ++j) {
1266 FileSpec path_to_try(module_search_paths_ptr->GetFileSpecAtIndex(i));
1279 for (
int k = j; k >= 0; --k) {
1288 nullptr, old_modules, did_create_ptr));
1291 module_sp->SetPlatformFileSpec(path_to_try);
1302 llvm::StringRef component) {
1303 auto begin = llvm::sys::path::begin(path);
1304 auto end = llvm::sys::path::end(path);
1305 for (
auto it = begin; it != end; ++it) {
1306 if (it->contains(component)) {
1307 llvm::SmallString<128> buffer;
1308 llvm::sys::path::append(buffer, begin, ++it,
1309 llvm::sys::path::Style::posix);
1310 return buffer.str().str();
1317 if (
FileSpec fspec = HostInfo::GetShlibDir())
1323 if (
FileSpec fspec = HostInfo::GetShlibDir())
1329#if !defined(__APPLE__)
1330 return llvm::Triple::MacOSX;
1333 return llvm::Triple::MacOSX;
1335 return llvm::Triple::IOS;
1336#elif TARGET_OS_WATCH
1337 return llvm::Triple::WatchOS;
1339 return llvm::Triple::TvOS;
1340#elif TARGET_OS_BRIDGE
1341 return llvm::Triple::BridgeOS;
1343#error "LLDB being compiled for an unrecognized Darwin OS"
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,...)
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 GetOwnerAtIndex(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={})
void AppendPathComponent(llvm::StringRef component)
void SetDirectory(ConstString directory)
Directory string set accessor.
const ConstString & GetFilename() const
Filename string const get accessor.
bool RemoveLastPathComponent()
Removes the last path component by replacing the current path with its parent.
ConstString GetLastPathComponent() const
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, ConstString setting_name)
static bool CreateSettingForPlatformPlugin(Debugger &debugger, const lldb::OptionValuePropertiesSP &properties_sp, ConstString description, bool is_global_property)
static bool UnregisterPlugin(ABICreateInstance create_callback)
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.
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(ConstString key, Object *object)> const &callback) const
std::shared_ptr< Dictionary > DictionarySP
std::shared_ptr< Array > ArraySP
Provides public interface for all SymbolFiles.
static FileSpec FindSymbolFileInBundle(const FileSpec &dsym_bundle_fspec, const lldb_private::UUID *uuid, const ArchSpec *arch)
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
Type
Different types of Xcode SDKs.
static std::string GetCanonicalName(Info info)
Return the canonical SDK name, such as "macosx" for the macOS SDK.
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.
@ eLanguageTypeUnknown
Unknown or invalid language value.
A parsed SDK directory name.