76#include "llvm/ADT/STLExtras.h"
77#include "llvm/ADT/ScopeExit.h"
78#include "llvm/ADT/SetVector.h"
79#include "llvm/Support/ErrorExtras.h"
80#include "llvm/Support/ThreadPool.h"
93struct ExecutableInstaller {
96 : m_platform{platform}, m_module{module},
97 m_local_file{m_module->GetFileSpec()},
98 m_remote_file{m_module->GetRemoteInstallFileSpec()} {}
100 void setupRemoteFile()
const { m_module->SetPlatformFileSpec(m_remote_file); }
104 const FileSpec m_local_file;
105 const FileSpec m_remote_file;
108struct MainExecutableInstaller {
111 ProcessLaunchInfo &launch_info)
112 : m_platform{platform}, m_module{module},
113 m_local_file{m_module->GetFileSpec()},
115 getRemoteFileSpec(m_platform, target, m_module, m_local_file)},
116 m_launch_info{launch_info} {}
118 void setupRemoteFile()
const {
119 m_module->SetPlatformFileSpec(m_remote_file);
122 m_platform->SetFilePermissions(m_remote_file, 0700 );
127 const FileSpec m_local_file;
128 const FileSpec m_remote_file;
133 const FileSpec &local_file) {
134 FileSpec remote_file =
module->GetRemoteInstallFileSpec();
135 if (remote_file || !target->GetAutoInstallMainExecutable())
141 remote_file = platform->GetRemoteWorkingDirectory();
147 ProcessLaunchInfo &m_launch_info;
153template <
typename Installer>
155 if (!installer.m_local_file || !installer.m_remote_file)
158 Status error = installer.m_platform->Install(installer.m_local_file,
159 installer.m_remote_file);
163 installer.setupRemoteFile();
178 static constexpr llvm::StringLiteral class_name(
"lldb.target");
211 static_cast<void *
>(
this));
214 "Target::Target created with architecture {0} ({1})",
216 target_arch.
GetTriple().getTriple().c_str());
224 LLDB_LOG(log,
"{0} Target::~Target()",
static_cast<void *
>(
this));
236 if (breakpoint_sp->IsInternal())
250 elem.second->CopyIntoNewTarget(*
this);
251 if (llvm::Error
error = new_override_up->HasErrors())
253 "Can't copy breakpoint override from the dummy target: "
291 llvm::consumeError(
m_process_sp->FlushDelayedBreakpoints());
293 std::unique_lock<std::recursive_mutex> lock;
324 llvm::StringRef plugin_name,
331 listener_sp, crash_file, can_connect);
338 const char *repl_options,
bool can_create) {
346 language = *single_lang;
347 }
else if (repl_languages.
Empty()) {
349 "LLDB isn't configured with REPL support for any languages.");
353 "Multiple possible REPL languages. Please specify a language.");
358 REPLMap::iterator pos =
m_repl_map.find(language);
366 "Couldn't find an existing REPL for %s, and can't create a new one",
381 "Couldn't create a REPL for %s",
396 std::lock_guard<std::recursive_mutex> guard(
m_mutex);
403 const bool notify =
false;
439 return abi_sp->GetPluginName();
471 if (!main_module_sp) {
476 shared_lib_filter.
Append(main_module_sp->GetFileSpec());
477 llvm::SetVector<std::string, std::vector<std::string>,
478 std::unordered_set<std::string>>
487 if (!entryPointName.empty())
488 entryPointNamesSet.insert(entryPointName);
490 if (entryPointNamesSet.empty()) {
496 nullptr, entryPointNamesSet.takeVector(),
497 eFunctionNameTypeFull,
507 bp_sp->SetOneShot(
true);
514 const std::unordered_set<std::string> &function_names,
518 containingModules, source_file_spec_list));
522 nullptr, std::move(source_regex), function_names,
523 !
static_cast<bool>(move_to_nearest_code)));
529 const FileSpec &file, uint32_t line_no,
532 LazyBool skip_prologue,
bool internal,
536 std::optional<llvm::StringRef> removed_prefix_opt =
538 if (!removed_prefix_opt)
539 remapped_file = file;
543 switch (inline_strategy) {
564 compile_unit_list.
Append(remapped_file);
577 !
static_cast<bool>(move_to_nearest_code));
582 nullptr, offset, skip_prologue, location_spec, removed_prefix_opt));
609 std::make_shared<SearchFilterForUnconstrainedSearches>(
612 std::make_shared<BreakpointResolverAddress>(
nullptr, addr);
619 bool request_hardware) {
621 std::make_shared<SearchFilterForUnconstrainedSearches>(
624 std::make_shared<BreakpointResolverAddress>(
nullptr,
Address(file_addr),
632 const FileSpecList *containingSourceFiles,
const char *func_name,
633 FunctionNameType func_name_type_mask,
LanguageType language,
635 bool internal,
bool hardware) {
639 containingModules, containingSourceFiles));
648 offset, offset_is_insn_count, skip_prologue));
657 const std::vector<std::string> &func_names,
658 FunctionNameType func_name_type_mask,
660 LazyBool skip_prologue,
bool internal,
bool hardware) {
662 size_t num_names = func_names.size();
665 containingModules, containingSourceFiles));
673 new BreakpointResolverName(
nullptr, func_names, func_name_type_mask,
674 language, offset, skip_prologue));
683 const char *func_names[],
size_t num_names,
684 FunctionNameType func_name_type_mask,
686 LazyBool skip_prologue,
bool internal,
bool hardware) {
690 containingModules, containingSourceFiles));
702 nullptr, func_names, num_names, func_name_type_mask, language, offset,
704 resolver_sp->SetOffset(offset);
713 if (containingModule !=
nullptr) {
716 filter_sp = std::make_shared<SearchFilterByModule>(shared_from_this(),
721 std::make_shared<SearchFilterForUnconstrainedSearches>(
731 if (containingModules && containingModules->
GetSize() != 0) {
734 filter_sp = std::make_shared<SearchFilterByModuleList>(shared_from_this(),
739 std::make_shared<SearchFilterForUnconstrainedSearches>(
749 if (containingSourceFiles ==
nullptr || containingSourceFiles->
GetSize() == 0)
753 if (containingModules ==
nullptr) {
757 filter_sp = std::make_shared<SearchFilterByModuleListAndCU>(
758 shared_from_this(),
FileSpecList(), *containingSourceFiles);
760 filter_sp = std::make_shared<SearchFilterByModuleListAndCU>(
761 shared_from_this(), *containingModules, *containingSourceFiles);
770 bool internal,
bool hardware) {
772 containingModules, containingSourceFiles));
775 :
static_cast<bool>(skip_prologue);
777 nullptr, std::move(func_regex), requested_language, 0,
skip));
784 bool catch_bp,
bool throw_bp,
bool internal,
787 *
this, language, catch_bp, throw_bp, internal);
788 if (exc_bkpt_sp && additional_args) {
790 if (precondition_sp && additional_args) {
792 *
error = precondition_sp->ConfigurePrecondition(*additional_args);
794 precondition_sp->ConfigurePrecondition(*additional_args);
801 const llvm::StringRef class_name,
const FileSpecList *containingModules,
802 const FileSpecList *containingSourceFiles,
bool internal,
809 containingSourceFiles && containingSourceFiles->
GetSize() > 0;
810 bool has_modules = containingModules && containingModules->
GetSize() > 0;
812 if (has_files && has_modules) {
814 containingSourceFiles);
815 }
else if (has_files) {
818 }
else if (has_modules) {
821 filter_sp = std::make_shared<SearchFilterForUnconstrainedSearches>(
832 bool internal,
bool request_hardware,
833 bool resolve_indirect_symbols) {
835 if (filter_sp && resolver_sp) {
843 resolver_sp = overridden_sp;
846 bp_sp.reset(
new Breakpoint(*
this, filter_sp, resolver_sp, hardware,
847 resolve_indirect_symbols));
848 resolver_sp->SetBreakpoint(bp_sp);
866 LLDB_LOGF(log,
"Target::%s (internal = %s) => break_id = %s\n",
867 __FUNCTION__, bp_sp->IsInternal() ?
"yes" :
"no", s.
GetData());
870 bp_sp->ResolveBreakpoint();
901 bp_sp->AddName(name);
906 std::make_pair(bp_name->GetName(), std::move(bp_name)));
912 if (!
error.Success())
917 return iter->second.get();
922 "Breakpoint name \"{0}\" doesn't exist and can_create is false.", name);
928 std::make_pair(name, std::make_unique<BreakpointName>(name.str())))
929 .first->second.get();
938 bp_sp->RemoveName(name);
943 llvm::StringRef name) {
944 bp_sp->RemoveName(name);
956 llvm::Expected<std::vector<BreakpointSP>> expected_vector =
959 if (!expected_vector) {
961 llvm::toString(expected_vector.takeError()));
965 for (
auto bp_sp : *expected_vector)
972 names.push_back(bp_name_entry.first().str());
978 llvm::StringRef class_name, uint64_t type_mask,
980 if (class_name.empty())
981 return llvm::createStringError(llvm::inconvertibleErrorCode(),
985 return llvm::createStringErrorV(
986 llvm::inconvertibleErrorCode(),
987 "invalid breakpoint type mask: {0}, should be composed of the "
988 "elements of the BreakpointResolverType enum.",
996 type_mask, std::string(class_name),
998 llvm::Error
error = new_override_up->HasErrors();
1010 std::vector<lldb::user_id_t> &idxs,
1011 uint32_t output_width,
1014 stream <<
"No overrides.\n";
1018 bool empty = idxs.empty();
1019 bool print_first =
true;
1021 auto idx_pos = llvm::find(idxs, elem.first);
1022 if (empty || idx_pos != idxs.end()) {
1026 output_width, use_color);
1028 output_width, use_color);
1029 print_first =
false;
1031 auto content = llvm::formatv(
"{0,4} {1,6} {2}\n", elem.first,
1032 elem.second->DescribeTypeMask(),
1033 elem.second->GetDescription())
1037 idxs.erase(idx_pos);
1049 if (!original_sp->ResolverTyInMask(elem.second->GetTypeMask()))
1052 elem.second->CheckForOverride(*
this, original_sp))
1053 return overriden_sp;
1059 std::optional<uint32_t> num_supported_hardware_watchpoints =
1064 if (!num_supported_hardware_watchpoints)
1067 if (*num_supported_hardware_watchpoints == 0) {
1069 "Target supports (%u) hardware watchpoint slots.\n",
1070 *num_supported_hardware_watchpoints);
1083 "Target::%s (addr = 0x%8.8" PRIx64
" size = %" PRIu64
1085 __FUNCTION__, addr, (uint64_t)size, kind);
1096 "cannot set a watchpoint with watch_size of 0");
1099 "invalid watch address: %" PRIu64, addr);
1115 const bool notify =
false;
1120 addr = abi->FixDataAddress(addr);
1134 std::unique_lock<std::recursive_mutex> lock;
1138 size_t old_size = matched_sp->GetByteSize();
1144 if (size == old_size && kind == old_type) {
1146 wp_sp->SetEnabled(
false, notify);
1155 wp_sp = std::make_shared<Watchpoint>(*
this, addr, size, type);
1156 wp_sp->SetWatchpointType(kind, notify);
1161 LLDB_LOGF(log,
"Target::%s (creation of watchpoint %s with id = %u)\n",
1162 __FUNCTION__,
error.Success() ?
"succeeded" :
"failed",
1177 LLDB_LOGF(log,
"Target::%s \n", __FUNCTION__);
1186 LLDB_LOGF(log,
"Target::%s (internal_also = %s)\n", __FUNCTION__,
1187 internal_also ?
"yes" :
"no");
1198 LLDB_LOGF(log,
"Target::%s (internal_also = %s)\n", __FUNCTION__,
1199 internal_also ?
"yes" :
"no");
1208 LLDB_LOGF(log,
"Target::%s", __FUNCTION__);
1215 LLDB_LOGF(log,
"Target::%s (internal_also = %s)\n", __FUNCTION__,
1216 internal_also ?
"yes" :
"no");
1225 LLDB_LOGF(log,
"Target::%s", __FUNCTION__);
1232 LLDB_LOGF(log,
"Target::%s (break_id = %i, internal = %s)\n", __FUNCTION__,
1252 LLDB_LOGF(log,
"Target::%s (break_id = %i, internal = %s)\n", __FUNCTION__,
1262 bp_sp->SetEnabled(
false);
1270 LLDB_LOGF(log,
"Target::%s (break_id = %i, internal = %s)\n", __FUNCTION__,
1281 bp_sp->SetEnabled(
true);
1301 std::string path(file.
GetPath());
1309 if (
error.Success()) {
1310 break_store_ptr = input_data_sp->GetAsArray();
1311 if (!break_store_ptr) {
1313 "Tried to append to invalid input file %s", path.c_str());
1319 if (!break_store_ptr) {
1320 break_store_sp = std::make_shared<StructuredData::Array>();
1321 break_store_ptr = break_store_sp.get();
1328 lldb::eFilePermissionsFileDefault);
1335 std::unique_lock<std::recursive_mutex> lock;
1341 size_t num_breakpoints = breakpoints.
GetSize();
1342 for (
size_t i = 0; i < num_breakpoints; i++) {
1347 break_store_ptr->
AddItem(bkpt_save_sp);
1351 std::unordered_set<lldb::break_id_t> processed_bkpts;
1352 const size_t count = bp_ids.
GetSize();
1353 for (
size_t i = 0; i < count; ++i) {
1359 std::pair<std::unordered_set<lldb::break_id_t>::iterator,
bool>
1360 insert_result = processed_bkpts.insert(bp_id);
1361 if (!insert_result.second)
1368 if (!bkpt_save_sp) {
1370 "Unable to serialize breakpoint %d", bp_id);
1373 break_store_ptr->
AddItem(bkpt_save_sp);
1378 break_store_ptr->
Dump(out_file,
false);
1385 std::vector<std::string> no_names;
1390 std::vector<std::string> &names,
1392 std::unique_lock<std::recursive_mutex> lock;
1398 if (!
error.Success()) {
1400 }
else if (!input_data_sp || !input_data_sp->IsValid()) {
1402 "Invalid JSON from input file: %s.", file.
GetPath().c_str());
1409 "Invalid breakpoint data from input file: %s.", file.
GetPath().c_str());
1413 size_t num_bkpts = bkpt_array->
GetSize();
1414 size_t num_names = names.size();
1416 for (
size_t i = 0; i < num_bkpts; i++) {
1422 "Invalid breakpoint data for element %zu from input file: %s.", i,
1433 shared_from_this(), bkpt_data_sp,
error);
1434 if (!
error.Success()) {
1436 "Error restoring breakpoint %zu from %s: %s.", i,
1452 LLDB_LOGF(log,
"Target::%s\n", __FUNCTION__);
1481 LLDB_LOGF(log,
"Target::%s\n", __FUNCTION__);
1508 LLDB_LOGF(log,
"Target::%s\n", __FUNCTION__);
1534 LLDB_LOGF(log,
"Target::%s\n", __FUNCTION__);
1540 wp_sp->ResetHitCount();
1548 LLDB_LOGF(log,
"Target::%s\n", __FUNCTION__);
1554 wp_sp->ResetHistoricValues();
1563 LLDB_LOGF(log,
"Target::%s\n", __FUNCTION__);
1572 wp_sp->SetIgnoreCount(ignore_count);
1580 LLDB_LOGF(log,
"Target::%s (watch_id = %i)\n", __FUNCTION__, watch_id);
1599 LLDB_LOGF(log,
"Target::%s (watch_id = %i)\n", __FUNCTION__, watch_id);
1618 LLDB_LOGF(log,
"Target::%s (watch_id = %i)\n", __FUNCTION__, watch_id);
1633 uint32_t ignore_count) {
1635 LLDB_LOGF(log,
"Target::%s (watch_id = %i)\n", __FUNCTION__, watch_id);
1642 wp_sp->SetIgnoreCount(ignore_count);
1649 std::lock_guard<std::recursive_mutex> lock(
m_images.GetMutex());
1662 if (executable_sp &&
1664 return executable_sp;
1673 std::lock_guard<std::recursive_mutex> lock(
m_images.GetMutex());
1698 if (executable_sp) {
1701 pid = proc->GetID();
1705 info->
uuid = executable_sp->GetUUID();
1707 info->
triple = executable_sp->GetArchitecture().GetTriple().getTriple();
1713 info->
uuid = executable_sp->GetUUID();
1719 "Target::RebuildModuleListWithExecutable (executable = '%s')",
1720 executable_sp->GetFileSpec().GetPath().c_str());
1722 const bool notify =
true;
1731 if (!
m_arch.GetSpec().IsValid()) {
1732 m_arch = executable_sp->GetArchitecture();
1734 "Target::RebuildModuleListWithExecutable setting architecture "
1736 "based on executable file",
1737 m_arch.GetSpec().GetArchitectureName(),
1738 m_arch.GetSpec().GetTriple().getTriple());
1741 ObjectFile *executable_objfile = executable_sp->GetObjectFile();
1742 bool load_dependents =
true;
1743 switch (load_dependent_files) {
1745 load_dependents = executable_sp->IsExecutable();
1748 load_dependents =
true;
1751 load_dependents =
false;
1755 if (executable_objfile && load_dependents) {
1758 std::mutex dependent_files_mutex;
1763 auto GetDependentModules = [&](
FileSpec dependent_file_spec) {
1764 FileSpec platform_dependent_file_spec;
1766 m_platform_sp->GetFileWithUUID(dependent_file_spec,
nullptr,
1767 platform_dependent_file_spec);
1769 platform_dependent_file_spec = dependent_file_spec;
1774 if (image_module_sp) {
1776 ObjectFile *objfile = image_module_sp->GetObjectFile();
1782 std::lock_guard<std::mutex> guard(dependent_files_mutex);
1783 dependent_files_copy = dependent_files;
1788 const size_t previous_dependent_files =
1789 dependent_files_copy.
GetSize();
1794 std::lock_guard<std::mutex> guard(dependent_files_mutex);
1795 for (
size_t i = previous_dependent_files;
1796 i < dependent_files_copy.
GetSize(); ++i)
1807 for (uint32_t i = 0; i < dependent_files.
GetSize(); i++) {
1813 std::lock_guard<std::mutex> guard(dependent_files_mutex);
1814 for (; i < dependent_files.
GetSize(); i++)
1815 task_group.async(GetDependentModules,
1828 bool missing_local_arch = !
m_arch.GetSpec().IsValid();
1829 bool replace_local_arch =
true;
1830 bool compatible_local_arch =
false;
1839 if (!platform_sp || !platform_sp->IsCompatibleArchitecture(
1843 GetDebugger().GetPlatformList().GetOrCreate(other, {},
1845 arch_platform_sp->SetLocateModuleCallback(
1846 platform_sp->GetLocateModuleCallback());
1849 other = platform_arch;
1855 if (!missing_local_arch) {
1856 if (merge &&
m_arch.GetSpec().IsCompatibleMatch(arch_spec)) {
1859 if (
m_arch.GetSpec().IsCompatibleMatch(other)) {
1860 compatible_local_arch =
true;
1863 replace_local_arch =
false;
1868 if (compatible_local_arch || missing_local_arch) {
1872 if (replace_local_arch)
1875 "Target::SetArchitecture merging compatible arch; arch "
1877 m_arch.GetSpec().GetArchitectureName(),
1878 m_arch.GetSpec().GetTriple().getTriple());
1886 "Target::SetArchitecture changing architecture to %s (%s) from %s (%s)",
1888 arch_spec.
GetTriple().getTriple().c_str(),
1889 m_arch.GetSpec().GetArchitectureName(),
1890 m_arch.GetSpec().GetTriple().getTriple().c_str());
1897 if (executable_sp) {
1899 "Target::SetArchitecture Trying to select executable file "
1900 "architecture %s (%s)",
1902 arch_spec.
GetTriple().getTriple().c_str());
1903 ModuleSpec module_spec(executable_sp->GetFileSpec(), other);
1904 module_spec.
SetTarget(shared_from_this());
1908 if (!
error.Fail() && executable_sp) {
1919 if (
m_arch.GetSpec().IsCompatibleMatch(arch_spec)) {
1924 "Target::MergeArchitecture target has arch %s, merging with "
1926 m_arch.GetSpec().GetTriple().getTriple().c_str(),
1927 arch_spec.
GetTriple().getTriple().c_str());
1948 my_module_list.
Append(module_sp);
1958 my_module_list.
Append(module_sp);
1971 old_module_sp, new_module_sp);
1984 "Loading the scripts of '{0}' every time: "
1985 "target.experimental.reload-module-scripts is set",
1994 const UUID &uuid =
module.GetUUID();
1996 LLDB_LOG(log,
"Loading the scripts of '{0}' every time: it has no UUID",
2004 "Skipping the scripts of '{0}': this target already loaded them",
2016 const size_t num_images = module_list.
GetSize();
2018 std::list<Status> errors;
2020 for (
const auto &err : errors)
2023 for (
size_t idx = 0; idx < num_images; ++idx) {
2034 type_system->ModulesDidLoad(module_list);
2039 std::make_shared<TargetEventData>(shared_from_this(), module_list);
2048 runtime->SymbolsDidLoad(module_list);
2055 std::make_shared<TargetEventData>(shared_from_this(), module_list);
2064 std::make_shared<TargetEventData>(shared_from_this(), module_list);
2078 const bool should_flush_type_systems =
2080 auto *object_file =
module.GetObjectFile();
2085 auto type = object_file->GetType();
2089 return module.FileHasChanged() &&
2090 (type == ObjectFile::eTypeObjectFile ||
2091 type == ObjectFile::eTypeExecutable ||
2092 type == ObjectFile::eTypeSharedLibrary);
2095 if (should_flush_type_systems)
2103 const FileSpec &module_file_spec) {
2108 size_t num_modules = matchingModules.
GetSize();
2112 if (num_modules > 0) {
2113 for (
size_t i = 0; i < num_modules; i++) {
2128 return m_platform_sp->ModuleIsExcludedForUnconstrainedSearches(*
this,
2140 if (section_sp->IsEncrypted()) {
2144 ModuleSP module_sp(section_sp->GetModule());
2146 ObjectFile *objfile = section_sp->GetModule()->GetObjectFile();
2149 section_sp.get(), addr.
GetOffset(), dst, dst_len);
2154 "error reading data from section {0}", section_sp->GetName());
2161 "address doesn't contain a section that points to a "
2162 "section in a object file");
2170 bool *did_read_live_memory) {
2172 if (did_read_live_memory)
2173 *did_read_live_memory =
false;
2186 size_t bytes_read = 0;
2193 if (section_load_list.
IsEmpty()) {
2199 m_images.ResolveFileAddress(file_addr, resolved_addr);
2212 resolved_addr = fixed_addr;
2217 std::unique_ptr<uint8_t[]> file_cache_read_buffer;
2218 size_t file_cache_bytes_read = 0;
2224 auto permissions =
Flags(section_sp->GetPermissions());
2225 bool is_readonly = !permissions.Test(ePermissionsWritable) &&
2226 permissions.Test(ePermissionsReadable);
2228 file_cache_bytes_read =
2230 if (file_cache_bytes_read == dst_len)
2231 return file_cache_bytes_read;
2232 else if (file_cache_bytes_read > 0) {
2233 file_cache_read_buffer =
2234 std::make_unique<uint8_t[]>(file_cache_bytes_read);
2235 std::memcpy(file_cache_read_buffer.get(), dst, file_cache_bytes_read);
2247 if (addr_module_sp && addr_module_sp->GetFileSpec())
2249 "{0:F}[{1:x+}] can't be resolved, {0:F} is not currently loaded",
2253 "0x%" PRIx64
" can't be resolved", resolved_addr.
GetFileAddress());
2256 if (bytes_read != dst_len) {
2257 if (
error.Success()) {
2258 if (bytes_read == 0)
2260 "read memory from 0x%" PRIx64
" failed", load_addr);
2263 "only %" PRIu64
" of %" PRIu64
2264 " bytes were read from memory at 0x%" PRIx64,
2265 (uint64_t)bytes_read, (uint64_t)dst_len, load_addr);
2270 *load_addr_ptr = load_addr;
2271 if (did_read_live_memory)
2272 *did_read_live_memory =
true;
2278 if (file_cache_read_buffer && file_cache_bytes_read > 0) {
2282 std::memcpy(dst, file_cache_read_buffer.get(), file_cache_bytes_read);
2283 return file_cache_bytes_read;
2294 if (bytes_read > 0 && bytes_read != dst_len &&
error.Success() &&
2297 "only {0} of {1} bytes were read from the object file cache",
2298 bytes_read, dst_len);
2315 out_str.append(buf, length);
2318 if (length ==
sizeof(buf) - 1)
2319 curr_addr += length;
2324 return out_str.size();
2328 size_t dst_max_len,
Status &result_error,
2329 bool force_live_memory) {
2330 size_t total_cstr_len = 0;
2331 if (dst && dst_max_len) {
2332 result_error.
Clear();
2334 memset(dst, 0, dst_max_len);
2341 const size_t cache_line_size = 512;
2343 size_t bytes_left = dst_max_len - 1;
2344 char *curr_dst = dst;
2346 while (bytes_left > 0) {
2347 addr_t cache_line_bytes_left =
2348 cache_line_size - (curr_addr % cache_line_size);
2350 std::min<addr_t>(bytes_left, cache_line_bytes_left);
2352 size_t bytes_read =
ReadMemory(address, curr_dst, bytes_to_read,
error,
2355 if (bytes_read == 0) {
2356 result_error = std::move(
error);
2357 dst[total_cstr_len] =
'\0';
2360 const size_t len = strlen(curr_dst);
2362 total_cstr_len += len;
2364 if (len < bytes_to_read)
2367 curr_dst += bytes_read;
2368 curr_addr += bytes_read;
2369 bytes_left -= bytes_read;
2376 result_error.
Clear();
2378 return total_cstr_len;
2386 return cache_line_size - (load_addr % cache_line_size);
2396 size_t type_width,
bool force_live_memory) {
2397 if (!dst || !max_bytes || !type_width || max_bytes < type_width)
2400 size_t total_bytes_read = 0;
2404 memset(dst, 0, max_bytes);
2405 size_t bytes_left = max_bytes - type_width;
2407 const char terminator[4] = {
'\0',
'\0',
'\0',
'\0'};
2408 assert(
sizeof(terminator) >= type_width &&
"Attempting to validate a "
2409 "string with more than 4 bytes "
2413 char *curr_dst = dst;
2416 while (bytes_left > 0 &&
error.Success()) {
2420 ReadMemory(address, curr_dst, bytes_to_read,
error, force_live_memory);
2422 if (bytes_read == 0)
2427 size_t aligned_start = total_bytes_read - total_bytes_read % type_width;
2428 for (
size_t i = aligned_start;
2429 i + type_width <= total_bytes_read + bytes_read; i += type_width)
2430 if (::memcmp(&dst[i], terminator, type_width) == 0) {
2435 total_bytes_read += bytes_read;
2436 curr_dst += bytes_read;
2437 address.
Slide(bytes_read);
2438 bytes_left -= bytes_read;
2440 return total_bytes_read;
2444 bool is_signed,
Scalar &scalar,
2446 bool force_live_memory) {
2449 if (byte_size <=
sizeof(uval)) {
2452 if (bytes_read == byte_size) {
2454 m_arch.GetSpec().GetAddressByteSize());
2457 scalar = data.
GetMaxU32(&offset, byte_size);
2459 scalar = data.
GetMaxU64(&offset, byte_size);
2469 "byte size of %u is too large for integer scalar type", byte_size);
2475 size_t integer_byte_size,
2477 bool force_live_memory) {
2486 size_t integer_byte_size,
2488 bool force_live_memory) {
2498 bool force_live_memory) {
2501 false, scalar,
error, force_live_memory)) {
2505 if (section_load_list.
IsEmpty()) {
2508 m_images.ResolveFileAddress(pointer_vm_addr, pointer_addr);
2519 pointer_addr.
SetOffset(pointer_vm_addr);
2527 bool notify,
Status *error_ptr,
2528 bool invoke_symbol_locators) {
2535 module_spec.
SetTarget(shared_from_this());
2537 if (std::optional<FileSpec> remapped_obj_file =
2548 module_sp =
m_images.FindFirstModule(module_spec);
2551 llvm::SmallVector<ModuleSP, 1>
2554 bool did_create_module =
false;
2564 module_spec, module_sp, symbol_file_spec, &did_create_module);
2588 std::string transformed_dir;
2594 transformed_spec.
SetTarget(shared_from_this());
2596 transformed_spec, module_sp, &old_modules, &did_create_module,
2597 true, invoke_symbol_locators);
2614 module_spec, module_sp, &old_modules, &did_create_module,
2615 true, invoke_symbol_locators);
2618 if (!module_sp && invoke_symbol_locators) {
2623 module_spec, *
this, module_sp, &old_modules, &did_create_module);
2634 ObjectFile *objfile = module_sp->GetObjectFile();
2650 "debug info files aren't valid target "
2651 "modules, please specify an executable");
2658 "stub libraries aren't valid target "
2659 "modules, please specify an executable");
2664 "unsupported file type, please specify an executable");
2683 m_images.FindModules(module_spec_copy, found_modules);
2685 old_modules.push_back(found_module);
2692 if (symbol_file_spec)
2693 module_sp->SetSymbolFileFileSpec(symbol_file_spec);
2695 llvm::SmallVector<ModuleSP, 1> replaced_modules;
2696 for (
ModuleSP &old_module_sp : old_modules) {
2697 if (
m_images.GetIndexForModule(old_module_sp.get()) !=
2699 if (replaced_modules.empty())
2700 m_images.ReplaceModule(old_module_sp, module_sp);
2704 replaced_modules.push_back(std::move(old_module_sp));
2708 if (replaced_modules.size() > 1) {
2721 auto dump = [&message](
Module &dump_module) ->
void {
2722 UUID dump_uuid = dump_module.GetUUID();
2726 message <<
" (uuid ";
2729 dump_uuid.
Dump(message);
2731 message <<
"not specified";
2736 message <<
"New module ";
2739 << llvm::formatv(
" simultaneously replaced {0} old modules: ",
2740 replaced_modules.size());
2741 for (
ModuleSP &replaced_module_sp : replaced_modules)
2742 dump(*replaced_module_sp);
2748 if (replaced_modules.empty()) {
2749 if (!
m_images.AppendIfNeeded(module_sp, notify) && notify)
2753 for (
ModuleSP &old_module_sp : replaced_modules) {
2754 auto old_module_wp = old_module_sp->weak_from_this();
2755 old_module_sp.reset();
2763 *error_ptr = std::move(
error);
2792llvm::Expected<lldb::TypeSystemSP>
2794 bool create_on_demand) {
2796 return llvm::createStringError(
"invalid target");
2809 if (languages_for_expressions.
Empty())
2810 return llvm::createStringError(
2811 "No expression support for any languages");
2827std::vector<lldb::TypeSystemSP>
2840 llvm::SetVector<lldb::TypeSystemSP, std::vector<lldb::TypeSystemSP>,
2841 std::set<lldb::TypeSystemSP>>
2842 scratch_type_systems;
2847 for (
auto bit : languages_for_expressions.
bitvector.set_bits()) {
2849 auto type_system_or_err =
2851 if (!type_system_or_err)
2854 "Language '{1}' has expression support but no scratch type "
2855 "system available: {0}",
2857 else if (
auto ts = *type_system_or_err)
2858 scratch_type_systems.insert(ts);
2861 return scratch_type_systems.takeVector();
2868 if (
auto err = type_system_or_err.takeError()) {
2871 "Unable to get persistent expression state for language {1}: {0}",
2876 if (
auto ts = *type_system_or_err)
2877 return ts->GetPersistentExpressionState();
2880 "Unable to get persistent expression state for language {}:",
2886 llvm::StringRef expr, llvm::StringRef prefix,
SourceLanguage language,
2890 auto type_system_or_err =
2892 if (
auto err = type_system_or_err.takeError()) {
2894 "Could not find type system for language %s: %s",
2896 llvm::toString(std::move(err)).c_str());
2900 auto ts = *type_system_or_err;
2903 "Type system for language %s is no longer live",
2908 auto *user_expr = ts->GetUserExpression(expr, prefix, language, desired_type,
2912 "Could not create an expression for language %s",
2923 if (
auto err = type_system_or_err.takeError()) {
2925 "Could not find type system for language %s: %s",
2927 llvm::toString(std::move(err)).c_str());
2930 auto ts = *type_system_or_err;
2933 "Type system for language %s is no longer live",
2937 auto *persistent_fn = ts->GetFunctionCaller(return_type, function_address,
2938 arg_value_list, name);
2941 "Could not create an expression for language %s",
2944 return persistent_fn;
2947llvm::Expected<std::unique_ptr<UtilityFunction>>
2952 if (!type_system_or_err)
2953 return type_system_or_err.takeError();
2954 auto ts = *type_system_or_err;
2956 return llvm::createStringError(
2957 llvm::StringRef(
"Type system for language ") +
2959 llvm::StringRef(
" is no longer live"));
2960 std::unique_ptr<UtilityFunction> utility_fn =
2961 ts->CreateUtilityFunction(std::move(expression), std::move(name));
2963 return llvm::createStringError(
2964 llvm::StringRef(
"Could not create an expression for language") +
2968 if (!utility_fn->Install(diagnostics, exe_ctx))
2970 "Could not install utility function:");
2972 return std::move(utility_fn);
2993 "setting target's default architecture to {0} ({1})",
3000 if (llvm::to_integer(label, n))
3001 return llvm::createStringError(
"cannot use integer as target label");
3005 if (target_sp && target_sp->GetLabel() == label) {
3006 return llvm::createStringErrorV(
3007 "Cannot use label '{0}' since it's set in target #{1}.", label, i);
3012 return llvm::Error::success();
3021 Target *target =
nullptr;
3022 if (sc_ptr !=
nullptr)
3024 if (target ==
nullptr && exe_ctx_ptr)
3034 result_valobj_sp.reset();
3039 m_stats.GetExpressionStats().NotifyFailure();
3040 return execution_results;
3046 llvm::scope_exit on_exit([
this, old_suppress_value]() {
3064 if (expr[0] ==
'$') {
3065 auto type_system_or_err =
3067 if (
auto err = type_system_or_err.takeError()) {
3069 "Unable to get scratch type system: {0}");
3071 auto ts = *type_system_or_err;
3074 "Scratch type system is no longer live: {0}");
3077 ts->GetPersistentExpressionState()->GetVariable(expr);
3080 if (persistent_var_sp) {
3081 result_valobj_sp = persistent_var_sp->GetValueObject();
3087 result_valobj_sp, fixed_expression, ctx_obj);
3091 m_stats.GetExpressionStats().NotifySuccess();
3093 m_stats.GetExpressionStats().NotifyFailure();
3094 return execution_results;
3100 [name, &variable_sp](
TypeSystemSP type_system) ->
bool {
3101 auto ts = type_system.get();
3105 ts->GetPersistentExpressionState()) {
3106 variable_sp = persistent_state->GetVariable(name);
3121 auto ts = type_system.get();
3126 ts->GetPersistentExpressionState()) {
3127 address = persistent_state->LookupSymbol(name);
3140 const bool has_primary_executable = exe_module && exe_module->
GetObjectFile();
3141 if (has_primary_executable) {
3148 const size_t num_images = modules.
GetSize();
3149 for (
size_t idx = 0; idx < num_images; ++idx) {
3151 if (!module_sp || !module_sp->GetObjectFile())
3154 Address entry_addr = module_sp->GetObjectFile()->GetEntryPointAddress();
3160 if (!has_primary_executable)
3161 return llvm::createStringError(
3162 "No primary executable found and could not find entry point address in "
3163 "any executable module");
3165 return llvm::createStringError(
3166 "Could not find entry point address for primary executable module \"" +
3174 ? arch_plugin->GetCallableLoadAddress(load_addr, addr_class)
3181 return arch_plugin ? arch_plugin->GetOpcodeLoadAddress(load_addr, addr_class)
3187 return arch_plugin ? arch_plugin->GetBreakableLoadAddress(addr, *
this) : addr;
3190llvm::Expected<lldb::DisassemblerSP>
3192 const char *flavor_string) {
3194 bool force_live_memory =
true;
3197 const size_t bytes_read =
3199 force_live_memory, &load_addr);
3202 return llvm::joinErrors(
3203 llvm::createStringErrorV(
3204 "Target::ReadInstructions failed to read memory at {:x}: ",
3210 if (!flavor_string || flavor_string[0] ==
'\0') {
3215 if (arch == llvm::Triple::x86 || arch == llvm::Triple::x86_64)
3243 stop_hook_sp.reset(
new StopHookCoded(shared_from_this(), new_uid));
3256 return stop_hook_sp;
3268 return (num_removed != 0);
3276 StopHookCollection::iterator specified_hook_iter;
3279 found_hook = (*specified_hook_iter).second;
3284 bool active_state) {
3285 StopHookCollection::iterator specified_hook_iter;
3290 (*specified_hook_iter).second->SetIsActive(active_state);
3295 StopHookCollection::iterator pos, end =
m_stop_hooks.end();
3297 (*pos).second->SetIsActive(active_state);
3306const std::vector<Target::StopHookSP>
3311 std::vector<StopHookSP> stop_hooks;
3313 stop_hooks.push_back(hook);
3319 std::vector<StopHookSP> stop_hooks;
3320 std::vector<HookSP> hooks;
3347 llvm::erase_if(stop_hooks, [
this](
const StopHookSP &hook) {
3348 return !hook->IsActive() || !hook->GetRunAtInitialStop() ||
3351 llvm::erase_if(hooks, [
this](
const HookSP &hook) {
3353 !hook->GetRunAtInitialStop() || !
m_hooks.count(hook->GetID());
3355 if (stop_hooks.empty() && hooks.empty())
3376 auto is_active = [at_initial_stop](
StopHookSP hook) {
3377 bool should_run_now = (!at_initial_stop || hook->GetRunAtInitialStop());
3378 return hook->IsActive() && should_run_now;
3382 std::vector<StopHookSP> active_hooks;
3386 if (is_active(hook))
3387 active_hooks.push_back(hook);
3391 std::vector<HookSP> active_unified_hooks;
3392 for (
auto &[_, hook] :
m_hooks) {
3394 (!at_initial_stop || hook->GetRunAtInitialStop()))
3395 active_unified_hooks.push_back(hook);
3398 if (active_hooks.empty() && active_unified_hooks.empty())
3407 uint32_t last_natural_stop =
m_process_sp->GetModIDRef().GetLastNaturalStopID();
3412 active_hooks, active_unified_hooks, at_initial_stop);
3421 if (
error.Success()) {
3422 LLDB_LOG(log,
"Resuming from RunStopHooks");
3425 LLDB_LOG(log,
"Resuming from RunStopHooks failed: {0}",
error);
3435 llvm::ArrayRef<HookSP> active_unified_hooks,
3436 bool at_initial_stop) {
3437 std::vector<ExecutionContext> exc_ctx_with_reasons;
3440 size_t num_threads = cur_threadlist.
GetSize();
3441 for (
size_t i = 0; i < num_threads; i++) {
3443 if (cur_thread_sp->ThreadStoppedForAReason()) {
3445 exc_ctx_with_reasons.emplace_back(
m_process_sp.get(), cur_thread_sp.get(),
3446 cur_frame_sp.get());
3455 size_t num_exe_ctx = exc_ctx_with_reasons.size();
3456 if (num_exe_ctx == 0) {
3457 if (at_initial_stop && num_threads > 0) {
3459 exc_ctx_with_reasons.emplace_back(
3461 thread_to_use_sp->GetStackFrameAtIndex(0).get());
3471 llvm::scope_exit on_exit([output_sp] { output_sp->Flush(); });
3473 size_t num_hooks_with_output = llvm::count_if(
3474 active_hooks, [](
auto h) {
return !h->GetSuppressOutput(); });
3475 num_hooks_with_output += llvm::count_if(
3476 active_unified_hooks, [](
auto h) {
return !h->GetSuppressOutput(); });
3477 bool print_hook_header = (num_hooks_with_output > 1);
3478 bool print_thread_header = (num_exe_ctx > 1);
3479 bool should_stop =
false;
3480 bool requested_continue =
false;
3487 for (
auto cur_hook_sp : active_hooks) {
3488 bool any_thread_matched =
false;
3489 bool deleted_one_shot =
false;
3490 for (
auto exc_ctx : exc_ctx_with_reasons) {
3491 if (!cur_hook_sp->ExecutionContextPasses(exc_ctx))
3498 if (cur_hook_sp->IsOneShot() && !deleted_one_shot) {
3500 deleted_one_shot =
true;
3503 bool suppress_output = cur_hook_sp->GetSuppressOutput();
3504 if (print_hook_header && !any_thread_matched && !suppress_output) {
3508 output_sp->Printf(
"\n- Hook %" PRIu64
" (%s)\n", cur_hook_sp->GetID(),
3511 output_sp->Printf(
"\n- Hook %" PRIu64
"\n", cur_hook_sp->GetID());
3512 any_thread_matched =
true;
3515 if (print_thread_header && !suppress_output)
3516 output_sp->Printf(
"-- Thread %d\n",
3517 exc_ctx.GetThreadPtr()->GetIndexID());
3519 auto result = cur_hook_sp->HandleStop(exc_ctx, output_sp);
3522 if (cur_hook_sp->GetAutoContinue())
3523 requested_continue =
true;
3528 requested_continue =
true;
3537 output_sp->Printf(
"\nAborting stop hooks, hook %" PRIu64
3538 " set the program running.\n"
3539 " Consider using '-G true' to make "
3540 "stop hooks auto-continue.\n",
3541 cur_hook_sp->GetID());
3551 for (
auto cur_hook_sp : active_unified_hooks) {
3552 bool any_thread_matched =
false;
3553 for (
auto exc_ctx : exc_ctx_with_reasons) {
3554 if (!cur_hook_sp->ExecutionContextPasses(exc_ctx))
3557 bool suppress_output = cur_hook_sp->GetSuppressOutput();
3558 if (print_hook_header && !any_thread_matched && !suppress_output) {
3562 output_sp->Printf(
"\n- Hook %" PRIu64
" (%s)\n", cur_hook_sp->GetID(),
3565 output_sp->Printf(
"\n- Hook %" PRIu64
"\n", cur_hook_sp->GetID());
3566 any_thread_matched =
true;
3569 if (print_thread_header && !suppress_output)
3570 output_sp->Printf(
"-- Thread %d\n",
3571 exc_ctx.GetThreadPtr()->GetIndexID());
3573 auto result = cur_hook_sp->HandleStop(exc_ctx, output_sp);
3576 if (cur_hook_sp->GetAutoContinue())
3577 requested_continue =
true;
3582 requested_continue =
true;
3587 output_sp->Printf(
"\nAborting stop hooks, hook %" PRIu64
3588 " set the program running.\n"
3589 " Consider using '-G true' to make "
3590 "stop hooks auto-continue.\n",
3591 cur_hook_sp->GetID());
3597 if (requested_continue && !should_stop)
3607 return *g_settings_ptr;
3613 if (!platform_sp || !platform_sp->IsRemote() || !platform_sp->IsConnected())
3623 MainExecutableInstaller installer{platform_sp, module_sp,
3624 shared_from_this(), *launch_info};
3627 ExecutableInstaller installer{platform_sp, module_sp};
3639 uint32_t stop_id,
bool allow_section_end) {
3646 return m_images.ResolveFileAddress(file_addr, resolved_addr);
3650 addr_t new_section_load_addr,
3651 bool warn_multiple) {
3652 const addr_t old_section_load_addr =
3655 if (old_section_load_addr != new_section_load_addr) {
3656 uint32_t stop_id = 0;
3659 stop_id = process_sp->GetStopID();
3663 stop_id, section_sp, new_section_load_addr, warn_multiple))
3670 size_t section_unload_count = 0;
3671 size_t num_modules = module_list.
GetSize();
3672 for (
size_t i = 0; i < num_modules; ++i) {
3673 section_unload_count +=
3676 return section_unload_count;
3680 uint32_t stop_id = 0;
3683 stop_id = process_sp->GetStopID();
3686 SectionList *sections = module_sp->GetSectionList();
3687 size_t section_unload_count = 0;
3690 for (uint32_t i = 0; i < num_sections; ++i) {
3695 return section_unload_count;
3699 uint32_t stop_id = 0;
3702 stop_id = process_sp->GetStopID();
3710 uint32_t stop_id = 0;
3713 stop_id = process_sp->GetStopID();
3744 m_stats.SetLaunchOrAttachTime();
3748 LLDB_LOGF(log,
"Target::%s() called for %s", __FUNCTION__,
3760 state = process_sp->GetState();
3762 "Target::%s the process exists, and its current state is %s",
3765 LLDB_LOGF(log,
"Target::%s the process instance doesn't currently exist.",
3778 const bool synchronous_execution =
3786 if (launch_info.
GetFlags().
Test(eLaunchFlagLaunchInTTY))
3788 "can't launch in tty when launching through a remote connection");
3806 LLDB_LOGF(log,
"Target::%s asking the platform to debug the process",
3820 "Target::%s the platform doesn't know how to debug a "
3821 "process, getting a process plugin to do this for us.",
3840 if (!
error.Success())
3846 bool rebroadcast_first_stop =
3847 !synchronous_execution &&
3853 state =
m_process_sp->WaitForProcessToStop(std::nullopt, &first_stop_event_sp,
3854 rebroadcast_first_stop,
3858 if (rebroadcast_first_stop) {
3861 assert(first_stop_event_sp);
3870 if (launch_info.
GetFlags().
Test(eLaunchFlagStopAtEntry))
3872 if (synchronous_execution)
3879 if (!
error.Success()) {
3881 "process resume at entry point failed: %s",
error.AsCString());
3885 bool with_shell = !!launch_info.
GetShell();
3887 const char *exit_desc =
m_process_sp->GetExitDescription();
3889 if (exit_desc && exit_desc[0])
3890 desc =
" (" + std::string(exit_desc) +
')';
3893 "process exited with status %i%s\n"
3894 "'r' and 'run' are aliases that default to launching through a "
3896 "Try launching without going through a shell by using "
3897 "'process launch'.",
3898 exit_status, desc.c_str());
3901 "process exited with status %i%s", exit_status, desc.c_str());
3905 "initial process state wasn't stopped: %s",
StateAsCString(state));
3917 return llvm::createStringError(llvm::inconvertibleErrorCode(),
3918 "A process is required for tracing");
3920 return llvm::createStringError(llvm::inconvertibleErrorCode(),
3921 "A trace already exists for the target");
3923 llvm::Expected<TraceSupportedResponse> trace_type =
3926 return llvm::createStringError(
3927 llvm::inconvertibleErrorCode(),
"Tracing is not supported. %s",
3928 llvm::toString(trace_type.takeError()).c_str());
3929 if (llvm::Expected<TraceSP> trace_sp =
3933 return llvm::createStringError(
3934 llvm::inconvertibleErrorCode(),
3935 "Couldn't create a Trace object for the process. %s",
3936 llvm::toString(trace_sp.takeError()).c_str());
3947 Progress attach_progress(
"Waiting to attach to process");
3948 m_stats.SetLaunchOrAttachTime();
3952 state = process_sp->GetState();
3965 if (old_exec_module_sp)
3967 old_exec_module_sp->GetPlatformFileSpec().GetFilename());
3971 "no process specified, create a target with a file, or "
3972 "specify the --pid or --name");
3976 const auto platform_sp =
3979 const bool async = attach_info.
GetAsync();
3981 hijack_listener_sp =
3997 plugin_name,
nullptr,
false);
4000 "failed to create process using plugin '{0}'",
4001 plugin_name.empty() ?
"<empty>" : plugin_name);
4005 if (hijack_listener_sp)
4006 process_sp->HijackProcessEvents(hijack_listener_sp);
4007 error = process_sp->Attach(attach_info);
4010 if (
error.Success() && process_sp) {
4012 process_sp->RestoreProcessEvents();
4015 state = process_sp->WaitForProcessToStop(
4018 process_sp->RestoreProcessEvents();
4025 const char *exit_desc = process_sp->GetExitDescription();
4030 "process did not stop (no such process or permission problem?)");
4031 process_sp->Destroy(
false);
4041 return llvm::createStringError(
"invalid frame provider descriptor");
4043 llvm::StringRef name = descriptor.
GetName();
4045 return llvm::createStringError(
4046 "frame provider descriptor has no class name");
4049 std::unique_lock<std::recursive_mutex> guard(
4053 uint32_t descriptor_hash = descriptor.
GetHash();
4055 if (entry.second.GetHash() == descriptor_hash)
4057 llvm::formatv(
"frame provider idx={0} with the same class name and "
4058 "arguments is already registered",
4059 entry.second.GetID())
4065 new_descriptor.
SetID(descriptor_id);
4070 return descriptor_id;
4075 bool removed =
false;
4077 std::lock_guard<std::recursive_mutex> guard(
4089 std::lock_guard<std::recursive_mutex> guard(
4098const llvm::MapVector<uint32_t, ScriptedFrameProviderDescriptor> &
4100 std::lock_guard<std::recursive_mutex> guard(
4109 for (
ThreadSP thread_sp : process_sp->Threads()) {
4111 thread_sp->ClearScriptedFrameProvider();
4114 auto data_sp = std::make_shared<Thread::ThreadEventData>(thread_sp);
4126 const bool default_to_use_pty =
4130 "have platform={0}, platform_sp->IsHost()={1}, default_to_use_pty={2}",
4132 platform_sp ? (platform_sp->IsHost() ?
"true" :
"false") :
"n/a",
4133 default_to_use_pty);
4140 LLDB_LOG(log,
"at least one of stdin/stdout/stderr was not set, evaluating "
4141 "default handling");
4150 LLDB_LOG(log,
"eLaunchFlagDisableSTDIO set, adding suppression action "
4151 "for stdin, stdout and stderr");
4171 LLDB_LOG(log,
"target stdin='{0}', target stdout='{1}', stderr='{2}'",
4172 in_file_spec, out_file_spec, err_file_spec);
4176 LLDB_LOG(log,
"appended stdin open file action for {0}", in_file_spec);
4179 if (out_file_spec) {
4181 LLDB_LOG(log,
"appended stdout open file action for {0}",
4185 if (err_file_spec) {
4187 LLDB_LOG(log,
"appended stderr open file action for {0}",
4191 if (default_to_use_pty) {
4194 ::getenv(
"LLDB_LAUNCH_FLAG_USE_PIPES")) {
4195 llvm::Error Err = info.SetUpPipeRedirection();
4197 "SetUpPipeRedirection failed: {0}");
4202 "SetUpPtyRedirection failed: {0}");
4222 elem.notify = notify;
4232 = signals_sp->GetSignalNumberFromName(elem.first().str().c_str());
4237 signals_sp->SetShouldSuppress(signo,
false);
4239 signals_sp->SetShouldSuppress(signo,
true);
4242 signals_sp->SetShouldNotify(signo,
true);
4244 signals_sp->SetShouldNotify(signo,
false);
4247 signals_sp->SetShouldStop(signo,
true);
4249 signals_sp->SetShouldStop(signo,
false);
4258 = signals_sp->GetSignalNumberFromName(elem.first().str().c_str());
4264 signals_sp->ResetSignal(signo, do_stop, do_notify, do_pass);
4275 warning_stream_sp->Printf(
"Target signal '%s' not found in process\n",
4276 elem.first().str().c_str());
4289 signals_sp = process_sp->GetUnixSignals();
4292 const char *signal_name = entry.c_str();
4307 strm.
PutCString(
"=========== ======= ======= =======\n");
4309 auto str_for_lazy = [] (
LazyBool lazy) ->
const char * {
4315 llvm_unreachable(
"Fully covered switch above!");
4319 bool print_it =
false;
4320 for (
size_t idx = 0; idx < num_args; idx++) {
4327 strm.
Printf(
"%-11s ", elem.first().str().c_str());
4328 strm.
Printf(
"%s %s %s\n", str_for_lazy(elem.second.pass),
4329 str_for_lazy(elem.second.stop),
4330 str_for_lazy(elem.second.notify));
4362 bool will_run =
true;
4386 s.
Indent(
"State: enabled\n");
4388 s.
Indent(
"State: disabled\n");
4391 s.
Indent(
"AutoContinue on\n");
4424 uint32_t num_commands =
m_commands.GetSize();
4425 for (uint32_t i = 0; i < num_commands; i++) {
4437 const std::vector<std::string> &strings) {
4438 for (
auto string : strings)
4445 assert(exc_ctx.
GetTargetPtr() &&
"Can't call PerformAction on a context "
4483 GetTarget()->GetDebugger().GetScriptInterpreter();
4484 if (!script_interp) {
4492 "ScriptedStopHook::%s () - ERROR: %s", __FUNCTION__,
4493 "Script interpreter couldn't create Scripted Stop Hook Interface");
4504 if (!object_sp || !object_sp->IsValid()) {
4506 "ScriptedStopHook::%s () - ERROR: %s", __FUNCTION__,
4507 "Failed to create valid script object");
4522 llvm::formatv(
"{0} failed: {1}", what, llvm::toString(std::move(
error)))
4530 assert(exc_ctx.
GetTargetPtr() &&
"Can't call HandleStop on a context "
4536 lldb::StreamSP stream = std::make_shared<lldb_private::StreamString>();
4537 auto should_stop_or_err =
m_interface_sp->HandleStop(exc_ctx, stream);
4538 output_sp->PutCString(
4540 if (!should_stop_or_err) {
4542 llvm::formatv(
"stop hook {0}",
GetID()).str(),
4565 s.
Format(
"{0}\n", class_name);
4574 if (!as_dict || !as_dict->IsValid())
4577 uint32_t num_keys = as_dict->GetSize();
4584 auto print_one_element = [&s](llvm::StringRef key,
4587 s.
Format(
"{0} : {1}\n", key, object->GetStringValue());
4591 as_dict->ForEach(print_one_element);
4623 bool will_run =
true;
4644 std::string fires_on;
4648 if (!fires_on.empty())
4650 fires_on +=
"unload";
4653 if (!fires_on.empty())
4657 if (!fires_on.empty()) {
4659 s.
Printf(
"Triggers: %s\n", fires_on.c_str());
4672 s.
Indent(
"AutoContinue on\n");
4708 s.
Indent(
"Commands: \n");
4710 for (uint32_t i = 0; i <
m_commands.GetSize(); i++) {
4727 const std::vector<std::string> &strings) {
4728 for (
const auto &
string : strings)
4743 Debugger &debugger = target_sp->GetDebugger();
4746 if (target_sp->GetProcessSP())
4747 exe_ctx.
SetContext(target_sp->GetProcessSP());
4774 assert(exc_ctx.
GetTargetPtr() &&
"Can't call HandleStop on a context "
4810 GetTarget()->GetDebugger().GetScriptInterpreter();
4817 "ScriptedHook::%s () - ERROR: %s", __FUNCTION__,
4818 "Script interpreter couldn't create Scripted Hook Interface");
4826 if (!object_sp || !object_sp->IsValid())
4828 "ScriptedHook::%s () - ERROR: %s", __FUNCTION__,
4829 "Failed to create valid script object");
4836 "hook class implements none of the expected methods "
4837 "(handle_module_loaded, handle_module_unloaded, handle_stop)");
4839 if (methods.handle_module_loaded)
4841 if (methods.handle_module_unloaded)
4843 if (methods.handle_stop)
4857 StreamSP stream = std::make_shared<StreamString>();
4861 llvm::formatv(
"hook {0}",
GetID()).str(),
4862 target_sp->GetDebugger());
4873 StreamSP stream = std::make_shared<StreamString>();
4877 llvm::formatv(
"hook {0}",
GetID()).str(),
4878 target_sp->GetDebugger());
4884 assert(exc_ctx.
GetTargetPtr() &&
"Can't call HandleStop on a context "
4890 lldb::StreamSP stream = std::make_shared<lldb_private::StreamString>();
4891 auto should_stop_or_err =
m_interface_sp->HandleStop(exc_ctx, stream);
4893 if (!should_stop_or_err) {
4895 llvm::formatv(
"hook {0}",
GetID()).str(),
4923 s.
Format(
"{0}\n", class_name);
4929 if (as_dict && as_dict->IsValid() && as_dict->GetSize() > 0) {
4933 auto print_one_element = [&s](llvm::StringRef key,
4936 s.
Format(
"{0} : {1}\n", key, object->GetStringValue());
4940 as_dict->ForEach(print_one_element);
4958 hook_sp.reset(
new HookScripted(shared_from_this(), new_uid));
4978 size_t num_removed =
m_hooks.erase(uid);
4979 return (num_removed != 0);
4985 auto iter =
m_hooks.find(uid);
4988 return iter->second;
4995 std::advance(iter, index);
4996 return iter->second;
5000 auto iter =
m_hooks.find(uid);
5003 iter->second->SetIsEnabled(enabled);
5008 for (
auto &[_, hook] :
m_hooks)
5009 hook->SetIsEnabled(enabled);
5020 std::vector<HookSP> active_hooks;
5021 for (
auto &[_, hook_sp] :
m_hooks) {
5022 if (hook_sp->IsEnabled() && hook_sp->FiresOn(trigger))
5023 active_hooks.push_back(hook_sp);
5026 if (active_hooks.empty())
5031 for (
auto &hook_sp : active_hooks) {
5033 hook_sp->HandleModuleLoaded(output_sp);
5035 hook_sp->HandleModuleUnloaded(output_sp);
5044 "no-dynamic-values",
5045 "Don't calculate the dynamic type of values",
5050 "Calculate the dynamic type of values "
5051 "even if you have to run the target.",
5056 "Calculate the dynamic type of values, but don't run the target.",
5068 "Never look for inline breakpoint locations (fastest). This setting "
5069 "should only be used if you know that no inlining occurs in your"
5075 "Only check for inline breakpoint locations when setting breakpoints "
5076 "in header files, but not when setting breakpoint in implementation "
5077 "source files (default).",
5082 "Always look for inline breakpoint locations when setting file and "
5083 "line breakpoints (slower but most accurate).",
5097 "Disassembler default (currently att).",
5102 "Intel disassembler flavor.",
5107 "AT&T disassembler flavor.",
5115 "Use LLVM's MCJIT execution engine.",
5120 "Use LLVM's ORC execution engine.",
5128 "Never import the 'std' C++ module in the expression parser.",
5133 "Retry evaluating expressions with an imported 'std' C++ module if they"
5134 " failed to parse without the module. This allows evaluating more "
5135 "complex expressions involving C++ standard library types."
5140 "Always import the 'std' C++ module. This allows evaluating more "
5141 "complex expressions involving C++ standard library types. This feature"
5146static constexpr OptionEnumValueElement
5151 "Automatically determine the most appropriate method for the "
5155 "Prefer using the realized classes struct."},
5157 "Prefer using the CopyRealizedClassList API."},
5159 "Prefer using the GetRealizedClassList API."},
5166 "C-style (0xffff).",
5171 "Asm-style (0ffffh).",
5179 "Load debug scripts inside symbol files",
5184 "Do not load debug scripts inside symbol files.",
5189 "Warn about debug scripts inside symbol files but do not load them.",
5194 "Load debug scripts inside trusted symbol files, and warn about "
5195 "scripts from untrusted symbol files.",
5203 "Load .lldbinit files from current directory",
5208 "Do not load .lldbinit files from current directory",
5213 "Warn about loading .lldbinit files from current directory",
5221 "Load minimal information when loading modules from memory. Currently "
5222 "this setting loads sections only.",
5227 "Load partial information when loading modules from memory. Currently "
5228 "this setting loads sections and function bounds.",
5233 "Load complete information when loading modules from memory. Currently "
5234 "this setting loads sections and all symbols.",
5238#define LLDB_PROPERTIES_target
5239#include "TargetProperties.inc"
5242#define LLDB_PROPERTIES_target
5243#include "TargetPropertiesEnum.inc"
5248 :
public Cloneable<TargetOptionValueProperties, OptionValueProperties> {
5259 Target *target = exe_ctx->GetTargetPtr();
5264 if (
this != target_properties)
5273#define LLDB_PROPERTIES_target_experimental
5274#include "TargetProperties.inc"
5277#define LLDB_PROPERTIES_target_experimental
5278#include "TargetPropertiesEnum.inc"
5282 :
public Cloneable<TargetExperimentalOptionValueProperties,
5283 OptionValueProperties> {
5320 m_collection_sp->SetValueChangedCallback(ePropertyDetachOnError, [
this] {
5333 std::make_unique<TargetExperimentalProperties>();
5336 "Experimental settings - setting these won't produce "
5337 "errors if the setting is not present.",
5340 m_collection_sp = std::make_shared<TargetOptionValueProperties>(
"target");
5343 std::make_unique<TargetExperimentalProperties>();
5346 "Experimental settings - setting these won't produce "
5347 "errors if the setting is not present.",
5350 "process",
"Settings specific to processes.",
true,
5377 exp_property->
GetValue()->GetAsProperties();
5380 return std::nullopt;
5393 exp_property->
GetValue()->GetAsProperties();
5411 exp_property->
GetValue()->GetAsProperties();
5417 const uint32_t idx = ePropertyDefaultArch;
5422 const uint32_t idx = ePropertyDefaultArch;
5427 const uint32_t idx = ePropertyMoveToNearestCode;
5429 idx, g_target_properties[idx].default_uint_value != 0);
5433 const uint32_t idx = ePropertyPreferDynamic;
5436 g_target_properties[idx].default_uint_value));
5440 const uint32_t idx = ePropertyPreferDynamic;
5446 "Interrupted checking preload symbols")) {
5449 const uint32_t idx = ePropertyPreloadSymbols;
5451 idx, g_target_properties[idx].default_uint_value != 0);
5455 const uint32_t idx = ePropertyPreloadSymbols;
5460 const uint32_t idx = ePropertyDisableASLR;
5462 idx, g_target_properties[idx].default_uint_value != 0);
5466 const uint32_t idx = ePropertyDisableASLR;
5471 const uint32_t idx = ePropertyInheritTCC;
5473 idx, g_target_properties[idx].default_uint_value != 0);
5477 const uint32_t idx = ePropertyInheritTCC;
5482 const uint32_t idx = ePropertyDetachOnError;
5484 idx, g_target_properties[idx].default_uint_value != 0);
5488 const uint32_t idx = ePropertyDetachOnError;
5493 const uint32_t idx = ePropertyDisableSTDIO;
5495 idx, g_target_properties[idx].default_uint_value != 0);
5499 const uint32_t idx = ePropertyDisableSTDIO;
5503 const uint32_t idx = ePropertyLaunchWorkingDir;
5505 idx, g_target_properties[idx].default_cstr_value);
5509 const uint32_t idx = ePropertyParallelModuleLoad;
5511 idx, g_target_properties[idx].default_uint_value != 0);
5515 const uint32_t idx = ePropertyDisassemblyFlavor;
5516 const char *return_value;
5521 g_target_properties[idx].default_uint_value));
5524 return return_value;
5528 const uint32_t idx = ePropertyDisassemblyCPU;
5530 idx, g_target_properties[idx].default_cstr_value);
5531 return str.empty() ? nullptr : str.data();
5535 const uint32_t idx = ePropertyDisassemblyFeatures;
5537 idx, g_target_properties[idx].default_cstr_value);
5538 return str.empty() ? nullptr : str.data();
5542 const uint32_t idx = ePropertyInlineStrategy;
5545 static_cast<InlineStrategy>(g_target_properties[idx].default_uint_value));
5551 const uint32_t idx = ePropertySourceRealpathPrefixes;
5556 const uint32_t idx = ePropertyArg0;
5558 idx, g_target_properties[idx].default_cstr_value);
5562 const uint32_t idx = ePropertyArg0;
5568 const uint32_t idx = ePropertyRunArgs;
5573 const uint32_t idx = ePropertyRunArgs;
5583 ePropertyInheritEnv,
5584 g_target_properties[ePropertyInheritEnv].default_uint_value != 0)) {
5585 if (
auto platform_sp =
m_target->GetPlatform()) {
5586 Environment platform_env = platform_sp->GetEnvironment();
5587 for (
const auto &KV : platform_env)
5588 env[KV.first()] = KV.second;
5592 Args property_unset_env;
5594 property_unset_env);
5595 for (
const auto &var : property_unset_env)
5596 env.erase(var.ref());
5599 m_collection_sp->GetPropertyAtIndexAsArgs(ePropertyEnvVars, property_env);
5601 env[KV.first()] = KV.second;
5617 ePropertyInheritEnv,
5618 g_target_properties[ePropertyInheritEnv].default_uint_value != 0))
5622 if (platform_sp ==
nullptr)
5625 Environment platform_environment = platform_sp->GetEnvironment();
5626 for (
const auto &KV : platform_environment)
5627 environment[KV.first()] = KV.second;
5629 Args property_unset_environment;
5631 property_unset_environment);
5632 for (
const auto &var : property_unset_environment)
5633 environment.erase(var.ref());
5639 Args property_environment;
5641 property_environment);
5643 for (
const auto &KV :
Environment(property_environment))
5644 environment[KV.first()] = KV.second;
5651 const uint32_t idx = ePropertyEnvVars;
5656 const uint32_t idx = ePropertySkipPrologue;
5658 idx, g_target_properties[idx].default_uint_value != 0);
5662 const uint32_t idx = ePropertySourceMap;
5665 assert(option_value);
5670 const uint32_t idx = ePropertyObjectMap;
5673 assert(option_value);
5678 const uint32_t idx = ePropertyAutoSourceMapRelative;
5680 idx, g_target_properties[idx].default_uint_value != 0);
5684 const uint32_t idx = ePropertyExecutableSearchPaths;
5687 assert(option_value);
5692 const uint32_t idx = ePropertyExecutableSearchPaths;
5697 const uint32_t idx = ePropertyDebugFileSearchPaths;
5702 const uint32_t idx = ePropertyClangModuleSearchPaths;
5707 const uint32_t idx = ePropertyAutoImportClangModules;
5709 idx, g_target_properties[idx].default_uint_value != 0);
5713 const uint32_t idx = ePropertyImportStdModule;
5716 g_target_properties[idx].default_uint_value));
5720 const uint32_t idx = ePropertyDynamicClassInfoHelper;
5723 g_target_properties[idx].default_uint_value));
5727 const uint32_t idx = ePropertyAutoApplyFixIts;
5729 idx, g_target_properties[idx].default_uint_value != 0);
5733 const uint32_t idx = ePropertyRetriesWithFixIts;
5735 idx, g_target_properties[idx].default_uint_value);
5739 const uint32_t idx = ePropertyNotifyAboutFixIts;
5741 idx, g_target_properties[idx].default_uint_value != 0);
5745 const uint32_t idx = ePropertySaveObjectsDir;
5750 const uint32_t idx = ePropertyJITEngine;
5752 idx,
static_cast<JITEngine>(g_target_properties[idx].default_uint_value));
5761 bool exists = instance.
Exists(new_dir);
5762 bool is_directory = instance.
IsDirectory(new_dir);
5763 std::string path = new_dir.
GetPath(
true);
5764 bool writable = llvm::sys::fs::can_write(path);
5765 if (exists && is_directory && writable)
5773 llvm::raw_string_ostream os(buffer);
5774 os <<
"JIT object dir '" << path <<
"' ";
5776 os <<
"does not exist";
5777 else if (!is_directory)
5778 os <<
"is not a directory";
5780 os <<
"is not writable";
5782 std::optional<lldb::user_id_t> debugger_id;
5784 debugger_id =
m_target->GetDebugger().GetID();
5789 const uint32_t idx = ePropertyEnableSynthetic;
5791 idx, g_target_properties[idx].default_uint_value != 0);
5795 const uint32_t idx = ePropertyShowHexVariableValuesWithLeadingZeroes;
5797 idx, g_target_properties[idx].default_uint_value != 0);
5801 const uint32_t idx = ePropertyMaxZeroPaddingInFloatFormat;
5803 idx, g_target_properties[idx].default_uint_value);
5807 const uint32_t idx = ePropertyMaxChildrenCount;
5809 idx, g_target_properties[idx].default_uint_value);
5812std::pair<uint32_t, bool>
5814 const uint32_t idx = ePropertyMaxChildrenDepth;
5815 auto *option_value =
5817 bool is_default = !option_value->OptionWasSet();
5818 return {option_value->GetCurrentValue(), is_default};
5822 const uint32_t idx = ePropertyMaxSummaryLength;
5824 idx, g_target_properties[idx].default_uint_value);
5828 const uint32_t idx = ePropertyMaxMemReadSize;
5830 idx, g_target_properties[idx].default_uint_value);
5834 const uint32_t idx = ePropertyInputPath;
5839 const uint32_t idx = ePropertyInputPath;
5844 const uint32_t idx = ePropertyOutputPath;
5849 const uint32_t idx = ePropertyOutputPath;
5854 const uint32_t idx = ePropertyErrorPath;
5859 const uint32_t idx = ePropertyErrorPath;
5864 const uint32_t idx = ePropertyLanguage;
5869 const uint32_t idx = ePropertyExprPrefix;
5875 return llvm::StringRef(
5876 reinterpret_cast<const char *
>(data_sp->GetBytes()),
5877 data_sp->GetByteSize());
5883 const uint32_t idx = ePropertyExprErrorLimit;
5885 idx, g_target_properties[idx].default_uint_value);
5889 const uint32_t idx = ePropertyExprAllocAddress;
5891 idx, g_target_properties[idx].default_uint_value);
5895 const uint32_t idx = ePropertyExprAllocSize;
5897 idx, g_target_properties[idx].default_uint_value);
5901 const uint32_t idx = ePropertyExprAllocAlign;
5903 idx, g_target_properties[idx].default_uint_value);
5907 const uint32_t idx = ePropertyBreakpointUseAvoidList;
5909 idx, g_target_properties[idx].default_uint_value != 0);
5913 const uint32_t idx = ePropertyBreakpointsConditionMode;
5916 g_target_properties[idx].default_uint_value));
5920 const uint32_t idx = ePropertyUseHexImmediates;
5922 idx, g_target_properties[idx].default_uint_value != 0);
5926 const uint32_t idx = ePropertyUseFastStepping;
5928 idx, g_target_properties[idx].default_uint_value != 0);
5932 const uint32_t idx = ePropertyDisplayExpressionsInCrashlogs;
5934 idx, g_target_properties[idx].default_uint_value != 0);
5938 const uint32_t idx = ePropertyLoadScriptFromSymbolFile;
5941 g_target_properties[idx].default_uint_value));
5946 const uint32_t idx = ePropertyLoadScriptFromSymbolFile;
5951 const uint32_t idx = ePropertyLoadCWDlldbinitFile;
5954 g_target_properties[idx].default_uint_value));
5958 const uint32_t idx = ePropertyHexImmediateStyle;
5961 g_target_properties[idx].default_uint_value));
5965 const uint32_t idx = ePropertyMemoryModuleLoadLevel;
5968 g_target_properties[idx].default_uint_value));
5972 const uint32_t idx = ePropertyTrapHandlerNames;
5977 const uint32_t idx = ePropertyTrapHandlerNames;
5982 const uint32_t idx = ePropertyDisplayRuntimeSupportValues;
5984 idx, g_target_properties[idx].default_uint_value != 0);
5988 const uint32_t idx = ePropertyDisplayRuntimeSupportValues;
5993 const uint32_t idx = ePropertyDisplayRecognizedArguments;
5995 idx, g_target_properties[idx].default_uint_value != 0);
5999 const uint32_t idx = ePropertyDisplayRecognizedArguments;
6015 if (input_file_action) {
6020 if (output_file_action) {
6025 if (error_file_action) {
6031 launch_info.
GetFlags().
Test(lldb::eLaunchFlagInheritTCCFromParent));
6036 const uint32_t idx = ePropertyRequireHardwareBreakpoints;
6038 idx, g_target_properties[idx].default_uint_value != 0);
6042 const uint32_t idx = ePropertyRequireHardwareBreakpoints;
6047 const uint32_t idx = ePropertyAutoInstallMainExecutable;
6049 idx, g_target_properties[idx].default_uint_value != 0);
6083 m_launch_info.GetFlags().Set(lldb::eLaunchFlagDetachOnError);
6085 m_launch_info.GetFlags().Clear(lldb::eLaunchFlagDetachOnError);
6092 m_launch_info.GetFlags().Clear(lldb::eLaunchFlagDisableASLR);
6097 m_launch_info.GetFlags().Set(lldb::eLaunchFlagInheritTCCFromParent);
6099 m_launch_info.GetFlags().Clear(lldb::eLaunchFlagInheritTCCFromParent);
6104 m_launch_info.GetFlags().Set(lldb::eLaunchFlagDisableSTDIO);
6106 m_launch_info.GetFlags().Clear(lldb::eLaunchFlagDisableSTDIO);
6110 const uint32_t idx = ePropertyDebugUtilityExpression;
6112 idx, g_target_properties[idx].default_uint_value != 0);
6116 const uint32_t idx = ePropertyDebugUtilityExpression;
6121 const uint32_t idx = ePropertyCheckValueObjectOwnership;
6123 idx, g_target_properties[idx].default_uint_value != 0);
6127 const uint32_t idx = ePropertyCheckValueObjectOwnership;
6131std::optional<LoadScriptFromSymFile>
6133 llvm::StringRef module_name)
const {
6134 auto *dict =
m_collection_sp->GetPropertyAtIndexAsOptionValueDictionary(
6135 ePropertyAutoLoadScriptsForModules);
6137 return std::nullopt;
6141 return std::nullopt;
6148 auto *dict =
m_collection_sp->GetPropertyAtIndexAsOptionValueDictionary(
6149 ePropertyAutoLoadScriptsForModules);
6153 dict->SetValueForKey(module_name,
6154 std::make_shared<OptionValueEnumeration>(
6175 return "Target::TargetEventData";
6212 return created_target_sp;
6238 return m_stats.ToJSON(*
this, options);
6256 lldb::BreakpointEventType eventKind) {
6258 std::shared_ptr<Breakpoint::BreakpointEventData> data_sp =
6259 std::make_shared<Breakpoint::BreakpointEventData>(
6260 eventKind, bp.shared_from_this());
6276 if (
auto platform_fspecs_or_err =
6278 fspecs.
Append(*platform_fspecs_or_err);
6281 platform_fspecs_or_err.takeError(),
6282 "Skipping safe auto-load: {0}");
6287 for (
const auto &fspec :
6302 if (option_name.empty())
6303 return llvm::createStringError(
"can't set an option with an empty name");
6308 return llvm::createStringErrorV(
"trying to override existing option '{0}' "
6309 "of type '{1}' with a boolean value",
6310 option_name, existing_sp->GetType());
6314 return llvm::Error::success();
6318 llvm::StringRef option_name)
const {
6321 if (!opts.
HasKey(option_name))
6322 return llvm::createStringErrorV(
"option '{0}' does not exist", option_name);
6326 return llvm::createStringErrorV(
"failed to get option '{0}' as boolean",
6348 "c++-ignore-context-qualifiers";
6361 return llvm::cantFail(
static void dump(const StructuredData::Array &array, Stream &s)
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 void skip(TSLexer *lexer)
static double elapsed(const StatsTimepoint &start, const StatsTimepoint &end)
static Status installExecutable(const Installer &installer)
constexpr llvm::StringLiteral s_cpp_ignore_context_qualifiers_option
static constexpr OptionEnumValueElement g_dynamic_class_info_helper_value_types[]
static bool CheckIfWatchpointsSupported(Target *target, Status &error)
static constexpr OptionEnumValueElement g_jit_engine_value_types[]
static constexpr OptionEnumValueElement g_load_cwd_lldbinit_values[]
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 void ReportScriptedHookError(llvm::Error error, llvm::StringRef what, Debugger &debugger)
Hook callbacks have no caller to return an error to, so report a failure as a debugger diagnostic.
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)
llvm::StringRef 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.
static bool TypeMaskIsValid(uint64_t mask)
static std::string DescribeMask(uint64_t mask)
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)
bool EventTypeHasListeners(uint32_t event_type)
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 SetImmediateErrorStream(const lldb::StreamSP &stream_sp)
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.
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.
A class to manage flag bits.
static const FileSpecList & GetDefaultSafeAutoLoadPaths()
void SetAsyncExecution(bool async)
CommandInterpreter & GetCommandInterpreter()
lldb::StreamUP GetAsyncErrorStream()
TargetList & GetTargetList()
Get accessor for the target list.
static void ReportWarning(std::string message, std::optional< lldb::user_id_t > debugger_id=std::nullopt, std::once_flag *once=nullptr)
Report warning events.
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.
EvaluateExpressionOptions()
bool GetCppIgnoreContextQualifiers() const
void SetCppIgnoreContextQualifiers(bool value)
const StructuredData::Dictionary & GetLanguageOptions() const
llvm::Expected< bool > GetBooleanLanguageOption(llvm::StringRef option_name) const
Get the language-plugin specific boolean option called option_name.
llvm::Error SetBooleanLanguageOption(llvm::StringRef option_name, bool value)
Set language-plugin specific option called option_name to the specified boolean value.
StructuredData::DictionarySP m_language_options_sp
Dictionary mapping names of language-plugin specific options to values.
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.
void SetContext(const lldb::TargetSP &target_sp, bool get_process)
Target * GetTargetPtr() const
Returns a pointer to the target object.
Thread & GetThreadRef() const
Returns a reference to the thread object.
Represents a file descriptor action to be performed during process launch.
const FileSpec & GetFileSpec() const
Get the file specification for open actions.
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 SetFilename(llvm::StringRef filename)
Filename string set accessor.
void SetPath(llvm::StringRef p)
Temporary helper for FileSystem change.
llvm::StringRef GetFilename() const
Filename string const get accessor.
llvm::StringRef GetDirectory() const
Directory string const get accessor.
size_t GetPath(char *path, size_t max_path_length, bool denormalize=true) const
Extract the full path to the file.
void SetDirectory(llvm::StringRef directory)
Directory string set accessor.
bool IsSourceImplementationFile() const
Returns true if the filespec represents an implementation source file (files with a "....
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(llvm::StringRef name)
A collection class for Module objects.
static Status GetSharedModule(const ModuleSpec &module_spec, lldb::ModuleSP &module_sp, llvm::SmallVectorImpl< lldb::ModuleSP > *old_modules, bool *did_create_ptr, bool invoke_locate_callback=true, bool invoke_symbol_locators=true)
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)
void PreloadSymbols(bool parallelize) const
For each module in this ModuleList, preload its symbols.
bool AppendIfNeeded(const lldb::ModuleSP &new_module, bool notify=true)
Append a module to the module list, if it is not already there.
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.
bool LoadScriptingResourcesInTarget(Target *target, std::list< Status > &errors, bool continue_on_error=true)
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.
void SetTarget(lldb::TargetSP target)
Set the target to be used when resolving a module.
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(llvm::StringRef path, std::string &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)
static PolicyStack & Get()
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)
bool TryLock(ProcessRunLock *lock)
Try to acquire the read lock.
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.
ProcessRunLock::ProcessRunLocker StopLocker
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::ScriptedHookInterfaceSP CreateScriptedHookInterface()
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.
virtual 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)
Forwards the arguments to llvm::formatv and writes to the stream.
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.
IndentScope MakeIndentScope(unsigned indent_amount=2)
Create an indentation scope that restores the original indent level when the object goes out of scope...
void IndentLess(unsigned amount=2)
Decrement the current indentation level.
void IndentMore(unsigned amount=2)
Increment the current indentation level.
void SetObjectSP(const StructuredData::ObjectSP &obj)
void AddItem(const ObjectSP &item)
ObjectSP GetItemAtIndex(size_t idx) const
bool GetValueForKeyAsBoolean(llvm::StringRef key, bool &result) const
ObjectSP GetValueForKey(llvm::StringRef key) const
bool HasKey(llvm::StringRef key) const
void Dump(lldb_private::Stream &s, bool pretty_print=true) const
A class which can hold structured data.
std::shared_ptr< Dictionary > DictionarySP
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.
bool SymbolContextMatches(const SymbolContext &sc)
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
bool GetUseDILForCreatingValues() 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
bool GetCheckValueObjectOwnership() const
uint64_t GetExprAllocAlign() const
MemoryModuleLoadLevel GetMemoryModuleLoadLevel() const
llvm::StringRef GetArg0() const
uint32_t GetMaximumMemReadSize() const
void SetRunArguments(const Args &args)
FileSpec GetStandardErrorPath() const
void SetLoadScriptFromSymbolFile(LoadScriptFromSymFile load_style)
Set the target-wide target.load-script-from-symbol-file setting.
bool GetEnableNotifyAboutFixIts() const
bool SetPreferDynamicValue(lldb::DynamicValueType d)
void SetDisplayRecognizedArguments(bool b)
void SetUseDILForCreatingValues(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
JITEngine GetJITEngine() 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)
lldb::BreakpointConditionMode GetBreakpointsConditionMode() const
void SetDisableSTDIO(bool b)
bool GetAutoInstallMainExecutable() const
const char * GetDisassemblyFeatures() const
void SetAutoLoadScriptsForModule(llvm::StringRef module_name, LoadScriptFromSymFile load_style)
Set the LoadScriptFromSymFile for a module called module_name (excluding file extension).
RealpathPrefixes GetSourceRealpathPrefixes() const
void SetCheckValueObjectOwnership(bool check)
uint64_t GetNumberOfRetriesWithFixits() const
uint64_t GetExprAllocSize() const
std::optional< LoadScriptFromSymFile > GetAutoLoadScriptsForModule(llvm::StringRef module_name) 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
std::unique_ptr< TargetExperimentalProperties > m_experimental_properties_up
FileSpecList GetClangModuleSearchPaths()
void SetStandardOutputPath(llvm::StringRef path)
void ErrorPathValueChangedCallback()
bool GetRequireHardwareBreakpoints() const
PathMappingList & GetSourcePathMap() const
bool GetReloadModuleScripts() const
bool GetAutoSourceMapRelative() 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)
std::string DescribeTypeMask()
void GetDescription(Stream &s, lldb::DescriptionLevel level) const override
void SetActionFromString(const std::string &string)
Populate the command list by splitting a single string on newlines.
void SetActionFromStrings(const std::vector< std::string > &strings)
Populate the command list from a vector of individual command strings.
void HandleModuleLoaded(lldb::StreamSP output) override
StringList & GetCommands()
Return the list of commands that this hook runs.
StopHook::StopHookResult HandleStop(ExecutionContext &exe_ctx, lldb::StreamSP output) override
Called when the process stops.
void HandleModuleUnloaded(lldb::StreamSP output) override
llvm::StringRef GetScriptClassName() const
Status SetScriptCallback(const ScriptedMetadata &scripted_metadata)
void HandleModuleLoaded(lldb::StreamSP output) override
StopHook::StopHookResult HandleStop(ExecutionContext &exe_ctx, lldb::StreamSP output) override
Called when the process stops.
void GetDescription(Stream &s, lldb::DescriptionLevel level) const override
lldb::ScriptedHookInterfaceSP m_interface_sp
void HandleModuleUnloaded(lldb::StreamSP output) override
ThreadSpec * GetThreadSpecifier()
lldb::SymbolContextSpecifierSP m_sc_specifier_sp
bool ExecutionContextPasses(const ExecutionContext &exe_ctx)
Check if the execution context passes the specifier and thread spec filters.
void GetFilterDescription(Stream &s, lldb::DescriptionLevel level) const
Print the filter portion of the description (AutoContinue, Specifier, ThreadSpec).
lldb::TargetSP & GetTarget()
SymbolContextSpecifier * GetSCSpecifier()
lldb::TargetSP m_target_sp
virtual void GetDescription(Stream &s, lldb::DescriptionLevel level) const
void SetSCSpecifier(SymbolContextSpecifier *specifier)
Set the symbol context specifier. The hook takes ownership.
void SetThreadSpecifier(ThreadSpec *specifier)
Set the thread specifier. The hook takes ownership.
std::unique_ptr< ThreadSpec > m_thread_spec_up
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
lldb::ScriptedHookInterfaceSP m_interface_sp
StopHookResult HandleStop(ExecutionContext &exc_ctx, lldb::StreamSP output) override
Status SetScriptCallback(const ScriptedMetadata &scripted_metadata)
void GetSubclassDescription(Stream &s, lldb::DescriptionLevel level) const override
llvm::StringRef GetScriptClassName() const
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 lldb::TargetSP GetCreatedTargetFromEvent(const Event *event_ptr)
static ModuleList GetModuleListFromEvent(const Event *event_ptr)
~TargetEventData() override
static const TargetEventData * GetEventDataFromEvent(const Event *event_ptr)
lldb::TargetSP m_created_target_sp
TargetEventData(const lldb::TargetSP &target_sp)
lldb::TargetSP m_target_sp
static lldb::TargetSP GetTargetFromEvent(const Event *event_ptr)
void ModulesDidLoad(ModuleList &module_list)
This call may preload module symbols, and may do so in parallel depending on the following target set...
void RunCollectedInitialStopHooks()
Run the collected stop hooks and hooks that were added with –at-initial-stop if the process is stoppe...
lldb::ThreadSP CalculateThread() override
llvm::Expected< uint32_t > AddScriptedFrameProviderDescriptor(const ScriptedFrameProviderDescriptor &descriptor)
Add or update a scripted frame provider descriptor for this target.
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::ModuleWP m_executable_module_wp
The marked main executable. Weak, so it can't outlive its image.
bool RemoveHookByID(lldb::user_id_t uid)
lldb::WatchpointSP CreateWatchpoint(lldb::addr_t addr, size_t size, const CompilerType *type, uint32_t kind, Status &error)
void ApplyNameToBreakpoints(BreakpointName &bp_name)
lldb::user_id_t m_hook_next_id
std::recursive_mutex * GetAPIMutexForCurrentPolicy()
The mutex the calling thread must serialize on for its current policy, or nullptr when that policy by...
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()
void MarkExecutableModule(const lldb::ModuleSP &module_sp)
Make module_sp the main executable without clearing the other images, unlike RebuildModuleListWithExe...
const std::vector< StopHookSP > GetStopHooks(bool internal=false) const
bool RecordScriptingResources(Module &module)
Record that we're auto-loading module's scripts in this target, so we only load them once.
void RemoveTargetGroup(const TargetGroup *group)
Called only by TargetGroup::RemoveTarget to remove group membership.
void SetTrace(const lldb::TraceSP &trace_sp)
Set the Trace object containing processor trace information of this target.
BreakpointList & GetBreakpointList(bool internal=false)
uint32_t m_next_frame_provider_id
lldb_private::SummaryStatisticsCache & GetSummaryStatisticsCache()
const llvm::MapVector< uint32_t, ScriptedFrameProviderDescriptor > & GetScriptedFrameProviderDescriptors() const
Get all scripted frame provider descriptors for this target.
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::user_id_t AddBreakpointResolverOverride(BreakpointResolverOverrideUP override_up)
Add a breakpoint override resolver. This version can't fail.
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.
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)
TargetAPIMutex GetAPIMutex()
Returns a handle resolved to the mutex to serialize on before touching the target through the SB API.
void PrimeFromDummyTarget(Target &target)
bool RemoveScriptedFrameProviderDescriptor(uint32_t id)
Remove a scripted frame provider descriptor by id.
lldb::RegisterTypeBuilderSP m_register_type_builder_sp
static void SettingsTerminate()
bool EnableWatchpointByID(lldb::watch_id_t watch_id)
void DeleteBreakpointName(llvm::StringRef name)
HookSP CreateHook(Hook::HookKind kind)
bool ResolveFileAddress(lldb::addr_t load_addr, Address &so_addr)
bool ClearAllWatchpointHitCounts()
CompilerType GetRegisterType(const RegisterInfo ®_info)
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)
ModuleLoadedScriptHooks m_module_added_hooks
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)
friend class TargetAPIMutex
void DisableAllowedBreakpoints()
bool SetHookEnabledStateByID(lldb::user_id_t uid, bool enabled)
bool SetSectionUnloaded(const lldb::SectionSP §ion_sp)
lldb::TargetSP CalculateTarget() override
const lldb::ProcessSP & GetProcessSP() const
void ClearModules(bool delete_locations)
void RemoveNameFromBreakpoint(lldb::BreakpointSP &bp_sp, llvm::StringRef name)
BreakpointNameMap m_breakpoint_names
bool RemoveBreakpointByID(lldb::break_id_t break_id)
llvm::MapVector< uint32_t, ScriptedFrameProviderDescriptor > m_frame_provider_descriptors
Map of scripted frame provider descriptors for this target.
static bool ResetSignalFromDummy(lldb::UnixSignalsSP signals_sp, const DummySignalElement &element)
Architecture * GetArchitecturePlugin() const
lldb::ModuleSP GetOrCreateModule(const ModuleSpec &module_spec, bool notify, Status *error_ptr=nullptr, bool invoke_symbol_locators=true)
Find a binary on the system and return its Module, or return an existing Module that is already in th...
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)
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
An optional lldb_private::Trace object containing processor trace information of this target.
bool RemoveAllWatchpoints(bool end_to_end=true)
bool ReadPointerFromMemory(const Address &addr, Status &error, Address &pointer_addr, bool force_live_memory=false)
TargetGroupList m_target_groups
Every target group this target belongs to.
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,...
StopHooksVote RunStopHooksAtCurrentStop(llvm::ArrayRef< StopHookSP > active_hooks, llvm::ArrayRef< HookSP > active_unified_hooks, bool at_initial_stop)
Run active_hooks and active_unified_hooks at the process's current stop, on each thread that stopped ...
WatchpointList m_watchpoint_list
BreakpointList m_breakpoint_list
void DescribeBreakpointOverrides(Stream &stream, std::vector< lldb::user_id_t > &idxs, uint32_t terminal_width, bool use_color)
Describe the breakpoint overrides.
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.
HookSP GetHookByID(lldb::user_id_t uid)
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)
void SetAllHooksEnabledState(bool enabled)
std::recursive_mutex m_mutex
An API mutex that is used by the lldb::SB* classes make the SB interface thread safe.
std::recursive_mutex m_frame_provider_descriptors_mutex
lldb::user_id_t m_target_unique_id
The globally unique ID assigned to this target.
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
StopHooksVote
What the stop hooks that ran at a stop ask us to do with the process.
@ Stop
No hook asked to continue, or one asked to stay stopped.
@ Continue
At least one hook asked to continue, and none asked to stay stopped.
@ AlreadyContinued
A hook resumed the process itself.
void AddTargetGroup(const lldb::TargetGroupSP &group_sp)
Called only by TargetGroup::AddTarget to record group membership.
SummaryStatisticsCache m_summary_statistics_cache
std::mutex m_loaded_scripts_mutex
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)
void NotifyBreakpointChanged(Breakpoint &bp, lldb::BreakpointEventType event_kind)
Sends a breakpoint notification event.
lldb::SearchFilterSP GetSearchFilterForModule(const FileSpec *containingModule)
llvm::StringMapEntry< DummySignalValues > DummySignalElement
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 RunModuleHooks(bool is_load)
std::map< lldb::user_id_t, BreakpointResolverOverrideUP > m_breakpoint_overrides
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.
void UndoCreateHook(lldb::user_id_t uid)
Removes the most recently created hook.
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.
FileSpecList GetSafeAutoLoadPaths() const
Get the list of paths that LLDB will consider automatically loading scripting resources from.
static TargetProperties & GetGlobalProperties()
Status Install(ProcessLaunchInfo *launch_info)
HookSP GetHookAtIndex(size_t index)
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.
std::unique_ptr< BreakpointResolverOverride > BreakpointResolverOverrideUP
const ModuleList & GetImages() const
Get accessor for the images for this process.
const ArchSpec & GetArchitecture() const
WatchpointList & GetWatchpointList()
@ eBroadcastBitModulesLoaded
@ eBroadcastBitSymbolsLoaded
@ eBroadcastBitModulesUnloaded
@ eBroadcastBitWatchpointChanged
@ eBroadcastBitBreakpointChanged
@ eBroadcastBitNewTargetCreated
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)
void InvalidateThreadFrameProviders()
Invalidate all potentially cached frame providers for all threads and trigger a stack changed event f...
bool IgnoreAllWatchpoints(uint32_t ignore_count)
void AddBreakpoint(lldb::BreakpointSP breakpoint_sp, bool internal)
std::string m_target_session_name
The target session name for this target, used to name debugging sessions in DAP.
TypeSystemMap m_scratch_type_system_map
void AddBreakpointName(std::unique_ptr< BreakpointName > bp_name)
SectionLoadHistory m_section_load_history
lldb::BreakpointResolverSP CheckBreakpointOverrides(lldb::BreakpointResolverSP original_sp)
void GetBreakpointNames(std::vector< std::string > &names)
bool IsDummyTarget() const
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.
void ClearScriptedFrameProviderDescriptors()
Clear all scripted frame provider descriptors for this target.
void RebuildModuleListWithExecutable(lldb::ModuleSP &module_sp, LoadDependentFiles load_dependent_files=eLoadDependentsDefault)
Clear the module list and rebuild it around a new main executable.
lldb::WatchpointSP m_last_created_watchpoint
Status CreateBreakpointsFromFile(const FileSpec &file, BreakpointIDList &new_bps)
void SetREPL(lldb::LanguageType language, lldb::REPLSP repl_sp)
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)
std::shared_ptr< Hook > HookSP
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.
std::vector< lldb::TargetGroupSP > GetTargetGroups() const
Return the target groups this target belongs to.
llvm::SmallDenseSet< UUID > m_loaded_scripts
Used to not run stop hooks for expressions.
void SetPlatform(const lldb::PlatformSP &platform_sp)
bool SetSectionLoadAddress(const lldb::SectionSP §ion, lldb::addr_t load_addr, bool warn_multiple=false)
BreakpointName * FindBreakpointName(llvm::StringRef name, bool can_create, Status &error)
Status Attach(ProcessAttachInfo &attach_info, Stream *stream)
static void SetDefaultArchitecture(const ArchSpec &arch)
lldb::BreakpointSP m_last_created_breakpoint
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)
@ eBroadcastBitStackChanged
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
void OutputWordWrappedLines(Stream &strm, llvm::StringRef text, uint32_t output_max_columns, bool use_color)
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
@ eLoadScriptFromSymFileTrusted
@ 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
BreakpointConditionMode
Modes for evaluating breakpoint conditions.
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::TargetGroup > TargetGroupSP
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.
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
@ eStructuredDataTypeBoolean
std::shared_ptr< lldb_private::Module > ModuleSP
std::shared_ptr< lldb_private::OptionValue > OptionValueSP
std::shared_ptr< lldb_private::EventData > EventDataSP
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.
bool can_bypass_target_api_mutex
Describes what view of the process a thread should see and what operations it is allowed to perform.
Capabilities capabilities
@ Private
Parent (unwinder) frames, private state, private run lock.
Every register is described in detail including its name, alternate name (optional),...
This struct contains the metadata needed to instantiate a frame provider and optional filters to cont...
llvm::StringRef GetName() const
Get the name of this descriptor (the scripted class name).
uint32_t GetHash() const
Get the content-based hash from ScriptedMetadata.
void SetID(uint32_t id)
Set the monotonically increasing ID for this descriptor.
bool IsValid() const
Check if this descriptor has valid metadata for script-based providers.
A type-erased pair of llvm::dwarf::SourceLanguageName and version.
lldb::LanguageType AsLanguageType() const
llvm::StringRef GetDescription() const
static TestingProperties & GetGlobalTestingProperties()
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)