70#include "llvm/ADT/ScopeExit.h"
71#include "llvm/ADT/SetVector.h"
72#include "llvm/Support/ThreadPool.h"
84struct ExecutableInstaller {
87 : m_platform{platform}, m_module{module},
88 m_local_file{m_module->GetFileSpec()},
89 m_remote_file{m_module->GetRemoteInstallFileSpec()} {}
91 void setupRemoteFile()
const { m_module->SetPlatformFileSpec(m_remote_file); }
95 const FileSpec m_local_file;
96 const FileSpec m_remote_file;
99struct MainExecutableInstaller {
102 ProcessLaunchInfo &launch_info)
103 : m_platform{platform}, m_module{module},
104 m_local_file{m_module->GetFileSpec()},
106 getRemoteFileSpec(m_platform, target, m_module, m_local_file)},
107 m_launch_info{launch_info} {}
109 void setupRemoteFile()
const {
110 m_module->SetPlatformFileSpec(m_remote_file);
113 m_platform->SetFilePermissions(m_remote_file, 0700 );
118 const FileSpec m_local_file;
119 const FileSpec m_remote_file;
124 const FileSpec &local_file) {
125 FileSpec remote_file =
module->GetRemoteInstallFileSpec();
126 if (remote_file || !target->GetAutoInstallMainExecutable())
132 remote_file = platform->GetRemoteWorkingDirectory();
138 ProcessLaunchInfo &m_launch_info;
144template <
typename Installer>
146 if (!installer.m_local_file || !installer.m_remote_file)
149 Status error = installer.m_platform->Install(installer.m_local_file,
150 installer.m_remote_file);
154 installer.setupRemoteFile();
171 static constexpr llvm::StringLiteral class_name(
"lldb.target");
200 static_cast<void *
>(
this));
203 "Target::Target created with architecture {0} ({1})",
205 target_arch.
GetTriple().getTriple().c_str());
213 LLDB_LOG(log,
"{0} Target::~Target()",
static_cast<void *
>(
this));
223 if (breakpoint_sp->IsInternal())
268 std::unique_lock<std::recursive_mutex> lock;
299 llvm::StringRef plugin_name,
306 listener_sp, crash_file, can_connect);
313 const char *repl_options,
bool can_create) {
321 language = *single_lang;
322 }
else if (repl_languages.
Empty()) {
324 "LLDB isn't configured with REPL support for any languages.");
328 "Multiple possible REPL languages. Please specify a language.");
333 REPLMap::iterator pos =
m_repl_map.find(language);
341 "Couldn't find an existing REPL for %s, and can't create a new one",
356 "Couldn't create a REPL for %s",
370 std::lock_guard<std::recursive_mutex> guard(
m_mutex);
377 const bool notify =
false;
401 return abi_sp->GetPluginName();
434 shared_lib_filter.
Append(main_module_sp->GetFileSpec());
435 llvm::SetVector<std::string, std::vector<std::string>,
436 std::unordered_set<std::string>>
445 if (!entryPointName.empty())
446 entryPointNamesSet.insert(entryPointName);
448 if (entryPointNamesSet.empty()) {
454 nullptr, entryPointNamesSet.takeVector(),
455 eFunctionNameTypeFull,
465 bp_sp->SetOneShot(
true);
472 const std::unordered_set<std::string> &function_names,
476 containingModules, source_file_spec_list));
480 nullptr, std::move(source_regex), function_names,
481 !
static_cast<bool>(move_to_nearest_code)));
487 const FileSpec &file, uint32_t line_no,
490 LazyBool skip_prologue,
bool internal,
494 std::optional<llvm::StringRef> removed_prefix_opt =
496 if (!removed_prefix_opt)
497 remapped_file = file;
501 switch (inline_strategy) {
522 compile_unit_list.
Append(remapped_file);
535 !
static_cast<bool>(move_to_nearest_code));
540 nullptr, offset, skip_prologue, location_spec, removed_prefix_opt));
567 std::make_shared<SearchFilterForUnconstrainedSearches>(
570 std::make_shared<BreakpointResolverAddress>(
nullptr, addr);
577 bool request_hardware) {
579 std::make_shared<SearchFilterForUnconstrainedSearches>(
582 std::make_shared<BreakpointResolverAddress>(
nullptr, file_addr,
590 const FileSpecList *containingSourceFiles,
const char *func_name,
591 FunctionNameType func_name_type_mask,
LanguageType language,
593 bool internal,
bool hardware) {
597 containingModules, containingSourceFiles));
606 offset, offset_is_insn_count, skip_prologue));
615 const std::vector<std::string> &func_names,
616 FunctionNameType func_name_type_mask,
618 LazyBool skip_prologue,
bool internal,
bool hardware) {
620 size_t num_names = func_names.size();
623 containingModules, containingSourceFiles));
631 new BreakpointResolverName(
nullptr, func_names, func_name_type_mask,
632 language, offset, skip_prologue));
641 const char *func_names[],
size_t num_names,
642 FunctionNameType func_name_type_mask,
644 LazyBool skip_prologue,
bool internal,
bool hardware) {
648 containingModules, containingSourceFiles));
660 nullptr, func_names, num_names, func_name_type_mask, language, offset,
662 resolver_sp->SetOffset(offset);
671 if (containingModule !=
nullptr) {
674 filter_sp = std::make_shared<SearchFilterByModule>(shared_from_this(),
679 std::make_shared<SearchFilterForUnconstrainedSearches>(
689 if (containingModules && containingModules->
GetSize() != 0) {
692 filter_sp = std::make_shared<SearchFilterByModuleList>(shared_from_this(),
697 std::make_shared<SearchFilterForUnconstrainedSearches>(
707 if (containingSourceFiles ==
nullptr || containingSourceFiles->
GetSize() == 0)
711 if (containingModules ==
nullptr) {
715 filter_sp = std::make_shared<SearchFilterByModuleListAndCU>(
716 shared_from_this(),
FileSpecList(), *containingSourceFiles);
718 filter_sp = std::make_shared<SearchFilterByModuleListAndCU>(
719 shared_from_this(), *containingModules, *containingSourceFiles);
728 bool internal,
bool hardware) {
730 containingModules, containingSourceFiles));
733 :
static_cast<bool>(skip_prologue);
735 nullptr, std::move(func_regex), requested_language, 0, skip));
742 bool catch_bp,
bool throw_bp,
bool internal,
745 *
this, language, catch_bp, throw_bp, internal);
746 if (exc_bkpt_sp && additional_args) {
748 if (precondition_sp && additional_args) {
750 *
error = precondition_sp->ConfigurePrecondition(*additional_args);
752 precondition_sp->ConfigurePrecondition(*additional_args);
759 const llvm::StringRef class_name,
const FileSpecList *containingModules,
760 const FileSpecList *containingSourceFiles,
bool internal,
767 containingSourceFiles && containingSourceFiles->
GetSize() > 0;
768 bool has_modules = containingModules && containingModules->
GetSize() > 0;
770 if (has_files && has_modules) {
772 containingSourceFiles);
773 }
else if (has_files) {
776 }
else if (has_modules) {
779 filter_sp = std::make_shared<SearchFilterForUnconstrainedSearches>(
790 bool internal,
bool request_hardware,
791 bool resolve_indirect_symbols) {
793 if (filter_sp && resolver_sp) {
795 bp_sp.reset(
new Breakpoint(*
this, filter_sp, resolver_sp, hardware,
796 resolve_indirect_symbols));
797 resolver_sp->SetBreakpoint(bp_sp);
815 LLDB_LOGF(log,
"Target::%s (internal = %s) => break_id = %s\n",
816 __FUNCTION__, bp_sp->IsInternal() ?
"yes" :
"no", s.
GetData());
819 bp_sp->ResolveBreakpoint();
850 bp_sp->AddName(name);
855 std::make_pair(bp_name->GetName(), std::move(bp_name)));
861 if (!
error.Success())
866 return iter->second.get();
871 "Breakpoint name \"%s\" doesn't exist and "
872 "can_create is false.",
878 .insert(std::make_pair(name, std::make_unique<BreakpointName>(name)))
879 .first->second.get();
886 const char *name_cstr = name.
AsCString();
889 bp_sp->RemoveName(name_cstr);
907 llvm::Expected<std::vector<BreakpointSP>> expected_vector =
910 if (!expected_vector) {
912 llvm::toString(expected_vector.takeError()));
916 for (
auto bp_sp : *expected_vector)
923 names.push_back(bp_name_entry.first.AsCString());
933 std::optional<uint32_t> num_supported_hardware_watchpoints =
938 if (!num_supported_hardware_watchpoints)
941 if (*num_supported_hardware_watchpoints == 0) {
943 "Target supports (%u) hardware watchpoint slots.\n",
944 *num_supported_hardware_watchpoints);
957 "Target::%s (addr = 0x%8.8" PRIx64
" size = %" PRIu64
959 __FUNCTION__, addr, (uint64_t)size, kind);
970 "cannot set a watchpoint with watch_size of 0");
973 "invalid watch address: %" PRIu64, addr);
989 const bool notify =
false;
994 addr = abi->FixDataAddress(addr);
1008 std::unique_lock<std::recursive_mutex> lock;
1012 size_t old_size = matched_sp->GetByteSize();
1018 if (size == old_size && kind == old_type) {
1020 wp_sp->SetEnabled(
false, notify);
1029 wp_sp = std::make_shared<Watchpoint>(*
this, addr, size, type);
1030 wp_sp->SetWatchpointType(kind, notify);
1035 LLDB_LOGF(log,
"Target::%s (creation of watchpoint %s with id = %u)\n",
1036 __FUNCTION__,
error.Success() ?
"succeeded" :
"failed",
1051 LLDB_LOGF(log,
"Target::%s \n", __FUNCTION__);
1060 LLDB_LOGF(log,
"Target::%s (internal_also = %s)\n", __FUNCTION__,
1061 internal_also ?
"yes" :
"no");
1072 LLDB_LOGF(log,
"Target::%s (internal_also = %s)\n", __FUNCTION__,
1073 internal_also ?
"yes" :
"no");
1082 LLDB_LOGF(log,
"Target::%s", __FUNCTION__);
1089 LLDB_LOGF(log,
"Target::%s (internal_also = %s)\n", __FUNCTION__,
1090 internal_also ?
"yes" :
"no");
1099 LLDB_LOGF(log,
"Target::%s", __FUNCTION__);
1106 LLDB_LOGF(log,
"Target::%s (break_id = %i, internal = %s)\n", __FUNCTION__,
1126 LLDB_LOGF(log,
"Target::%s (break_id = %i, internal = %s)\n", __FUNCTION__,
1136 bp_sp->SetEnabled(
false);
1144 LLDB_LOGF(log,
"Target::%s (break_id = %i, internal = %s)\n", __FUNCTION__,
1155 bp_sp->SetEnabled(
true);
1175 std::string path(file.
GetPath());
1183 if (
error.Success()) {
1184 break_store_ptr = input_data_sp->
GetAsArray();
1185 if (!break_store_ptr) {
1187 "Tried to append to invalid input file %s", path.c_str());
1193 if (!break_store_ptr) {
1194 break_store_sp = std::make_shared<StructuredData::Array>();
1195 break_store_ptr = break_store_sp.get();
1202 lldb::eFilePermissionsFileDefault);
1209 std::unique_lock<std::recursive_mutex> lock;
1215 size_t num_breakpoints = breakpoints.
GetSize();
1216 for (
size_t i = 0; i < num_breakpoints; i++) {
1221 break_store_ptr->
AddItem(bkpt_save_sp);
1225 std::unordered_set<lldb::break_id_t> processed_bkpts;
1226 const size_t count = bp_ids.
GetSize();
1227 for (
size_t i = 0; i < count; ++i) {
1233 std::pair<std::unordered_set<lldb::break_id_t>::iterator,
bool>
1234 insert_result = processed_bkpts.insert(bp_id);
1235 if (!insert_result.second)
1242 if (!bkpt_save_sp) {
1244 "Unable to serialize breakpoint %d", bp_id);
1247 break_store_ptr->
AddItem(bkpt_save_sp);
1252 break_store_ptr->
Dump(out_file,
false);
1259 std::vector<std::string> no_names;
1264 std::vector<std::string> &names,
1266 std::unique_lock<std::recursive_mutex> lock;
1272 if (!
error.Success()) {
1274 }
else if (!input_data_sp || !input_data_sp->IsValid()) {
1276 "Invalid JSON from input file: %s.", file.
GetPath().c_str());
1283 "Invalid breakpoint data from input file: %s.", file.
GetPath().c_str());
1287 size_t num_bkpts = bkpt_array->
GetSize();
1288 size_t num_names = names.size();
1290 for (
size_t i = 0; i < num_bkpts; i++) {
1296 "Invalid breakpoint data for element %zu from input file: %s.", i,
1307 shared_from_this(), bkpt_data_sp,
error);
1308 if (!
error.Success()) {
1310 "Error restoring breakpoint %zu from %s: %s.", i,
1326 LLDB_LOGF(log,
"Target::%s\n", __FUNCTION__);
1355 LLDB_LOGF(log,
"Target::%s\n", __FUNCTION__);
1382 LLDB_LOGF(log,
"Target::%s\n", __FUNCTION__);
1408 LLDB_LOGF(log,
"Target::%s\n", __FUNCTION__);
1414 wp_sp->ResetHitCount();
1422 LLDB_LOGF(log,
"Target::%s\n", __FUNCTION__);
1428 wp_sp->ResetHistoricValues();
1437 LLDB_LOGF(log,
"Target::%s\n", __FUNCTION__);
1446 wp_sp->SetIgnoreCount(ignore_count);
1454 LLDB_LOGF(log,
"Target::%s (watch_id = %i)\n", __FUNCTION__, watch_id);
1473 LLDB_LOGF(log,
"Target::%s (watch_id = %i)\n", __FUNCTION__, watch_id);
1492 LLDB_LOGF(log,
"Target::%s (watch_id = %i)\n", __FUNCTION__, watch_id);
1507 uint32_t ignore_count) {
1509 LLDB_LOGF(log,
"Target::%s (watch_id = %i)\n", __FUNCTION__, watch_id);
1516 wp_sp->SetIgnoreCount(ignore_count);
1523 std::lock_guard<std::recursive_mutex> lock(
m_images.GetMutex());
1535 return m_images.GetModuleAtIndex(0);
1546 if (module_sp && !module_sp->LoadScriptingResourceInTarget(target,
error,
1548 if (
error.AsCString())
1550 "unable to load scripting data for module %s - error reported was "
1552 module_sp->GetFileSpec().GetFileNameStrippingExtension().GetCString(),
1555 if (feedback_stream.
GetSize())
1557 "%s\n", feedback_stream.
GetData());
1580 if (executable_sp) {
1583 pid = proc->GetID();
1587 info->
uuid = executable_sp->GetUUID();
1589 info->
triple = executable_sp->GetArchitecture().GetTriple().getTriple();
1595 info->
uuid = executable_sp->GetUUID();
1601 executable_sp->GetFileSpec().GetPath().c_str());
1603 const bool notify =
true;
1609 if (!
m_arch.GetSpec().IsValid()) {
1610 m_arch = executable_sp->GetArchitecture();
1612 "Target::SetExecutableModule setting architecture to {0} ({1}) "
1613 "based on executable file",
1614 m_arch.GetSpec().GetArchitectureName(),
1615 m_arch.GetSpec().GetTriple().getTriple());
1618 ObjectFile *executable_objfile = executable_sp->GetObjectFile();
1619 bool load_dependents =
true;
1620 switch (load_dependent_files) {
1622 load_dependents = executable_sp->IsExecutable();
1625 load_dependents =
true;
1628 load_dependents =
false;
1632 if (executable_objfile && load_dependents) {
1635 std::mutex dependent_files_mutex;
1640 auto GetDependentModules = [&](
FileSpec dependent_file_spec) {
1641 FileSpec platform_dependent_file_spec;
1643 m_platform_sp->GetFileWithUUID(dependent_file_spec,
nullptr,
1644 platform_dependent_file_spec);
1646 platform_dependent_file_spec = dependent_file_spec;
1651 if (image_module_sp) {
1653 ObjectFile *objfile = image_module_sp->GetObjectFile();
1659 std::lock_guard<std::mutex> guard(dependent_files_mutex);
1660 dependent_files_copy = dependent_files;
1665 const size_t previous_dependent_files =
1666 dependent_files_copy.
GetSize();
1671 std::lock_guard<std::mutex> guard(dependent_files_mutex);
1672 for (
size_t i = previous_dependent_files;
1673 i < dependent_files_copy.
GetSize(); ++i)
1684 for (uint32_t i = 0; i < dependent_files.
GetSize(); i++) {
1690 std::lock_guard<std::mutex> guard(dependent_files_mutex);
1691 for (; i < dependent_files.
GetSize(); i++)
1692 task_group.async(GetDependentModules,
1705 bool missing_local_arch = !
m_arch.GetSpec().IsValid();
1706 bool replace_local_arch =
true;
1707 bool compatible_local_arch =
false;
1716 if (!platform_sp || !platform_sp->IsCompatibleArchitecture(
1720 GetDebugger().GetPlatformList().GetOrCreate(other, {},
1722 arch_platform_sp->SetLocateModuleCallback(
1723 platform_sp->GetLocateModuleCallback());
1726 other = platform_arch;
1732 if (!missing_local_arch) {
1733 if (merge &&
m_arch.GetSpec().IsCompatibleMatch(arch_spec)) {
1736 if (
m_arch.GetSpec().IsCompatibleMatch(other)) {
1737 compatible_local_arch =
true;
1740 replace_local_arch =
false;
1745 if (compatible_local_arch || missing_local_arch) {
1749 if (replace_local_arch)
1752 "Target::SetArchitecture merging compatible arch; arch "
1754 m_arch.GetSpec().GetArchitectureName(),
1755 m_arch.GetSpec().GetTriple().getTriple());
1763 "Target::SetArchitecture changing architecture to %s (%s) from %s (%s)",
1765 arch_spec.
GetTriple().getTriple().c_str(),
1766 m_arch.GetSpec().GetArchitectureName(),
1767 m_arch.GetSpec().GetTriple().getTriple().c_str());
1774 if (executable_sp) {
1776 "Target::SetArchitecture Trying to select executable file "
1777 "architecture %s (%s)",
1779 arch_spec.
GetTriple().getTriple().c_str());
1780 ModuleSpec module_spec(executable_sp->GetFileSpec(), other);
1783 &search_paths,
nullptr,
nullptr);
1785 if (!
error.Fail() && executable_sp) {
1796 if (
m_arch.GetSpec().IsCompatibleMatch(arch_spec)) {
1801 "Target::MergeArchitecture target has arch %s, merging with "
1803 m_arch.GetSpec().GetTriple().getTriple().c_str(),
1804 arch_spec.
GetTriple().getTriple().c_str());
1825 my_module_list.
Append(module_sp);
1835 my_module_list.
Append(module_sp);
1848 old_module_sp, new_module_sp);
1857 const size_t num_images = module_list.
GetSize();
1859 for (
size_t idx = 0; idx < num_images; ++idx) {
1871 std::make_shared<TargetEventData>(shared_from_this(), module_list);
1880 runtime->SymbolsDidLoad(module_list);
1887 std::make_shared<TargetEventData>(shared_from_this(), module_list);
1896 std::make_shared<TargetEventData>(shared_from_this(), module_list);
1910 const bool should_flush_type_systems =
1912 auto *object_file =
module.GetObjectFile();
1917 auto type = object_file->GetType();
1921 return module.FileHasChanged() &&
1922 (type == ObjectFile::eTypeObjectFile ||
1923 type == ObjectFile::eTypeExecutable ||
1924 type == ObjectFile::eTypeSharedLibrary);
1927 if (should_flush_type_systems)
1933 const FileSpec &module_file_spec) {
1938 size_t num_modules = matchingModules.
GetSize();
1942 if (num_modules > 0) {
1943 for (
size_t i = 0; i < num_modules; i++) {
1958 return m_platform_sp->ModuleIsExcludedForUnconstrainedSearches(*
this,
1970 if (section_sp->IsEncrypted()) {
1974 ModuleSP module_sp(section_sp->GetModule());
1979 section_sp.get(), addr.
GetOffset(), dst, dst_len);
1984 "error reading data from section %s",
1985 section_sp->GetName().GetCString());
1992 "address doesn't contain a section that points to a "
1993 "section in a object file");
2001 bool *did_read_live_memory) {
2003 if (did_read_live_memory)
2004 *did_read_live_memory =
false;
2017 size_t bytes_read = 0;
2024 if (section_load_list.
IsEmpty()) {
2030 m_images.ResolveFileAddress(file_addr, resolved_addr);
2043 resolved_addr = fixed_addr;
2048 std::unique_ptr<uint8_t[]> file_cache_read_buffer;
2049 size_t file_cache_bytes_read = 0;
2055 auto permissions =
Flags(section_sp->GetPermissions());
2056 bool is_readonly = !permissions.Test(ePermissionsWritable) &&
2057 permissions.Test(ePermissionsReadable);
2059 file_cache_bytes_read =
2061 if (file_cache_bytes_read == dst_len)
2062 return file_cache_bytes_read;
2063 else if (file_cache_bytes_read > 0) {
2064 file_cache_read_buffer =
2065 std::make_unique<uint8_t[]>(file_cache_bytes_read);
2066 std::memcpy(file_cache_read_buffer.get(), dst, file_cache_bytes_read);
2078 if (addr_module_sp && addr_module_sp->GetFileSpec())
2080 "{0:F}[{1:x+}] can't be resolved, {0:F} is not currently loaded",
2084 "0x%" PRIx64
" can't be resolved", resolved_addr.
GetFileAddress());
2087 if (bytes_read != dst_len) {
2088 if (
error.Success()) {
2089 if (bytes_read == 0)
2091 "read memory from 0x%" PRIx64
" failed", load_addr);
2094 "only %" PRIu64
" of %" PRIu64
2095 " bytes were read from memory at 0x%" PRIx64,
2096 (uint64_t)bytes_read, (uint64_t)dst_len, load_addr);
2101 *load_addr_ptr = load_addr;
2102 if (did_read_live_memory)
2103 *did_read_live_memory =
true;
2109 if (file_cache_read_buffer && file_cache_bytes_read > 0) {
2112 std::memcpy(dst, file_cache_read_buffer.get(), file_cache_bytes_read);
2113 return file_cache_bytes_read;
2135 out_str.append(buf, length);
2138 if (length ==
sizeof(buf) - 1)
2139 curr_addr += length;
2144 return out_str.size();
2148 size_t dst_max_len,
Status &result_error,
2149 bool force_live_memory) {
2150 size_t total_cstr_len = 0;
2151 if (dst && dst_max_len) {
2152 result_error.
Clear();
2154 memset(dst, 0, dst_max_len);
2161 const size_t cache_line_size = 512;
2163 size_t bytes_left = dst_max_len - 1;
2164 char *curr_dst = dst;
2166 while (bytes_left > 0) {
2167 addr_t cache_line_bytes_left =
2168 cache_line_size - (curr_addr % cache_line_size);
2170 std::min<addr_t>(bytes_left, cache_line_bytes_left);
2172 size_t bytes_read =
ReadMemory(address, curr_dst, bytes_to_read,
error,
2175 if (bytes_read == 0) {
2176 result_error = std::move(
error);
2177 dst[total_cstr_len] =
'\0';
2180 const size_t len = strlen(curr_dst);
2182 total_cstr_len += len;
2184 if (len < bytes_to_read)
2187 curr_dst += bytes_read;
2188 curr_addr += bytes_read;
2189 bytes_left -= bytes_read;
2196 result_error.
Clear();
2198 return total_cstr_len;
2206 return cache_line_size - (load_addr % cache_line_size);
2216 size_t type_width,
bool force_live_memory) {
2217 if (!dst || !max_bytes || !type_width || max_bytes < type_width)
2220 size_t total_bytes_read = 0;
2224 memset(dst, 0, max_bytes);
2225 size_t bytes_left = max_bytes - type_width;
2227 const char terminator[4] = {
'\0',
'\0',
'\0',
'\0'};
2228 assert(
sizeof(terminator) >= type_width &&
"Attempting to validate a "
2229 "string with more than 4 bytes "
2233 char *curr_dst = dst;
2236 while (bytes_left > 0 &&
error.Success()) {
2240 ReadMemory(address, curr_dst, bytes_to_read,
error, force_live_memory);
2242 if (bytes_read == 0)
2247 size_t aligned_start = total_bytes_read - total_bytes_read % type_width;
2248 for (
size_t i = aligned_start;
2249 i + type_width <= total_bytes_read + bytes_read; i += type_width)
2250 if (::memcmp(&dst[i], terminator, type_width) == 0) {
2255 total_bytes_read += bytes_read;
2256 curr_dst += bytes_read;
2257 address.
Slide(bytes_read);
2258 bytes_left -= bytes_read;
2260 return total_bytes_read;
2264 bool is_signed,
Scalar &scalar,
2266 bool force_live_memory) {
2269 if (byte_size <=
sizeof(uval)) {
2272 if (bytes_read == byte_size) {
2274 m_arch.GetSpec().GetAddressByteSize());
2277 scalar = data.
GetMaxU32(&offset, byte_size);
2279 scalar = data.
GetMaxU64(&offset, byte_size);
2287 "byte size of %u is too large for integer scalar type", byte_size);
2293 size_t integer_byte_size,
2295 bool force_live_memory) {
2304 size_t integer_byte_size,
2306 bool force_live_memory) {
2316 bool force_live_memory) {
2319 false, scalar,
error, force_live_memory)) {
2323 if (section_load_list.
IsEmpty()) {
2326 m_images.ResolveFileAddress(pointer_vm_addr, pointer_addr);
2337 pointer_addr.
SetOffset(pointer_vm_addr);
2345 bool notify,
Status *error_ptr) {
2353 if (std::optional<FileSpec> remapped_obj_file =
2364 module_sp =
m_images.FindFirstModule(module_spec);
2367 llvm::SmallVector<ModuleSP, 1>
2370 bool did_create_module =
false;
2380 module_spec, module_sp, symbol_file_spec, &did_create_module);
2411 &search_paths, &old_modules,
2412 &did_create_module);
2430 &old_modules, &did_create_module);
2438 module_spec,
m_process_sp.get(), module_sp, &search_paths,
2439 &old_modules, &did_create_module);
2450 ObjectFile *objfile = module_sp->GetObjectFile();
2466 "debug info files aren't valid target "
2467 "modules, please specify an executable");
2474 "stub libraries aren't valid target "
2475 "modules, please specify an executable");
2480 "unsupported file type, please specify an executable");
2499 m_images.FindModules(module_spec_copy, found_modules);
2501 old_modules.push_back(found_module);
2508 if (symbol_file_spec)
2509 module_sp->SetSymbolFileFileSpec(symbol_file_spec);
2514 module_sp->PreloadSymbols();
2515 llvm::SmallVector<ModuleSP, 1> replaced_modules;
2516 for (
ModuleSP &old_module_sp : old_modules) {
2517 if (
m_images.GetIndexForModule(old_module_sp.get()) !=
2519 if (replaced_modules.empty())
2520 m_images.ReplaceModule(old_module_sp, module_sp);
2524 replaced_modules.push_back(std::move(old_module_sp));
2528 if (replaced_modules.size() > 1) {
2541 auto dump = [&message](
Module &dump_module) ->
void {
2542 UUID dump_uuid = dump_module.GetUUID();
2546 message <<
" (uuid ";
2549 dump_uuid.
Dump(message);
2551 message <<
"not specified";
2556 message <<
"New module ";
2559 << llvm::formatv(
" simultaneously replaced {0} old modules: ",
2560 replaced_modules.size());
2561 for (
ModuleSP &replaced_module_sp : replaced_modules)
2562 dump(*replaced_module_sp);
2568 if (replaced_modules.empty())
2569 m_images.Append(module_sp, notify);
2571 for (
ModuleSP &old_module_sp : replaced_modules) {
2572 auto old_module_wp = old_module_sp->weak_from_this();
2573 old_module_sp.reset();
2581 *error_ptr = std::move(
error);
2610llvm::Expected<lldb::TypeSystemSP>
2612 bool create_on_demand) {
2614 return llvm::createStringError(
"Invalid Target");
2626 if (languages_for_expressions.
Empty())
2627 return llvm::createStringError(
2628 "No expression support for any languages");
2639 uint32_t byte_size) {
2642 return provider->GetRegisterType(name, flags, byte_size);
2645std::vector<lldb::TypeSystemSP>
2653 std::vector<lldb::TypeSystemSP> scratch_type_systems;
2658 for (
auto bit : languages_for_expressions.
bitvector.set_bits()) {
2660 auto type_system_or_err =
2662 if (!type_system_or_err)
2665 "Language '{1}' has expression support but no scratch type "
2666 "system available: {0}",
2669 if (
auto ts = *type_system_or_err)
2670 scratch_type_systems.push_back(ts);
2673 std::sort(scratch_type_systems.begin(), scratch_type_systems.end());
2674 scratch_type_systems.erase(llvm::unique(scratch_type_systems),
2675 scratch_type_systems.end());
2676 return scratch_type_systems;
2683 if (
auto err = type_system_or_err.takeError()) {
2686 "Unable to get persistent expression state for language {1}: {0}",
2691 if (
auto ts = *type_system_or_err)
2692 return ts->GetPersistentExpressionState();
2695 "Unable to get persistent expression state for language {1}: {0}",
2701 llvm::StringRef expr, llvm::StringRef prefix,
SourceLanguage language,
2705 auto type_system_or_err =
2707 if (
auto err = type_system_or_err.takeError()) {
2709 "Could not find type system for language %s: %s",
2711 llvm::toString(std::move(err)).c_str());
2715 auto ts = *type_system_or_err;
2718 "Type system for language %s is no longer live",
2723 auto *user_expr = ts->GetUserExpression(expr, prefix, language, desired_type,
2727 "Could not create an expression for language %s",
2738 if (
auto err = type_system_or_err.takeError()) {
2740 "Could not find type system for language %s: %s",
2742 llvm::toString(std::move(err)).c_str());
2745 auto ts = *type_system_or_err;
2748 "Type system for language %s is no longer live",
2752 auto *persistent_fn = ts->GetFunctionCaller(return_type, function_address,
2753 arg_value_list, name);
2756 "Could not create an expression for language %s",
2759 return persistent_fn;
2762llvm::Expected<std::unique_ptr<UtilityFunction>>
2767 if (!type_system_or_err)
2768 return type_system_or_err.takeError();
2769 auto ts = *type_system_or_err;
2771 return llvm::createStringError(
2772 llvm::StringRef(
"Type system for language ") +
2774 llvm::StringRef(
" is no longer live"));
2775 std::unique_ptr<UtilityFunction> utility_fn =
2776 ts->CreateUtilityFunction(std::move(expression), std::move(name));
2778 return llvm::createStringError(
2779 llvm::StringRef(
"Could not create an expression for language") +
2783 if (!utility_fn->Install(diagnostics, exe_ctx))
2785 "Could not install utility function:");
2787 return std::move(utility_fn);
2808 "setting target's default architecture to {0} ({1})",
2815 if (llvm::to_integer(label, n))
2816 return llvm::createStringError(
"Cannot use integer as target label.");
2820 if (target_sp && target_sp->GetLabel() == label) {
2821 return llvm::make_error<llvm::StringError>(
2823 "Cannot use label '{0}' since it's set in target #{1}.", label,
2825 llvm::inconvertibleErrorCode());
2830 return llvm::Error::success();
2839 Target *target =
nullptr;
2840 if (sc_ptr !=
nullptr)
2842 if (target ==
nullptr && exe_ctx_ptr)
2852 result_valobj_sp.reset();
2857 m_stats.GetExpressionStats().NotifyFailure();
2858 return execution_results;
2864 auto on_exit = llvm::make_scope_exit([
this, old_suppress_value]() {
2882 if (expr[0] ==
'$') {
2883 auto type_system_or_err =
2885 if (
auto err = type_system_or_err.takeError()) {
2887 "Unable to get scratch type system");
2889 auto ts = *type_system_or_err;
2892 "Scratch type system is no longer live: {0}");
2895 ts->GetPersistentExpressionState()->GetVariable(expr);
2898 if (persistent_var_sp) {
2899 result_valobj_sp = persistent_var_sp->GetValueObject();
2905 result_valobj_sp, fixed_expression, ctx_obj);
2909 m_stats.GetExpressionStats().NotifySuccess();
2911 m_stats.GetExpressionStats().NotifyFailure();
2912 return execution_results;
2918 [name, &variable_sp](
TypeSystemSP type_system) ->
bool {
2919 auto ts = type_system.get();
2923 ts->GetPersistentExpressionState()) {
2924 variable_sp = persistent_state->GetVariable(name);
2939 auto ts = type_system.get();
2944 ts->GetPersistentExpressionState()) {
2945 address = persistent_state->LookupSymbol(name);
2958 const bool has_primary_executable = exe_module && exe_module->
GetObjectFile();
2959 if (has_primary_executable) {
2966 const size_t num_images = modules.
GetSize();
2967 for (
size_t idx = 0; idx < num_images; ++idx) {
2969 if (!module_sp || !module_sp->GetObjectFile())
2972 Address entry_addr = module_sp->GetObjectFile()->GetEntryPointAddress();
2978 if (!has_primary_executable)
2979 return llvm::createStringError(
2980 "No primary executable found and could not find entry point address in "
2981 "any executable module");
2983 return llvm::createStringError(
2984 "Could not find entry point address for primary executable module \"" +
2992 ? arch_plugin->GetCallableLoadAddress(load_addr, addr_class)
2999 return arch_plugin ? arch_plugin->GetOpcodeLoadAddress(load_addr, addr_class)
3005 return arch_plugin ? arch_plugin->GetBreakableLoadAddress(addr, *
this) : addr;
3008llvm::Expected<lldb::DisassemblerSP>
3010 const char *flavor_string) {
3012 bool force_live_memory =
true;
3015 const size_t bytes_read =
3017 force_live_memory, &load_addr);
3020 return llvm::createStringError(
3021 error.AsCString(
"Target::ReadInstructions failed to read memory at %s"),
3025 if (!flavor_string || flavor_string[0] ==
'\0') {
3030 if (arch == llvm::Triple::x86 || arch == llvm::Triple::x86_64)
3058 stop_hook_sp.reset(
new StopHookCoded(shared_from_this(), new_uid));
3065 return stop_hook_sp;
3077 return (num_removed != 0);
3085 StopHookCollection::iterator specified_hook_iter;
3088 found_hook = (*specified_hook_iter).second;
3093 bool active_state) {
3094 StopHookCollection::iterator specified_hook_iter;
3099 (*specified_hook_iter).second->SetIsActive(active_state);
3104 StopHookCollection::iterator pos, end =
m_stop_hooks.end();
3106 (*pos).second->SetIsActive(active_state);
3115const std::vector<Target::StopHookSP>
3120 std::vector<StopHookSP> stop_hooks;
3122 stop_hooks.push_back(hook);
3140 auto is_active = [at_initial_stop](
StopHookSP hook) {
3141 bool should_run_now = (!at_initial_stop || hook->GetRunAtInitialStop());
3142 return hook->IsActive() && should_run_now;
3146 std::vector<StopHookSP> active_hooks;
3150 if (is_active(hook))
3151 active_hooks.push_back(hook);
3153 if (active_hooks.empty())
3162 uint32_t last_natural_stop =
m_process_sp->GetModIDRef().GetLastNaturalStopID();
3168 std::vector<ExecutionContext> exc_ctx_with_reasons;
3171 size_t num_threads = cur_threadlist.
GetSize();
3172 for (
size_t i = 0; i < num_threads; i++) {
3174 if (cur_thread_sp->ThreadStoppedForAReason()) {
3176 exc_ctx_with_reasons.emplace_back(
m_process_sp.get(), cur_thread_sp.get(),
3177 cur_frame_sp.get());
3186 size_t num_exe_ctx = exc_ctx_with_reasons.size();
3187 if (num_exe_ctx == 0) {
3188 if (at_initial_stop && num_threads > 0) {
3190 exc_ctx_with_reasons.emplace_back(
3192 thread_to_use_sp->GetStackFrameAtIndex(0).get());
3200 auto on_exit = llvm::make_scope_exit([output_sp] { output_sp->Flush(); });
3202 size_t num_hooks_with_output = llvm::count_if(
3203 active_hooks, [](
auto h) {
return !h->GetSuppressOutput(); });
3204 bool print_hook_header = (num_hooks_with_output > 1);
3205 bool print_thread_header = (num_exe_ctx > 1);
3206 bool should_stop =
false;
3207 bool requested_continue =
false;
3209 for (
auto cur_hook_sp : active_hooks) {
3210 bool any_thread_matched =
false;
3211 for (
auto exc_ctx : exc_ctx_with_reasons) {
3212 if (!cur_hook_sp->ExecutionContextPasses(exc_ctx))
3215 bool suppress_output = cur_hook_sp->GetSuppressOutput();
3216 if (print_hook_header && !any_thread_matched && !suppress_output) {
3220 output_sp->
Printf(
"\n- Hook %" PRIu64
" (%s)\n", cur_hook_sp->GetID(),
3223 output_sp->Printf(
"\n- Hook %" PRIu64
"\n", cur_hook_sp->GetID());
3224 any_thread_matched =
true;
3227 if (print_thread_header && !suppress_output)
3228 output_sp->Printf(
"-- Thread %d\n",
3229 exc_ctx.GetThreadPtr()->GetIndexID());
3231 auto result = cur_hook_sp->HandleStop(exc_ctx, output_sp);
3234 if (cur_hook_sp->GetAutoContinue())
3235 requested_continue =
true;
3240 requested_continue =
true;
3249 output_sp->Printf(
"\nAborting stop hooks, hook %" PRIu64
3250 " set the program running.\n"
3251 " Consider using '-G true' to make "
3252 "stop hooks auto-continue.\n",
3253 cur_hook_sp->GetID());
3264 if (requested_continue && !should_stop) {
3267 if (
error.Success()) {
3268 LLDB_LOG(log,
"Resuming from RunStopHooks");
3271 LLDB_LOG(log,
"Resuming from RunStopHooks failed: {0}",
error);
3284 return *g_settings_ptr;
3290 if (!platform_sp || !platform_sp->IsRemote() || !platform_sp->IsConnected())
3300 MainExecutableInstaller installer{platform_sp, module_sp,
3301 shared_from_this(), *launch_info};
3304 ExecutableInstaller installer{platform_sp, module_sp};
3316 uint32_t stop_id,
bool allow_section_end) {
3323 return m_images.ResolveFileAddress(file_addr, resolved_addr);
3327 addr_t new_section_load_addr,
3328 bool warn_multiple) {
3329 const addr_t old_section_load_addr =
3332 if (old_section_load_addr != new_section_load_addr) {
3333 uint32_t stop_id = 0;
3336 stop_id = process_sp->GetStopID();
3340 stop_id, section_sp, new_section_load_addr, warn_multiple))
3347 size_t section_unload_count = 0;
3348 size_t num_modules = module_list.
GetSize();
3349 for (
size_t i = 0; i < num_modules; ++i) {
3350 section_unload_count +=
3353 return section_unload_count;
3357 uint32_t stop_id = 0;
3360 stop_id = process_sp->GetStopID();
3363 SectionList *sections = module_sp->GetSectionList();
3364 size_t section_unload_count = 0;
3367 for (uint32_t i = 0; i < num_sections; ++i) {
3372 return section_unload_count;
3376 uint32_t stop_id = 0;
3379 stop_id = process_sp->GetStopID();
3387 uint32_t stop_id = 0;
3390 stop_id = process_sp->GetStopID();
3421 m_stats.SetLaunchOrAttachTime();
3425 LLDB_LOGF(log,
"Target::%s() called for %s", __FUNCTION__,
3437 state = process_sp->GetState();
3439 "Target::%s the process exists, and its current state is %s",
3442 LLDB_LOGF(log,
"Target::%s the process instance doesn't currently exist.",
3455 const bool synchronous_execution =
3463 if (launch_info.
GetFlags().
Test(eLaunchFlagLaunchInTTY))
3465 "can't launch in tty when launching through a remote connection");
3483 LLDB_LOGF(log,
"Target::%s asking the platform to debug the process",
3497 "Target::%s the platform doesn't know how to debug a "
3498 "process, getting a process plugin to do this for us.",
3517 if (!
error.Success())
3523 bool rebroadcast_first_stop =
3524 !synchronous_execution &&
3530 state =
m_process_sp->WaitForProcessToStop(std::nullopt, &first_stop_event_sp,
3531 rebroadcast_first_stop,
3535 if (rebroadcast_first_stop) {
3538 assert(first_stop_event_sp);
3547 if (launch_info.
GetFlags().
Test(eLaunchFlagStopAtEntry))
3549 if (synchronous_execution)
3556 if (!
error.Success()) {
3558 "process resume at entry point failed: %s",
error.AsCString());
3562 bool with_shell = !!launch_info.
GetShell();
3564 const char *exit_desc =
m_process_sp->GetExitDescription();
3566 if (exit_desc && exit_desc[0])
3567 desc =
" (" + std::string(exit_desc) +
')';
3570 "process exited with status %i%s\n"
3571 "'r' and 'run' are aliases that default to launching through a "
3573 "Try launching without going through a shell by using "
3574 "'process launch'.",
3575 exit_status, desc.c_str());
3578 "process exited with status %i%s", exit_status, desc.c_str());
3582 "initial process state wasn't stopped: %s",
StateAsCString(state));
3594 return llvm::createStringError(llvm::inconvertibleErrorCode(),
3595 "A process is required for tracing");
3597 return llvm::createStringError(llvm::inconvertibleErrorCode(),
3598 "A trace already exists for the target");
3600 llvm::Expected<TraceSupportedResponse> trace_type =
3603 return llvm::createStringError(
3604 llvm::inconvertibleErrorCode(),
"Tracing is not supported. %s",
3605 llvm::toString(trace_type.takeError()).c_str());
3606 if (llvm::Expected<TraceSP> trace_sp =
3610 return llvm::createStringError(
3611 llvm::inconvertibleErrorCode(),
3612 "Couldn't create a Trace object for the process. %s",
3613 llvm::toString(trace_sp.takeError()).c_str());
3624 Progress attach_progress(
"Waiting to attach to process");
3625 m_stats.SetLaunchOrAttachTime();
3629 state = process_sp->GetState();
3642 if (old_exec_module_sp)
3644 old_exec_module_sp->GetPlatformFileSpec().GetFilename());
3648 "no process specified, create a target with a file, or "
3649 "specify the --pid or --name");
3653 const auto platform_sp =
3656 const bool async = attach_info.
GetAsync();
3674 plugin_name,
nullptr,
false);
3677 "failed to create process using plugin '{0}'",
3678 plugin_name.empty() ?
"<empty>" : plugin_name);
3682 if (hijack_listener_sp)
3683 process_sp->HijackProcessEvents(hijack_listener_sp);
3684 error = process_sp->Attach(attach_info);
3687 if (
error.Success() && process_sp) {
3689 process_sp->RestoreProcessEvents();
3692 state = process_sp->WaitForProcessToStop(
3695 process_sp->RestoreProcessEvents();
3702 const char *exit_desc = process_sp->GetExitDescription();
3707 "process did not stop (no such process or permission problem?)");
3708 process_sp->Destroy(
false);
3721 const bool default_to_use_pty =
3725 "have platform={0}, platform_sp->IsHost()={1}, default_to_use_pty={2}",
3727 platform_sp ? (platform_sp->IsHost() ?
"true" :
"false") :
"n/a",
3728 default_to_use_pty);
3735 LLDB_LOG(log,
"at least one of stdin/stdout/stderr was not set, evaluating "
3736 "default handling");
3745 LLDB_LOG(log,
"eLaunchFlagDisableSTDIO set, adding suppression action "
3746 "for stdin, stdout and stderr");
3766 LLDB_LOG(log,
"target stdin='{0}', target stdout='{1}', stderr='{2}'",
3767 in_file_spec, out_file_spec, err_file_spec);
3771 LLDB_LOG(log,
"appended stdin open file action for {0}", in_file_spec);
3774 if (out_file_spec) {
3776 LLDB_LOG(log,
"appended stdout open file action for {0}",
3780 if (err_file_spec) {
3782 LLDB_LOG(log,
"appended stderr open file action for {0}",
3786 if (default_to_use_pty) {
3788 LLDB_LOG_ERROR(log, std::move(Err),
"SetUpPtyRedirection failed: {0}");
3805 elem.notify = notify;
3815 = signals_sp->GetSignalNumberFromName(elem.first().str().c_str());
3820 signals_sp->SetShouldSuppress(signo,
false);
3822 signals_sp->SetShouldSuppress(signo,
true);
3825 signals_sp->SetShouldNotify(signo,
true);
3827 signals_sp->SetShouldNotify(signo,
false);
3830 signals_sp->SetShouldStop(signo,
true);
3832 signals_sp->SetShouldStop(signo,
false);
3841 = signals_sp->GetSignalNumberFromName(elem.first().str().c_str());
3847 signals_sp->ResetSignal(signo, do_stop, do_notify, do_pass);
3858 warning_stream_sp->Printf(
"Target signal '%s' not found in process\n",
3859 elem.first().str().c_str());
3872 signals_sp = process_sp->GetUnixSignals();
3875 const char *signal_name = entry.c_str();
3889 strm.
Printf(
"NAME PASS STOP NOTIFY\n");
3890 strm.
Printf(
"=========== ======= ======= =======\n");
3892 auto str_for_lazy = [] (
LazyBool lazy) ->
const char * {
3898 llvm_unreachable(
"Fully covered switch above!");
3902 bool print_it =
false;
3903 for (
size_t idx = 0; idx < num_args; idx++) {
3910 strm.
Printf(
"%-11s ", elem.first().str().c_str());
3911 strm.
Printf(
"%s %s %s\n", str_for_lazy(elem.second.pass),
3912 str_for_lazy(elem.second.stop),
3913 str_for_lazy(elem.second.notify));
3944 bool will_run =
true;
3970 s.
Indent(
"State: enabled\n");
3972 s.
Indent(
"State: disabled\n");
3975 s.
Indent(
"AutoContinue on\n");
4005 s.
Indent(
"Commands: \n");
4007 uint32_t num_commands =
m_commands.GetSize();
4008 for (uint32_t i = 0; i < num_commands; i++) {
4021 const std::vector<std::string> &strings) {
4022 for (
auto string : strings)
4029 assert(exc_ctx.
GetTargetPtr() &&
"Can't call PerformAction on a context "
4066 GetTarget()->GetDebugger().GetScriptInterpreter();
4067 if (!script_interp) {
4075 "ScriptedStopHook::%s () - ERROR: %s", __FUNCTION__,
4076 "Script interpreter couldn't create Scripted Stop Hook Interface");
4090 if (!object_sp || !object_sp->IsValid()) {
4092 "ScriptedStopHook::%s () - ERROR: %s", __FUNCTION__,
4093 "Failed to create valid script object");
4103 assert(exc_ctx.
GetTargetPtr() &&
"Can't call HandleStop on a context "
4109 lldb::StreamSP stream = std::make_shared<lldb_private::StreamString>();
4110 auto should_stop_or_err =
m_interface_sp->HandleStop(exc_ctx, stream);
4111 output_sp->PutCString(
4113 if (!should_stop_or_err)
4135 if (!object_sp || !object_sp->IsValid())
4139 if (!as_dict || !as_dict->
IsValid())
4142 uint32_t num_keys = as_dict->
GetSize();
4149 auto print_one_element = [&s](llvm::StringRef key,
4152 s.
Format(
"{0} : {1}\n", key, object->GetStringValue());
4156 as_dict->
ForEach(print_one_element);
4164 "no-dynamic-values",
4165 "Don't calculate the dynamic type of values",
4170 "Calculate the dynamic type of values "
4171 "even if you have to run the target.",
4176 "Calculate the dynamic type of values, but don't run the target.",
4188 "Never look for inline breakpoint locations (fastest). This setting "
4189 "should only be used if you know that no inlining occurs in your"
4195 "Only check for inline breakpoint locations when setting breakpoints "
4196 "in header files, but not when setting breakpoint in implementation "
4197 "source files (default).",
4202 "Always look for inline breakpoint locations when setting file and "
4203 "line breakpoints (slower but most accurate).",
4217 "Disassembler default (currently att).",
4222 "Intel disassembler flavor.",
4227 "AT&T disassembler flavor.",
4235 "Never import the 'std' C++ module in the expression parser.",
4240 "Retry evaluating expressions with an imported 'std' C++ module if they"
4241 " failed to parse without the module. This allows evaluating more "
4242 "complex expressions involving C++ standard library types."
4247 "Always import the 'std' C++ module. This allows evaluating more "
4248 "complex expressions involving C++ standard library types. This feature"
4253static constexpr OptionEnumValueElement
4258 "Automatically determine the most appropriate method for the "
4262 "Prefer using the realized classes struct."},
4264 "Prefer using the CopyRealizedClassList API."},
4266 "Prefer using the GetRealizedClassList API."},
4273 "C-style (0xffff).",
4278 "Asm-style (0ffffh).",
4286 "Load debug scripts inside symbol files",
4291 "Do not load debug scripts inside symbol files.",
4296 "Warn about debug scripts inside symbol files but do not load them.",
4304 "Load .lldbinit files from current directory",
4309 "Do not load .lldbinit files from current directory",
4314 "Warn about loading .lldbinit files from current directory",
4322 "Load minimal information when loading modules from memory. Currently "
4323 "this setting loads sections only.",
4328 "Load partial information when loading modules from memory. Currently "
4329 "this setting loads sections and function bounds.",
4334 "Load complete information when loading modules from memory. Currently "
4335 "this setting loads sections and all symbols.",
4339#define LLDB_PROPERTIES_target
4340#include "TargetProperties.inc"
4343#define LLDB_PROPERTIES_target
4344#include "TargetPropertiesEnum.inc"
4349 :
public Cloneable<TargetOptionValueProperties, OptionValueProperties> {
4360 Target *target = exe_ctx->GetTargetPtr();
4365 if (
this != target_properties)
4374#define LLDB_PROPERTIES_target_experimental
4375#include "TargetProperties.inc"
4378#define LLDB_PROPERTIES_target_experimental
4379#include "TargetPropertiesEnum.inc"
4383 :
public Cloneable<TargetExperimentalOptionValueProperties,
4384 OptionValueProperties> {
4421 m_collection_sp->SetValueChangedCallback(ePropertyDetachOnError, [
this] {
4434 std::make_unique<TargetExperimentalProperties>();
4437 "Experimental settings - setting these won't produce "
4438 "errors if the setting is not present.",
4441 m_collection_sp = std::make_shared<TargetOptionValueProperties>(
"target");
4444 std::make_unique<TargetExperimentalProperties>();
4447 "Experimental settings - setting these won't produce "
4448 "errors if the setting is not present.",
4451 "process",
"Settings specific to processes.",
true,
4478 exp_property->
GetValue()->GetAsProperties();
4481 return std::nullopt;
4494 exp_property->
GetValue()->GetAsProperties();
4506 exp_property->
GetValue()->GetAsProperties();
4512 const uint32_t idx = ePropertyDefaultArch;
4517 const uint32_t idx = ePropertyDefaultArch;
4522 const uint32_t idx = ePropertyMoveToNearestCode;
4524 idx, g_target_properties[idx].default_uint_value != 0);
4528 const uint32_t idx = ePropertyPreferDynamic;
4531 g_target_properties[idx].default_uint_value));
4535 const uint32_t idx = ePropertyPreferDynamic;
4541 "Interrupted checking preload symbols")) {
4544 const uint32_t idx = ePropertyPreloadSymbols;
4546 idx, g_target_properties[idx].default_uint_value != 0);
4550 const uint32_t idx = ePropertyPreloadSymbols;
4555 const uint32_t idx = ePropertyDisableASLR;
4557 idx, g_target_properties[idx].default_uint_value != 0);
4561 const uint32_t idx = ePropertyDisableASLR;
4566 const uint32_t idx = ePropertyInheritTCC;
4568 idx, g_target_properties[idx].default_uint_value != 0);
4572 const uint32_t idx = ePropertyInheritTCC;
4577 const uint32_t idx = ePropertyDetachOnError;
4579 idx, g_target_properties[idx].default_uint_value != 0);
4583 const uint32_t idx = ePropertyDetachOnError;
4588 const uint32_t idx = ePropertyDisableSTDIO;
4590 idx, g_target_properties[idx].default_uint_value != 0);
4594 const uint32_t idx = ePropertyDisableSTDIO;
4598 const uint32_t idx = ePropertyLaunchWorkingDir;
4600 idx, g_target_properties[idx].default_cstr_value);
4604 const uint32_t idx = ePropertyParallelModuleLoad;
4606 idx, g_target_properties[idx].default_uint_value != 0);
4610 const uint32_t idx = ePropertyDisassemblyFlavor;
4611 const char *return_value;
4616 g_target_properties[idx].default_uint_value));
4619 return return_value;
4623 const uint32_t idx = ePropertyDisassemblyCPU;
4625 idx, g_target_properties[idx].default_cstr_value);
4626 return str.empty() ? nullptr : str.data();
4630 const uint32_t idx = ePropertyDisassemblyFeatures;
4632 idx, g_target_properties[idx].default_cstr_value);
4633 return str.empty() ? nullptr : str.data();
4637 const uint32_t idx = ePropertyInlineStrategy;
4640 static_cast<InlineStrategy>(g_target_properties[idx].default_uint_value));
4646 const uint32_t idx = ePropertySourceRealpathPrefixes;
4651 const uint32_t idx = ePropertyArg0;
4653 idx, g_target_properties[idx].default_cstr_value);
4657 const uint32_t idx = ePropertyArg0;
4663 const uint32_t idx = ePropertyRunArgs;
4668 const uint32_t idx = ePropertyRunArgs;
4678 ePropertyInheritEnv,
4679 g_target_properties[ePropertyInheritEnv].default_uint_value != 0)) {
4680 if (
auto platform_sp =
m_target->GetPlatform()) {
4681 Environment platform_env = platform_sp->GetEnvironment();
4682 for (
const auto &KV : platform_env)
4683 env[KV.first()] = KV.second;
4687 Args property_unset_env;
4689 property_unset_env);
4690 for (
const auto &var : property_unset_env)
4691 env.erase(var.ref());
4694 m_collection_sp->GetPropertyAtIndexAsArgs(ePropertyEnvVars, property_env);
4696 env[KV.first()] = KV.second;
4712 ePropertyInheritEnv,
4713 g_target_properties[ePropertyInheritEnv].default_uint_value != 0))
4717 if (platform_sp ==
nullptr)
4720 Environment platform_environment = platform_sp->GetEnvironment();
4721 for (
const auto &KV : platform_environment)
4722 environment[KV.first()] = KV.second;
4724 Args property_unset_environment;
4726 property_unset_environment);
4727 for (
const auto &var : property_unset_environment)
4728 environment.erase(var.ref());
4734 Args property_environment;
4736 property_environment);
4738 for (
const auto &KV :
Environment(property_environment))
4739 environment[KV.first()] = KV.second;
4746 const uint32_t idx = ePropertyEnvVars;
4751 const uint32_t idx = ePropertySkipPrologue;
4753 idx, g_target_properties[idx].default_uint_value != 0);
4757 const uint32_t idx = ePropertySourceMap;
4760 assert(option_value);
4765 const uint32_t idx = ePropertyObjectMap;
4768 assert(option_value);
4773 const uint32_t idx = ePropertyAutoSourceMapRelative;
4775 idx, g_target_properties[idx].default_uint_value != 0);
4779 const uint32_t idx = ePropertyExecutableSearchPaths;
4782 assert(option_value);
4787 const uint32_t idx = ePropertyExecutableSearchPaths;
4792 const uint32_t idx = ePropertyDebugFileSearchPaths;
4797 const uint32_t idx = ePropertyClangModuleSearchPaths;
4802 const uint32_t idx = ePropertyAutoImportClangModules;
4804 idx, g_target_properties[idx].default_uint_value != 0);
4808 const uint32_t idx = ePropertyImportStdModule;
4811 g_target_properties[idx].default_uint_value));
4815 const uint32_t idx = ePropertyDynamicClassInfoHelper;
4818 g_target_properties[idx].default_uint_value));
4822 const uint32_t idx = ePropertyAutoApplyFixIts;
4824 idx, g_target_properties[idx].default_uint_value != 0);
4828 const uint32_t idx = ePropertyRetriesWithFixIts;
4830 idx, g_target_properties[idx].default_uint_value);
4834 const uint32_t idx = ePropertyNotifyAboutFixIts;
4836 idx, g_target_properties[idx].default_uint_value != 0);
4840 const uint32_t idx = ePropertySaveObjectsDir;
4850 bool exists = instance.
Exists(new_dir);
4851 bool is_directory = instance.
IsDirectory(new_dir);
4852 std::string path = new_dir.
GetPath(
true);
4853 bool writable = llvm::sys::fs::can_write(path);
4854 if (exists && is_directory && writable)
4862 llvm::raw_string_ostream os(buffer);
4863 os <<
"JIT object dir '" << path <<
"' ";
4865 os <<
"does not exist";
4866 else if (!is_directory)
4867 os <<
"is not a directory";
4869 os <<
"is not writable";
4871 std::optional<lldb::user_id_t> debugger_id;
4873 debugger_id =
m_target->GetDebugger().GetID();
4878 const uint32_t idx = ePropertyEnableSynthetic;
4880 idx, g_target_properties[idx].default_uint_value != 0);
4884 const uint32_t idx = ePropertyShowHexVariableValuesWithLeadingZeroes;
4886 idx, g_target_properties[idx].default_uint_value != 0);
4890 const uint32_t idx = ePropertyMaxZeroPaddingInFloatFormat;
4892 idx, g_target_properties[idx].default_uint_value);
4896 const uint32_t idx = ePropertyMaxChildrenCount;
4898 idx, g_target_properties[idx].default_uint_value);
4901std::pair<uint32_t, bool>
4903 const uint32_t idx = ePropertyMaxChildrenDepth;
4904 auto *option_value =
4906 bool is_default = !option_value->OptionWasSet();
4907 return {option_value->GetCurrentValue(), is_default};
4911 const uint32_t idx = ePropertyMaxSummaryLength;
4913 idx, g_target_properties[idx].default_uint_value);
4917 const uint32_t idx = ePropertyMaxMemReadSize;
4919 idx, g_target_properties[idx].default_uint_value);
4923 const uint32_t idx = ePropertyInputPath;
4928 const uint32_t idx = ePropertyInputPath;
4933 const uint32_t idx = ePropertyOutputPath;
4938 const uint32_t idx = ePropertyOutputPath;
4943 const uint32_t idx = ePropertyErrorPath;
4948 const uint32_t idx = ePropertyErrorPath;
4953 const uint32_t idx = ePropertyLanguage;
4958 const uint32_t idx = ePropertyExprPrefix;
4964 return llvm::StringRef(
4965 reinterpret_cast<const char *
>(data_sp->GetBytes()),
4966 data_sp->GetByteSize());
4972 const uint32_t idx = ePropertyExprErrorLimit;
4974 idx, g_target_properties[idx].default_uint_value);
4978 const uint32_t idx = ePropertyExprAllocAddress;
4980 idx, g_target_properties[idx].default_uint_value);
4984 const uint32_t idx = ePropertyExprAllocSize;
4986 idx, g_target_properties[idx].default_uint_value);
4990 const uint32_t idx = ePropertyExprAllocAlign;
4992 idx, g_target_properties[idx].default_uint_value);
4996 const uint32_t idx = ePropertyBreakpointUseAvoidList;
4998 idx, g_target_properties[idx].default_uint_value != 0);
5002 const uint32_t idx = ePropertyUseHexImmediates;
5004 idx, g_target_properties[idx].default_uint_value != 0);
5008 const uint32_t idx = ePropertyUseFastStepping;
5010 idx, g_target_properties[idx].default_uint_value != 0);
5014 const uint32_t idx = ePropertyDisplayExpressionsInCrashlogs;
5016 idx, g_target_properties[idx].default_uint_value != 0);
5020 const uint32_t idx = ePropertyLoadScriptFromSymbolFile;
5023 g_target_properties[idx].default_uint_value));
5027 const uint32_t idx = ePropertyLoadCWDlldbinitFile;
5030 g_target_properties[idx].default_uint_value));
5034 const uint32_t idx = ePropertyHexImmediateStyle;
5037 g_target_properties[idx].default_uint_value));
5041 const uint32_t idx = ePropertyMemoryModuleLoadLevel;
5044 g_target_properties[idx].default_uint_value));
5048 const uint32_t idx = ePropertyTrapHandlerNames;
5053 const uint32_t idx = ePropertyTrapHandlerNames;
5058 const uint32_t idx = ePropertyDisplayRuntimeSupportValues;
5060 idx, g_target_properties[idx].default_uint_value != 0);
5064 const uint32_t idx = ePropertyDisplayRuntimeSupportValues;
5069 const uint32_t idx = ePropertyDisplayRecognizedArguments;
5071 idx, g_target_properties[idx].default_uint_value != 0);
5075 const uint32_t idx = ePropertyDisplayRecognizedArguments;
5091 if (input_file_action) {
5096 if (output_file_action) {
5101 if (error_file_action) {
5107 launch_info.
GetFlags().
Test(lldb::eLaunchFlagInheritTCCFromParent));
5112 const uint32_t idx = ePropertyRequireHardwareBreakpoints;
5114 idx, g_target_properties[idx].default_uint_value != 0);
5118 const uint32_t idx = ePropertyRequireHardwareBreakpoints;
5123 const uint32_t idx = ePropertyAutoInstallMainExecutable;
5125 idx, g_target_properties[idx].default_uint_value != 0);
5159 m_launch_info.GetFlags().Set(lldb::eLaunchFlagDetachOnError);
5161 m_launch_info.GetFlags().Clear(lldb::eLaunchFlagDetachOnError);
5168 m_launch_info.GetFlags().Clear(lldb::eLaunchFlagDisableASLR);
5173 m_launch_info.GetFlags().Set(lldb::eLaunchFlagInheritTCCFromParent);
5175 m_launch_info.GetFlags().Clear(lldb::eLaunchFlagInheritTCCFromParent);
5180 m_launch_info.GetFlags().Set(lldb::eLaunchFlagDisableSTDIO);
5182 m_launch_info.GetFlags().Clear(lldb::eLaunchFlagDisableSTDIO);
5186 const uint32_t idx = ePropertyDebugUtilityExpression;
5188 idx, g_target_properties[idx].default_uint_value != 0);
5192 const uint32_t idx = ePropertyDebugUtilityExpression;
5208 return "Target::TargetEventData";
5258 return m_stats.ToJSON(*
this, options);
static llvm::raw_ostream & error(Stream &strm)
#define INTERRUPT_REQUESTED(debugger,...)
This handy define will keep you from having to generate a report for the interruption by hand.
#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,...)
static double elapsed(const StatsTimepoint &start, const StatsTimepoint &end)
static Status installExecutable(const Installer &installer)
static constexpr OptionEnumValueElement g_dynamic_class_info_helper_value_types[]
static bool CheckIfWatchpointsSupported(Target *target, Status &error)
static constexpr OptionEnumValueElement g_load_cwd_lldbinit_values[]
static void LoadScriptingResourceForModule(const ModuleSP &module_sp, Target *target)
static constexpr OptionEnumValueElement g_dynamic_value_types[]
static constexpr OptionEnumValueElement g_memory_module_load_level_values[]
static constexpr OptionEnumValueElement g_load_script_from_sym_file_values[]
static std::atomic< lldb::user_id_t > g_target_unique_id
static constexpr OptionEnumValueElement g_x86_dis_flavor_value_types[]
static constexpr OptionEnumValueElement g_hex_immediate_style_values[]
static constexpr OptionEnumValueElement g_inline_breakpoint_enums[]
static constexpr OptionEnumValueElement g_import_std_module_value_types[]
#define LLDB_SCOPED_TIMERF(...)
TargetExperimentalOptionValueProperties()
const Property * GetPropertyAtIndex(size_t idx, const ExecutionContext *exe_ctx=nullptr) const override
TargetOptionValueProperties(llvm::StringRef name)
static lldb::ABISP FindPlugin(lldb::ProcessSP process_sp, const ArchSpec &arch)
A section + offset based address class.
lldb::addr_t GetLoadAddress(Target *target) const
Get the load address.
bool SetLoadAddress(lldb::addr_t load_addr, Target *target, bool allow_section_end=false)
Set the address to represent load_addr.
lldb::SectionSP GetSection() const
Get const accessor for the section.
bool Slide(int64_t offset)
lldb::ModuleSP GetModule() const
Get accessor for the module for this address.
lldb::addr_t GetFileAddress() const
Get the file address.
lldb::addr_t GetOffset() const
Get the section relative offset value.
bool IsValid() const
Check if the object state is valid.
bool IsSectionOffset() const
Check if an address is section offset.
bool SetOffset(lldb::addr_t offset)
Set accessor for the offset.
An architecture specification class.
bool IsValid() const
Tests if this ArchSpec is valid.
llvm::Triple & GetTriple()
Architecture triple accessor.
void MergeFrom(const ArchSpec &other)
Merges fields from another ArchSpec into this ArchSpec.
const char * GetArchitectureName() const
Returns a static string representing the current architecture.
A command line argument class.
size_t GetArgumentCount() const
Gets the number of arguments left in this command object.
const char * GetArgumentAtIndex(size_t idx) const
Gets the NULL terminated C string argument pointer for the argument at index idx.
bool AddBreakpointID(BreakpointID bp_id)
BreakpointID GetBreakpointIDAtIndex(size_t index) const
lldb::break_id_t GetBreakpointID() const
static bool StringIsBreakpointName(llvm::StringRef str, Status &error)
Takes an input string and checks to see whether it is a breakpoint name.
General Outline: Allows adding and removing breakpoints and find by ID and index.
BreakpointIterable Breakpoints()
void GetListMutex(std::unique_lock< std::recursive_mutex > &lock)
Sets the passed in Locker to hold the Breakpoint List mutex.
void ResetHitCounts()
Resets the hit count of all breakpoints.
size_t GetSize() const
Returns the number of elements in this breakpoint list.
lldb::BreakpointSP GetBreakpointAtIndex(size_t i) const
Returns a shared pointer to the breakpoint with index i.
void MergeInto(const Permissions &incoming)
ConstString GetName() const
Permissions & GetPermissions()
BreakpointOptions & GetOptions()
void ConfigureBreakpoint(lldb::BreakpointSP bp_sp)
"lldb/Breakpoint/BreakpointOptions.h" Class that manages the options on a breakpoint or breakpoint lo...
void CopyOverSetOptions(const BreakpointOptions &rhs)
Copy over only the options set in the incoming BreakpointOptions.
"lldb/Breakpoint/BreakpointResolverFileLine.h" This class sets breakpoints by file and line.
"lldb/Breakpoint/BreakpointResolverFileRegex.h" This class sets breakpoints by file and line.
"lldb/Breakpoint/BreakpointResolverName.h" This class sets breakpoints on a given function name,...
"lldb/Breakpoint/BreakpointResolverScripted.h" This class sets breakpoints on a given Address.
General Outline: A breakpoint has four main parts, a filter, a resolver, the list of breakpoint locat...
virtual StructuredData::ObjectSP SerializeToStructuredData()
static lldb::BreakpointSP CreateFromStructuredData(lldb::TargetSP target_sp, StructuredData::ObjectSP &data_object_sp, Status &error)
static lldb::BreakpointSP CopyFromBreakpoint(lldb::TargetSP new_target, const Breakpoint &bp_to_copy_from)
static const char * GetSerializationKey()
static bool SerializedBreakpointMatchesNames(StructuredData::ObjectSP &bkpt_object_sp, std::vector< std::string > &names)
Broadcaster(lldb::BroadcasterManagerSP manager_sp, std::string name)
Construct with a broadcaster with a name.
void SetEventName(uint32_t event_mask, const char *name)
Set the name for an event bit.
void BroadcastEvent(lldb::EventSP &event_sp)
Broadcast an event which has no associated data.
void CheckInWithManager()
A class that implements CRTP-based "virtual constructor" idiom.
void SetStopOnContinue(bool stop_on_continue)
void SetPrintErrors(bool print_errors)
void SetEchoCommands(bool echo_commands)
void SetAddToHistory(bool add_to_history)
void SetStopOnError(bool stop_on_error)
void SetPrintResults(bool print_results)
void HandleCommands(const StringList &commands, const ExecutionContext &context, const CommandInterpreterRunOptions &options, CommandReturnObject &result)
Execute a list of commands in sequence.
void SetInteractive(bool b)
void SetImmediateOutputStream(const lldb::StreamSP &stream_sp)
lldb::ReturnStatus GetStatus() const
Generic representation of a type in a programming language.
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.
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 subclass of DataBuffer that stores a data buffer on the heap.
lldb::offset_t GetByteSize() const override
Get the number of bytes in the data buffer.
void SetAsyncExecution(bool async)
CommandInterpreter & GetCommandInterpreter()
lldb::StreamUP GetAsyncErrorStream()
TargetList & GetTargetList()
Get accessor for the target list.
static llvm::ThreadPoolInterface & GetThreadPool()
Shared thread pool. Use only with ThreadPoolTaskGroup.
static void ReportError(std::string message, std::optional< lldb::user_id_t > debugger_id=std::nullopt, std::once_flag *once=nullptr)
Report error events.
PlatformList & GetPlatformList()
lldb::ListenerSP GetListener()
llvm::Error GetAsError(lldb::ExpressionResults result, llvm::Twine message={}) const
Returns an ExpressionError with arg as error code.
static lldb::DisassemblerSP DisassembleBytes(const ArchSpec &arch, const char *plugin_name, const char *flavor, const char *cpu, const char *features, const Address &start, const void *bytes, size_t length, uint32_t max_num_instructions, bool data_from_file)
A class that measures elapsed time in an exception safe way.
static constexpr std::chrono::milliseconds default_timeout
virtual llvm::StringRef GetFlavor() const =0
"lldb/Target/ExecutionContextScope.h" Inherit from this if your object can reconstruct its execution ...
virtual void CalculateExecutionContext(ExecutionContext &exe_ctx)=0
Reconstruct the object's execution context into sc.
"lldb/Target/ExecutionContext.h" A class that contains an execution context.
void Clear()
Clear the object's state.
void SetTargetPtr(Target *target)
Set accessor to set only the target shared pointer from a target pointer.
StackFrame * GetFramePtr() const
Returns a pointer to the frame object.
Target * GetTargetPtr() const
Returns a pointer to the target object.
Thread & GetThreadRef() const
Returns a reference to the thread object.
llvm::StringRef GetPath() const
const FileSpec & GetFileSpecAtIndex(size_t idx) const
Get file at index.
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.
bool AppendIfUnique(const FileSpec &file)
Append a FileSpec object if unique.
void AppendPathComponent(llvm::StringRef component)
void SetDirectory(ConstString directory)
Directory string set accessor.
const ConstString & GetFilename() const
Filename string const get accessor.
const ConstString & GetDirectory() const
Directory string const get accessor.
void SetPath(llvm::StringRef p)
Temporary helper for FileSystem change.
size_t GetPath(char *path, size_t max_path_length, bool denormalize=true) const
Extract the full path to the file.
bool IsSourceImplementationFile() const
Returns true if the filespec represents an implementation source file (files with a "....
void SetFilename(ConstString filename)
Filename string set accessor.
bool Exists(const FileSpec &file_spec) const
Returns whether the given file exists.
bool IsDirectory(const FileSpec &file_spec) const
Returns whether the given path is a directory.
static FileSystem & Instance()
bool IsValid() const override
IsValid.
bool Test(ValueType bit) const
Test a single flag bit.
ValueType Set(ValueType mask)
Set one or more flags by logical OR'ing mask with the current flags.
Encapsulates a function that can be called.
static lldb::BreakpointSP CreateExceptionBreakpoint(Target &target, lldb::LanguageType language, bool catch_bp, bool throw_bp, bool is_internal=false)
static LanguageSet GetLanguagesSupportingREPLs()
static Language * FindPlugin(lldb::LanguageType language)
static const char * GetNameForLanguageType(lldb::LanguageType language)
Returns the internal LLDB name for the specified language.
static LanguageSet GetLanguagesSupportingTypeSystemsForExpressions()
virtual llvm::StringRef GetUserEntryPointName() const
static std::set< lldb::LanguageType > GetSupportedLanguages()
static lldb::ListenerSP MakeListener(const char *name)
lldb::ModuleSP GetModule() const
Get const accessor for the module pointer.
A collection class for Module objects.
bool AnyOf(std::function< bool(lldb_private::Module &module)> const &callback) const
Returns true if 'callback' returns true for one of the modules in this ModuleList.
static bool RemoveSharedModuleIfOrphaned(const lldb::ModuleWP module_ptr)
bool AppendIfNeeded(const lldb::ModuleSP &new_module, bool notify=true)
Append a module to the module list, if it is not already there.
static Status GetSharedModule(const ModuleSpec &module_spec, lldb::ModuleSP &module_sp, const FileSpecList *module_search_paths_ptr, llvm::SmallVectorImpl< lldb::ModuleSP > *old_modules, bool *did_create_ptr, bool always_create=false)
void FindModules(const ModuleSpec &module_spec, ModuleList &matching_module_list) const
Finds modules whose file specification matches module_spec.
lldb::ModuleSP GetModuleAtIndex(size_t idx) const
Get the module shared pointer for the module at index idx.
void Append(const lldb::ModuleSP &module_sp, bool notify=true)
Append a module to the module list.
size_t GetSize() const
Gets the size of the module list.
void ForEach(std::function< IterationAction(const lldb::ModuleSP &module_sp)> const &callback) const
Applies 'callback' to each module in this ModuleList.
A class that describes an executable image and its associated object and symbol files.
virtual ObjectFile * GetObjectFile()
Get the object file representation for the current architecture.
const FileSpec & GetFileSpec() const
Get const accessor for the module file specification.
A plug-in interface definition class for object file parsers.
virtual uint32_t GetDependentModules(FileSpecList &file_list)=0
Extract the dependent modules from an object file.
virtual lldb_private::Address GetEntryPointAddress()
Returns the address of the Entry Point in this object file - if the object file doesn't have an entry...
@ eTypeExecutable
A normal executable.
@ eTypeDebugInfo
An object file that contains only debug information.
@ eTypeStubLibrary
A library that can be linked against but not used for execution.
@ eTypeObjectFile
An intermediate object file.
@ eTypeDynamicLinker
The platform's dynamic linker executable.
@ eTypeCoreFile
A core file that has a checkpoint of a program's execution state.
@ eTypeSharedLibrary
A shared library that can be used during execution.
virtual size_t ReadSectionData(Section *section, lldb::offset_t section_offset, void *dst, size_t dst_len)
void AppendCurrentValue(const FileSpec &value)
const lldb::DataBufferSP & GetFileContents()
PathMappingList & GetCurrentValue()
auto GetPropertyAtIndexAs(size_t idx, const ExecutionContext *exe_ctx=nullptr) const
Property * ProtectedGetPropertyAtIndex(size_t idx)
bool SetPropertyAtIndex(size_t idx, T t, const ExecutionContext *exe_ctx=nullptr) const
static lldb::OptionValuePropertiesSP CreateLocalCopy(const Properties &global_properties)
bool RemapPath(ConstString path, ConstString &new_path) const
std::optional< llvm::StringRef > ReverseRemapPath(const FileSpec &file, FileSpec &fixed) const
Perform reverse source path remap for input file.
static std::unique_ptr< Architecture > CreateArchitectureInstance(const ArchSpec &arch)
static lldb::RegisterTypeBuilderSP GetRegisterTypeBuilder(Target &target)
bool ProcessInfoSpecified() const
lldb::ListenerSP GetListenerForProcess(Debugger &debugger)
llvm::StringRef GetProcessPluginName() const
void SetHijackListener(const lldb::ListenerSP &listener_sp)
void SetExecutableFile(const FileSpec &exe_file, bool add_exe_file_as_first_arg)
lldb::ScriptedMetadataSP GetScriptedMetadata() const
lldb::ListenerSP GetHijackListener() const
llvm::StringRef GetArg0() const
void SetScriptedMetadata(lldb::ScriptedMetadataSP metadata_sp)
FileSpec & GetExecutableFile()
lldb::ListenerSP GetListener() const
lldb::ListenerSP GetShadowListener() const
Environment & GetEnvironment()
bool IsScriptedProcess() const
ArchSpec & GetArchitecture()
llvm::StringRef GetProcessPluginName() const
const FileSpec & GetShell() const
llvm::Error SetUpPtyRedirection()
bool AppendOpenFileAction(int fd, const FileSpec &file_spec, bool read, bool write)
bool AppendSuppressFileAction(int fd, bool read, bool write)
const FileAction * GetFileActionForFD(int fd) const
void SetProcessPluginName(llvm::StringRef plugin)
static void SettingsInitialize()
static constexpr llvm::StringRef AttachSynchronousHijackListenerName
static lldb::ProcessSP FindPlugin(lldb::TargetSP target_sp, llvm::StringRef plugin_name, lldb::ListenerSP listener_sp, const FileSpec *crash_file_path, bool can_connect)
Find a Process plug-in that can debug module using the currently selected architecture.
static constexpr llvm::StringRef LaunchSynchronousHijackListenerName
static ProcessProperties & GetGlobalProperties()
static void SettingsTerminate()
A Progress indicator helper class.
lldb::OptionValuePropertiesSP m_collection_sp
T GetPropertyAtIndexAs(uint32_t idx, T default_value, const ExecutionContext *exe_ctx=nullptr) const
static llvm::StringRef GetExperimentalSettingsName()
bool SetPropertyAtIndex(uint32_t idx, T t, const ExecutionContext *exe_ctx=nullptr) const
lldb::OptionValuePropertiesSP GetValueProperties() const
const lldb::OptionValueSP & GetValue() const
static lldb::REPLSP Create(Status &Status, lldb::LanguageType language, Debugger *debugger, Target *target, const char *repl_options)
Get a REPL with an existing target (or, failing that, a debugger to use), and (optional) extra argume...
bool SignExtend(uint32_t bit_pos)
unsigned long long ULongLong(unsigned long long fail_value=0) const
long long SLongLong(long long fail_value=0) const
virtual lldb::ScriptedStopHookInterfaceSP CreateScriptedStopHookInterface()
size_t GetNumSections(uint32_t depth) const
lldb::SectionSP GetSectionAtIndex(size_t idx) const
void Dump(Stream &s, Target *target)
bool ResolveLoadAddress(lldb::addr_t load_addr, Address &so_addr, bool allow_section_end=false) const
lldb::addr_t GetSectionLoadAddress(const lldb::SectionSP §ion_sp) const
"lldb/Core/SourceLocationSpec.h" A source location specifier class.
Class that provides a registry of known stack frame recognizers.
const SymbolContext & GetSymbolContext(lldb::SymbolContextItem resolve_scope)
Provide a SymbolContext for this StackFrame's current pc value.
void Clear()
Clear the object state.
static Status FromErrorStringWithFormat(const char *format,...) __attribute__((format(printf
static Status FromErrorString(const char *str)
bool Fail() const
Test for error condition.
static Status static Status FromErrorStringWithFormatv(const char *format, Args &&...args)
static Status FromError(llvm::Error error)
Avoid using this in new code. Migrate APIs to llvm::Expected instead.
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.
void Format(const char *format, Args &&... args)
llvm::raw_ostream & AsRawOstream()
Returns a raw_ostream that forwards the data to this Stream object.
size_t Indent(llvm::StringRef s="")
Indent the current line in the stream.
size_t Printf(const char *format,...) __attribute__((format(printf
Output printf formatted output to the stream.
size_t PutCString(llvm::StringRef cstr)
Output a C string to the stream.
void SetIndentLevel(unsigned level)
Set the current indentation level.
void IndentLess(unsigned amount=2)
Decrement the current indentation level.
void IndentMore(unsigned amount=2)
Increment the current indentation level.
unsigned GetIndentLevel() const
Get the current indentation level.
void AddItem(const ObjectSP &item)
ObjectSP GetItemAtIndex(size_t idx) const
ObjectSP GetValueForKey(llvm::StringRef key) const
void ForEach(std::function< bool(llvm::StringRef key, Object *object)> const &callback) const
Dictionary * GetAsDictionary()
virtual bool IsValid() const
void Dump(lldb_private::Stream &s, bool pretty_print=true) const
std::shared_ptr< Object > ObjectSP
std::shared_ptr< Array > ArraySP
static ObjectSP ParseJSONFromFile(const FileSpec &file, Status &error)
A class that wraps a std::map of SummaryStatistics objects behind a mutex.
Defines a symbol context baton that can be handed other debug core functions.
lldb::TargetSP target_sp
The Target for a given query.
TargetExperimentalProperties()
lldb::TargetSP GetTargetAtIndex(uint32_t index) const
size_t GetNumTargets() const
uint32_t GetMaximumSizeOfStringSummary() const
FileSpecList GetDebugFileSearchPaths()
llvm::StringRef GetLaunchWorkingDirectory() const
bool GetDisplayRecognizedArguments() const
ImportStdModule GetImportStdModule() const
bool GetDisableSTDIO() const
bool GetMoveToNearestCode() const
~TargetProperties() override
void AppendExecutableSearchPaths(const FileSpec &)
void SetInheritTCC(bool b)
bool GetEnableSyntheticValue() const
void UpdateLaunchInfoFromProperties()
ProcessLaunchInfo m_launch_info
uint64_t GetExprAllocAlign() const
MemoryModuleLoadLevel GetMemoryModuleLoadLevel() const
llvm::StringRef GetArg0() const
uint32_t GetMaximumMemReadSize() const
void SetRunArguments(const Args &args)
FileSpec GetStandardErrorPath() const
bool GetEnableNotifyAboutFixIts() const
bool SetPreferDynamicValue(lldb::DynamicValueType d)
void SetDisplayRecognizedArguments(bool b)
std::optional< bool > GetExperimentalPropertyValue(size_t prop_idx, ExecutionContext *exe_ctx=nullptr) const
bool GetDisableASLR() const
bool GetUseFastStepping() const
const ProcessLaunchInfo & GetProcessLaunchInfo() const
Environment ComputeEnvironment() const
void Arg0ValueChangedCallback()
bool GetUserSpecifiedTrapHandlerNames(Args &args) const
uint64_t GetExprErrorLimit() const
bool GetEnableAutoImportClangModules() const
bool GetDebugUtilityExpression() const
void CheckJITObjectsDir()
bool GetSkipPrologue() const
DynamicClassInfoHelper GetDynamicClassInfoHelper() const
FileSpec GetStandardOutputPath() const
void InputPathValueChangedCallback()
void SetDisplayRuntimeSupportValues(bool b)
uint32_t GetMaximumNumberOfChildrenToDisplay() const
void SetRequireHardwareBreakpoints(bool b)
void SetDisableSTDIO(bool b)
bool GetAutoInstallMainExecutable() const
const char * GetDisassemblyFeatures() const
RealpathPrefixes GetSourceRealpathPrefixes() const
uint64_t GetNumberOfRetriesWithFixits() const
uint64_t GetExprAllocSize() const
llvm::StringRef GetExpressionPrefixContents()
PathMappingList & GetObjectPathMap() const
const char * GetDisassemblyFlavor() const
void SetPreloadSymbols(bool b)
FileSpec GetStandardInputPath() const
bool GetInheritTCC() const
void InheritTCCValueChangedCallback()
lldb::DynamicValueType GetPreferDynamicValue() const
void DisableSTDIOValueChangedCallback()
InlineStrategy GetInlineStrategy() const
Environment GetTargetEnvironment() const
bool GetDisplayRuntimeSupportValues() const
void SetDetachOnError(bool b)
void SetUserSpecifiedTrapHandlerNames(const Args &args)
bool GetUseHexImmediates() const
bool GetPreloadSymbols() const
uint32_t GetMaxZeroPaddingInFloatFormat() const
uint64_t GetExprAllocAddress() const
void DetachOnErrorValueChangedCallback()
LoadCWDlldbinitFile GetLoadCWDlldbinitFile() const
Environment GetInheritedEnvironment() const
void SetArg0(llvm::StringRef arg)
void EnvVarsValueChangedCallback()
bool GetInjectLocalVariables(ExecutionContext *exe_ctx) const
bool ShowHexVariableValuesWithLeadingZeroes() const
SourceLanguage GetLanguage() const
void OutputPathValueChangedCallback()
Environment GetEnvironment() const
void SetProcessLaunchInfo(const ProcessLaunchInfo &launch_info)
void RunArgsValueChangedCallback()
FileSpec GetSaveJITObjectsDir() const
void SetEnvironment(Environment env)
LoadScriptFromSymFile GetLoadScriptFromSymbolFile() const
const char * GetDisassemblyCPU() const
void SetStandardErrorPath(llvm::StringRef path)
bool GetRunArguments(Args &args) const
bool GetBreakpointsConsultPlatformAvoidList()
FileSpecList GetExecutableSearchPaths()
void SetDisableASLR(bool b)
ArchSpec GetDefaultArchitecture() const
Disassembler::HexImmediateStyle GetHexImmediateStyle() const
bool GetParallelModuleLoad() const
void SetUseDIL(ExecutionContext *exe_ctx, bool b)
std::unique_ptr< TargetExperimentalProperties > m_experimental_properties_up
FileSpecList GetClangModuleSearchPaths()
void SetStandardOutputPath(llvm::StringRef path)
void ErrorPathValueChangedCallback()
bool GetRequireHardwareBreakpoints() const
PathMappingList & GetSourcePathMap() const
bool GetAutoSourceMapRelative() const
bool GetUseDIL(ExecutionContext *exe_ctx) const
void SetDefaultArchitecture(const ArchSpec &arch)
void SetStandardInputPath(llvm::StringRef path)
TargetProperties(Target *target)
bool GetDisplayExpressionsInCrashlogs() const
void DisableASLRValueChangedCallback()
bool GetEnableAutoApplyFixIts() const
void SetDebugUtilityExpression(bool debug)
std::pair< uint32_t, bool > GetMaximumDepthOfChildrenToDisplay() const
Get the max depth value, augmented with a bool to indicate whether the depth is the default.
bool GetDetachOnError() const
std::unique_ptr< Architecture > m_plugin_up
const Arch & operator=(const ArchSpec &spec)
Arch(const ArchSpec &spec)
StringList & GetCommands()
void SetActionFromString(const std::string &strings)
void SetActionFromStrings(const std::vector< std::string > &strings)
StopHookResult HandleStop(ExecutionContext &exc_ctx, lldb::StreamSP output_sp) override
void GetSubclassDescription(Stream &s, lldb::DescriptionLevel level) const override
Status SetScriptCallback(std::string class_name, StructuredData::ObjectSP extra_args_sp)
StopHookResult HandleStop(ExecutionContext &exc_ctx, lldb::StreamSP output) override
void GetSubclassDescription(Stream &s, lldb::DescriptionLevel level) const override
StructuredDataImpl m_extra_args
This holds the dictionary of keys & values that can be used to parametrize any given callback's behav...
lldb::ScriptedStopHookInterfaceSP m_interface_sp
SymbolContextSpecifier * GetSpecifier()
void SetSpecifier(SymbolContextSpecifier *specifier)
std::unique_ptr< ThreadSpec > m_thread_spec_up
void SetThreadSpecifier(ThreadSpec *specifier)
ThreadSpec * GetThreadSpecifier()
lldb::TargetSP m_target_sp
StopHook(const StopHook &rhs)
bool ExecutionContextPasses(const ExecutionContext &exe_ctx)
lldb::TargetSP & GetTarget()
lldb::SymbolContextSpecifierSP m_specifier_sp
virtual void GetSubclassDescription(Stream &s, lldb::DescriptionLevel level) const =0
void GetDescription(Stream &s, lldb::DescriptionLevel level) const
void Dump(Stream *s) const override
static llvm::StringRef GetFlavorString()
static ModuleList GetModuleListFromEvent(const Event *event_ptr)
~TargetEventData() override
static const TargetEventData * GetEventDataFromEvent(const Event *event_ptr)
TargetEventData(const lldb::TargetSP &target_sp)
lldb::TargetSP m_target_sp
static lldb::TargetSP GetTargetFromEvent(const Event *event_ptr)
void ModulesDidLoad(ModuleList &module_list)
lldb::ThreadSP CalculateThread() override
StopHookCollection m_stop_hooks
Module * GetExecutableModulePointer()
void Dump(Stream *s, lldb::DescriptionLevel description_level)
Dump a description of this object to a Stream.
bool m_suppress_stop_hooks
void DisableAllBreakpoints(bool internal_also=false)
lldb::WatchpointSP CreateWatchpoint(lldb::addr_t addr, size_t size, const CompilerType *type, uint32_t kind, Status &error)
void ApplyNameToBreakpoints(BreakpointName &bp_name)
lldb::TraceSP GetTrace()
Get the Trace object containing processor trace information of this target.
PathMappingList & GetImageSearchPathList()
void FinalizeFileActions(ProcessLaunchInfo &info)
lldb::addr_t GetCallableLoadAddress(lldb::addr_t load_addr, AddressClass addr_class=AddressClass::eInvalid) const
Get load_addr as a callable code load address for this target.
lldb::addr_t GetOpcodeLoadAddress(lldb::addr_t load_addr, AddressClass addr_class=AddressClass::eInvalid) const
Get load_addr as an opcode for this target.
lldb::BreakpointSP CreateScriptedBreakpoint(const llvm::StringRef class_name, const FileSpecList *containingModules, const FileSpecList *containingSourceFiles, bool internal, bool request_hardware, StructuredData::ObjectSP extra_args_sp, Status *creation_error=nullptr)
static Target * GetTargetFromContexts(const ExecutionContext *exe_ctx_ptr, const SymbolContext *sc_ptr)
lldb::addr_t GetBreakableLoadAddress(lldb::addr_t addr)
void ClearDummySignals(Args &signal_names)
Clear the dummy signals in signal_names from the target, or all signals if signal_names is empty.
static void ImageSearchPathsChanged(const PathMappingList &path_list, void *baton)
llvm::Expected< lldb_private::Address > GetEntryPointAddress()
This method will return the address of the starting function for this binary, e.g.
bool IgnoreWatchpointByID(lldb::watch_id_t watch_id, uint32_t ignore_count)
lldb::BreakpointSP CreateFuncRegexBreakpoint(const FileSpecList *containingModules, const FileSpecList *containingSourceFiles, RegularExpression func_regexp, lldb::LanguageType requested_language, LazyBool skip_prologue, bool internal, bool request_hardware)
lldb::BreakpointSP GetBreakpointByID(lldb::break_id_t break_id)
std::shared_ptr< StopHook > StopHookSP
void SymbolsDidLoad(ModuleList &module_list)
bool ClearAllWatchpointHistoricValues()
const std::vector< StopHookSP > GetStopHooks(bool internal=false) const
void SetTrace(const lldb::TraceSP &trace_sp)
Set the Trace object containing processor trace information of this target.
BreakpointList & GetBreakpointList(bool internal=false)
CompilerType GetRegisterType(const std::string &name, const lldb_private::RegisterFlags &flags, uint32_t byte_size)
BreakpointNameList m_breakpoint_names
lldb_private::SummaryStatisticsCache & GetSummaryStatisticsCache()
lldb::addr_t GetSectionLoadAddress(const lldb::SectionSP §ion_sp)
llvm::StringRef GetABIName() const
Returns the name of the target's ABI plugin.
SourceManager & GetSourceManager()
lldb::SearchFilterSP GetSearchFilterForModuleList(const FileSpecList *containingModuleList)
StopHookSP GetStopHookByID(lldb::user_id_t uid)
llvm::StringMap< DummySignalValues > m_dummy_signals
These are used to set the signal state when you don't have a process and more usefully in the Dummy t...
lldb::ProcessSP m_process_sp
Debugger & GetDebugger() const
lldb::SearchFilterSP m_search_filter_sp
PersistentExpressionState * GetPersistentExpressionStateForLanguage(lldb::LanguageType language)
void UpdateSignalsFromDummy(lldb::UnixSignalsSP signals_sp, lldb::StreamSP warning_stream_sp)
Updates the signals in signals_sp using the stored dummy signals.
bool m_is_dummy_target
Used to not run stop hooks for expressions.
static bool UpdateSignalFromDummy(lldb::UnixSignalsSP signals_sp, const DummySignalElement &element)
PathMappingList m_image_search_paths
bool ModuleIsExcludedForUnconstrainedSearches(const FileSpec &module_spec)
Return whether this FileSpec corresponds to a module that should be considered for general searches.
lldb::StackFrameSP CalculateStackFrame() override
SectionLoadList & GetSectionLoadList()
lldb::addr_t GetPersistentSymbol(ConstString name)
void PrimeFromDummyTarget(Target &target)
static void SettingsTerminate()
bool EnableWatchpointByID(lldb::watch_id_t watch_id)
bool ResolveFileAddress(lldb::addr_t load_addr, Address &so_addr)
bool ClearAllWatchpointHitCounts()
size_t ReadMemoryFromFileCache(const Address &addr, void *dst, size_t dst_len, Status &error)
void ClearAllLoadedSections()
std::vector< lldb::TypeSystemSP > GetScratchTypeSystems(bool create_on_demand=true)
size_t ReadScalarIntegerFromMemory(const Address &addr, uint32_t byte_size, bool is_signed, Scalar &scalar, Status &error, bool force_live_memory=false)
void AddNameToBreakpoint(BreakpointID &id, llvm::StringRef name, Status &error)
void DumpSectionLoadList(Stream &s)
void DeleteCurrentProcess()
BreakpointList m_internal_breakpoint_list
int64_t ReadSignedIntegerFromMemory(const Address &addr, size_t integer_byte_size, int64_t fail_value, Status &error, bool force_live_memory=false)
void DisableAllowedBreakpoints()
bool SetSectionUnloaded(const lldb::SectionSP §ion_sp)
lldb::TargetSP CalculateTarget() override
const lldb::ProcessSP & GetProcessSP() const
void ClearModules(bool delete_locations)
bool RemoveBreakpointByID(lldb::break_id_t break_id)
lldb::ModuleSP GetOrCreateModule(const ModuleSpec &module_spec, bool notify, Status *error_ptr=nullptr)
Find a binary on the system and return its Module, or return an existing Module that is already in th...
static bool ResetSignalFromDummy(lldb::UnixSignalsSP signals_sp, const DummySignalElement &element)
Architecture * GetArchitecturePlugin() const
llvm::json::Value ReportStatistics(const lldb_private::StatisticsOptions &options)
Get metrics associated with this target in JSON format.
FunctionCaller * GetFunctionCallerForLanguage(lldb::LanguageType language, const CompilerType &return_type, const Address &function_address, const ValueList &arg_value_list, const char *name, Status &error)
void EnableAllBreakpoints(bool internal_also=false)
Status Launch(ProcessLaunchInfo &launch_info, Stream *stream)
bool DisableBreakpointByID(lldb::break_id_t break_id)
lldb::BreakpointSP CreateBreakpointAtUserEntry(Status &error)
BreakpointName * FindBreakpointName(ConstString name, bool can_create, Status &error)
llvm::Expected< lldb::TraceSP > CreateTrace()
Create a Trace object for the current target using the using the default supported tracing technology...
lldb::TraceSP m_trace_sp
The globally unique ID assigned to this target.
bool RemoveAllWatchpoints(bool end_to_end=true)
bool ReadPointerFromMemory(const Address &addr, Status &error, Address &pointer_addr, bool force_live_memory=false)
void UndoCreateStopHook(lldb::user_id_t uid)
If you tried to create a stop hook, and that failed, call this to remove the stop hook,...
WatchpointList m_watchpoint_list
BreakpointList m_breakpoint_list
lldb::SourceManagerUP m_source_manager_up
bool RemoveWatchpointByID(lldb::watch_id_t watch_id)
bool ResolveLoadAddress(lldb::addr_t load_addr, Address &so_addr, uint32_t stop_id=SectionLoadHistory::eStopIDNow, bool allow_section_end=false)
size_t ReadStringFromMemory(const Address &addr, char *dst, size_t max_bytes, Status &error, size_t type_width, bool force_live_memory=true)
Read a NULL terminated string from memory.
void DeleteBreakpointName(ConstString name)
void NotifyWillClearList(const ModuleList &module_list) override
bool SetArchitecture(const ArchSpec &arch_spec, bool set_platform=false, bool merge=true)
Set the architecture for this target.
void NotifyModuleAdded(const ModuleList &module_list, const lldb::ModuleSP &module_sp) override
Implementing of ModuleList::Notifier.
llvm::Expected< lldb::TypeSystemSP > GetScratchTypeSystemForLanguage(lldb::LanguageType language, bool create_on_demand=true)
void ConfigureBreakpointName(BreakpointName &bp_name, const BreakpointOptions &options, const BreakpointName::Permissions &permissions)
lldb_private::SummaryStatisticsSP GetSummaryStatisticsSPForProviderName(lldb_private::TypeSummaryImpl &summary_provider)
lldb::SearchFilterSP GetSearchFilterForModuleAndCUList(const FileSpecList *containingModules, const FileSpecList *containingSourceFiles)
lldb::ModuleSP GetExecutableModule()
Gets the module for the main executable.
bool SetStopHookActiveStateByID(lldb::user_id_t uid, bool active_state)
const lldb::ProcessSP & CreateProcess(lldb::ListenerSP listener_sp, llvm::StringRef plugin_name, const FileSpec *crash_file, bool can_connect)
void SetAllStopHooksActiveState(bool active_state)
std::vector< StopHookSP > m_internal_stop_hooks
lldb::ExpressionVariableSP GetPersistentVariable(ConstString name)
void NotifyModulesRemoved(lldb_private::ModuleList &module_list) override
StopHookSP CreateStopHook(StopHook::StopHookKind kind, bool internal=false)
Add an empty stop hook to the Target's stop hook list, and returns a shared pointer to the new hook.
size_t ReadCStringFromMemory(const Address &addr, std::string &out_str, Status &error, bool force_live_memory=false)
std::recursive_mutex m_mutex
An API mutex that is used by the lldb::SB* classes make the SB interface thread safe.
lldb::user_id_t m_target_unique_id
void ModulesDidUnload(ModuleList &module_list, bool delete_locations)
void CalculateExecutionContext(ExecutionContext &exe_ctx) override
Reconstruct the object's execution context into sc.
llvm::Expected< lldb::DisassemblerSP > ReadInstructions(const Address &start_addr, uint32_t count, const char *flavor_string=nullptr)
llvm::Expected< lldb::TraceSP > GetTraceOrCreate()
If a Trace object is present, this returns it, otherwise a new Trace is created with Trace::CreateTra...
void NotifyModuleUpdated(const ModuleList &module_list, const lldb::ModuleSP &old_module_sp, const lldb::ModuleSP &new_module_sp) override
SummaryStatisticsCache m_summary_statistics_cache
Status SerializeBreakpointsToFile(const FileSpec &file, const BreakpointIDList &bp_ids, bool append)
void DidExec()
Called as the last function in Process::DidExec().
void SaveScriptedLaunchInfo(lldb_private::ProcessInfo &process_info)
lldb::user_id_t m_stop_hook_next_id
void RemoveAllStopHooks()
static FileSpecList GetDefaultExecutableSearchPaths()
lldb::BreakpointSP CreateExceptionBreakpoint(enum lldb::LanguageType language, bool catch_bp, bool throw_bp, bool internal, Args *additional_args=nullptr, Status *additional_args_error=nullptr)
lldb::SearchFilterSP GetSearchFilterForModule(const FileSpec *containingModule)
llvm::StringMapEntry< DummySignalValues > DummySignalElement
std::recursive_mutex & GetAPIMutex()
static llvm::StringRef GetStaticBroadcasterClass()
static FileSpecList GetDefaultDebugFileSearchPaths()
void EnableAllowedBreakpoints()
virtual size_t ReadMemory(const Address &addr, void *dst, size_t dst_len, Status &error, bool force_live_memory=false, lldb::addr_t *load_addr_ptr=nullptr, bool *did_read_live_memory=nullptr)
llvm::Error SetLabel(llvm::StringRef label)
Set a label for a target.
uint32_t m_latest_stop_hook_id
void RemoveAllowedBreakpoints()
bool DisableAllWatchpoints(bool end_to_end=true)
bool RunStopHooks(bool at_initial_stop=false)
void ClearSectionLoadList()
lldb::addr_t GetReasonableReadSize(const Address &addr)
Return a recommended size for memory reads at addr, optimizing for cache usage.
lldb::PlatformSP m_platform_sp
The platform for this target.
llvm::Expected< std::unique_ptr< UtilityFunction > > CreateUtilityFunction(std::string expression, std::string name, lldb::LanguageType language, ExecutionContext &exe_ctx)
Creates and installs a UtilityFunction for the given language.
static TargetProperties & GetGlobalProperties()
Status Install(ProcessLaunchInfo *launch_info)
lldb::PlatformSP GetPlatform()
void NotifyModuleRemoved(const ModuleList &module_list, const lldb::ModuleSP &module_sp) override
lldb::BreakpointSP CreateAddressInModuleBreakpoint(lldb::addr_t file_addr, bool internal, const FileSpec &file_spec, bool request_hardware)
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)
void RemoveAllBreakpoints(bool internal_also=false)
lldb::BreakpointSP CreateSourceRegexBreakpoint(const FileSpecList *containingModules, const FileSpecList *source_file_list, const std::unordered_set< std::string > &function_names, RegularExpression source_regex, bool internal, bool request_hardware, LazyBool move_to_nearest_code)
static ArchSpec GetDefaultArchitecture()
void ResetBreakpointHitCounts()
Resets the hit count of all breakpoints.
const ModuleList & GetImages() const
Get accessor for the images for this process.
const ArchSpec & GetArchitecture() const
WatchpointList & GetWatchpointList()
@ eBroadcastBitModulesLoaded
@ eBroadcastBitSymbolsLoaded
@ eBroadcastBitModulesUnloaded
@ eBroadcastBitWatchpointChanged
@ eBroadcastBitBreakpointChanged
bool EnableBreakpointByID(lldb::break_id_t break_id)
uint64_t ReadUnsignedIntegerFromMemory(const Address &addr, size_t integer_byte_size, uint64_t fail_value, Status &error, bool force_live_memory=false)
bool IgnoreAllWatchpoints(uint32_t ignore_count)
void AddBreakpoint(lldb::BreakpointSP breakpoint_sp, bool internal)
TypeSystemMap m_scratch_type_system_map
void AddBreakpointName(std::unique_ptr< BreakpointName > bp_name)
SectionLoadHistory m_section_load_history
void GetBreakpointNames(std::vector< std::string > &names)
Target(Debugger &debugger, const ArchSpec &target_arch, const lldb::PlatformSP &platform_sp, bool is_dummy_target)
Construct with optional file and arch.
size_t UnloadModuleSections(const lldb::ModuleSP &module_sp)
bool m_valid
This records the last natural stop at which we ran a stop-hook.
bool DisableWatchpointByID(lldb::watch_id_t watch_id)
void AddDummySignal(llvm::StringRef name, LazyBool pass, LazyBool print, LazyBool stop)
Add a signal to the Target's list of stored signals/actions.
lldb::WatchpointSP m_last_created_watchpoint
Status CreateBreakpointsFromFile(const FileSpec &file, BreakpointIDList &new_bps)
void SetREPL(lldb::LanguageType language, lldb::REPLSP repl_sp)
void SetExecutableModule(lldb::ModuleSP &module_sp, LoadDependentFiles load_dependent_files=eLoadDependentsDefault)
Set the main executable module.
lldb::StackFrameRecognizerManagerUP m_frame_recognizer_manager_up
Stores the frame recognizers of this target.
lldb::REPLSP GetREPL(Status &err, lldb::LanguageType language, const char *repl_options, bool can_create)
UserExpression * GetUserExpressionForLanguage(llvm::StringRef expr, llvm::StringRef prefix, SourceLanguage language, Expression::ResultType desired_type, const EvaluateExpressionOptions &options, ValueObject *ctx_obj, Status &error)
ModuleList m_images
The list of images for this process (shared libraries and anything dynamically loaded).
lldb::ProcessSP CalculateProcess() override
void PrintDummySignals(Stream &strm, Args &signals)
Print all the signals set in this target.
void SetPlatform(const lldb::PlatformSP &platform_sp)
bool SetSectionLoadAddress(const lldb::SectionSP §ion, lldb::addr_t load_addr, bool warn_multiple=false)
Status Attach(ProcessAttachInfo &attach_info, Stream *stream)
static void SetDefaultArchitecture(const ArchSpec &arch)
lldb::BreakpointSP m_last_created_breakpoint
void RemoveNameFromBreakpoint(lldb::BreakpointSP &bp_sp, ConstString name)
bool RemoveStopHookByID(lldb::user_id_t uid)
static void SettingsInitialize()
bool EnableAllWatchpoints(bool end_to_end=true)
std::recursive_mutex m_private_mutex
When the private state thread calls SB API's - usually because it is running OS plugin or Python Thre...
lldb::ExpressionResults EvaluateExpression(llvm::StringRef expression, ExecutionContextScope *exe_scope, lldb::ValueObjectSP &result_valobj_sp, const EvaluateExpressionOptions &options=EvaluateExpressionOptions(), std::string *fixed_expression=nullptr, ValueObject *ctx_obj=nullptr)
bool MergeArchitecture(const ArchSpec &arch_spec)
uint32_t GetSize(bool can_update=true)
lldb::ThreadSP GetThreadAtIndex(uint32_t idx, bool can_update=true)
static llvm::Expected< lldb::TraceSP > FindPluginForLiveProcess(llvm::StringRef plugin_name, Process &process)
Find a trace plug-in to trace a live process.
Represents UUID's of various sizes.
void Dump(Stream &s) const
Encapsulates a one-time expression for use in lldb.
static lldb::ExpressionResults Evaluate(ExecutionContext &exe_ctx, const EvaluateExpressionOptions &options, llvm::StringRef expr_cstr, llvm::StringRef expr_prefix, lldb::ValueObjectSP &result_valobj_sp, std::string *fixed_expression=nullptr, ValueObject *ctx_obj=nullptr)
Evaluate one expression in the scratch context of the target passed in the exe_ctx and return its res...
void GetListMutex(std::unique_lock< std::recursive_mutex > &lock)
Sets the passed in Locker to hold the Watchpoint List mutex.
uint8_t * GetBytes()
Get a pointer to the data.
#define LLDB_WATCH_TYPE_WRITE
#define LLDB_INVALID_BREAK_ID
#define LLDB_INVALID_SIGNAL_NUMBER
#define LLDB_INVALID_INDEX32
#define LLDB_WATCH_TYPE_IS_VALID(type)
#define LLDB_BREAK_ID_IS_INTERNAL(bid)
#define LLDB_WATCH_TYPE_MODIFY
#define LLDB_WATCH_TYPE_READ
#define LLDB_INVALID_ADDRESS
#define LLDB_INVALID_PROCESS_ID
@ SelectMostRelevantFrame
A class that represents a running process on the host machine.
@ eMemoryModuleLoadLevelPartial
@ eMemoryModuleLoadLevelComplete
@ eMemoryModuleLoadLevelMinimal
Log * GetLog(Cat mask)
Retrieve the Log object for the channel associated with the given log enum.
std::shared_ptr< SummaryStatistics > SummaryStatisticsSP
@ eLoadScriptFromSymFileTrue
@ eLoadScriptFromSymFileFalse
@ eLoadScriptFromSymFileWarn
static uint32_t bit(const uint32_t val, const uint32_t msbit)
@ eDynamicClassInfoHelperCopyRealizedClassList
@ eDynamicClassInfoHelperGetRealizedClassList
@ eDynamicClassInfoHelperAuto
@ eDynamicClassInfoHelperRealizedClassesStruct
OptionEnumValues GetDynamicValueTypes()
@ eImportStdModuleFallback
void LoadTypeSummariesForModule(lldb::ModuleSP module_sp)
Load type summaries embedded in the binary.
const char * StateAsCString(lldb::StateType state)
Converts a StateType to a C string.
llvm::ArrayRef< OptionEnumValueElement > OptionEnumValues
void LoadFormattersForModule(lldb::ModuleSP module_sp)
Load data formatters embedded in the binary.
@ eInlineBreakpointsNever
@ eInlineBreakpointsAlways
@ eInlineBreakpointsHeaders
std::shared_ptr< lldb_private::OptionValueProperties > OptionValuePropertiesSP
std::shared_ptr< lldb_private::Trace > TraceSP
std::shared_ptr< lldb_private::TypeSystem > TypeSystemSP
std::shared_ptr< lldb_private::ABI > ABISP
std::shared_ptr< lldb_private::StackFrame > StackFrameSP
std::shared_ptr< lldb_private::SearchFilter > SearchFilterSP
std::shared_ptr< lldb_private::BreakpointResolver > BreakpointResolverSP
DescriptionLevel
Description levels for "void GetDescription(Stream *, DescriptionLevel)" calls.
@ eDescriptionLevelVerbose
std::shared_ptr< lldb_private::Thread > ThreadSP
std::shared_ptr< lldb_private::ValueObject > ValueObjectSP
std::shared_ptr< lldb_private::ExpressionVariable > ExpressionVariableSP
std::shared_ptr< lldb_private::UnixSignals > UnixSignalsSP
std::shared_ptr< lldb_private::Platform > PlatformSP
StateType
Process and Thread States.
@ eStateConnected
Process is connected to remote debug services, but not launched or attached to anything yet.
@ eStateStopped
Process or thread is stopped and can be examined.
@ eStateAttaching
Process is currently trying to attach.
@ eStateExited
Process has exited and can't be examined.
std::shared_ptr< lldb_private::RegisterTypeBuilder > RegisterTypeBuilderSP
LanguageType
Programming language type.
@ eLanguageTypeMipsAssembler
Mips_Assembler.
@ eLanguageTypeUnknown
Unknown or invalid language value.
@ eLanguageTypeC
Non-standardized C, such as K&R.
std::shared_ptr< lldb_private::Stream > StreamSP
std::shared_ptr< lldb_private::Breakpoint > BreakpointSP
ExpressionResults
The results of expression evaluation.
std::shared_ptr< lldb_private::Process > ProcessSP
std::shared_ptr< lldb_private::BreakpointPrecondition > BreakpointPreconditionSP
std::shared_ptr< lldb_private::Event > EventSP
ReturnStatus
Command Return Status Types.
@ eReturnStatusSuccessContinuingResult
@ eReturnStatusSuccessContinuingNoResult
std::shared_ptr< lldb_private::Watchpoint > WatchpointSP
std::shared_ptr< lldb_private::Listener > ListenerSP
std::shared_ptr< lldb_private::DataBuffer > DataBufferSP
std::shared_ptr< lldb_private::Section > SectionSP
std::shared_ptr< lldb_private::Target > TargetSP
std::shared_ptr< lldb_private::Module > ModuleSP
std::shared_ptr< lldb_private::REPL > REPLSP
A SmallBitVector that represents a set of source languages (lldb::LanguageType).
llvm::SmallBitVector bitvector
std::optional< lldb::LanguageType > GetSingularLanguage()
If the set contains a single language only, return it.
A type-erased pair of llvm::dwarf::SourceLanguageName and version.
lldb::LanguageType AsLanguageType() const
llvm::StringRef GetDescription() const
UserID(lldb::user_id_t uid=LLDB_INVALID_UID)
Construct with optional user ID.
lldb::user_id_t GetID() const
Get accessor for the user ID.
std::string triple
The triple of this executable module.
bool is_start_entry
If true, this entry was emitted at the beginning of an event (eg., before the executable is set).
UUID uuid
The same as the executable-module's UUID.
lldb::pid_t pid
PID of the process owned by this target.
Helper RAII class for collecting telemetry.
void DispatchOnExit(llvm::unique_function< void(Info *info)> final_callback)
void DispatchNow(llvm::unique_function< void(Info *info)> populate_fields_cb)