75#include "llvm/ADT/STLExtras.h"
76#include "llvm/ADT/ScopeExit.h"
77#include "llvm/ADT/SetVector.h"
78#include "llvm/Support/ErrorExtras.h"
79#include "llvm/Support/ThreadPool.h"
91struct ExecutableInstaller {
94 : m_platform{platform}, m_module{module},
95 m_local_file{m_module->GetFileSpec()},
96 m_remote_file{m_module->GetRemoteInstallFileSpec()} {}
98 void setupRemoteFile()
const { m_module->SetPlatformFileSpec(m_remote_file); }
102 const FileSpec m_local_file;
103 const FileSpec m_remote_file;
106struct MainExecutableInstaller {
109 ProcessLaunchInfo &launch_info)
110 : m_platform{platform}, m_module{module},
111 m_local_file{m_module->GetFileSpec()},
113 getRemoteFileSpec(m_platform, target, m_module, m_local_file)},
114 m_launch_info{launch_info} {}
116 void setupRemoteFile()
const {
117 m_module->SetPlatformFileSpec(m_remote_file);
120 m_platform->SetFilePermissions(m_remote_file, 0700 );
125 const FileSpec m_local_file;
126 const FileSpec m_remote_file;
131 const FileSpec &local_file) {
132 FileSpec remote_file =
module->GetRemoteInstallFileSpec();
133 if (remote_file || !target->GetAutoInstallMainExecutable())
139 remote_file = platform->GetRemoteWorkingDirectory();
145 ProcessLaunchInfo &m_launch_info;
151template <
typename Installer>
153 if (!installer.m_local_file || !installer.m_remote_file)
156 Status error = installer.m_platform->Install(installer.m_local_file,
157 installer.m_remote_file);
161 installer.setupRemoteFile();
176 static constexpr llvm::StringLiteral class_name(
"lldb.target");
208 static_cast<void *
>(
this));
211 "Target::Target created with architecture {0} ({1})",
213 target_arch.
GetTriple().getTriple().c_str());
221 LLDB_LOG(log,
"{0} Target::~Target()",
static_cast<void *
>(
this));
233 if (breakpoint_sp->IsInternal())
247 elem.second->CopyIntoNewTarget(*
this);
248 if (new_override_up->Validate())
284 llvm::consumeError(
m_process_sp->FlushDelayedBreakpoints());
286 std::unique_lock<std::recursive_mutex> lock;
317 llvm::StringRef plugin_name,
324 listener_sp, crash_file, can_connect);
331 const char *repl_options,
bool can_create) {
339 language = *single_lang;
340 }
else if (repl_languages.
Empty()) {
342 "LLDB isn't configured with REPL support for any languages.");
346 "Multiple possible REPL languages. Please specify a language.");
351 REPLMap::iterator pos =
m_repl_map.find(language);
359 "Couldn't find an existing REPL for %s, and can't create a new one",
374 "Couldn't create a REPL for %s",
388 std::lock_guard<std::recursive_mutex> guard(
m_mutex);
395 const bool notify =
false;
419 return abi_sp->GetPluginName();
452 shared_lib_filter.
Append(main_module_sp->GetFileSpec());
453 llvm::SetVector<std::string, std::vector<std::string>,
454 std::unordered_set<std::string>>
463 if (!entryPointName.empty())
464 entryPointNamesSet.insert(entryPointName);
466 if (entryPointNamesSet.empty()) {
472 nullptr, entryPointNamesSet.takeVector(),
473 eFunctionNameTypeFull,
483 bp_sp->SetOneShot(
true);
490 const std::unordered_set<std::string> &function_names,
494 containingModules, source_file_spec_list));
498 nullptr, std::move(source_regex), function_names,
499 !
static_cast<bool>(move_to_nearest_code)));
505 const FileSpec &file, uint32_t line_no,
508 LazyBool skip_prologue,
bool internal,
512 std::optional<llvm::StringRef> removed_prefix_opt =
514 if (!removed_prefix_opt)
515 remapped_file = file;
519 switch (inline_strategy) {
540 compile_unit_list.
Append(remapped_file);
553 !
static_cast<bool>(move_to_nearest_code));
558 nullptr, offset, skip_prologue, location_spec, removed_prefix_opt));
585 std::make_shared<SearchFilterForUnconstrainedSearches>(
588 std::make_shared<BreakpointResolverAddress>(
nullptr, addr);
595 bool request_hardware) {
597 std::make_shared<SearchFilterForUnconstrainedSearches>(
600 std::make_shared<BreakpointResolverAddress>(
nullptr,
Address(file_addr),
608 const FileSpecList *containingSourceFiles,
const char *func_name,
609 FunctionNameType func_name_type_mask,
LanguageType language,
611 bool internal,
bool hardware) {
615 containingModules, containingSourceFiles));
624 offset, offset_is_insn_count, skip_prologue));
633 const std::vector<std::string> &func_names,
634 FunctionNameType func_name_type_mask,
636 LazyBool skip_prologue,
bool internal,
bool hardware) {
638 size_t num_names = func_names.size();
641 containingModules, containingSourceFiles));
649 new BreakpointResolverName(
nullptr, func_names, func_name_type_mask,
650 language, offset, skip_prologue));
659 const char *func_names[],
size_t num_names,
660 FunctionNameType func_name_type_mask,
662 LazyBool skip_prologue,
bool internal,
bool hardware) {
666 containingModules, containingSourceFiles));
678 nullptr, func_names, num_names, func_name_type_mask, language, offset,
680 resolver_sp->SetOffset(offset);
689 if (containingModule !=
nullptr) {
692 filter_sp = std::make_shared<SearchFilterByModule>(shared_from_this(),
697 std::make_shared<SearchFilterForUnconstrainedSearches>(
707 if (containingModules && containingModules->
GetSize() != 0) {
710 filter_sp = std::make_shared<SearchFilterByModuleList>(shared_from_this(),
715 std::make_shared<SearchFilterForUnconstrainedSearches>(
725 if (containingSourceFiles ==
nullptr || containingSourceFiles->
GetSize() == 0)
729 if (containingModules ==
nullptr) {
733 filter_sp = std::make_shared<SearchFilterByModuleListAndCU>(
734 shared_from_this(),
FileSpecList(), *containingSourceFiles);
736 filter_sp = std::make_shared<SearchFilterByModuleListAndCU>(
737 shared_from_this(), *containingModules, *containingSourceFiles);
746 bool internal,
bool hardware) {
748 containingModules, containingSourceFiles));
751 :
static_cast<bool>(skip_prologue);
753 nullptr, std::move(func_regex), requested_language, 0,
skip));
760 bool catch_bp,
bool throw_bp,
bool internal,
763 *
this, language, catch_bp, throw_bp, internal);
764 if (exc_bkpt_sp && additional_args) {
766 if (precondition_sp && additional_args) {
768 *
error = precondition_sp->ConfigurePrecondition(*additional_args);
770 precondition_sp->ConfigurePrecondition(*additional_args);
777 const llvm::StringRef class_name,
const FileSpecList *containingModules,
778 const FileSpecList *containingSourceFiles,
bool internal,
785 containingSourceFiles && containingSourceFiles->
GetSize() > 0;
786 bool has_modules = containingModules && containingModules->
GetSize() > 0;
788 if (has_files && has_modules) {
790 containingSourceFiles);
791 }
else if (has_files) {
794 }
else if (has_modules) {
797 filter_sp = std::make_shared<SearchFilterForUnconstrainedSearches>(
808 bool internal,
bool request_hardware,
809 bool resolve_indirect_symbols) {
811 if (filter_sp && resolver_sp) {
819 resolver_sp = overridden_sp;
822 bp_sp.reset(
new Breakpoint(*
this, filter_sp, resolver_sp, hardware,
823 resolve_indirect_symbols));
824 resolver_sp->SetBreakpoint(bp_sp);
842 LLDB_LOGF(log,
"Target::%s (internal = %s) => break_id = %s\n",
843 __FUNCTION__, bp_sp->IsInternal() ?
"yes" :
"no", s.
GetData());
846 bp_sp->ResolveBreakpoint();
877 bp_sp->AddName(name);
882 std::make_pair(bp_name->GetName(), std::move(bp_name)));
888 if (!
error.Success())
893 return iter->second.get();
898 "Breakpoint name \"{0}\" doesn't exist and can_create is false.", name);
904 std::make_pair(name, std::make_unique<BreakpointName>(name.str())))
905 .first->second.get();
914 bp_sp->RemoveName(name);
919 llvm::StringRef name) {
920 bp_sp->RemoveName(name);
932 llvm::Expected<std::vector<BreakpointSP>> expected_vector =
935 if (!expected_vector) {
937 llvm::toString(expected_vector.takeError()));
941 for (
auto bp_sp : *expected_vector)
948 names.push_back(bp_name_entry.first().str());
954 llvm::StringRef class_name, uint64_t type_mask,
956 if (class_name.empty())
957 return llvm::createStringError(llvm::inconvertibleErrorCode(),
961 return llvm::createStringErrorV(
962 llvm::inconvertibleErrorCode(),
963 "invalid breakpoint type mask: {0}, should be composed of the "
964 "elements of the BreakpointResolverType enum.",
972 type_mask, std::string(class_name),
974 llvm::Error
error = new_override_up->Validate();
986 std::vector<lldb::user_id_t> &idxs,
987 uint32_t output_width,
990 stream <<
"No overrides.\n";
994 bool empty = idxs.empty();
995 bool print_first =
true;
997 auto idx_pos = llvm::find(idxs, elem.first);
998 if (empty || idx_pos != idxs.end()) {
1002 output_width, use_color);
1004 output_width, use_color);
1005 print_first =
false;
1007 auto content = llvm::formatv(
"{0,4} {1,6} {2}\n", elem.first,
1008 elem.second->DescribeTypeMask(),
1009 elem.second->GetDescription())
1013 idxs.erase(idx_pos);
1025 if (!original_sp->ResolverTyInMask(elem.second->GetTypeMask()))
1028 elem.second->CheckForOverride(*
this, original_sp))
1029 return overriden_sp;
1035 std::optional<uint32_t> num_supported_hardware_watchpoints =
1040 if (!num_supported_hardware_watchpoints)
1043 if (*num_supported_hardware_watchpoints == 0) {
1045 "Target supports (%u) hardware watchpoint slots.\n",
1046 *num_supported_hardware_watchpoints);
1059 "Target::%s (addr = 0x%8.8" PRIx64
" size = %" PRIu64
1061 __FUNCTION__, addr, (uint64_t)size, kind);
1072 "cannot set a watchpoint with watch_size of 0");
1075 "invalid watch address: %" PRIu64, addr);
1091 const bool notify =
false;
1096 addr = abi->FixDataAddress(addr);
1110 std::unique_lock<std::recursive_mutex> lock;
1114 size_t old_size = matched_sp->GetByteSize();
1120 if (size == old_size && kind == old_type) {
1122 wp_sp->SetEnabled(
false, notify);
1131 wp_sp = std::make_shared<Watchpoint>(*
this, addr, size, type);
1132 wp_sp->SetWatchpointType(kind, notify);
1137 LLDB_LOGF(log,
"Target::%s (creation of watchpoint %s with id = %u)\n",
1138 __FUNCTION__,
error.Success() ?
"succeeded" :
"failed",
1153 LLDB_LOGF(log,
"Target::%s \n", __FUNCTION__);
1162 LLDB_LOGF(log,
"Target::%s (internal_also = %s)\n", __FUNCTION__,
1163 internal_also ?
"yes" :
"no");
1174 LLDB_LOGF(log,
"Target::%s (internal_also = %s)\n", __FUNCTION__,
1175 internal_also ?
"yes" :
"no");
1184 LLDB_LOGF(log,
"Target::%s", __FUNCTION__);
1191 LLDB_LOGF(log,
"Target::%s (internal_also = %s)\n", __FUNCTION__,
1192 internal_also ?
"yes" :
"no");
1201 LLDB_LOGF(log,
"Target::%s", __FUNCTION__);
1208 LLDB_LOGF(log,
"Target::%s (break_id = %i, internal = %s)\n", __FUNCTION__,
1228 LLDB_LOGF(log,
"Target::%s (break_id = %i, internal = %s)\n", __FUNCTION__,
1238 bp_sp->SetEnabled(
false);
1246 LLDB_LOGF(log,
"Target::%s (break_id = %i, internal = %s)\n", __FUNCTION__,
1257 bp_sp->SetEnabled(
true);
1277 std::string path(file.
GetPath());
1285 if (
error.Success()) {
1286 break_store_ptr = input_data_sp->GetAsArray();
1287 if (!break_store_ptr) {
1289 "Tried to append to invalid input file %s", path.c_str());
1295 if (!break_store_ptr) {
1296 break_store_sp = std::make_shared<StructuredData::Array>();
1297 break_store_ptr = break_store_sp.get();
1304 lldb::eFilePermissionsFileDefault);
1311 std::unique_lock<std::recursive_mutex> lock;
1317 size_t num_breakpoints = breakpoints.
GetSize();
1318 for (
size_t i = 0; i < num_breakpoints; i++) {
1323 break_store_ptr->
AddItem(bkpt_save_sp);
1327 std::unordered_set<lldb::break_id_t> processed_bkpts;
1328 const size_t count = bp_ids.
GetSize();
1329 for (
size_t i = 0; i < count; ++i) {
1335 std::pair<std::unordered_set<lldb::break_id_t>::iterator,
bool>
1336 insert_result = processed_bkpts.insert(bp_id);
1337 if (!insert_result.second)
1344 if (!bkpt_save_sp) {
1346 "Unable to serialize breakpoint %d", bp_id);
1349 break_store_ptr->
AddItem(bkpt_save_sp);
1354 break_store_ptr->
Dump(out_file,
false);
1361 std::vector<std::string> no_names;
1366 std::vector<std::string> &names,
1368 std::unique_lock<std::recursive_mutex> lock;
1374 if (!
error.Success()) {
1376 }
else if (!input_data_sp || !input_data_sp->IsValid()) {
1378 "Invalid JSON from input file: %s.", file.
GetPath().c_str());
1385 "Invalid breakpoint data from input file: %s.", file.
GetPath().c_str());
1389 size_t num_bkpts = bkpt_array->
GetSize();
1390 size_t num_names = names.size();
1392 for (
size_t i = 0; i < num_bkpts; i++) {
1398 "Invalid breakpoint data for element %zu from input file: %s.", i,
1409 shared_from_this(), bkpt_data_sp,
error);
1410 if (!
error.Success()) {
1412 "Error restoring breakpoint %zu from %s: %s.", i,
1428 LLDB_LOGF(log,
"Target::%s\n", __FUNCTION__);
1457 LLDB_LOGF(log,
"Target::%s\n", __FUNCTION__);
1484 LLDB_LOGF(log,
"Target::%s\n", __FUNCTION__);
1510 LLDB_LOGF(log,
"Target::%s\n", __FUNCTION__);
1516 wp_sp->ResetHitCount();
1524 LLDB_LOGF(log,
"Target::%s\n", __FUNCTION__);
1530 wp_sp->ResetHistoricValues();
1539 LLDB_LOGF(log,
"Target::%s\n", __FUNCTION__);
1548 wp_sp->SetIgnoreCount(ignore_count);
1556 LLDB_LOGF(log,
"Target::%s (watch_id = %i)\n", __FUNCTION__, watch_id);
1575 LLDB_LOGF(log,
"Target::%s (watch_id = %i)\n", __FUNCTION__, watch_id);
1594 LLDB_LOGF(log,
"Target::%s (watch_id = %i)\n", __FUNCTION__, watch_id);
1609 uint32_t ignore_count) {
1611 LLDB_LOGF(log,
"Target::%s (watch_id = %i)\n", __FUNCTION__, watch_id);
1618 wp_sp->SetIgnoreCount(ignore_count);
1625 std::lock_guard<std::recursive_mutex> lock(
m_images.GetMutex());
1637 return m_images.GetModuleAtIndex(0);
1664 if (executable_sp) {
1667 pid = proc->GetID();
1671 info->
uuid = executable_sp->GetUUID();
1673 info->
triple = executable_sp->GetArchitecture().GetTriple().getTriple();
1679 info->
uuid = executable_sp->GetUUID();
1685 executable_sp->GetFileSpec().GetPath().c_str());
1687 const bool notify =
true;
1693 if (!
m_arch.GetSpec().IsValid()) {
1694 m_arch = executable_sp->GetArchitecture();
1696 "Target::SetExecutableModule setting architecture to {0} ({1}) "
1697 "based on executable file",
1698 m_arch.GetSpec().GetArchitectureName(),
1699 m_arch.GetSpec().GetTriple().getTriple());
1702 ObjectFile *executable_objfile = executable_sp->GetObjectFile();
1703 bool load_dependents =
true;
1704 switch (load_dependent_files) {
1706 load_dependents = executable_sp->IsExecutable();
1709 load_dependents =
true;
1712 load_dependents =
false;
1716 if (executable_objfile && load_dependents) {
1719 std::mutex dependent_files_mutex;
1724 auto GetDependentModules = [&](
FileSpec dependent_file_spec) {
1725 FileSpec platform_dependent_file_spec;
1727 m_platform_sp->GetFileWithUUID(dependent_file_spec,
nullptr,
1728 platform_dependent_file_spec);
1730 platform_dependent_file_spec = dependent_file_spec;
1735 if (image_module_sp) {
1737 ObjectFile *objfile = image_module_sp->GetObjectFile();
1743 std::lock_guard<std::mutex> guard(dependent_files_mutex);
1744 dependent_files_copy = dependent_files;
1749 const size_t previous_dependent_files =
1750 dependent_files_copy.
GetSize();
1755 std::lock_guard<std::mutex> guard(dependent_files_mutex);
1756 for (
size_t i = previous_dependent_files;
1757 i < dependent_files_copy.
GetSize(); ++i)
1768 for (uint32_t i = 0; i < dependent_files.
GetSize(); i++) {
1774 std::lock_guard<std::mutex> guard(dependent_files_mutex);
1775 for (; i < dependent_files.
GetSize(); i++)
1776 task_group.async(GetDependentModules,
1789 bool missing_local_arch = !
m_arch.GetSpec().IsValid();
1790 bool replace_local_arch =
true;
1791 bool compatible_local_arch =
false;
1800 if (!platform_sp || !platform_sp->IsCompatibleArchitecture(
1804 GetDebugger().GetPlatformList().GetOrCreate(other, {},
1806 arch_platform_sp->SetLocateModuleCallback(
1807 platform_sp->GetLocateModuleCallback());
1810 other = platform_arch;
1816 if (!missing_local_arch) {
1817 if (merge &&
m_arch.GetSpec().IsCompatibleMatch(arch_spec)) {
1820 if (
m_arch.GetSpec().IsCompatibleMatch(other)) {
1821 compatible_local_arch =
true;
1824 replace_local_arch =
false;
1829 if (compatible_local_arch || missing_local_arch) {
1833 if (replace_local_arch)
1836 "Target::SetArchitecture merging compatible arch; arch "
1838 m_arch.GetSpec().GetArchitectureName(),
1839 m_arch.GetSpec().GetTriple().getTriple());
1847 "Target::SetArchitecture changing architecture to %s (%s) from %s (%s)",
1849 arch_spec.
GetTriple().getTriple().c_str(),
1850 m_arch.GetSpec().GetArchitectureName(),
1851 m_arch.GetSpec().GetTriple().getTriple().c_str());
1858 if (executable_sp) {
1860 "Target::SetArchitecture Trying to select executable file "
1861 "architecture %s (%s)",
1863 arch_spec.
GetTriple().getTriple().c_str());
1864 ModuleSpec module_spec(executable_sp->GetFileSpec(), other);
1865 module_spec.
SetTarget(shared_from_this());
1869 if (!
error.Fail() && executable_sp) {
1880 if (
m_arch.GetSpec().IsCompatibleMatch(arch_spec)) {
1885 "Target::MergeArchitecture target has arch %s, merging with "
1887 m_arch.GetSpec().GetTriple().getTriple().c_str(),
1888 arch_spec.
GetTriple().getTriple().c_str());
1909 my_module_list.
Append(module_sp);
1919 my_module_list.
Append(module_sp);
1932 old_module_sp, new_module_sp);
1944 const size_t num_images = module_list.
GetSize();
1946 std::list<Status> errors;
1948 for (
const auto &err : errors)
1951 for (
size_t idx = 0; idx < num_images; ++idx) {
1963 std::make_shared<TargetEventData>(shared_from_this(), module_list);
1972 runtime->SymbolsDidLoad(module_list);
1979 std::make_shared<TargetEventData>(shared_from_this(), module_list);
1988 std::make_shared<TargetEventData>(shared_from_this(), module_list);
2002 const bool should_flush_type_systems =
2004 auto *object_file =
module.GetObjectFile();
2009 auto type = object_file->GetType();
2013 return module.FileHasChanged() &&
2014 (type == ObjectFile::eTypeObjectFile ||
2015 type == ObjectFile::eTypeExecutable ||
2016 type == ObjectFile::eTypeSharedLibrary);
2019 if (should_flush_type_systems)
2027 const FileSpec &module_file_spec) {
2032 size_t num_modules = matchingModules.
GetSize();
2036 if (num_modules > 0) {
2037 for (
size_t i = 0; i < num_modules; i++) {
2052 return m_platform_sp->ModuleIsExcludedForUnconstrainedSearches(*
this,
2064 if (section_sp->IsEncrypted()) {
2068 ModuleSP module_sp(section_sp->GetModule());
2070 ObjectFile *objfile = section_sp->GetModule()->GetObjectFile();
2073 section_sp.get(), addr.
GetOffset(), dst, dst_len);
2078 "error reading data from section {0}", section_sp->GetName());
2085 "address doesn't contain a section that points to a "
2086 "section in a object file");
2094 bool *did_read_live_memory) {
2096 if (did_read_live_memory)
2097 *did_read_live_memory =
false;
2110 size_t bytes_read = 0;
2117 if (section_load_list.
IsEmpty()) {
2123 m_images.ResolveFileAddress(file_addr, resolved_addr);
2136 resolved_addr = fixed_addr;
2141 std::unique_ptr<uint8_t[]> file_cache_read_buffer;
2142 size_t file_cache_bytes_read = 0;
2148 auto permissions =
Flags(section_sp->GetPermissions());
2149 bool is_readonly = !permissions.Test(ePermissionsWritable) &&
2150 permissions.Test(ePermissionsReadable);
2152 file_cache_bytes_read =
2154 if (file_cache_bytes_read == dst_len)
2155 return file_cache_bytes_read;
2156 else if (file_cache_bytes_read > 0) {
2157 file_cache_read_buffer =
2158 std::make_unique<uint8_t[]>(file_cache_bytes_read);
2159 std::memcpy(file_cache_read_buffer.get(), dst, file_cache_bytes_read);
2171 if (addr_module_sp && addr_module_sp->GetFileSpec())
2173 "{0:F}[{1:x+}] can't be resolved, {0:F} is not currently loaded",
2177 "0x%" PRIx64
" can't be resolved", resolved_addr.
GetFileAddress());
2180 if (bytes_read != dst_len) {
2181 if (
error.Success()) {
2182 if (bytes_read == 0)
2184 "read memory from 0x%" PRIx64
" failed", load_addr);
2187 "only %" PRIu64
" of %" PRIu64
2188 " bytes were read from memory at 0x%" PRIx64,
2189 (uint64_t)bytes_read, (uint64_t)dst_len, load_addr);
2194 *load_addr_ptr = load_addr;
2195 if (did_read_live_memory)
2196 *did_read_live_memory =
true;
2202 if (file_cache_read_buffer && file_cache_bytes_read > 0) {
2205 std::memcpy(dst, file_cache_read_buffer.get(), file_cache_bytes_read);
2206 return file_cache_bytes_read;
2228 out_str.append(buf, length);
2231 if (length ==
sizeof(buf) - 1)
2232 curr_addr += length;
2237 return out_str.size();
2241 size_t dst_max_len,
Status &result_error,
2242 bool force_live_memory) {
2243 size_t total_cstr_len = 0;
2244 if (dst && dst_max_len) {
2245 result_error.
Clear();
2247 memset(dst, 0, dst_max_len);
2254 const size_t cache_line_size = 512;
2256 size_t bytes_left = dst_max_len - 1;
2257 char *curr_dst = dst;
2259 while (bytes_left > 0) {
2260 addr_t cache_line_bytes_left =
2261 cache_line_size - (curr_addr % cache_line_size);
2263 std::min<addr_t>(bytes_left, cache_line_bytes_left);
2265 size_t bytes_read =
ReadMemory(address, curr_dst, bytes_to_read,
error,
2268 if (bytes_read == 0) {
2269 result_error = std::move(
error);
2270 dst[total_cstr_len] =
'\0';
2273 const size_t len = strlen(curr_dst);
2275 total_cstr_len += len;
2277 if (len < bytes_to_read)
2280 curr_dst += bytes_read;
2281 curr_addr += bytes_read;
2282 bytes_left -= bytes_read;
2289 result_error.
Clear();
2291 return total_cstr_len;
2299 return cache_line_size - (load_addr % cache_line_size);
2309 size_t type_width,
bool force_live_memory) {
2310 if (!dst || !max_bytes || !type_width || max_bytes < type_width)
2313 size_t total_bytes_read = 0;
2317 memset(dst, 0, max_bytes);
2318 size_t bytes_left = max_bytes - type_width;
2320 const char terminator[4] = {
'\0',
'\0',
'\0',
'\0'};
2321 assert(
sizeof(terminator) >= type_width &&
"Attempting to validate a "
2322 "string with more than 4 bytes "
2326 char *curr_dst = dst;
2329 while (bytes_left > 0 &&
error.Success()) {
2333 ReadMemory(address, curr_dst, bytes_to_read,
error, force_live_memory);
2335 if (bytes_read == 0)
2340 size_t aligned_start = total_bytes_read - total_bytes_read % type_width;
2341 for (
size_t i = aligned_start;
2342 i + type_width <= total_bytes_read + bytes_read; i += type_width)
2343 if (::memcmp(&dst[i], terminator, type_width) == 0) {
2348 total_bytes_read += bytes_read;
2349 curr_dst += bytes_read;
2350 address.
Slide(bytes_read);
2351 bytes_left -= bytes_read;
2353 return total_bytes_read;
2357 bool is_signed,
Scalar &scalar,
2359 bool force_live_memory) {
2362 if (byte_size <=
sizeof(uval)) {
2365 if (bytes_read == byte_size) {
2367 m_arch.GetSpec().GetAddressByteSize());
2370 scalar = data.
GetMaxU32(&offset, byte_size);
2372 scalar = data.
GetMaxU64(&offset, byte_size);
2382 "byte size of %u is too large for integer scalar type", byte_size);
2388 size_t integer_byte_size,
2390 bool force_live_memory) {
2399 size_t integer_byte_size,
2401 bool force_live_memory) {
2411 bool force_live_memory) {
2414 false, scalar,
error, force_live_memory)) {
2418 if (section_load_list.
IsEmpty()) {
2421 m_images.ResolveFileAddress(pointer_vm_addr, pointer_addr);
2432 pointer_addr.
SetOffset(pointer_vm_addr);
2440 bool notify,
Status *error_ptr) {
2447 module_spec.
SetTarget(shared_from_this());
2449 if (std::optional<FileSpec> remapped_obj_file =
2460 module_sp =
m_images.FindFirstModule(module_spec);
2463 llvm::SmallVector<ModuleSP, 1>
2466 bool did_create_module =
false;
2476 module_spec, module_sp, symbol_file_spec, &did_create_module);
2507 transformed_spec.
SetTarget(shared_from_this());
2509 &old_modules, &did_create_module);
2526 &old_modules, &did_create_module);
2534 module_spec,
m_process_sp.get(), module_sp, &old_modules,
2535 &did_create_module);
2546 ObjectFile *objfile = module_sp->GetObjectFile();
2562 "debug info files aren't valid target "
2563 "modules, please specify an executable");
2570 "stub libraries aren't valid target "
2571 "modules, please specify an executable");
2576 "unsupported file type, please specify an executable");
2595 m_images.FindModules(module_spec_copy, found_modules);
2597 old_modules.push_back(found_module);
2604 if (symbol_file_spec)
2605 module_sp->SetSymbolFileFileSpec(symbol_file_spec);
2607 llvm::SmallVector<ModuleSP, 1> replaced_modules;
2608 for (
ModuleSP &old_module_sp : old_modules) {
2609 if (
m_images.GetIndexForModule(old_module_sp.get()) !=
2611 if (replaced_modules.empty())
2612 m_images.ReplaceModule(old_module_sp, module_sp);
2616 replaced_modules.push_back(std::move(old_module_sp));
2620 if (replaced_modules.size() > 1) {
2633 auto dump = [&message](
Module &dump_module) ->
void {
2634 UUID dump_uuid = dump_module.GetUUID();
2638 message <<
" (uuid ";
2641 dump_uuid.
Dump(message);
2643 message <<
"not specified";
2648 message <<
"New module ";
2651 << llvm::formatv(
" simultaneously replaced {0} old modules: ",
2652 replaced_modules.size());
2653 for (
ModuleSP &replaced_module_sp : replaced_modules)
2654 dump(*replaced_module_sp);
2660 if (replaced_modules.empty()) {
2661 if (!
m_images.AppendIfNeeded(module_sp, notify) && notify)
2665 for (
ModuleSP &old_module_sp : replaced_modules) {
2666 auto old_module_wp = old_module_sp->weak_from_this();
2667 old_module_sp.reset();
2675 *error_ptr = std::move(
error);
2704llvm::Expected<lldb::TypeSystemSP>
2706 bool create_on_demand) {
2708 return llvm::createStringError(
"invalid target");
2721 if (languages_for_expressions.
Empty())
2722 return llvm::createStringError(
2723 "No expression support for any languages");
2734 uint32_t byte_size) {
2741std::vector<lldb::TypeSystemSP>
2749 std::vector<lldb::TypeSystemSP> scratch_type_systems;
2754 for (
auto bit : languages_for_expressions.
bitvector.set_bits()) {
2756 auto type_system_or_err =
2758 if (!type_system_or_err)
2761 "Language '{1}' has expression support but no scratch type "
2762 "system available: {0}",
2765 if (
auto ts = *type_system_or_err)
2766 scratch_type_systems.push_back(ts);
2769 std::sort(scratch_type_systems.begin(), scratch_type_systems.end());
2770 scratch_type_systems.erase(llvm::unique(scratch_type_systems),
2771 scratch_type_systems.end());
2772 return scratch_type_systems;
2779 if (
auto err = type_system_or_err.takeError()) {
2782 "Unable to get persistent expression state for language {1}: {0}",
2787 if (
auto ts = *type_system_or_err)
2788 return ts->GetPersistentExpressionState();
2791 "Unable to get persistent expression state for language {}:",
2797 llvm::StringRef expr, llvm::StringRef prefix,
SourceLanguage language,
2801 auto type_system_or_err =
2803 if (
auto err = type_system_or_err.takeError()) {
2805 "Could not find type system for language %s: %s",
2807 llvm::toString(std::move(err)).c_str());
2811 auto ts = *type_system_or_err;
2814 "Type system for language %s is no longer live",
2819 auto *user_expr = ts->GetUserExpression(expr, prefix, language, desired_type,
2823 "Could not create an expression for language %s",
2834 if (
auto err = type_system_or_err.takeError()) {
2836 "Could not find type system for language %s: %s",
2838 llvm::toString(std::move(err)).c_str());
2841 auto ts = *type_system_or_err;
2844 "Type system for language %s is no longer live",
2848 auto *persistent_fn = ts->GetFunctionCaller(return_type, function_address,
2849 arg_value_list, name);
2852 "Could not create an expression for language %s",
2855 return persistent_fn;
2858llvm::Expected<std::unique_ptr<UtilityFunction>>
2863 if (!type_system_or_err)
2864 return type_system_or_err.takeError();
2865 auto ts = *type_system_or_err;
2867 return llvm::createStringError(
2868 llvm::StringRef(
"Type system for language ") +
2870 llvm::StringRef(
" is no longer live"));
2871 std::unique_ptr<UtilityFunction> utility_fn =
2872 ts->CreateUtilityFunction(std::move(expression), std::move(name));
2874 return llvm::createStringError(
2875 llvm::StringRef(
"Could not create an expression for language") +
2879 if (!utility_fn->Install(diagnostics, exe_ctx))
2881 "Could not install utility function:");
2883 return std::move(utility_fn);
2904 "setting target's default architecture to {0} ({1})",
2911 if (llvm::to_integer(label, n))
2912 return llvm::createStringError(
"cannot use integer as target label");
2916 if (target_sp && target_sp->GetLabel() == label) {
2917 return llvm::createStringErrorV(
2918 "Cannot use label '{0}' since it's set in target #{1}.", label, i);
2923 return llvm::Error::success();
2932 Target *target =
nullptr;
2933 if (sc_ptr !=
nullptr)
2935 if (target ==
nullptr && exe_ctx_ptr)
2945 result_valobj_sp.reset();
2950 m_stats.GetExpressionStats().NotifyFailure();
2951 return execution_results;
2957 llvm::scope_exit on_exit([
this, old_suppress_value]() {
2975 if (expr[0] ==
'$') {
2976 auto type_system_or_err =
2978 if (
auto err = type_system_or_err.takeError()) {
2980 "Unable to get scratch type system");
2982 auto ts = *type_system_or_err;
2985 "Scratch type system is no longer live: {0}");
2988 ts->GetPersistentExpressionState()->GetVariable(expr);
2991 if (persistent_var_sp) {
2992 result_valobj_sp = persistent_var_sp->GetValueObject();
2999 if (
ThreadSP thread_sp = exe_ctx.GetThreadSP()) {
3000 if (thread_sp->IsAnyProviderActive()) {
3008 result_valobj_sp, fixed_expression, ctx_obj);
3012 m_stats.GetExpressionStats().NotifySuccess();
3014 m_stats.GetExpressionStats().NotifyFailure();
3015 return execution_results;
3021 [name, &variable_sp](
TypeSystemSP type_system) ->
bool {
3022 auto ts = type_system.get();
3026 ts->GetPersistentExpressionState()) {
3027 variable_sp = persistent_state->GetVariable(name);
3042 auto ts = type_system.get();
3047 ts->GetPersistentExpressionState()) {
3048 address = persistent_state->LookupSymbol(name);
3061 const bool has_primary_executable = exe_module && exe_module->
GetObjectFile();
3062 if (has_primary_executable) {
3069 const size_t num_images = modules.
GetSize();
3070 for (
size_t idx = 0; idx < num_images; ++idx) {
3072 if (!module_sp || !module_sp->GetObjectFile())
3075 Address entry_addr = module_sp->GetObjectFile()->GetEntryPointAddress();
3081 if (!has_primary_executable)
3082 return llvm::createStringError(
3083 "No primary executable found and could not find entry point address in "
3084 "any executable module");
3086 return llvm::createStringError(
3087 "Could not find entry point address for primary executable module \"" +
3095 ? arch_plugin->GetCallableLoadAddress(load_addr, addr_class)
3102 return arch_plugin ? arch_plugin->GetOpcodeLoadAddress(load_addr, addr_class)
3108 return arch_plugin ? arch_plugin->GetBreakableLoadAddress(addr, *
this) : addr;
3111llvm::Expected<lldb::DisassemblerSP>
3113 const char *flavor_string) {
3115 bool force_live_memory =
true;
3118 const size_t bytes_read =
3120 force_live_memory, &load_addr);
3123 return llvm::createStringErrorV(
3125 "Target::ReadInstructions failed to read memory at {:x}"),
3129 if (!flavor_string || flavor_string[0] ==
'\0') {
3134 if (arch == llvm::Triple::x86 || arch == llvm::Triple::x86_64)
3162 stop_hook_sp.reset(
new StopHookCoded(shared_from_this(), new_uid));
3169 return stop_hook_sp;
3181 return (num_removed != 0);
3189 StopHookCollection::iterator specified_hook_iter;
3192 found_hook = (*specified_hook_iter).second;
3197 bool active_state) {
3198 StopHookCollection::iterator specified_hook_iter;
3203 (*specified_hook_iter).second->SetIsActive(active_state);
3208 StopHookCollection::iterator pos, end =
m_stop_hooks.end();
3210 (*pos).second->SetIsActive(active_state);
3219const std::vector<Target::StopHookSP>
3224 std::vector<StopHookSP> stop_hooks;
3226 stop_hooks.push_back(hook);
3244 auto is_active = [at_initial_stop](
StopHookSP hook) {
3245 bool should_run_now = (!at_initial_stop || hook->GetRunAtInitialStop());
3246 return hook->IsActive() && should_run_now;
3250 std::vector<StopHookSP> active_hooks;
3254 if (is_active(hook))
3255 active_hooks.push_back(hook);
3259 std::vector<HookSP> active_unified_hooks;
3260 for (
auto &[_, hook] :
m_hooks) {
3262 (!at_initial_stop || hook->GetRunAtInitialStop()))
3263 active_unified_hooks.push_back(hook);
3266 if (active_hooks.empty() && active_unified_hooks.empty())
3275 uint32_t last_natural_stop =
m_process_sp->GetModIDRef().GetLastNaturalStopID();
3279 std::vector<ExecutionContext> exc_ctx_with_reasons;
3282 size_t num_threads = cur_threadlist.
GetSize();
3283 for (
size_t i = 0; i < num_threads; i++) {
3285 if (cur_thread_sp->ThreadStoppedForAReason()) {
3287 exc_ctx_with_reasons.emplace_back(
m_process_sp.get(), cur_thread_sp.get(),
3288 cur_frame_sp.get());
3297 size_t num_exe_ctx = exc_ctx_with_reasons.size();
3298 if (num_exe_ctx == 0) {
3299 if (at_initial_stop && num_threads > 0) {
3301 exc_ctx_with_reasons.emplace_back(
3303 thread_to_use_sp->GetStackFrameAtIndex(0).get());
3313 llvm::scope_exit on_exit([output_sp] { output_sp->Flush(); });
3315 size_t num_hooks_with_output = llvm::count_if(
3316 active_hooks, [](
auto h) {
return !h->GetSuppressOutput(); });
3317 num_hooks_with_output += llvm::count_if(
3318 active_unified_hooks, [](
auto h) {
return !h->GetSuppressOutput(); });
3319 bool print_hook_header = (num_hooks_with_output > 1);
3320 bool print_thread_header = (num_exe_ctx > 1);
3321 bool should_stop =
false;
3322 bool requested_continue =
false;
3329 for (
auto cur_hook_sp : active_hooks) {
3330 bool any_thread_matched =
false;
3331 for (
auto exc_ctx : exc_ctx_with_reasons) {
3332 if (!cur_hook_sp->ExecutionContextPasses(exc_ctx))
3335 bool suppress_output = cur_hook_sp->GetSuppressOutput();
3336 if (print_hook_header && !any_thread_matched && !suppress_output) {
3340 output_sp->Printf(
"\n- Hook %" PRIu64
" (%s)\n", cur_hook_sp->GetID(),
3343 output_sp->Printf(
"\n- Hook %" PRIu64
"\n", cur_hook_sp->GetID());
3344 any_thread_matched =
true;
3347 if (print_thread_header && !suppress_output)
3348 output_sp->Printf(
"-- Thread %d\n",
3349 exc_ctx.GetThreadPtr()->GetIndexID());
3351 auto result = cur_hook_sp->HandleStop(exc_ctx, output_sp);
3354 if (cur_hook_sp->GetAutoContinue())
3355 requested_continue =
true;
3360 requested_continue =
true;
3369 output_sp->Printf(
"\nAborting stop hooks, hook %" PRIu64
3370 " set the program running.\n"
3371 " Consider using '-G true' to make "
3372 "stop hooks auto-continue.\n",
3373 cur_hook_sp->GetID());
3383 for (
auto cur_hook_sp : active_unified_hooks) {
3384 bool any_thread_matched =
false;
3385 for (
auto exc_ctx : exc_ctx_with_reasons) {
3386 if (!cur_hook_sp->ExecutionContextPasses(exc_ctx))
3389 bool suppress_output = cur_hook_sp->GetSuppressOutput();
3390 if (print_hook_header && !any_thread_matched && !suppress_output) {
3394 output_sp->Printf(
"\n- Hook %" PRIu64
" (%s)\n", cur_hook_sp->GetID(),
3397 output_sp->Printf(
"\n- Hook %" PRIu64
"\n", cur_hook_sp->GetID());
3398 any_thread_matched =
true;
3401 if (print_thread_header && !suppress_output)
3402 output_sp->Printf(
"-- Thread %d\n",
3403 exc_ctx.GetThreadPtr()->GetIndexID());
3405 auto result = cur_hook_sp->HandleStop(exc_ctx, output_sp);
3408 if (cur_hook_sp->GetAutoContinue())
3409 requested_continue =
true;
3414 requested_continue =
true;
3419 output_sp->Printf(
"\nAborting stop hooks, hook %" PRIu64
3420 " set the program running.\n"
3421 " Consider using '-G true' to make "
3422 "stop hooks auto-continue.\n",
3423 cur_hook_sp->GetID());
3431 if (requested_continue && !should_stop) {
3434 if (
error.Success()) {
3435 LLDB_LOG(log,
"Resuming from RunStopHooks");
3438 LLDB_LOG(log,
"Resuming from RunStopHooks failed: {0}",
error);
3451 return *g_settings_ptr;
3457 if (!platform_sp || !platform_sp->IsRemote() || !platform_sp->IsConnected())
3467 MainExecutableInstaller installer{platform_sp, module_sp,
3468 shared_from_this(), *launch_info};
3471 ExecutableInstaller installer{platform_sp, module_sp};
3483 uint32_t stop_id,
bool allow_section_end) {
3490 return m_images.ResolveFileAddress(file_addr, resolved_addr);
3494 addr_t new_section_load_addr,
3495 bool warn_multiple) {
3496 const addr_t old_section_load_addr =
3499 if (old_section_load_addr != new_section_load_addr) {
3500 uint32_t stop_id = 0;
3503 stop_id = process_sp->GetStopID();
3507 stop_id, section_sp, new_section_load_addr, warn_multiple))
3514 size_t section_unload_count = 0;
3515 size_t num_modules = module_list.
GetSize();
3516 for (
size_t i = 0; i < num_modules; ++i) {
3517 section_unload_count +=
3520 return section_unload_count;
3524 uint32_t stop_id = 0;
3527 stop_id = process_sp->GetStopID();
3530 SectionList *sections = module_sp->GetSectionList();
3531 size_t section_unload_count = 0;
3534 for (uint32_t i = 0; i < num_sections; ++i) {
3539 return section_unload_count;
3543 uint32_t stop_id = 0;
3546 stop_id = process_sp->GetStopID();
3554 uint32_t stop_id = 0;
3557 stop_id = process_sp->GetStopID();
3588 m_stats.SetLaunchOrAttachTime();
3592 LLDB_LOGF(log,
"Target::%s() called for %s", __FUNCTION__,
3604 state = process_sp->GetState();
3606 "Target::%s the process exists, and its current state is %s",
3609 LLDB_LOGF(log,
"Target::%s the process instance doesn't currently exist.",
3622 const bool synchronous_execution =
3630 if (launch_info.
GetFlags().
Test(eLaunchFlagLaunchInTTY))
3632 "can't launch in tty when launching through a remote connection");
3650 LLDB_LOGF(log,
"Target::%s asking the platform to debug the process",
3664 "Target::%s the platform doesn't know how to debug a "
3665 "process, getting a process plugin to do this for us.",
3684 if (!
error.Success())
3690 bool rebroadcast_first_stop =
3691 !synchronous_execution &&
3697 state =
m_process_sp->WaitForProcessToStop(std::nullopt, &first_stop_event_sp,
3698 rebroadcast_first_stop,
3702 if (rebroadcast_first_stop) {
3705 assert(first_stop_event_sp);
3714 if (launch_info.
GetFlags().
Test(eLaunchFlagStopAtEntry))
3716 if (synchronous_execution)
3723 if (!
error.Success()) {
3725 "process resume at entry point failed: %s",
error.AsCString());
3729 bool with_shell = !!launch_info.
GetShell();
3731 const char *exit_desc =
m_process_sp->GetExitDescription();
3733 if (exit_desc && exit_desc[0])
3734 desc =
" (" + std::string(exit_desc) +
')';
3737 "process exited with status %i%s\n"
3738 "'r' and 'run' are aliases that default to launching through a "
3740 "Try launching without going through a shell by using "
3741 "'process launch'.",
3742 exit_status, desc.c_str());
3745 "process exited with status %i%s", exit_status, desc.c_str());
3749 "initial process state wasn't stopped: %s",
StateAsCString(state));
3761 return llvm::createStringError(llvm::inconvertibleErrorCode(),
3762 "A process is required for tracing");
3764 return llvm::createStringError(llvm::inconvertibleErrorCode(),
3765 "A trace already exists for the target");
3767 llvm::Expected<TraceSupportedResponse> trace_type =
3770 return llvm::createStringError(
3771 llvm::inconvertibleErrorCode(),
"Tracing is not supported. %s",
3772 llvm::toString(trace_type.takeError()).c_str());
3773 if (llvm::Expected<TraceSP> trace_sp =
3777 return llvm::createStringError(
3778 llvm::inconvertibleErrorCode(),
3779 "Couldn't create a Trace object for the process. %s",
3780 llvm::toString(trace_sp.takeError()).c_str());
3791 Progress attach_progress(
"Waiting to attach to process");
3792 m_stats.SetLaunchOrAttachTime();
3796 state = process_sp->GetState();
3809 if (old_exec_module_sp)
3811 old_exec_module_sp->GetPlatformFileSpec().GetFilename());
3815 "no process specified, create a target with a file, or "
3816 "specify the --pid or --name");
3820 const auto platform_sp =
3823 const bool async = attach_info.
GetAsync();
3841 plugin_name,
nullptr,
false);
3844 "failed to create process using plugin '{0}'",
3845 plugin_name.empty() ?
"<empty>" : plugin_name);
3849 if (hijack_listener_sp)
3850 process_sp->HijackProcessEvents(hijack_listener_sp);
3851 error = process_sp->Attach(attach_info);
3854 if (
error.Success() && process_sp) {
3856 process_sp->RestoreProcessEvents();
3859 state = process_sp->WaitForProcessToStop(
3862 process_sp->RestoreProcessEvents();
3869 const char *exit_desc = process_sp->GetExitDescription();
3874 "process did not stop (no such process or permission problem?)");
3875 process_sp->Destroy(
false);
3885 return llvm::createStringError(
"invalid frame provider descriptor");
3887 llvm::StringRef name = descriptor.
GetName();
3889 return llvm::createStringError(
3890 "frame provider descriptor has no class name");
3893 std::unique_lock<std::recursive_mutex> guard(
3897 uint32_t descriptor_hash = descriptor.
GetHash();
3899 if (entry.second.GetHash() == descriptor_hash)
3901 llvm::formatv(
"frame provider idx={0} with the same class name and "
3902 "arguments is already registered",
3903 entry.second.GetID())
3909 new_descriptor.
SetID(descriptor_id);
3914 return descriptor_id;
3919 bool removed =
false;
3921 std::lock_guard<std::recursive_mutex> guard(
3933 std::lock_guard<std::recursive_mutex> guard(
3942const llvm::MapVector<uint32_t, ScriptedFrameProviderDescriptor> &
3944 std::lock_guard<std::recursive_mutex> guard(
3953 for (
ThreadSP thread_sp : process_sp->Threads()) {
3955 thread_sp->ClearScriptedFrameProvider();
3958 auto data_sp = std::make_shared<Thread::ThreadEventData>(thread_sp);
3970 const bool default_to_use_pty =
3974 "have platform={0}, platform_sp->IsHost()={1}, default_to_use_pty={2}",
3976 platform_sp ? (platform_sp->IsHost() ?
"true" :
"false") :
"n/a",
3977 default_to_use_pty);
3984 LLDB_LOG(log,
"at least one of stdin/stdout/stderr was not set, evaluating "
3985 "default handling");
3994 LLDB_LOG(log,
"eLaunchFlagDisableSTDIO set, adding suppression action "
3995 "for stdin, stdout and stderr");
4015 LLDB_LOG(log,
"target stdin='{0}', target stdout='{1}', stderr='{2}'",
4016 in_file_spec, out_file_spec, err_file_spec);
4020 LLDB_LOG(log,
"appended stdin open file action for {0}", in_file_spec);
4023 if (out_file_spec) {
4025 LLDB_LOG(log,
"appended stdout open file action for {0}",
4029 if (err_file_spec) {
4031 LLDB_LOG(log,
"appended stderr open file action for {0}",
4035 if (default_to_use_pty) {
4038 ::getenv(
"LLDB_LAUNCH_FLAG_USE_PIPES")) {
4039 llvm::Error Err = info.SetUpPipeRedirection();
4041 "SetUpPipeRedirection failed: {0}");
4046 "SetUpPtyRedirection failed: {0}");
4066 elem.notify = notify;
4076 = signals_sp->GetSignalNumberFromName(elem.first().str().c_str());
4081 signals_sp->SetShouldSuppress(signo,
false);
4083 signals_sp->SetShouldSuppress(signo,
true);
4086 signals_sp->SetShouldNotify(signo,
true);
4088 signals_sp->SetShouldNotify(signo,
false);
4091 signals_sp->SetShouldStop(signo,
true);
4093 signals_sp->SetShouldStop(signo,
false);
4102 = signals_sp->GetSignalNumberFromName(elem.first().str().c_str());
4108 signals_sp->ResetSignal(signo, do_stop, do_notify, do_pass);
4119 warning_stream_sp->Printf(
"Target signal '%s' not found in process\n",
4120 elem.first().str().c_str());
4133 signals_sp = process_sp->GetUnixSignals();
4136 const char *signal_name = entry.c_str();
4150 strm.
Printf(
"NAME PASS STOP NOTIFY\n");
4151 strm.
Printf(
"=========== ======= ======= =======\n");
4153 auto str_for_lazy = [] (
LazyBool lazy) ->
const char * {
4159 llvm_unreachable(
"Fully covered switch above!");
4163 bool print_it =
false;
4164 for (
size_t idx = 0; idx < num_args; idx++) {
4171 strm.
Printf(
"%-11s ", elem.first().str().c_str());
4172 strm.
Printf(
"%s %s %s\n", str_for_lazy(elem.second.pass),
4173 str_for_lazy(elem.second.stop),
4174 str_for_lazy(elem.second.notify));
4205 bool will_run =
true;
4229 s.
Indent(
"State: enabled\n");
4231 s.
Indent(
"State: disabled\n");
4234 s.
Indent(
"AutoContinue on\n");
4264 uint32_t num_commands =
m_commands.GetSize();
4265 for (uint32_t i = 0; i < num_commands; i++) {
4277 const std::vector<std::string> &strings) {
4278 for (
auto string : strings)
4285 assert(exc_ctx.
GetTargetPtr() &&
"Can't call PerformAction on a context "
4323 GetTarget()->GetDebugger().GetScriptInterpreter();
4324 if (!script_interp) {
4332 "ScriptedStopHook::%s () - ERROR: %s", __FUNCTION__,
4333 "Script interpreter couldn't create Scripted Stop Hook Interface");
4344 if (!object_sp || !object_sp->IsValid()) {
4346 "ScriptedStopHook::%s () - ERROR: %s", __FUNCTION__,
4347 "Failed to create valid script object");
4357 assert(exc_ctx.
GetTargetPtr() &&
"Can't call HandleStop on a context "
4363 lldb::StreamSP stream = std::make_shared<lldb_private::StreamString>();
4364 auto should_stop_or_err =
m_interface_sp->HandleStop(exc_ctx, stream);
4365 output_sp->PutCString(
4367 if (!should_stop_or_err) {
4369 "scripted stop hook HandleStop failed: {0}");
4391 s.
Format(
"{0}\n", class_name);
4400 if (!as_dict || !as_dict->IsValid())
4403 uint32_t num_keys = as_dict->GetSize();
4410 auto print_one_element = [&s](llvm::StringRef key,
4413 s.
Format(
"{0} : {1}\n", key, object->GetStringValue());
4417 as_dict->ForEach(print_one_element);
4449 bool will_run =
true;
4470 std::string fires_on;
4474 if (!fires_on.empty())
4476 fires_on +=
"unload";
4479 if (!fires_on.empty())
4483 if (!fires_on.empty()) {
4485 s.
Printf(
"Triggers: %s\n", fires_on.c_str());
4498 s.
Indent(
"AutoContinue on\n");
4534 s.
Indent(
"Commands: \n");
4536 for (uint32_t i = 0; i <
m_commands.GetSize(); i++) {
4553 const std::vector<std::string> &strings) {
4554 for (
const auto &
string : strings)
4569 Debugger &debugger = target_sp->GetDebugger();
4572 if (target_sp->GetProcessSP())
4573 exe_ctx.
SetContext(target_sp->GetProcessSP());
4600 assert(exc_ctx.
GetTargetPtr() &&
"Can't call HandleStop on a context "
4636 GetTarget()->GetDebugger().GetScriptInterpreter();
4643 "ScriptedHook::%s () - ERROR: %s", __FUNCTION__,
4644 "Script interpreter couldn't create Scripted Hook Interface");
4652 if (!object_sp || !object_sp->IsValid())
4654 "ScriptedHook::%s () - ERROR: %s", __FUNCTION__,
4655 "Failed to create valid script object");
4662 "hook class implements none of the expected methods "
4663 "(handle_module_loaded, handle_module_unloaded, handle_stop)");
4665 if (methods.handle_module_loaded)
4667 if (methods.handle_module_unloaded)
4669 if (methods.handle_stop)
4679 StreamSP stream = std::make_shared<StreamString>();
4688 StreamSP stream = std::make_shared<StreamString>();
4696 assert(exc_ctx.
GetTargetPtr() &&
"Can't call HandleStop on a context "
4702 lldb::StreamSP stream = std::make_shared<lldb_private::StreamString>();
4703 auto should_stop_or_err =
m_interface_sp->HandleStop(exc_ctx, stream);
4705 if (!should_stop_or_err)
4731 s.
Format(
"{0}\n", class_name);
4737 if (as_dict && as_dict->IsValid() && as_dict->GetSize() > 0) {
4741 auto print_one_element = [&s](llvm::StringRef key,
4744 s.
Format(
"{0} : {1}\n", key, object->GetStringValue());
4748 as_dict->ForEach(print_one_element);
4766 hook_sp.reset(
new HookScripted(shared_from_this(), new_uid));
4781 size_t num_removed =
m_hooks.erase(uid);
4782 return (num_removed != 0);
4788 auto iter =
m_hooks.find(uid);
4791 return iter->second;
4798 std::advance(iter, index);
4799 return iter->second;
4803 auto iter =
m_hooks.find(uid);
4806 iter->second->SetIsEnabled(enabled);
4811 for (
auto &[_, hook] :
m_hooks)
4812 hook->SetIsEnabled(enabled);
4823 std::vector<HookSP> active_hooks;
4824 for (
auto &[_, hook_sp] :
m_hooks) {
4825 if (hook_sp->IsEnabled() && hook_sp->FiresOn(trigger))
4826 active_hooks.push_back(hook_sp);
4829 if (active_hooks.empty())
4834 for (
auto &hook_sp : active_hooks) {
4836 hook_sp->HandleModuleLoaded(output_sp);
4838 hook_sp->HandleModuleUnloaded(output_sp);
4847 "no-dynamic-values",
4848 "Don't calculate the dynamic type of values",
4853 "Calculate the dynamic type of values "
4854 "even if you have to run the target.",
4859 "Calculate the dynamic type of values, but don't run the target.",
4871 "Never look for inline breakpoint locations (fastest). This setting "
4872 "should only be used if you know that no inlining occurs in your"
4878 "Only check for inline breakpoint locations when setting breakpoints "
4879 "in header files, but not when setting breakpoint in implementation "
4880 "source files (default).",
4885 "Always look for inline breakpoint locations when setting file and "
4886 "line breakpoints (slower but most accurate).",
4900 "Disassembler default (currently att).",
4905 "Intel disassembler flavor.",
4910 "AT&T disassembler flavor.",
4918 "Never import the 'std' C++ module in the expression parser.",
4923 "Retry evaluating expressions with an imported 'std' C++ module if they"
4924 " failed to parse without the module. This allows evaluating more "
4925 "complex expressions involving C++ standard library types."
4930 "Always import the 'std' C++ module. This allows evaluating more "
4931 "complex expressions involving C++ standard library types. This feature"
4936static constexpr OptionEnumValueElement
4941 "Automatically determine the most appropriate method for the "
4945 "Prefer using the realized classes struct."},
4947 "Prefer using the CopyRealizedClassList API."},
4949 "Prefer using the GetRealizedClassList API."},
4956 "C-style (0xffff).",
4961 "Asm-style (0ffffh).",
4969 "Load debug scripts inside symbol files",
4974 "Do not load debug scripts inside symbol files.",
4979 "Warn about debug scripts inside symbol files but do not load them.",
4984 "Load debug scripts inside trusted symbol files, and warn about "
4985 "scripts from untrusted symbol files.",
4993 "Load .lldbinit files from current directory",
4998 "Do not load .lldbinit files from current directory",
5003 "Warn about loading .lldbinit files from current directory",
5011 "Load minimal information when loading modules from memory. Currently "
5012 "this setting loads sections only.",
5017 "Load partial information when loading modules from memory. Currently "
5018 "this setting loads sections and function bounds.",
5023 "Load complete information when loading modules from memory. Currently "
5024 "this setting loads sections and all symbols.",
5028#define LLDB_PROPERTIES_target
5029#include "TargetProperties.inc"
5032#define LLDB_PROPERTIES_target
5033#include "TargetPropertiesEnum.inc"
5038 :
public Cloneable<TargetOptionValueProperties, OptionValueProperties> {
5049 Target *target = exe_ctx->GetTargetPtr();
5054 if (
this != target_properties)
5063#define LLDB_PROPERTIES_target_experimental
5064#include "TargetProperties.inc"
5067#define LLDB_PROPERTIES_target_experimental
5068#include "TargetPropertiesEnum.inc"
5072 :
public Cloneable<TargetExperimentalOptionValueProperties,
5073 OptionValueProperties> {
5110 m_collection_sp->SetValueChangedCallback(ePropertyDetachOnError, [
this] {
5123 std::make_unique<TargetExperimentalProperties>();
5126 "Experimental settings - setting these won't produce "
5127 "errors if the setting is not present.",
5130 m_collection_sp = std::make_shared<TargetOptionValueProperties>(
"target");
5133 std::make_unique<TargetExperimentalProperties>();
5136 "Experimental settings - setting these won't produce "
5137 "errors if the setting is not present.",
5140 "process",
"Settings specific to processes.",
true,
5167 exp_property->
GetValue()->GetAsProperties();
5170 return std::nullopt;
5183 exp_property->
GetValue()->GetAsProperties();
5195 exp_property->
GetValue()->GetAsProperties();
5201 const uint32_t idx = ePropertyDefaultArch;
5206 const uint32_t idx = ePropertyDefaultArch;
5211 const uint32_t idx = ePropertyMoveToNearestCode;
5213 idx, g_target_properties[idx].default_uint_value != 0);
5217 const uint32_t idx = ePropertyPreferDynamic;
5220 g_target_properties[idx].default_uint_value));
5224 const uint32_t idx = ePropertyPreferDynamic;
5230 "Interrupted checking preload symbols")) {
5233 const uint32_t idx = ePropertyPreloadSymbols;
5235 idx, g_target_properties[idx].default_uint_value != 0);
5239 const uint32_t idx = ePropertyPreloadSymbols;
5244 const uint32_t idx = ePropertyDisableASLR;
5246 idx, g_target_properties[idx].default_uint_value != 0);
5250 const uint32_t idx = ePropertyDisableASLR;
5255 const uint32_t idx = ePropertyInheritTCC;
5257 idx, g_target_properties[idx].default_uint_value != 0);
5261 const uint32_t idx = ePropertyInheritTCC;
5266 const uint32_t idx = ePropertyDetachOnError;
5268 idx, g_target_properties[idx].default_uint_value != 0);
5272 const uint32_t idx = ePropertyDetachOnError;
5277 const uint32_t idx = ePropertyDisableSTDIO;
5279 idx, g_target_properties[idx].default_uint_value != 0);
5283 const uint32_t idx = ePropertyDisableSTDIO;
5287 const uint32_t idx = ePropertyLaunchWorkingDir;
5289 idx, g_target_properties[idx].default_cstr_value);
5293 const uint32_t idx = ePropertyParallelModuleLoad;
5295 idx, g_target_properties[idx].default_uint_value != 0);
5299 const uint32_t idx = ePropertyDisassemblyFlavor;
5300 const char *return_value;
5305 g_target_properties[idx].default_uint_value));
5308 return return_value;
5312 const uint32_t idx = ePropertyDisassemblyCPU;
5314 idx, g_target_properties[idx].default_cstr_value);
5315 return str.empty() ? nullptr : str.data();
5319 const uint32_t idx = ePropertyDisassemblyFeatures;
5321 idx, g_target_properties[idx].default_cstr_value);
5322 return str.empty() ? nullptr : str.data();
5326 const uint32_t idx = ePropertyInlineStrategy;
5329 static_cast<InlineStrategy>(g_target_properties[idx].default_uint_value));
5335 const uint32_t idx = ePropertySourceRealpathPrefixes;
5340 const uint32_t idx = ePropertyArg0;
5342 idx, g_target_properties[idx].default_cstr_value);
5346 const uint32_t idx = ePropertyArg0;
5352 const uint32_t idx = ePropertyRunArgs;
5357 const uint32_t idx = ePropertyRunArgs;
5367 ePropertyInheritEnv,
5368 g_target_properties[ePropertyInheritEnv].default_uint_value != 0)) {
5369 if (
auto platform_sp =
m_target->GetPlatform()) {
5370 Environment platform_env = platform_sp->GetEnvironment();
5371 for (
const auto &KV : platform_env)
5372 env[KV.first()] = KV.second;
5376 Args property_unset_env;
5378 property_unset_env);
5379 for (
const auto &var : property_unset_env)
5380 env.erase(var.ref());
5383 m_collection_sp->GetPropertyAtIndexAsArgs(ePropertyEnvVars, property_env);
5385 env[KV.first()] = KV.second;
5401 ePropertyInheritEnv,
5402 g_target_properties[ePropertyInheritEnv].default_uint_value != 0))
5406 if (platform_sp ==
nullptr)
5409 Environment platform_environment = platform_sp->GetEnvironment();
5410 for (
const auto &KV : platform_environment)
5411 environment[KV.first()] = KV.second;
5413 Args property_unset_environment;
5415 property_unset_environment);
5416 for (
const auto &var : property_unset_environment)
5417 environment.erase(var.ref());
5423 Args property_environment;
5425 property_environment);
5427 for (
const auto &KV :
Environment(property_environment))
5428 environment[KV.first()] = KV.second;
5435 const uint32_t idx = ePropertyEnvVars;
5440 const uint32_t idx = ePropertySkipPrologue;
5442 idx, g_target_properties[idx].default_uint_value != 0);
5446 const uint32_t idx = ePropertySourceMap;
5449 assert(option_value);
5454 const uint32_t idx = ePropertyObjectMap;
5457 assert(option_value);
5462 const uint32_t idx = ePropertyAutoSourceMapRelative;
5464 idx, g_target_properties[idx].default_uint_value != 0);
5468 const uint32_t idx = ePropertyExecutableSearchPaths;
5471 assert(option_value);
5476 const uint32_t idx = ePropertyExecutableSearchPaths;
5481 const uint32_t idx = ePropertyDebugFileSearchPaths;
5486 const uint32_t idx = ePropertyClangModuleSearchPaths;
5491 const uint32_t idx = ePropertyAutoImportClangModules;
5493 idx, g_target_properties[idx].default_uint_value != 0);
5497 const uint32_t idx = ePropertyImportStdModule;
5500 g_target_properties[idx].default_uint_value));
5504 const uint32_t idx = ePropertyDynamicClassInfoHelper;
5507 g_target_properties[idx].default_uint_value));
5511 const uint32_t idx = ePropertyAutoApplyFixIts;
5513 idx, g_target_properties[idx].default_uint_value != 0);
5517 const uint32_t idx = ePropertyRetriesWithFixIts;
5519 idx, g_target_properties[idx].default_uint_value);
5523 const uint32_t idx = ePropertyNotifyAboutFixIts;
5525 idx, g_target_properties[idx].default_uint_value != 0);
5529 const uint32_t idx = ePropertySaveObjectsDir;
5539 bool exists = instance.
Exists(new_dir);
5540 bool is_directory = instance.
IsDirectory(new_dir);
5541 std::string path = new_dir.
GetPath(
true);
5542 bool writable = llvm::sys::fs::can_write(path);
5543 if (exists && is_directory && writable)
5551 llvm::raw_string_ostream os(buffer);
5552 os <<
"JIT object dir '" << path <<
"' ";
5554 os <<
"does not exist";
5555 else if (!is_directory)
5556 os <<
"is not a directory";
5558 os <<
"is not writable";
5560 std::optional<lldb::user_id_t> debugger_id;
5562 debugger_id =
m_target->GetDebugger().GetID();
5567 const uint32_t idx = ePropertyEnableSynthetic;
5569 idx, g_target_properties[idx].default_uint_value != 0);
5573 const uint32_t idx = ePropertyShowHexVariableValuesWithLeadingZeroes;
5575 idx, g_target_properties[idx].default_uint_value != 0);
5579 const uint32_t idx = ePropertyMaxZeroPaddingInFloatFormat;
5581 idx, g_target_properties[idx].default_uint_value);
5585 const uint32_t idx = ePropertyMaxChildrenCount;
5587 idx, g_target_properties[idx].default_uint_value);
5590std::pair<uint32_t, bool>
5592 const uint32_t idx = ePropertyMaxChildrenDepth;
5593 auto *option_value =
5595 bool is_default = !option_value->OptionWasSet();
5596 return {option_value->GetCurrentValue(), is_default};
5600 const uint32_t idx = ePropertyMaxSummaryLength;
5602 idx, g_target_properties[idx].default_uint_value);
5606 const uint32_t idx = ePropertyMaxMemReadSize;
5608 idx, g_target_properties[idx].default_uint_value);
5612 const uint32_t idx = ePropertyInputPath;
5617 const uint32_t idx = ePropertyInputPath;
5622 const uint32_t idx = ePropertyOutputPath;
5627 const uint32_t idx = ePropertyOutputPath;
5632 const uint32_t idx = ePropertyErrorPath;
5637 const uint32_t idx = ePropertyErrorPath;
5642 const uint32_t idx = ePropertyLanguage;
5647 const uint32_t idx = ePropertyExprPrefix;
5653 return llvm::StringRef(
5654 reinterpret_cast<const char *
>(data_sp->GetBytes()),
5655 data_sp->GetByteSize());
5661 const uint32_t idx = ePropertyExprErrorLimit;
5663 idx, g_target_properties[idx].default_uint_value);
5667 const uint32_t idx = ePropertyExprAllocAddress;
5669 idx, g_target_properties[idx].default_uint_value);
5673 const uint32_t idx = ePropertyExprAllocSize;
5675 idx, g_target_properties[idx].default_uint_value);
5679 const uint32_t idx = ePropertyExprAllocAlign;
5681 idx, g_target_properties[idx].default_uint_value);
5685 const uint32_t idx = ePropertyBreakpointUseAvoidList;
5687 idx, g_target_properties[idx].default_uint_value != 0);
5691 const uint32_t idx = ePropertyUseHexImmediates;
5693 idx, g_target_properties[idx].default_uint_value != 0);
5697 const uint32_t idx = ePropertyUseFastStepping;
5699 idx, g_target_properties[idx].default_uint_value != 0);
5703 const uint32_t idx = ePropertyDisplayExpressionsInCrashlogs;
5705 idx, g_target_properties[idx].default_uint_value != 0);
5709 const uint32_t idx = ePropertyLoadScriptFromSymbolFile;
5712 g_target_properties[idx].default_uint_value));
5717 const uint32_t idx = ePropertyLoadScriptFromSymbolFile;
5722 const uint32_t idx = ePropertyLoadCWDlldbinitFile;
5725 g_target_properties[idx].default_uint_value));
5729 const uint32_t idx = ePropertyHexImmediateStyle;
5732 g_target_properties[idx].default_uint_value));
5736 const uint32_t idx = ePropertyMemoryModuleLoadLevel;
5739 g_target_properties[idx].default_uint_value));
5743 const uint32_t idx = ePropertyTrapHandlerNames;
5748 const uint32_t idx = ePropertyTrapHandlerNames;
5753 const uint32_t idx = ePropertyDisplayRuntimeSupportValues;
5755 idx, g_target_properties[idx].default_uint_value != 0);
5759 const uint32_t idx = ePropertyDisplayRuntimeSupportValues;
5764 const uint32_t idx = ePropertyDisplayRecognizedArguments;
5766 idx, g_target_properties[idx].default_uint_value != 0);
5770 const uint32_t idx = ePropertyDisplayRecognizedArguments;
5786 if (input_file_action) {
5791 if (output_file_action) {
5796 if (error_file_action) {
5802 launch_info.
GetFlags().
Test(lldb::eLaunchFlagInheritTCCFromParent));
5807 const uint32_t idx = ePropertyRequireHardwareBreakpoints;
5809 idx, g_target_properties[idx].default_uint_value != 0);
5813 const uint32_t idx = ePropertyRequireHardwareBreakpoints;
5818 const uint32_t idx = ePropertyAutoInstallMainExecutable;
5820 idx, g_target_properties[idx].default_uint_value != 0);
5854 m_launch_info.GetFlags().Set(lldb::eLaunchFlagDetachOnError);
5856 m_launch_info.GetFlags().Clear(lldb::eLaunchFlagDetachOnError);
5863 m_launch_info.GetFlags().Clear(lldb::eLaunchFlagDisableASLR);
5868 m_launch_info.GetFlags().Set(lldb::eLaunchFlagInheritTCCFromParent);
5870 m_launch_info.GetFlags().Clear(lldb::eLaunchFlagInheritTCCFromParent);
5875 m_launch_info.GetFlags().Set(lldb::eLaunchFlagDisableSTDIO);
5877 m_launch_info.GetFlags().Clear(lldb::eLaunchFlagDisableSTDIO);
5881 const uint32_t idx = ePropertyDebugUtilityExpression;
5883 idx, g_target_properties[idx].default_uint_value != 0);
5887 const uint32_t idx = ePropertyDebugUtilityExpression;
5892 const uint32_t idx = ePropertyCheckValueObjectOwnership;
5894 idx, g_target_properties[idx].default_uint_value != 0);
5898 const uint32_t idx = ePropertyCheckValueObjectOwnership;
5902std::optional<LoadScriptFromSymFile>
5904 llvm::StringRef module_name)
const {
5905 auto *dict =
m_collection_sp->GetPropertyAtIndexAsOptionValueDictionary(
5906 ePropertyAutoLoadScriptsForModules);
5908 return std::nullopt;
5912 return std::nullopt;
5919 auto *dict =
m_collection_sp->GetPropertyAtIndexAsOptionValueDictionary(
5920 ePropertyAutoLoadScriptsForModules);
5924 dict->SetValueForKey(module_name,
5925 std::make_shared<OptionValueEnumeration>(
5946 return "Target::TargetEventData";
5983 return created_target_sp;
6006 return m_stats.ToJSON(*
this, options);
6024 lldb::BreakpointEventType eventKind) {
6026 std::shared_ptr<Breakpoint::BreakpointEventData> data_sp =
6027 std::make_shared<Breakpoint::BreakpointEventData>(
6028 eventKind, bp.shared_from_this());
6044 if (
auto platform_fspecs_or_err =
6046 fspecs.
Append(*platform_fspecs_or_err);
6049 platform_fspecs_or_err.takeError(),
6050 "Skipping safe auto-load: {0}");
6055 for (
const auto &fspec :
6070 if (option_name.empty())
6071 return llvm::createStringError(
"can't set an option with an empty name");
6076 return llvm::createStringErrorV(
"trying to override existing option '{0}' "
6077 "of type '{1}' with a boolean value",
6078 option_name, existing_sp->GetType());
6082 return llvm::Error::success();
6086 llvm::StringRef option_name)
const {
6089 if (!opts.
HasKey(option_name))
6090 return llvm::createStringErrorV(
"option '{0}' does not exist", option_name);
6094 return llvm::createStringErrorV(
"failed to get option '{0}' as boolean",
6116 "c++-ignore-context-qualifiers";
6129 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_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 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.
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.
void SetTryAllThreads(bool try_others=true)
void SetStopOthers(bool stop_others=true)
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(const char *name)
A collection class for Module objects.
bool AnyOf(std::function< bool(lldb_private::Module &module)> const &callback) const
Returns true if 'callback' returns true for one of the modules in this ModuleList.
static Status GetSharedModule(const ModuleSpec &module_spec, lldb::ModuleSP &module_sp, llvm::SmallVectorImpl< lldb::ModuleSP > *old_modules, bool *did_create_ptr, bool invoke_locate_callback=true)
static 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(ConstString path, ConstString &new_path) const
std::optional< llvm::StringRef > ReverseRemapPath(const FileSpec &file, FileSpec &fixed) const
Perform reverse source path remap for input file.
static std::unique_ptr< Architecture > CreateArchitectureInstance(const ArchSpec &arch)
static lldb::RegisterTypeBuilderSP GetRegisterTypeBuilder(Target &target)
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)
static void SettingsInitialize()
static constexpr llvm::StringRef AttachSynchronousHijackListenerName
static lldb::ProcessSP FindPlugin(lldb::TargetSP target_sp, llvm::StringRef plugin_name, lldb::ListenerSP listener_sp, const FileSpec *crash_file_path, bool can_connect)
Find a Process plug-in that can debug module using the currently selected architecture.
static constexpr llvm::StringRef LaunchSynchronousHijackListenerName
static ProcessProperties & GetGlobalProperties()
static void SettingsTerminate()
A Progress indicator helper class.
lldb::OptionValuePropertiesSP m_collection_sp
T GetPropertyAtIndexAs(uint32_t idx, T default_value, const ExecutionContext *exe_ctx=nullptr) const
static llvm::StringRef GetExperimentalSettingsName()
bool SetPropertyAtIndex(uint32_t idx, T t, const ExecutionContext *exe_ctx=nullptr) const
lldb::OptionValuePropertiesSP GetValueProperties() const
const lldb::OptionValueSP & GetValue() const
static lldb::REPLSP Create(Status &Status, lldb::LanguageType language, Debugger *debugger, Target *target, const char *repl_options)
Get a REPL with an existing target (or, failing that, a debugger to use), and (optional) extra argume...
bool SignExtend(uint32_t bit_pos)
unsigned long long ULongLong(unsigned long long fail_value=0) const
long long SLongLong(long long fail_value=0) const
virtual lldb::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
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)
std::optional< bool > GetExperimentalPropertyValue(size_t prop_idx, ExecutionContext *exe_ctx=nullptr) const
bool GetDisableASLR() const
bool GetUseFastStepping() const
const ProcessLaunchInfo & GetProcessLaunchInfo() const
Environment ComputeEnvironment() const
void Arg0ValueChangedCallback()
bool GetUserSpecifiedTrapHandlerNames(Args &args) const
uint64_t GetExprErrorLimit() const
bool GetEnableAutoImportClangModules() const
bool GetDebugUtilityExpression() const
void CheckJITObjectsDir()
bool GetSkipPrologue() const
DynamicClassInfoHelper GetDynamicClassInfoHelper() const
FileSpec GetStandardOutputPath() const
void InputPathValueChangedCallback()
void SetDisplayRuntimeSupportValues(bool b)
uint32_t GetMaximumNumberOfChildrenToDisplay() const
void SetRequireHardwareBreakpoints(bool b)
void SetDisableSTDIO(bool b)
bool GetAutoInstallMainExecutable() const
const char * GetDisassemblyFeatures() const
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
void SetUseDIL(ExecutionContext *exe_ctx, bool b)
std::unique_ptr< TargetExperimentalProperties > m_experimental_properties_up
FileSpecList GetClangModuleSearchPaths()
void SetStandardOutputPath(llvm::StringRef path)
void ErrorPathValueChangedCallback()
bool GetRequireHardwareBreakpoints() const
PathMappingList & GetSourcePathMap() const
bool GetAutoSourceMapRelative() const
bool GetUseDIL(ExecutionContext *exe_ctx) const
void SetDefaultArchitecture(const ArchSpec &arch)
void SetStandardInputPath(llvm::StringRef path)
TargetProperties(Target *target)
bool GetDisplayExpressionsInCrashlogs() const
void DisableASLRValueChangedCallback()
bool GetEnableAutoApplyFixIts() const
void SetDebugUtilityExpression(bool debug)
std::pair< uint32_t, bool > GetMaximumDepthOfChildrenToDisplay() const
Get the max depth value, augmented with a bool to indicate whether the depth is the default.
bool GetDetachOnError() const
std::unique_ptr< Architecture > m_plugin_up
const Arch & operator=(const ArchSpec &spec)
Arch(const ArchSpec &spec)
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...
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)
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
lldb::TraceSP GetTrace()
Get the Trace object containing processor trace information of this target.
PathMappingList & GetImageSearchPathList()
void FinalizeFileActions(ProcessLaunchInfo &info)
lldb::addr_t GetCallableLoadAddress(lldb::addr_t load_addr, AddressClass addr_class=AddressClass::eInvalid) const
Get load_addr as a callable code load address for this target.
lldb::addr_t GetOpcodeLoadAddress(lldb::addr_t load_addr, AddressClass addr_class=AddressClass::eInvalid) const
Get load_addr as an opcode for this target.
lldb::BreakpointSP CreateScriptedBreakpoint(const llvm::StringRef class_name, const FileSpecList *containingModules, const FileSpecList *containingSourceFiles, bool internal, bool request_hardware, StructuredData::ObjectSP extra_args_sp, Status *creation_error=nullptr)
static Target * GetTargetFromContexts(const ExecutionContext *exe_ctx_ptr, const SymbolContext *sc_ptr)
lldb::addr_t GetBreakableLoadAddress(lldb::addr_t addr)
void ClearDummySignals(Args &signal_names)
Clear the dummy signals in signal_names from the target, or all signals if signal_names is empty.
static void ImageSearchPathsChanged(const PathMappingList &path_list, void *baton)
llvm::Expected< lldb_private::Address > GetEntryPointAddress()
This method will return the address of the starting function for this binary, e.g.
bool IgnoreWatchpointByID(lldb::watch_id_t watch_id, uint32_t ignore_count)
lldb::BreakpointSP CreateFuncRegexBreakpoint(const FileSpecList *containingModules, const FileSpecList *containingSourceFiles, RegularExpression func_regexp, lldb::LanguageType requested_language, LazyBool skip_prologue, bool internal, bool request_hardware)
lldb::BreakpointSP GetBreakpointByID(lldb::break_id_t break_id)
std::shared_ptr< StopHook > StopHookSP
void SymbolsDidLoad(ModuleList &module_list)
bool ClearAllWatchpointHistoricValues()
const std::vector< StopHookSP > GetStopHooks(bool internal=false) const
void SetTrace(const lldb::TraceSP &trace_sp)
Set the Trace object containing processor trace information of this target.
BreakpointList & GetBreakpointList(bool internal=false)
uint32_t m_next_frame_provider_id
CompilerType GetRegisterType(const std::string &name, const lldb_private::RegisterFlags &flags, uint32_t byte_size)
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.
bool m_is_dummy_target
Used to not run stop hooks for expressions.
static bool UpdateSignalFromDummy(lldb::UnixSignalsSP signals_sp, const DummySignalElement &element)
PathMappingList m_image_search_paths
bool ModuleIsExcludedForUnconstrainedSearches(const FileSpec &module_spec)
Return whether this FileSpec corresponds to a module that should be considered for general searches.
lldb::StackFrameSP CalculateStackFrame() override
SectionLoadList & GetSectionLoadList()
lldb::addr_t GetPersistentSymbol(ConstString name)
void PrimeFromDummyTarget(Target &target)
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()
size_t ReadMemoryFromFileCache(const Address &addr, void *dst, size_t dst_len, Status &error)
void ClearAllLoadedSections()
std::vector< lldb::TypeSystemSP > GetScratchTypeSystems(bool create_on_demand=true)
size_t ReadScalarIntegerFromMemory(const Address &addr, uint32_t byte_size, bool is_signed, Scalar &scalar, Status &error, bool force_live_memory=false)
void AddNameToBreakpoint(BreakpointID &id, llvm::StringRef name, Status &error)
void DumpSectionLoadList(Stream &s)
void DeleteCurrentProcess()
BreakpointList m_internal_breakpoint_list
int64_t ReadSignedIntegerFromMemory(const Address &addr, size_t integer_byte_size, int64_t fail_value, Status &error, bool force_live_memory=false)
void DisableAllowedBreakpoints()
bool 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.
lldb::ModuleSP GetOrCreateModule(const ModuleSpec &module_spec, bool notify, Status *error_ptr=nullptr)
Find a binary on the system and return its Module, or return an existing Module that is already in th...
static bool ResetSignalFromDummy(lldb::UnixSignalsSP signals_sp, const DummySignalElement &element)
Architecture * GetArchitecturePlugin() const
llvm::json::Value ReportStatistics(const lldb_private::StatisticsOptions &options)
Get metrics associated with this target in JSON format.
FunctionCaller * GetFunctionCallerForLanguage(lldb::LanguageType language, const CompilerType &return_type, const Address &function_address, const ValueList &arg_value_list, const char *name, Status &error)
void EnableAllBreakpoints(bool internal_also=false)
Status Launch(ProcessLaunchInfo &launch_info, Stream *stream)
bool DisableBreakpointByID(lldb::break_id_t break_id)
lldb::BreakpointSP CreateBreakpointAtUserEntry(Status &error)
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)
void UndoCreateStopHook(lldb::user_id_t uid)
If you tried to create a stop hook, and that failed, call this to remove the stop hook,...
WatchpointList m_watchpoint_list
BreakpointList m_breakpoint_list
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
SummaryStatisticsCache m_summary_statistics_cache
Status SerializeBreakpointsToFile(const FileSpec &file, const BreakpointIDList &bp_ids, bool append)
void DidExec()
Called as the last function in Process::DidExec().
void SaveScriptedLaunchInfo(lldb_private::ProcessInfo &process_info)
lldb::user_id_t m_stop_hook_next_id
void RemoveAllStopHooks()
static FileSpecList GetDefaultExecutableSearchPaths()
lldb::BreakpointSP CreateExceptionBreakpoint(enum lldb::LanguageType language, bool catch_bp, bool throw_bp, bool internal, Args *additional_args=nullptr, Status *additional_args_error=nullptr)
void NotifyBreakpointChanged(Breakpoint &bp, lldb::BreakpointEventType event_kind)
Sends a breakpoint notification event.
lldb::SearchFilterSP GetSearchFilterForModule(const FileSpec *containingModule)
llvm::StringMapEntry< DummySignalValues > DummySignalElement
std::recursive_mutex & GetAPIMutex()
static llvm::StringRef GetStaticBroadcasterClass()
static FileSpecList GetDefaultDebugFileSearchPaths()
void EnableAllowedBreakpoints()
virtual size_t ReadMemory(const Address &addr, void *dst, size_t dst_len, Status &error, bool force_live_memory=false, lldb::addr_t *load_addr_ptr=nullptr, bool *did_read_live_memory=nullptr)
llvm::Error SetLabel(llvm::StringRef label)
Set a label for a target.
uint32_t m_latest_stop_hook_id
void 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.
lldb::WatchpointSP m_last_created_watchpoint
Status CreateBreakpointsFromFile(const FileSpec &file, BreakpointIDList &new_bps)
void SetREPL(lldb::LanguageType language, lldb::REPLSP repl_sp)
void SetExecutableModule(lldb::ModuleSP &module_sp, LoadDependentFiles load_dependent_files=eLoadDependentsDefault)
Set the main executable module.
lldb::StackFrameRecognizerManagerUP m_frame_recognizer_manager_up
Stores the frame recognizers of this target.
lldb::REPLSP GetREPL(Status &err, lldb::LanguageType language, const char *repl_options, bool can_create)
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.
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
std::shared_ptr< lldb_private::Trace > TraceSP
std::shared_ptr< lldb_private::TypeSystem > TypeSystemSP
std::shared_ptr< lldb_private::ABI > ABISP
std::shared_ptr< lldb_private::StackFrame > StackFrameSP
std::shared_ptr< lldb_private::SearchFilter > SearchFilterSP
std::shared_ptr< lldb_private::BreakpointResolver > BreakpointResolverSP
DescriptionLevel
Description levels for "void GetDescription(Stream *, DescriptionLevel)" calls.
@ eDescriptionLevelVerbose
std::shared_ptr< lldb_private::Thread > ThreadSP
std::shared_ptr< lldb_private::ValueObject > ValueObjectSP
std::shared_ptr< lldb_private::ExpressionVariable > ExpressionVariableSP
std::shared_ptr< lldb_private::UnixSignals > UnixSignalsSP
std::shared_ptr< lldb_private::Platform > PlatformSP
StateType
Process and Thread States.
@ eStateConnected
Process is connected to remote debug services, but not launched or attached to anything yet.
@ eStateStopped
Process or thread is stopped and can be examined.
@ eStateAttaching
Process is currently trying to attach.
@ eStateExited
Process has exited and can't be examined.
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.
Describes what view of the process a thread should see and what operations it is allowed to perform.
@ Private
Parent (unwinder) frames, private state, private run lock.
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)