68#include "llvm/ADT/ScopeExit.h"
69#include "llvm/ADT/SetVector.h"
83 m_plugin_up(
PluginManager::CreateArchitectureInstance(spec)) {}
92 static constexpr llvm::StringLiteral class_name(
"lldb.target");
120 static_cast<void *
>(
this));
123 "Target::Target created with architecture {0} ({1})",
125 target_arch.
GetTriple().getTriple().c_str());
133 LLDB_LOG(log,
"{0} Target::~Target()",
static_cast<void *
>(
this));
141 if (breakpoint_sp->IsInternal())
186 std::unique_lock<std::recursive_mutex> lock;
211 llvm::StringRef plugin_name,
218 listener_sp, crash_file, can_connect);
225 const char *repl_options,
bool can_create) {
233 language = *single_lang;
234 }
else if (repl_languages.
Empty()) {
236 "LLDB isn't configured with REPL support for any languages.");
240 "Multiple possible REPL languages. Please specify a language.");
245 REPLMap::iterator pos =
m_repl_map.find(language);
253 "Couldn't find an existing REPL for %s, and can't create a new one",
281 std::lock_guard<std::recursive_mutex> guard(
m_mutex);
288 const bool notify =
false;
311 return abi_sp->GetPluginName();
342 ModuleSP main_module_sp = GetExecutableModule();
344 shared_lib_filter.
Append(main_module_sp->GetFileSpec());
345 llvm::SetVector<std::string, std::vector<std::string>,
346 std::unordered_set<std::string>>
351 error.SetErrorString(
"Language not found\n");
355 if (!entryPointName.empty())
356 entryPointNamesSet.insert(entryPointName);
358 if (entryPointNamesSet.empty()) {
359 error.SetErrorString(
"No entry point name found\n");
364 nullptr, entryPointNamesSet.takeVector(),
365 eFunctionNameTypeFull,
372 error.SetErrorString(
"Breakpoint creation failed.\n");
375 bp_sp->SetOneShot(
true);
382 const std::unordered_set<std::string> &function_names,
386 containingModules, source_file_spec_list));
390 nullptr, std::move(source_regex), function_names,
391 !
static_cast<bool>(move_to_nearest_code)));
397 const FileSpec &file, uint32_t line_no,
400 LazyBool skip_prologue,
bool internal,
404 std::optional<llvm::StringRef> removed_prefix_opt =
406 if (!removed_prefix_opt)
407 remapped_file = file;
411 switch (inline_strategy) {
432 compile_unit_list.
Append(remapped_file);
445 !
static_cast<bool>(move_to_nearest_code));
450 nullptr, offset, skip_prologue, location_spec, removed_prefix_opt));
486 bool request_hardware) {
490 nullptr, file_addr, file_spec));
497 const FileSpecList *containingSourceFiles,
const char *func_name,
498 FunctionNameType func_name_type_mask,
LanguageType language,
503 containingModules, containingSourceFiles));
512 offset, skip_prologue));
521 const std::vector<std::string> &func_names,
522 FunctionNameType func_name_type_mask,
524 LazyBool skip_prologue,
bool internal,
bool hardware) {
526 size_t num_names = func_names.size();
529 containingModules, containingSourceFiles));
538 language, offset, skip_prologue));
547 const char *func_names[],
size_t num_names,
548 FunctionNameType func_name_type_mask,
550 LazyBool skip_prologue,
bool internal,
bool hardware) {
554 containingModules, containingSourceFiles));
566 nullptr, func_names, num_names, func_name_type_mask, language, offset,
568 resolver_sp->SetOffset(offset);
577 if (containingModule !=
nullptr) {
580 filter_sp = std::make_shared<SearchFilterByModule>(shared_from_this(),
585 std::make_shared<SearchFilterForUnconstrainedSearches>(
595 if (containingModules && containingModules->
GetSize() != 0) {
598 filter_sp = std::make_shared<SearchFilterByModuleList>(shared_from_this(),
603 std::make_shared<SearchFilterForUnconstrainedSearches>(
613 if (containingSourceFiles ==
nullptr || containingSourceFiles->
GetSize() == 0)
617 if (containingModules ==
nullptr) {
621 filter_sp = std::make_shared<SearchFilterByModuleListAndCU>(
622 shared_from_this(),
FileSpecList(), *containingSourceFiles);
624 filter_sp = std::make_shared<SearchFilterByModuleListAndCU>(
625 shared_from_this(), *containingModules, *containingSourceFiles);
634 bool internal,
bool hardware) {
636 containingModules, containingSourceFiles));
639 :
static_cast<bool>(skip_prologue);
641 nullptr, std::move(func_regex), requested_language, 0, skip));
648 bool catch_bp,
bool throw_bp,
bool internal,
651 *
this, language, catch_bp, throw_bp, internal);
652 if (exc_bkpt_sp && additional_args) {
654 if (precondition_sp && additional_args) {
656 *
error = precondition_sp->ConfigurePrecondition(*additional_args);
658 precondition_sp->ConfigurePrecondition(*additional_args);
665 const llvm::StringRef class_name,
const FileSpecList *containingModules,
666 const FileSpecList *containingSourceFiles,
bool internal,
673 containingSourceFiles && containingSourceFiles->
GetSize() > 0;
674 bool has_modules = containingModules && containingModules->
GetSize() > 0;
676 if (has_files && has_modules) {
678 containingSourceFiles);
679 }
else if (has_files) {
682 }
else if (has_modules) {
685 filter_sp = std::make_shared<SearchFilterForUnconstrainedSearches>(
696 bool internal,
bool request_hardware,
697 bool resolve_indirect_symbols) {
699 if (filter_sp && resolver_sp) {
701 bp_sp.reset(
new Breakpoint(*
this, filter_sp, resolver_sp, hardware,
702 resolve_indirect_symbols));
703 resolver_sp->SetBreakpoint(bp_sp);
721 LLDB_LOGF(log,
"Target::%s (internal = %s) => break_id = %s\n",
722 __FUNCTION__, bp_sp->IsInternal() ?
"yes" :
"no", s.
GetData());
725 bp_sp->ResolveBreakpoint();
739 error.SetErrorStringWithFormat(
"Could not find breakpoint %s", s.
GetData());
755 bp_sp->AddName(name);
760 std::make_pair(bp_name->GetName(), std::move(bp_name)));
766 if (!
error.Success())
771 return iter->second.get();
775 error.SetErrorStringWithFormat(
"Breakpoint name \"%s\" doesn't exist and "
776 "can_create is false.",
782 .insert(std::make_pair(name, std::make_unique<BreakpointName>(name)))
783 .first->second.get();
790 const char *name_cstr = name.
AsCString();
793 bp_sp->RemoveName(name_cstr);
811 llvm::Expected<std::vector<BreakpointSP>> expected_vector =
814 if (!expected_vector) {
816 llvm::toString(expected_vector.takeError()));
820 for (
auto bp_sp : *expected_vector)
827 names.push_back(bp_name_entry.first.AsCString());
837 std::optional<uint32_t> num_supported_hardware_watchpoints =
842 if (!num_supported_hardware_watchpoints)
845 if (*num_supported_hardware_watchpoints == 0) {
846 error.SetErrorStringWithFormat(
847 "Target supports (%u) hardware watchpoint slots.\n",
848 *num_supported_hardware_watchpoints);
861 "Target::%s (addr = 0x%8.8" PRIx64
" size = %" PRIu64
863 __FUNCTION__, addr, (uint64_t)size, kind);
867 error.SetErrorString(
"process is not alive");
873 error.SetErrorString(
"cannot set a watchpoint with watch_size of 0");
875 error.SetErrorStringWithFormat(
"invalid watch address: %" PRIu64, addr);
880 error.SetErrorStringWithFormat(
"invalid watchpoint type: %d", kind);
890 const bool notify =
false;
895 addr = abi->FixDataAddress(addr);
909 std::unique_lock<std::recursive_mutex> lock;
913 size_t old_size = matched_sp->GetByteSize();
919 if (size == old_size && kind == old_type) {
921 wp_sp->SetEnabled(
false, notify);
930 wp_sp = std::make_shared<Watchpoint>(*
this, addr, size, type);
931 wp_sp->SetWatchpointType(kind, notify);
936 LLDB_LOGF(log,
"Target::%s (creation of watchpoint %s with id = %u)\n",
937 __FUNCTION__,
error.Success() ?
"succeeded" :
"failed",
952 LLDB_LOGF(log,
"Target::%s \n", __FUNCTION__);
961 LLDB_LOGF(log,
"Target::%s (internal_also = %s)\n", __FUNCTION__,
962 internal_also ?
"yes" :
"no");
973 LLDB_LOGF(log,
"Target::%s (internal_also = %s)\n", __FUNCTION__,
974 internal_also ?
"yes" :
"no");
983 LLDB_LOGF(log,
"Target::%s", __FUNCTION__);
990 LLDB_LOGF(log,
"Target::%s (internal_also = %s)\n", __FUNCTION__,
991 internal_also ?
"yes" :
"no");
1000 LLDB_LOGF(log,
"Target::%s", __FUNCTION__);
1007 LLDB_LOGF(log,
"Target::%s (break_id = %i, internal = %s)\n", __FUNCTION__,
1027 LLDB_LOGF(log,
"Target::%s (break_id = %i, internal = %s)\n", __FUNCTION__,
1037 bp_sp->SetEnabled(
false);
1045 LLDB_LOGF(log,
"Target::%s (break_id = %i, internal = %s)\n", __FUNCTION__,
1056 bp_sp->SetEnabled(
true);
1072 error.SetErrorString(
"Invalid FileSpec.");
1076 std::string path(file.
GetPath());
1084 if (
error.Success()) {
1085 break_store_ptr = input_data_sp->
GetAsArray();
1086 if (!break_store_ptr) {
1087 error.SetErrorStringWithFormat(
1088 "Tried to append to invalid input file %s", path.c_str());
1094 if (!break_store_ptr) {
1095 break_store_sp = std::make_shared<StructuredData::Array>();
1096 break_store_ptr = break_store_sp.get();
1103 lldb::eFilePermissionsFileDefault);
1105 error.SetErrorStringWithFormat(
"Unable to open output file: %s.",
1110 std::unique_lock<std::recursive_mutex> lock;
1116 size_t num_breakpoints = breakpoints.
GetSize();
1117 for (
size_t i = 0; i < num_breakpoints; i++) {
1122 break_store_ptr->
AddItem(bkpt_save_sp);
1126 std::unordered_set<lldb::break_id_t> processed_bkpts;
1127 const size_t count = bp_ids.
GetSize();
1128 for (
size_t i = 0; i < count; ++i) {
1134 std::pair<std::unordered_set<lldb::break_id_t>::iterator,
bool>
1135 insert_result = processed_bkpts.insert(bp_id);
1136 if (!insert_result.second)
1143 if (!bkpt_save_sp) {
1144 error.SetErrorStringWithFormat(
"Unable to serialize breakpoint %d",
1148 break_store_ptr->
AddItem(bkpt_save_sp);
1153 break_store_ptr->
Dump(out_file,
false);
1160 std::vector<std::string> no_names;
1165 std::vector<std::string> &names,
1167 std::unique_lock<std::recursive_mutex> lock;
1173 if (!
error.Success()) {
1175 }
else if (!input_data_sp || !input_data_sp->IsValid()) {
1176 error.SetErrorStringWithFormat(
"Invalid JSON from input file: %s.",
1183 error.SetErrorStringWithFormat(
1184 "Invalid breakpoint data from input file: %s.", file.
GetPath().c_str());
1188 size_t num_bkpts = bkpt_array->
GetSize();
1189 size_t num_names = names.size();
1191 for (
size_t i = 0; i < num_bkpts; i++) {
1196 error.SetErrorStringWithFormat(
1197 "Invalid breakpoint data for element %zu from input file: %s.", i,
1208 shared_from_this(), bkpt_data_sp,
error);
1209 if (!
error.Success()) {
1210 error.SetErrorStringWithFormat(
1211 "Error restoring breakpoint %zu from %s: %s.", i,
1227 LLDB_LOGF(log,
"Target::%s\n", __FUNCTION__);
1256 LLDB_LOGF(log,
"Target::%s\n", __FUNCTION__);
1283 LLDB_LOGF(log,
"Target::%s\n", __FUNCTION__);
1309 LLDB_LOGF(log,
"Target::%s\n", __FUNCTION__);
1315 wp_sp->ResetHitCount();
1323 LLDB_LOGF(log,
"Target::%s\n", __FUNCTION__);
1329 wp_sp->ResetHistoricValues();
1338 LLDB_LOGF(log,
"Target::%s\n", __FUNCTION__);
1347 wp_sp->SetIgnoreCount(ignore_count);
1355 LLDB_LOGF(log,
"Target::%s (watch_id = %i)\n", __FUNCTION__, watch_id);
1374 LLDB_LOGF(log,
"Target::%s (watch_id = %i)\n", __FUNCTION__, watch_id);
1393 LLDB_LOGF(log,
"Target::%s (watch_id = %i)\n", __FUNCTION__, watch_id);
1408 uint32_t ignore_count) {
1410 LLDB_LOGF(log,
"Target::%s (watch_id = %i)\n", __FUNCTION__, watch_id);
1417 wp_sp->SetIgnoreCount(ignore_count);
1445 if (module_sp && !module_sp->LoadScriptingResourceInTarget(target,
error,
1447 if (
error.AsCString())
1449 "unable to load scripting data for module %s - error reported was "
1451 module_sp->GetFileSpec().GetFileNameStrippingExtension().GetCString(),
1454 if (feedback_stream.
GetSize())
1477 if (executable_sp) {
1480 executable_sp->GetFileSpec().GetPath().c_str());
1482 const bool notify =
true;
1489 m_arch = executable_sp->GetArchitecture();
1491 "Target::SetExecutableModule setting architecture to {0} ({1}) "
1492 "based on executable file",
1498 ObjectFile *executable_objfile = executable_sp->GetObjectFile();
1499 bool load_dependents =
true;
1500 switch (load_dependent_files) {
1502 load_dependents = executable_sp->IsExecutable();
1505 load_dependents =
true;
1508 load_dependents =
false;
1512 if (executable_objfile && load_dependents) {
1515 for (uint32_t i = 0; i < dependent_files.
GetSize(); i++) {
1517 FileSpec platform_dependent_file_spec;
1519 m_platform_sp->GetFileWithUUID(dependent_file_spec,
nullptr,
1520 platform_dependent_file_spec);
1522 platform_dependent_file_spec = dependent_file_spec;
1527 if (image_module_sp) {
1529 ObjectFile *objfile = image_module_sp->GetObjectFile();
1543 bool replace_local_arch =
true;
1544 bool compatible_local_arch =
false;
1553 if (!platform_sp || !platform_sp->IsCompatibleArchitecture(
1557 GetDebugger().GetPlatformList().GetOrCreate(other, {},
1561 other = platform_arch;
1567 if (!missing_local_arch) {
1572 compatible_local_arch =
true;
1575 replace_local_arch =
false;
1580 if (compatible_local_arch || missing_local_arch) {
1584 if (replace_local_arch)
1587 "Target::SetArchitecture merging compatible arch; arch "
1598 "Target::SetArchitecture changing architecture to %s (%s) from %s (%s)",
1600 arch_spec.
GetTriple().getTriple().c_str(),
1609 if (executable_sp) {
1611 "Target::SetArchitecture Trying to select executable file "
1612 "architecture %s (%s)",
1614 arch_spec.
GetTriple().getTriple().c_str());
1615 ModuleSpec module_spec(executable_sp->GetFileSpec(), other);
1618 &search_paths,
nullptr,
nullptr);
1620 if (!
error.Fail() && executable_sp) {
1636 "Target::MergeArchitecture target has arch %s, merging with "
1639 arch_spec.
GetTriple().getTriple().c_str());
1660 my_module_list.
Append(module_sp);
1670 my_module_list.
Append(module_sp);
1683 old_module_sp, new_module_sp);
1692 const size_t num_images = module_list.
GetSize();
1694 for (
size_t idx = 0; idx < num_images; ++idx) {
1704 std::make_shared<TargetEventData>(shared_from_this(), module_list);
1713 runtime->SymbolsDidLoad(module_list);
1720 std::make_shared<TargetEventData>(shared_from_this(), module_list);
1729 std::make_shared<TargetEventData>(shared_from_this(), module_list);
1743 const bool should_flush_type_systems =
1750 auto type = object_file->
GetType();
1760 if (should_flush_type_systems)
1766 const FileSpec &module_file_spec) {
1771 size_t num_modules = matchingModules.
GetSize();
1775 if (num_modules > 0) {
1776 for (
size_t i = 0; i < num_modules; i++) {
1791 return m_platform_sp->ModuleIsExcludedForUnconstrainedSearches(*
this,
1803 if (section_sp->IsEncrypted()) {
1804 error.SetErrorString(
"section is encrypted");
1807 ModuleSP module_sp(section_sp->GetModule());
1812 section_sp.get(), addr.
GetOffset(), dst, dst_len);
1816 error.SetErrorStringWithFormat(
"error reading data from section %s",
1817 section_sp->GetName().GetCString());
1819 error.SetErrorString(
"address isn't from a object file");
1821 error.SetErrorString(
"address isn't in a module");
1823 error.SetErrorString(
"address doesn't contain a section that points to a "
1824 "section in a object file");
1845 size_t bytes_read = 0;
1852 if (section_load_list.
IsEmpty()) {
1871 resolved_addr = fixed_addr;
1876 std::unique_ptr<uint8_t[]> file_cache_read_buffer;
1877 size_t file_cache_bytes_read = 0;
1883 auto permissions =
Flags(section_sp->GetPermissions());
1884 bool is_readonly = !permissions.Test(ePermissionsWritable) &&
1885 permissions.Test(ePermissionsReadable);
1887 file_cache_bytes_read =
1889 if (file_cache_bytes_read == dst_len)
1890 return file_cache_bytes_read;
1891 else if (file_cache_bytes_read > 0) {
1892 file_cache_read_buffer =
1893 std::make_unique<uint8_t[]>(file_cache_bytes_read);
1894 std::memcpy(file_cache_read_buffer.get(), dst, file_cache_bytes_read);
1906 if (addr_module_sp && addr_module_sp->GetFileSpec())
1907 error.SetErrorStringWithFormatv(
1908 "{0:F}[{1:x+}] can't be resolved, {0:F} is not currently loaded",
1911 error.SetErrorStringWithFormat(
"0x%" PRIx64
" can't be resolved",
1915 if (bytes_read != dst_len) {
1916 if (
error.Success()) {
1917 if (bytes_read == 0)
1918 error.SetErrorStringWithFormat(
1919 "read memory from 0x%" PRIx64
" failed", load_addr);
1921 error.SetErrorStringWithFormat(
1922 "only %" PRIu64
" of %" PRIu64
1923 " bytes were read from memory at 0x%" PRIx64,
1924 (uint64_t)bytes_read, (uint64_t)dst_len, load_addr);
1929 *load_addr_ptr = load_addr;
1935 if (file_cache_read_buffer && file_cache_bytes_read > 0) {
1938 std::memcpy(dst, file_cache_read_buffer.get(), file_cache_bytes_read);
1939 return file_cache_bytes_read;
1961 out_str.append(buf, length);
1964 if (length ==
sizeof(buf) - 1)
1965 curr_addr += length;
1970 return out_str.size();
1974 size_t dst_max_len,
Status &result_error,
1975 bool force_live_memory) {
1976 size_t total_cstr_len = 0;
1977 if (dst && dst_max_len) {
1978 result_error.
Clear();
1980 memset(dst, 0, dst_max_len);
1988 const size_t cache_line_size = 512;
1990 size_t bytes_left = dst_max_len - 1;
1991 char *curr_dst = dst;
1993 while (bytes_left > 0) {
1994 addr_t cache_line_bytes_left =
1995 cache_line_size - (curr_addr % cache_line_size);
1997 std::min<addr_t>(bytes_left, cache_line_bytes_left);
1998 size_t bytes_read =
ReadMemory(address, curr_dst, bytes_to_read,
error,
2001 if (bytes_read == 0) {
2002 result_error =
error;
2003 dst[total_cstr_len] =
'\0';
2006 const size_t len = strlen(curr_dst);
2008 total_cstr_len += len;
2010 if (len < bytes_to_read)
2013 curr_dst += bytes_read;
2014 curr_addr += bytes_read;
2015 bytes_left -= bytes_read;
2022 result_error.
Clear();
2024 return total_cstr_len;
2032 return cache_line_size - (load_addr % cache_line_size);
2042 size_t type_width,
bool force_live_memory) {
2043 if (!dst || !max_bytes || !type_width || max_bytes < type_width)
2046 size_t total_bytes_read = 0;
2050 memset(dst, 0, max_bytes);
2051 size_t bytes_left = max_bytes - type_width;
2053 const char terminator[4] = {
'\0',
'\0',
'\0',
'\0'};
2054 assert(
sizeof(terminator) >= type_width &&
"Attempting to validate a "
2055 "string with more than 4 bytes "
2059 char *curr_dst = dst;
2062 while (bytes_left > 0 &&
error.Success()) {
2066 ReadMemory(address, curr_dst, bytes_to_read,
error, force_live_memory);
2068 if (bytes_read == 0)
2073 size_t aligned_start = total_bytes_read - total_bytes_read % type_width;
2074 for (
size_t i = aligned_start;
2075 i + type_width <= total_bytes_read + bytes_read; i += type_width)
2076 if (::memcmp(&dst[i], terminator, type_width) == 0) {
2081 total_bytes_read += bytes_read;
2082 curr_dst += bytes_read;
2083 address.
Slide(bytes_read);
2084 bytes_left -= bytes_read;
2086 return total_bytes_read;
2090 bool is_signed,
Scalar &scalar,
2092 bool force_live_memory) {
2095 if (byte_size <=
sizeof(uval)) {
2098 if (bytes_read == byte_size) {
2103 scalar = data.
GetMaxU32(&offset, byte_size);
2105 scalar = data.
GetMaxU64(&offset, byte_size);
2112 error.SetErrorStringWithFormat(
2113 "byte size of %u is too large for integer scalar type", byte_size);
2119 size_t integer_byte_size,
2121 bool force_live_memory) {
2131 bool force_live_memory) {
2134 false, scalar,
error, force_live_memory)) {
2138 if (section_load_list.
IsEmpty()) {
2152 pointer_addr.
SetOffset(pointer_vm_addr);
2160 bool notify,
Status *error_ptr) {
2168 if (std::optional<FileSpec> remapped_obj_file =
2182 llvm::SmallVector<ModuleSP, 1>
2185 bool did_create_module =
false;
2195 module_spec, module_sp, symbol_file_spec, &did_create_module);
2226 &search_paths, &old_modules,
2227 &did_create_module);
2245 &old_modules, &did_create_module);
2253 module_spec,
m_process_sp.get(), module_sp, &search_paths,
2254 &old_modules, &did_create_module);
2256 error.SetErrorString(
"no platform is currently set");
2265 ObjectFile *objfile = module_sp->GetObjectFile();
2280 error_ptr->
SetErrorString(
"debug info files aren't valid target "
2281 "modules, please specify an executable");
2288 "modules, please specify an executable");
2293 "unsupported file type, please specify an executable");
2314 old_modules.push_back(found_module);
2321 if (symbol_file_spec)
2322 module_sp->SetSymbolFileFileSpec(symbol_file_spec);
2327 module_sp->PreloadSymbols();
2328 llvm::SmallVector<ModuleSP, 1> replaced_modules;
2329 for (
ModuleSP &old_module_sp : old_modules) {
2332 if (replaced_modules.empty())
2337 replaced_modules.push_back(std::move(old_module_sp));
2341 if (replaced_modules.size() > 1) {
2354 auto dump = [&message](
Module &dump_module) ->
void {
2355 UUID dump_uuid = dump_module.GetUUID();
2359 message <<
" (uuid ";
2362 dump_uuid.
Dump(message);
2364 message <<
"not specified";
2369 message <<
"New module ";
2372 << llvm::formatv(
" simultaneously replaced {0} old modules: ",
2373 replaced_modules.size());
2374 for (
ModuleSP &replaced_module_sp : replaced_modules)
2375 dump(*replaced_module_sp);
2381 if (replaced_modules.empty())
2384 for (
ModuleSP &old_module_sp : replaced_modules) {
2385 Module *old_module_ptr = old_module_sp.get();
2386 old_module_sp.reset();
2423llvm::Expected<lldb::TypeSystemSP>
2425 bool create_on_demand) {
2427 return llvm::createStringError(
"Invalid Target");
2439 if (languages_for_expressions.
Empty())
2440 return llvm::createStringError(
2441 "No expression support for any languages");
2452 uint32_t byte_size) {
2455 return provider->GetRegisterType(name, flags, byte_size);
2458std::vector<lldb::TypeSystemSP>
2466 std::vector<lldb::TypeSystemSP> scratch_type_systems;
2471 for (
auto bit : languages_for_expressions.
bitvector.set_bits()) {
2473 auto type_system_or_err =
2475 if (!type_system_or_err)
2478 "Language '{1}' has expression support but no scratch type "
2479 "system available: {0}",
2482 if (
auto ts = *type_system_or_err)
2483 scratch_type_systems.push_back(ts);
2486 std::sort(scratch_type_systems.begin(), scratch_type_systems.end());
2487 scratch_type_systems.erase(
2488 std::unique(scratch_type_systems.begin(), scratch_type_systems.end()),
2489 scratch_type_systems.end());
2490 return scratch_type_systems;
2497 if (
auto err = type_system_or_err.takeError()) {
2500 "Unable to get persistent expression state for language {1}: {0}",
2505 if (
auto ts = *type_system_or_err)
2506 return ts->GetPersistentExpressionState();
2509 "Unable to get persistent expression state for language {1}: {0}",
2515 llvm::StringRef expr, llvm::StringRef prefix,
SourceLanguage language,
2519 auto type_system_or_err =
2521 if (
auto err = type_system_or_err.takeError()) {
2522 error.SetErrorStringWithFormat(
2523 "Could not find type system for language %s: %s",
2525 llvm::toString(std::move(err)).c_str());
2529 auto ts = *type_system_or_err;
2531 error.SetErrorStringWithFormat(
2532 "Type system for language %s is no longer live",
2537 auto *user_expr = ts->GetUserExpression(expr, prefix, language, desired_type,
2540 error.SetErrorStringWithFormat(
2541 "Could not create an expression for language %s",
2552 if (
auto err = type_system_or_err.takeError()) {
2553 error.SetErrorStringWithFormat(
2554 "Could not find type system for language %s: %s",
2556 llvm::toString(std::move(err)).c_str());
2559 auto ts = *type_system_or_err;
2561 error.SetErrorStringWithFormat(
2562 "Type system for language %s is no longer live",
2566 auto *persistent_fn = ts->GetFunctionCaller(return_type, function_address,
2567 arg_value_list, name);
2569 error.SetErrorStringWithFormat(
2570 "Could not create an expression for language %s",
2573 return persistent_fn;
2576llvm::Expected<std::unique_ptr<UtilityFunction>>
2581 if (!type_system_or_err)
2582 return type_system_or_err.takeError();
2583 auto ts = *type_system_or_err;
2585 return llvm::createStringError(
2586 llvm::StringRef(
"Type system for language ") +
2588 llvm::StringRef(
" is no longer live"));
2589 std::unique_ptr<UtilityFunction> utility_fn =
2590 ts->CreateUtilityFunction(std::move(expression), std::move(name));
2592 return llvm::createStringError(
2593 llvm::StringRef(
"Could not create an expression for language") +
2597 if (!utility_fn->Install(diagnostics, exe_ctx))
2598 return llvm::createStringError(diagnostics.
GetString());
2600 return std::move(utility_fn);
2621 "setting target's default architecture to {0} ({1})",
2628 if (llvm::to_integer(label, n))
2629 return llvm::createStringError(
"Cannot use integer as target label.");
2633 if (target_sp && target_sp->GetLabel() == label) {
2634 return llvm::make_error<llvm::StringError>(
2636 "Cannot use label '{0}' since it's set in target #{1}.", label,
2638 llvm::inconvertibleErrorCode());
2643 return llvm::Error::success();
2652 Target *target =
nullptr;
2653 if (sc_ptr !=
nullptr)
2655 if (target ==
nullptr && exe_ctx_ptr)
2665 result_valobj_sp.reset();
2671 return execution_results;
2677 auto on_exit = llvm::make_scope_exit([
this, old_suppress_value]() {
2695 if (expr[0] ==
'$') {
2696 auto type_system_or_err =
2698 if (
auto err = type_system_or_err.takeError()) {
2700 "Unable to get scratch type system");
2702 auto ts = *type_system_or_err;
2705 "Scratch type system is no longer live: {0}");
2708 ts->GetPersistentExpressionState()->GetVariable(expr);
2711 if (persistent_var_sp) {
2712 result_valobj_sp = persistent_var_sp->GetValueObject();
2718 result_valobj_sp,
error,
2719 fixed_expression, ctx_obj);
2721 if (
error.Fail() && !result_valobj_sp)
2723 exe_ctx.GetBestExecutionContextScope(),
error);
2730 return execution_results;
2736 [name, &variable_sp](
TypeSystemSP type_system) ->
bool {
2737 auto ts = type_system.get();
2741 ts->GetPersistentExpressionState()) {
2742 variable_sp = persistent_state->GetVariable(name);
2757 auto ts = type_system.get();
2762 ts->GetPersistentExpressionState()) {
2763 address = persistent_state->LookupSymbol(name);
2764 if (address != LLDB_INVALID_ADDRESS)
2776 const bool has_primary_executable = exe_module && exe_module->
GetObjectFile();
2777 if (has_primary_executable) {
2784 const size_t num_images = modules.
GetSize();
2785 for (
size_t idx = 0; idx < num_images; ++idx) {
2787 if (!module_sp || !module_sp->GetObjectFile())
2790 Address entry_addr = module_sp->GetObjectFile()->GetEntryPointAddress();
2796 if (!has_primary_executable)
2797 return llvm::createStringError(
2798 "No primary executable found and could not find entry point address in "
2799 "any executable module");
2801 return llvm::createStringError(
2802 "Could not find entry point address for primary executable module \"" +
2810 ? arch_plugin->GetCallableLoadAddress(load_addr, addr_class)
2817 return arch_plugin ? arch_plugin->GetOpcodeLoadAddress(load_addr, addr_class)
2823 return arch_plugin ? arch_plugin->GetBreakableLoadAddress(addr, *
this) : addr;
2844 return stop_hook_sp;
2856 return (num_removed != 0);
2864 StopHookCollection::iterator specified_hook_iter;
2867 found_hook = (*specified_hook_iter).second;
2872 bool active_state) {
2873 StopHookCollection::iterator specified_hook_iter;
2878 (*specified_hook_iter).second->SetIsActive(active_state);
2883 StopHookCollection::iterator pos, end =
m_stop_hooks.end();
2885 (*pos).second->SetIsActive(active_state);
2905 bool any_active_hooks =
false;
2907 if (hook.second->IsActive()) {
2908 any_active_hooks =
true;
2912 if (!any_active_hooks)
2921 uint32_t last_natural_stop =
m_process_sp->GetModIDRef().GetLastNaturalStopID();
2927 std::vector<ExecutionContext> exc_ctx_with_reasons;
2930 size_t num_threads = cur_threadlist.
GetSize();
2931 for (
size_t i = 0; i < num_threads; i++) {
2933 if (cur_thread_sp->ThreadStoppedForAReason()) {
2935 exc_ctx_with_reasons.emplace_back(
m_process_sp.get(), cur_thread_sp.get(),
2936 cur_frame_sp.get());
2941 size_t num_exe_ctx = exc_ctx_with_reasons.size();
2942 if (num_exe_ctx == 0)
2947 bool auto_continue =
false;
2948 bool hooks_ran =
false;
2950 bool print_thread_header = (num_exe_ctx != 1);
2951 bool should_stop =
false;
2952 bool somebody_restarted =
false;
2956 if (!cur_hook_sp->IsActive())
2959 bool any_thread_matched =
false;
2960 for (
auto exc_ctx : exc_ctx_with_reasons) {
2963 if (somebody_restarted)
2966 if (!cur_hook_sp->ExecutionContextPasses(exc_ctx))
2971 auto_continue |= cur_hook_sp->GetAutoContinue();
2976 if (print_hook_header && !any_thread_matched) {
2980 output_sp->
Printf(
"\n- Hook %" PRIu64
" (%s)\n", cur_hook_sp->GetID(),
2983 output_sp->Printf(
"\n- Hook %" PRIu64
"\n", cur_hook_sp->GetID());
2984 any_thread_matched =
true;
2987 if (print_thread_header)
2988 output_sp->Printf(
"-- Thread %d\n",
2989 exc_ctx.GetThreadPtr()->GetIndexID());
2992 cur_hook_sp->HandleStop(exc_ctx, output_sp);
2993 bool this_should_stop =
true;
2995 switch (this_result) {
2999 if (cur_hook_sp->GetAutoContinue())
3000 this_should_stop =
false;
3002 this_should_stop =
true;
3006 this_should_stop =
false;
3012 output_sp->Printf(
"\nAborting stop hooks, hook %" PRIu64
3013 " set the program running.\n"
3014 " Consider using '-G true' to make "
3015 "stop hooks auto-continue.\n",
3016 cur_hook_sp->GetID());
3017 somebody_restarted =
true;
3024 if (somebody_restarted)
3029 should_stop = this_should_stop;
3037 if (somebody_restarted)
3043 if ((hooks_ran && !should_stop) || auto_continue) {
3046 if (
error.Success()) {
3047 LLDB_LOG(log,
"Resuming from RunStopHooks");
3050 LLDB_LOG(log,
"Resuming from RunStopHooks failed: {0}",
error);
3063 return *g_settings_ptr;
3070 if (platform_sp->IsRemote()) {
3071 if (platform_sp->IsConnected()) {
3077 const size_t num_images = modules.
GetSize();
3078 for (
size_t idx = 0; idx < num_images; ++idx) {
3082 FileSpec local_file(module_sp->GetFileSpec());
3084 FileSpec remote_file(module_sp->GetRemoteInstallFileSpec());
3088 remote_file = platform_sp->GetRemoteWorkingDirectory();
3090 module_sp->GetFileSpec().GetFilename().GetCString());
3094 error = platform_sp->Install(local_file, remote_file);
3095 if (
error.Success()) {
3096 module_sp->SetPlatformFileSpec(remote_file);
3097 if (is_main_executable) {
3098 platform_sp->SetFilePermissions(remote_file, 0700);
3125 addr_t new_section_load_addr,
3126 bool warn_multiple) {
3127 const addr_t old_section_load_addr =
3130 if (old_section_load_addr != new_section_load_addr) {
3131 uint32_t stop_id = 0;
3134 stop_id = process_sp->GetStopID();
3138 stop_id, section_sp, new_section_load_addr, warn_multiple))
3145 size_t section_unload_count = 0;
3146 size_t num_modules = module_list.
GetSize();
3147 for (
size_t i = 0; i < num_modules; ++i) {
3148 section_unload_count +=
3151 return section_unload_count;
3155 uint32_t stop_id = 0;
3158 stop_id = process_sp->GetStopID();
3161 SectionList *sections = module_sp->GetSectionList();
3162 size_t section_unload_count = 0;
3165 for (uint32_t i = 0; i < num_sections; ++i) {
3170 return section_unload_count;
3174 uint32_t stop_id = 0;
3177 stop_id = process_sp->GetStopID();
3185 uint32_t stop_id = 0;
3188 stop_id = process_sp->GetStopID();
3213 LLDB_LOGF(log,
"Target::%s() called for %s", __FUNCTION__,
3225 state = process_sp->GetState();
3227 "Target::%s the process exists, and its current state is %s",
3230 LLDB_LOGF(log,
"Target::%s the process instance doesn't currently exist.",
3243 const bool synchronous_execution =
3251 if (launch_info.
GetFlags().
Test(eLaunchFlagLaunchInTTY)) {
3252 error.SetErrorString(
3253 "can't launch in tty when launching through a remote connection");
3273 LLDB_LOGF(log,
"Target::%s asking the platform to debug the process",
3287 "Target::%s the platform doesn't know how to debug a "
3288 "process, getting a process plugin to do this for us.",
3308 error.SetErrorString(
"failed to launch or debug process");
3310 if (!
error.Success())
3313 bool rebroadcast_first_stop =
3314 !synchronous_execution &&
3320 state =
m_process_sp->WaitForProcessToStop(std::nullopt, &first_stop_event_sp,
3321 rebroadcast_first_stop,
3325 if (rebroadcast_first_stop) {
3326 assert(first_stop_event_sp);
3333 if (launch_info.
GetFlags().
Test(eLaunchFlagStopAtEntry))
3335 if (synchronous_execution)
3342 if (!
error.Success()) {
3345 "process resume at entry point failed: %s",
error.AsCString());
3350 bool with_shell = !!launch_info.
GetShell();
3352 const char *exit_desc =
m_process_sp->GetExitDescription();
3354 if (exit_desc && exit_desc[0])
3355 desc =
" (" + std::string(exit_desc) +
')';
3357 error.SetErrorStringWithFormat(
3358 "process exited with status %i%s\n"
3359 "'r' and 'run' are aliases that default to launching through a "
3361 "Try launching without going through a shell by using "
3362 "'process launch'.",
3363 exit_status, desc.c_str());
3365 error.SetErrorStringWithFormat(
"process exited with status %i%s",
3366 exit_status, desc.c_str());
3369 error.SetErrorStringWithFormat(
"initial process state wasn't stopped: %s",
3382 return llvm::createStringError(llvm::inconvertibleErrorCode(),
3383 "A process is required for tracing");
3385 return llvm::createStringError(llvm::inconvertibleErrorCode(),
3386 "A trace already exists for the target");
3388 llvm::Expected<TraceSupportedResponse> trace_type =
3391 return llvm::createStringError(
3392 llvm::inconvertibleErrorCode(),
"Tracing is not supported. %s",
3393 llvm::toString(trace_type.takeError()).c_str());
3394 if (llvm::Expected<TraceSP> trace_sp =
3398 return llvm::createStringError(
3399 llvm::inconvertibleErrorCode(),
3400 "Couldn't create a Trace object for the process. %s",
3401 llvm::toString(trace_sp.takeError()).c_str());
3416 state = process_sp->GetState();
3419 return Status(
"process attach is in progress");
3420 return Status(
"a process is already being debugged");
3429 if (old_exec_module_sp)
3431 old_exec_module_sp->GetPlatformFileSpec().GetFilename());
3434 return Status(
"no process specified, create a target with a file, or "
3435 "specify the --pid or --name");
3439 const auto platform_sp =
3442 const bool async = attach_info.
GetAsync();
3460 plugin_name,
nullptr,
false);
3462 error.SetErrorStringWithFormatv(
3463 "failed to create process using plugin '{0}'",
3464 plugin_name.empty() ?
"<empty>" : plugin_name);
3468 if (hijack_listener_sp)
3469 process_sp->HijackProcessEvents(hijack_listener_sp);
3470 error = process_sp->Attach(attach_info);
3473 if (
error.Success() && process_sp) {
3475 process_sp->RestoreProcessEvents();
3478 state = process_sp->WaitForProcessToStop(
3481 process_sp->RestoreProcessEvents();
3484 const char *exit_desc = process_sp->GetExitDescription();
3486 error.SetErrorStringWithFormat(
"%s", exit_desc);
3488 error.SetErrorString(
3489 "process did not stop (no such process or permission problem?)");
3490 process_sp->Destroy(
false);
3503 const bool default_to_use_pty =
3507 "have platform={0}, platform_sp->IsHost()={1}, default_to_use_pty={2}",
3509 platform_sp ? (platform_sp->IsHost() ?
"true" :
"false") :
"n/a",
3510 default_to_use_pty);
3517 LLDB_LOG(log,
"at least one of stdin/stdout/stderr was not set, evaluating "
3518 "default handling");
3527 LLDB_LOG(log,
"eLaunchFlagDisableSTDIO set, adding suppression action "
3528 "for stdin, stdout and stderr");
3548 LLDB_LOG(log,
"target stdin='{0}', target stdout='{1}', stderr='{1}'",
3549 in_file_spec, out_file_spec, err_file_spec);
3553 LLDB_LOG(log,
"appended stdin open file action for {0}", in_file_spec);
3556 if (out_file_spec) {
3558 LLDB_LOG(log,
"appended stdout open file action for {0}",
3562 if (err_file_spec) {
3564 LLDB_LOG(log,
"appended stderr open file action for {0}",
3568 if (default_to_use_pty) {
3570 LLDB_LOG_ERROR(log, std::move(Err),
"SetUpPtyRedirection failed: {0}");
3587 elem.notify = notify;
3597 = signals_sp->GetSignalNumberFromName(elem.first().str().c_str());
3602 signals_sp->SetShouldSuppress(signo,
false);
3604 signals_sp->SetShouldSuppress(signo,
true);
3607 signals_sp->SetShouldNotify(signo,
true);
3609 signals_sp->SetShouldNotify(signo,
false);
3612 signals_sp->SetShouldStop(signo,
true);
3614 signals_sp->SetShouldStop(signo,
false);
3623 = signals_sp->GetSignalNumberFromName(elem.first().str().c_str());
3629 signals_sp->ResetSignal(signo, do_stop, do_notify, do_pass);
3640 warning_stream_sp->Printf(
"Target signal '%s' not found in process\n",
3641 elem.first().str().c_str());
3654 signals_sp = process_sp->GetUnixSignals();
3657 const char *signal_name = entry.c_str();
3671 strm.
Printf(
"NAME PASS STOP NOTIFY\n");
3672 strm.
Printf(
"=========== ======= ======= =======\n");
3674 auto str_for_lazy = [] (
LazyBool lazy) ->
const char * {
3680 llvm_unreachable(
"Fully covered switch above!");
3684 bool print_it =
false;
3685 for (
size_t idx = 0; idx < num_args; idx++) {
3692 strm.
Printf(
"%-11s ", elem.first().str().c_str());
3693 strm.
Printf(
"%s %s %s\n", str_for_lazy(elem.second.pass),
3694 str_for_lazy(elem.second.stop),
3695 str_for_lazy(elem.second.notify));
3702 :
UserID(uid), m_target_sp(target_sp), m_specifier_sp(),
3703 m_thread_spec_up() {}
3706 :
UserID(rhs.GetID()), m_target_sp(rhs.m_target_sp),
3707 m_specifier_sp(rhs.m_specifier_sp), m_thread_spec_up(),
3708 m_active(rhs.m_active), m_auto_continue(rhs.m_auto_continue) {
3714 m_specifier_sp.reset(specifier);
3718 m_thread_spec_up.reset(specifier);
3726 bool will_run =
true;
3728 will_run = GetSpecifier()->SymbolContextMatches(
3730 if (will_run && GetThreadSpecifier() !=
nullptr)
3732 GetThreadSpecifier()->ThreadPassesBasicTests(exc_ctx.
GetThreadRef());
3742 GetSubclassDescription(s, level);
3750 s.
Printf(
"Hook: %" PRIu64
"\n", GetID());
3752 s.
Indent(
"State: enabled\n");
3754 s.
Indent(
"State: disabled\n");
3756 if (m_auto_continue)
3757 s.
Indent(
"AutoContinue on\n");
3759 if (m_specifier_sp) {
3763 m_specifier_sp->GetDescription(&s, level);
3767 if (m_thread_spec_up) {
3770 m_thread_spec_up->GetDescription(&tmp, level);
3776 GetSubclassDescription(s, level);
3783 if (m_commands.GetSize() == 1)
3784 s.
PutCString(m_commands.GetStringAtIndex(0));
3787 s.
Indent(
"Commands: \n");
3789 uint32_t num_commands = m_commands.GetSize();
3790 for (uint32_t i = 0; i < num_commands; i++) {
3791 s.
Indent(m_commands.GetStringAtIndex(i));
3799 GetCommands().SplitIntoLines(
string);
3803 const std::vector<std::string> &strings) {
3804 for (
auto string : strings)
3805 GetCommands().AppendString(
string.c_str());
3811 assert(exc_ctx.
GetTargetPtr() &&
"Can't call PerformAction on a context "
3814 if (!m_commands.GetSize())
3815 return StopHookResult::KeepStopped;
3838 return StopHookResult::AlreadyContinued;
3839 return StopHookResult::KeepStopped;
3848 GetTarget()->GetDebugger().GetScriptInterpreter();
3849 if (!script_interp) {
3850 error.SetErrorString(
"No script interpreter installed.");
3854 m_class_name = class_name;
3855 m_extra_args.SetObjectSP(extra_args_sp);
3858 GetTarget(), m_class_name.c_str(), m_extra_args,
error);
3866 assert(exc_ctx.
GetTargetPtr() &&
"Can't call HandleStop on a context "
3870 GetTarget()->GetDebugger().GetScriptInterpreter();
3872 return StopHookResult::KeepStopped;
3875 m_implementation_sp, exc_ctx, output_sp);
3877 return should_stop ? StopHookResult::KeepStopped
3878 : StopHookResult::RequestContinue;
3888 s.
Printf(
"%s\n", m_class_name.c_str());
3893 if (!m_extra_args.IsValid())
3896 if (!object_sp || !object_sp->IsValid())
3900 if (!as_dict || !as_dict->
IsValid())
3903 uint32_t num_keys = as_dict->
GetSize();
3910 auto print_one_element = [&s](llvm::StringRef key,
3913 s.
Format(
"{0} : {1}\n", key, object->GetStringValue());
3917 as_dict->
ForEach(print_one_element);
3925 "no-dynamic-values",
3926 "Don't calculate the dynamic type of values",
3931 "Calculate the dynamic type of values "
3932 "even if you have to run the target.",
3937 "Calculate the dynamic type of values, but don't run the target.",
3949 "Never look for inline breakpoint locations (fastest). This setting "
3950 "should only be used if you know that no inlining occurs in your"
3956 "Only check for inline breakpoint locations when setting breakpoints "
3957 "in header files, but not when setting breakpoint in implementation "
3958 "source files (default).",
3963 "Always look for inline breakpoint locations when setting file and "
3964 "line breakpoints (slower but most accurate).",
3978 "Disassembler default (currently att).",
3983 "Intel disassembler flavor.",
3988 "AT&T disassembler flavor.",
3996 "Never import the 'std' C++ module in the expression parser.",
4001 "Retry evaluating expressions with an imported 'std' C++ module if they"
4002 " failed to parse without the module. This allows evaluating more "
4003 "complex expressions involving C++ standard library types."
4008 "Always import the 'std' C++ module. This allows evaluating more "
4009 "complex expressions involving C++ standard library types. This feature"
4019 "Automatically determine the most appropriate method for the "
4023 "Prefer using the realized classes struct."},
4025 "Prefer using the CopyRealizedClassList API."},
4027 "Prefer using the GetRealizedClassList API."},
4034 "C-style (0xffff).",
4039 "Asm-style (0ffffh).",
4047 "Load debug scripts inside symbol files",
4052 "Do not load debug scripts inside symbol files.",
4057 "Warn about debug scripts inside symbol files but do not load them.",
4065 "Load .lldbinit files from current directory",
4070 "Do not load .lldbinit files from current directory",
4075 "Warn about loading .lldbinit files from current directory",
4083 "Load minimal information when loading modules from memory. Currently "
4084 "this setting loads sections only.",
4089 "Load partial information when loading modules from memory. Currently "
4090 "this setting loads sections and function bounds.",
4095 "Load complete information when loading modules from memory. Currently "
4096 "this setting loads sections and all symbols.",
4100#define LLDB_PROPERTIES_target
4101#include "TargetProperties.inc"
4104#define LLDB_PROPERTIES_target
4105#include "TargetPropertiesEnum.inc"
4110 :
public Cloneable<TargetOptionValueProperties, OptionValueProperties> {
4121 Target *target = exe_ctx->GetTargetPtr();
4126 if (
this != target_properties)
4130 return ProtectedGetPropertyAtIndex(idx);
4135#define LLDB_PROPERTIES_target_experimental
4136#include "TargetProperties.inc"
4139#define LLDB_PROPERTIES_target_experimental
4140#include "TargetPropertiesEnum.inc"
4144 :
public Cloneable<TargetExperimentalOptionValueProperties,
4145 OptionValueProperties> {
4159 :
Properties(), m_launch_info(), m_target(target) {
4182 m_collection_sp->SetValueChangedCallback(ePropertyDetachOnError, [
this] {
4195 std::make_unique<TargetExperimentalProperties>();
4198 "Experimental settings - setting these won't produce "
4199 "errors if the setting is not present.",
4202 m_collection_sp = std::make_shared<TargetOptionValueProperties>(
"target");
4205 std::make_unique<TargetExperimentalProperties>();
4208 "Experimental settings - setting these won't produce "
4209 "errors if the setting is not present.",
4212 "process",
"Settings specific to processes.",
true,
4239 exp_property->
GetValue()->GetAsProperties();
4242 return std::nullopt;
4252 const uint32_t idx = ePropertyDefaultArch;
4253 return GetPropertyAtIndexAs<ArchSpec>(idx, {});
4257 const uint32_t idx = ePropertyDefaultArch;
4262 const uint32_t idx = ePropertyMoveToNearestCode;
4263 return GetPropertyAtIndexAs<bool>(
4264 idx, g_target_properties[idx].default_uint_value != 0);
4268 const uint32_t idx = ePropertyPreferDynamic;
4269 return GetPropertyAtIndexAs<lldb::DynamicValueType>(
4271 g_target_properties[idx].default_uint_value));
4275 const uint32_t idx = ePropertyPreferDynamic;
4281 "Interrupted checking preload symbols")) {
4284 const uint32_t idx = ePropertyPreloadSymbols;
4285 return GetPropertyAtIndexAs<bool>(
4286 idx, g_target_properties[idx].default_uint_value != 0);
4290 const uint32_t idx = ePropertyPreloadSymbols;
4295 const uint32_t idx = ePropertyDisableASLR;
4296 return GetPropertyAtIndexAs<bool>(
4297 idx, g_target_properties[idx].default_uint_value != 0);
4301 const uint32_t idx = ePropertyDisableASLR;
4306 const uint32_t idx = ePropertyInheritTCC;
4307 return GetPropertyAtIndexAs<bool>(
4308 idx, g_target_properties[idx].default_uint_value != 0);
4312 const uint32_t idx = ePropertyInheritTCC;
4317 const uint32_t idx = ePropertyDetachOnError;
4318 return GetPropertyAtIndexAs<bool>(
4319 idx, g_target_properties[idx].default_uint_value != 0);
4323 const uint32_t idx = ePropertyDetachOnError;
4328 const uint32_t idx = ePropertyDisableSTDIO;
4329 return GetPropertyAtIndexAs<bool>(
4330 idx, g_target_properties[idx].default_uint_value != 0);
4334 const uint32_t idx = ePropertyDisableSTDIO;
4339 const uint32_t idx = ePropertyDisassemblyFlavor;
4340 const char *return_value;
4343 GetPropertyAtIndexAs<x86DisassemblyFlavor>(
4345 g_target_properties[idx].default_uint_value));
4348 return return_value;
4352 const uint32_t idx = ePropertyInlineStrategy;
4353 return GetPropertyAtIndexAs<InlineStrategy>(
4355 static_cast<InlineStrategy>(g_target_properties[idx].default_uint_value));
4361 const uint32_t idx = ePropertySourceRealpathPrefixes;
4366 const uint32_t idx = ePropertyArg0;
4367 return GetPropertyAtIndexAs<llvm::StringRef>(
4368 idx, g_target_properties[idx].default_cstr_value);
4372 const uint32_t idx = ePropertyArg0;
4378 const uint32_t idx = ePropertyRunArgs;
4383 const uint32_t idx = ePropertyRunArgs;
4392 GetPropertyAtIndexAs<bool>(
4393 ePropertyInheritEnv,
4394 g_target_properties[ePropertyInheritEnv].default_uint_value != 0)) {
4396 Environment platform_env = platform_sp->GetEnvironment();
4397 for (
const auto &KV : platform_env)
4398 env[KV.first()] = KV.second;
4402 Args property_unset_env;
4404 property_unset_env);
4405 for (
const auto &var : property_unset_env)
4406 env.erase(var.ref());
4409 m_collection_sp->GetPropertyAtIndexAsArgs(ePropertyEnvVars, property_env);
4411 env[KV.first()] = KV.second;
4426 if (!GetPropertyAtIndexAs<bool>(
4427 ePropertyInheritEnv,
4428 g_target_properties[ePropertyInheritEnv].default_uint_value != 0))
4432 if (platform_sp ==
nullptr)
4435 Environment platform_environment = platform_sp->GetEnvironment();
4436 for (
const auto &KV : platform_environment)
4437 environment[KV.first()] = KV.second;
4439 Args property_unset_environment;
4441 property_unset_environment);
4442 for (
const auto &var : property_unset_environment)
4443 environment.erase(var.ref());
4449 Args property_environment;
4451 property_environment);
4453 for (
const auto &KV :
Environment(property_environment))
4454 environment[KV.first()] = KV.second;
4461 const uint32_t idx = ePropertyEnvVars;
4466 const uint32_t idx = ePropertySkipPrologue;
4467 return GetPropertyAtIndexAs<bool>(
4468 idx, g_target_properties[idx].default_uint_value != 0);
4472 const uint32_t idx = ePropertySourceMap;
4475 assert(option_value);
4480 const uint32_t idx = ePropertyObjectMap;
4483 assert(option_value);
4488 const uint32_t idx = ePropertyAutoSourceMapRelative;
4489 return GetPropertyAtIndexAs<bool>(
4490 idx, g_target_properties[idx].default_uint_value != 0);
4494 const uint32_t idx = ePropertyExecutableSearchPaths;
4497 assert(option_value);
4502 const uint32_t idx = ePropertyExecutableSearchPaths;
4503 return GetPropertyAtIndexAs<FileSpecList>(idx, {});
4507 const uint32_t idx = ePropertyDebugFileSearchPaths;
4508 return GetPropertyAtIndexAs<FileSpecList>(idx, {});
4512 const uint32_t idx = ePropertyClangModuleSearchPaths;
4513 return GetPropertyAtIndexAs<FileSpecList>(idx, {});
4517 const uint32_t idx = ePropertyAutoImportClangModules;
4518 return GetPropertyAtIndexAs<bool>(
4519 idx, g_target_properties[idx].default_uint_value != 0);
4523 const uint32_t idx = ePropertyImportStdModule;
4524 return GetPropertyAtIndexAs<ImportStdModule>(
4526 g_target_properties[idx].default_uint_value));
4530 const uint32_t idx = ePropertyDynamicClassInfoHelper;
4531 return GetPropertyAtIndexAs<DynamicClassInfoHelper>(
4533 g_target_properties[idx].default_uint_value));
4537 const uint32_t idx = ePropertyAutoApplyFixIts;
4538 return GetPropertyAtIndexAs<bool>(
4539 idx, g_target_properties[idx].default_uint_value != 0);
4543 const uint32_t idx = ePropertyRetriesWithFixIts;
4544 return GetPropertyAtIndexAs<uint64_t>(
4545 idx, g_target_properties[idx].default_uint_value);
4549 const uint32_t idx = ePropertyNotifyAboutFixIts;
4550 return GetPropertyAtIndexAs<bool>(
4551 idx, g_target_properties[idx].default_uint_value != 0);
4555 const uint32_t idx = ePropertySaveObjectsDir;
4556 return GetPropertyAtIndexAs<FileSpec>(idx, {});
4565 bool exists = instance.
Exists(new_dir);
4566 bool is_directory = instance.
IsDirectory(new_dir);
4567 std::string path = new_dir.
GetPath(
true);
4568 bool writable = llvm::sys::fs::can_write(path);
4569 if (exists && is_directory && writable)
4577 llvm::raw_string_ostream os(buffer);
4578 os <<
"JIT object dir '" << path <<
"' ";
4580 os <<
"does not exist";
4581 else if (!is_directory)
4582 os <<
"is not a directory";
4584 os <<
"is not writable";
4586 std::optional<lldb::user_id_t> debugger_id;
4593 const uint32_t idx = ePropertyEnableSynthetic;
4594 return GetPropertyAtIndexAs<bool>(
4595 idx, g_target_properties[idx].default_uint_value != 0);
4599 const uint32_t idx = ePropertyShowHexVariableValuesWithLeadingZeroes;
4600 return GetPropertyAtIndexAs<bool>(
4601 idx, g_target_properties[idx].default_uint_value != 0);
4605 const uint32_t idx = ePropertyMaxZeroPaddingInFloatFormat;
4606 return GetPropertyAtIndexAs<uint64_t>(
4607 idx, g_target_properties[idx].default_uint_value);
4611 const uint32_t idx = ePropertyMaxChildrenCount;
4612 return GetPropertyAtIndexAs<int64_t>(
4613 idx, g_target_properties[idx].default_uint_value);
4616std::pair<uint32_t, bool>
4618 const uint32_t idx = ePropertyMaxChildrenDepth;
4619 auto *option_value =
4621 bool is_default = !option_value->OptionWasSet();
4622 return {option_value->GetCurrentValue(), is_default};
4626 const uint32_t idx = ePropertyMaxSummaryLength;
4627 return GetPropertyAtIndexAs<uint64_t>(
4628 idx, g_target_properties[idx].default_uint_value);
4632 const uint32_t idx = ePropertyMaxMemReadSize;
4633 return GetPropertyAtIndexAs<uint64_t>(
4634 idx, g_target_properties[idx].default_uint_value);
4638 const uint32_t idx = ePropertyInputPath;
4639 return GetPropertyAtIndexAs<FileSpec>(idx, {});
4643 const uint32_t idx = ePropertyInputPath;
4648 const uint32_t idx = ePropertyOutputPath;
4649 return GetPropertyAtIndexAs<FileSpec>(idx, {});
4653 const uint32_t idx = ePropertyOutputPath;
4658 const uint32_t idx = ePropertyErrorPath;
4659 return GetPropertyAtIndexAs<FileSpec>(idx, {});
4663 const uint32_t idx = ePropertyErrorPath;
4668 const uint32_t idx = ePropertyLanguage;
4669 return {GetPropertyAtIndexAs<LanguageType>(idx, {})};
4673 const uint32_t idx = ePropertyExprPrefix;
4679 return llvm::StringRef(
4680 reinterpret_cast<const char *
>(data_sp->GetBytes()),
4681 data_sp->GetByteSize());
4687 const uint32_t idx = ePropertyExprErrorLimit;
4688 return GetPropertyAtIndexAs<uint64_t>(
4689 idx, g_target_properties[idx].default_uint_value);
4693 const uint32_t idx = ePropertyExprAllocAddress;
4694 return GetPropertyAtIndexAs<uint64_t>(
4695 idx, g_target_properties[idx].default_uint_value);
4699 const uint32_t idx = ePropertyExprAllocSize;
4700 return GetPropertyAtIndexAs<uint64_t>(
4701 idx, g_target_properties[idx].default_uint_value);
4705 const uint32_t idx = ePropertyExprAllocAlign;
4706 return GetPropertyAtIndexAs<uint64_t>(
4707 idx, g_target_properties[idx].default_uint_value);
4711 const uint32_t idx = ePropertyBreakpointUseAvoidList;
4712 return GetPropertyAtIndexAs<bool>(
4713 idx, g_target_properties[idx].default_uint_value != 0);
4717 const uint32_t idx = ePropertyUseHexImmediates;
4718 return GetPropertyAtIndexAs<bool>(
4719 idx, g_target_properties[idx].default_uint_value != 0);
4723 const uint32_t idx = ePropertyUseFastStepping;
4724 return GetPropertyAtIndexAs<bool>(
4725 idx, g_target_properties[idx].default_uint_value != 0);
4729 const uint32_t idx = ePropertyDisplayExpressionsInCrashlogs;
4730 return GetPropertyAtIndexAs<bool>(
4731 idx, g_target_properties[idx].default_uint_value != 0);
4735 const uint32_t idx = ePropertyLoadScriptFromSymbolFile;
4736 return GetPropertyAtIndexAs<LoadScriptFromSymFile>(
4738 g_target_properties[idx].default_uint_value));
4742 const uint32_t idx = ePropertyLoadCWDlldbinitFile;
4743 return GetPropertyAtIndexAs<LoadCWDlldbinitFile>(
4745 g_target_properties[idx].default_uint_value));
4749 const uint32_t idx = ePropertyHexImmediateStyle;
4750 return GetPropertyAtIndexAs<Disassembler::HexImmediateStyle>(
4752 g_target_properties[idx].default_uint_value));
4756 const uint32_t idx = ePropertyMemoryModuleLoadLevel;
4757 return GetPropertyAtIndexAs<MemoryModuleLoadLevel>(
4759 g_target_properties[idx].default_uint_value));
4763 const uint32_t idx = ePropertyTrapHandlerNames;
4768 const uint32_t idx = ePropertyTrapHandlerNames;
4773 const uint32_t idx = ePropertyDisplayRuntimeSupportValues;
4774 return GetPropertyAtIndexAs<bool>(
4775 idx, g_target_properties[idx].default_uint_value != 0);
4779 const uint32_t idx = ePropertyDisplayRuntimeSupportValues;
4784 const uint32_t idx = ePropertyDisplayRecognizedArguments;
4785 return GetPropertyAtIndexAs<bool>(
4786 idx, g_target_properties[idx].default_uint_value != 0);
4790 const uint32_t idx = ePropertyDisplayRecognizedArguments;
4806 if (input_file_action) {
4811 if (output_file_action) {
4816 if (error_file_action) {
4822 launch_info.
GetFlags().
Test(lldb::eLaunchFlagInheritTCCFromParent));
4827 const uint32_t idx = ePropertyRequireHardwareBreakpoints;
4828 return GetPropertyAtIndexAs<bool>(
4829 idx, g_target_properties[idx].default_uint_value != 0);
4833 const uint32_t idx = ePropertyRequireHardwareBreakpoints;
4838 const uint32_t idx = ePropertyAutoInstallMainExecutable;
4839 return GetPropertyAtIndexAs<bool>(
4840 idx, g_target_properties[idx].default_uint_value != 0);
4901 const uint32_t idx = ePropertyDebugUtilityExpression;
4902 return GetPropertyAtIndexAs<bool>(
4903 idx, g_target_properties[idx].default_uint_value != 0);
4907 const uint32_t idx = ePropertyDebugUtilityExpression;
4914 :
EventData(), m_target_sp(target_sp), m_module_list() {}
4918 :
EventData(), m_target_sp(target_sp), m_module_list(module_list) {}
4923 return "Target::TargetEventData";
4927 for (
size_t i = 0; i < m_module_list.GetSize(); ++i) {
4930 m_module_list.GetModuleAtIndex(i)->GetDescription(
static llvm::raw_ostream & error(Stream &strm)
#define INTERRUPT_REQUESTED(debugger,...)
This handy define will keep you from having to generate a report for the interruption by hand.
#define LLDB_LOG(log,...)
The LLDB_LOG* macros defined below are the way to emit log messages.
#define LLDB_LOGF(log,...)
#define LLDB_LOG_ERROR(log, error,...)
static double elapsed(const StatsTimepoint &start, const StatsTimepoint &end)
static constexpr OptionEnumValueElement g_dynamic_class_info_helper_value_types[]
static bool CheckIfWatchpointsSupported(Target *target, Status &error)
static constexpr OptionEnumValueElement g_load_cwd_lldbinit_values[]
static void LoadScriptingResourceForModule(const ModuleSP &module_sp, Target *target)
static constexpr OptionEnumValueElement g_dynamic_value_types[]
static constexpr OptionEnumValueElement g_memory_module_load_level_values[]
static constexpr OptionEnumValueElement g_load_script_from_sym_file_values[]
static 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.
uint32_t GetAddressByteSize() const
Returns the size in bytes of an address of the current architecture.
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.
bool IsCompatibleMatch(const ArchSpec &rhs) const
Shorthand for IsMatch(rhs, CompatibleMatch).
lldb::ByteOrder GetByteOrder() const
Returns the byte order for the architecture specification.
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 RemoveInvalidLocations(const ArchSpec &arch)
Removes all invalid breakpoint locations.
lldb::BreakpointSP FindBreakpointByID(lldb::break_id_t breakID) const
Returns a shared pointer to the breakpoint with id breakID.
void GetListMutex(std::unique_lock< std::recursive_mutex > &lock)
Sets the passed in Locker to hold the Breakpoint List mutex.
lldb::break_id_t Add(lldb::BreakpointSP &bp_sp, bool notify)
Add the breakpoint bp_sp to the list.
void SetEnabledAllowed(bool enabled)
void ResetHitCounts()
Resets the hit count of all breakpoints.
size_t GetSize() const
Returns the number of elements in this breakpoint list.
void UpdateBreakpointsWhenModuleIsReplaced(lldb::ModuleSP old_module_sp, lldb::ModuleSP new_module_sp)
void RemoveAll(bool notify)
Removes all the breakpoints from this list.
void UpdateBreakpoints(ModuleList &module_list, bool load, bool delete_locations)
Tell all the breakpoints to update themselves due to a change in the modules in module_list.
void ClearAllBreakpointSites()
llvm::Expected< std::vector< lldb::BreakpointSP > > FindBreakpointsByName(const char *name)
Find all the breakpoints with a given name.
void Dump(Stream *s) const
Standard "Dump" method. At present it does nothing.
bool Remove(lldb::break_id_t breakID, bool notify)
Removes the breakpoint given by breakID from this list.
void RemoveAllowed(bool notify)
Removes all the breakpoints from this list - first checking the ePermDelete on the breakpoints.
lldb::BreakpointSP GetBreakpointAtIndex(size_t i) const
Returns a shared pointer to the breakpoint with index i.
void SetEnabledAll(bool enabled)
void MergeInto(const Permissions &incoming)
ConstString GetName() const
Permissions & GetPermissions()
BreakpointOptions & GetOptions()
void ConfigureBreakpoint(lldb::BreakpointSP bp_sp)
"lldb/Breakpoint/BreakpointOptions.h" Class that manages the options on a breakpoint or breakpoint lo...
void CopyOverSetOptions(const BreakpointOptions &rhs)
Copy over only the options set in the incoming BreakpointOptions.
"lldb/Breakpoint/BreakpointResolverAddress.h" This class sets breakpoints on a given Address.
"lldb/Breakpoint/BreakpointResolverFileLine.h" This class sets breakpoints by file and line.
"lldb/Breakpoint/BreakpointResolverFileRegex.h" This class sets breakpoints by file and line.
"lldb/Breakpoint/BreakpointResolverName.h" This class sets breakpoints on a given function name,...
"lldb/Breakpoint/BreakpointResolverScripted.h" This class sets breakpoints on a given Address.
General Outline: A breakpoint has four main parts, a filter, a resolver, the list of breakpoint locat...
virtual StructuredData::ObjectSP SerializeToStructuredData()
static lldb::BreakpointSP CreateFromStructuredData(lldb::TargetSP target_sp, StructuredData::ObjectSP &data_object_sp, Status &error)
static lldb::BreakpointSP CopyFromBreakpoint(lldb::TargetSP new_target, const Breakpoint &bp_to_copy_from)
static const char * GetSerializationKey()
static bool SerializedBreakpointMatchesNames(StructuredData::ObjectSP &bkpt_object_sp, std::vector< std::string > &names)
An event broadcasting class.
void SetEventName(uint32_t event_mask, const char *name)
Set the name for an event bit.
void BroadcastEvent(lldb::EventSP &event_sp)
Broadcast an event which has no associated data.
void CheckInWithManager()
A class that implements CRTP-based "virtual constructor" idiom.
void SetStopOnContinue(bool stop_on_continue)
void SetPrintErrors(bool print_errors)
void SetEchoCommands(bool echo_commands)
void SetAddToHistory(bool add_to_history)
void SetStopOnError(bool stop_on_error)
void SetPrintResults(bool print_results)
void HandleCommands(const StringList &commands, const ExecutionContext &context, const CommandInterpreterRunOptions &options, CommandReturnObject &result)
Execute a list of commands in sequence.
void SetInteractive(bool b)
void SetImmediateOutputStream(const lldb::StreamSP &stream_sp)
lldb::ReturnStatus GetStatus() const
Generic representation of a type in a programming language.
A uniqued constant string class.
const char * AsCString(const char *value_if_empty=nullptr) const
Get the string value as a C string.
bool IsEmpty() const
Test for empty string.
llvm::StringRef GetStringRef() const
Get the string value as a llvm::StringRef.
const char * GetCString() const
Get the string value as a C string.
A class to manage flag bits.
lldb::StreamSP GetAsyncOutputStream()
void SetAsyncExecution(bool async)
CommandInterpreter & GetCommandInterpreter()
StreamFile & GetErrorStream()
TargetList & GetTargetList()
Get accessor for the target list.
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()
lldb::LanguageType GetREPLLanguage() const
std::string GetString(char separator='\n')
A class that measures elapsed time in an exception safe way.
static constexpr std::chrono::milliseconds default_timeout
virtual llvm::StringRef GetFlavor() const =0
"lldb/Target/ExecutionContextScope.h" Inherit from this if your object can reconstruct its execution ...
virtual void CalculateExecutionContext(ExecutionContext &exe_ctx)=0
Reconstruct the object's execution context into sc.
"lldb/Target/ExecutionContext.h" A class that contains an execution context.
void Clear()
Clear the object's state.
void SetTargetPtr(Target *target)
Set accessor to set only the target shared pointer from a target pointer.
StackFrame * GetFramePtr() const
Returns a pointer to the frame object.
Target * GetTargetPtr() const
Returns a pointer to the target object.
Thread & GetThreadRef() const
Returns a reference to the thread object.
llvm::StringRef GetPath() const
const FileSpec & GetFileSpecAtIndex(size_t idx) const
Get file at index.
void Append(const FileSpec &file)
Append a FileSpec object to the list.
size_t GetSize() const
Get the number of files in the file list.
void AppendPathComponent(llvm::StringRef component)
void SetDirectory(ConstString directory)
Directory string set accessor.
const ConstString & GetFilename() const
Filename string const get accessor.
const ConstString & GetDirectory() const
Directory string const get accessor.
void SetPath(llvm::StringRef p)
Temporary helper for FileSystem change.
size_t GetPath(char *path, size_t max_path_length, bool denormalize=true) const
Extract the full path to the file.
bool IsSourceImplementationFile() const
Returns true if the filespec represents an implementation source file (files with a "....
void SetFilename(ConstString filename)
Filename string set accessor.
bool Exists(const FileSpec &file_spec) const
Returns whether the given file exists.
bool IsDirectory(const FileSpec &file_spec) const
Returns whether the given path is a directory.
static FileSystem & Instance()
bool IsValid() const override
IsValid.
ValueType Clear(ValueType mask=~static_cast< ValueType >(0))
Clear one or more flags.
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)
static LanguageSet GetLanguagesSupportingTypeSystemsForExpressions()
virtual llvm::StringRef GetUserEntryPointName() const
static std::set< lldb::LanguageType > GetSupportedLanguages()
static lldb::ListenerSP MakeListener(const char *name)
lldb::ModuleSP GetModule() const
Get const accessor for the module pointer.
A collection class for Module objects.
bool ReplaceModule(const lldb::ModuleSP &old_module_sp, const lldb::ModuleSP &new_module_sp)
void ForEach(std::function< bool(const lldb::ModuleSP &module_sp)> const &callback) const
Applies 'callback' to each module in this ModuleList.
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.
size_t GetIndexForModule(const Module *module) const
lldb::ModuleSP FindFirstModule(const ModuleSpec &module_spec) const
void Clear()
Clear the object's state.
void Dump(Stream *s) const
Dump the description of each module contained in this list.
static bool RemoveSharedModuleIfOrphaned(const Module *module_ptr)
bool AppendIfNeeded(const lldb::ModuleSP &new_module, bool notify=true)
Append a module to the module list, if it is not already there.
static Status GetSharedModule(const ModuleSpec &module_spec, lldb::ModuleSP &module_sp, const FileSpecList *module_search_paths_ptr, llvm::SmallVectorImpl< lldb::ModuleSP > *old_modules, bool *did_create_ptr, bool always_create=false)
void FindModules(const ModuleSpec &module_spec, ModuleList &matching_module_list) const
Finds the first module whose file specification matches file_spec.
bool Remove(const lldb::ModuleSP &module_sp, bool notify=true)
Remove a module from the module list.
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 ResolveFileAddress(lldb::addr_t vm_addr, Address &so_addr) const
size_t GetSize() const
Gets the size of the module list.
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.
bool FileHasChanged() const
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)
static lldb::OptionValuePropertiesSP CreateLocalCopy(const Properties &global_properties)
bool RemapPath(ConstString path, ConstString &new_path) const
std::optional< llvm::StringRef > ReverseRemapPath(const FileSpec &file, FileSpec &fixed) const
Perform reverse source path remap for input file.
static std::unique_ptr< Architecture > CreateArchitectureInstance(const ArchSpec &arch)
static lldb::RegisterTypeBuilderSP GetRegisterTypeBuilder(Target &target)
bool ProcessInfoSpecified() const
lldb::ListenerSP GetListenerForProcess(Debugger &debugger)
llvm::StringRef GetProcessPluginName() const
void SetHijackListener(const lldb::ListenerSP &listener_sp)
void SetExecutableFile(const FileSpec &exe_file, bool add_exe_file_as_first_arg)
lldb::ScriptedMetadataSP GetScriptedMetadata() const
lldb::ListenerSP GetHijackListener() const
void SetArg0(llvm::StringRef arg)
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()
lldb::OptionValuePropertiesSP m_collection_sp
static llvm::StringRef GetExperimentalSettingsName()
bool SetPropertyAtIndex(uint32_t idx, T t, const ExecutionContext *exe_ctx=nullptr) const
virtual 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
virtual bool ScriptedStopHookHandleStop(StructuredData::GenericSP implementor_sp, ExecutionContext &exc_ctx, lldb::StreamSP stream_sp)
virtual StructuredData::GenericSP CreateScriptedStopHook(lldb::TargetSP target_sp, const char *class_name, const StructuredDataImpl &args_data, Status &error)
"lldb/Core/SearchFilter.h" This is a SearchFilter that searches through all modules.
size_t GetNumSections(uint32_t depth) const
lldb::SectionSP GetSectionAtIndex(size_t idx) const
bool ResolveLoadAddress(uint32_t stop_id, lldb::addr_t load_addr, Address &so_addr)
bool SetSectionLoadAddress(uint32_t stop_id, const lldb::SectionSP §ion_sp, lldb::addr_t load_addr, bool warn_multiple=false)
lldb::addr_t GetSectionLoadAddress(uint32_t stop_id, const lldb::SectionSP §ion_sp)
bool SetSectionUnloaded(uint32_t stop_id, const lldb::SectionSP §ion_sp, lldb::addr_t load_addr)
uint32_t GetLastStopID() const
bool ResolveLoadAddress(lldb::addr_t load_addr, Address &so_addr, bool allow_section_end=false) const
"lldb/Core/SourceLocationSpec.h" A source location specifier class.
Class that provides a registry of known stack frame recognizers.
const SymbolContext & GetSymbolContext(lldb::SymbolContextItem resolve_scope)
Provide a SymbolContext for this StackFrame's current pc value.
void Clear()
Clear the object state.
int SetErrorStringWithFormat(const char *format,...) __attribute__((format(printf
Set the current error string to a formatted error string.
bool Fail() const
Test for error condition.
void SetErrorString(llvm::StringRef err_str)
Set the current error string to err_str.
bool Success() const
Test for success condition.
const char * GetData() const
llvm::StringRef GetString() const
A stream class that can stream formatted output to a file.
void Format(const char *format, Args &&... args)
llvm::raw_ostream & AsRawOstream()
Returns a raw_ostream that forwards the data to this Stream object.
size_t Indent(llvm::StringRef s="")
Indent the current line in the stream.
size_t Printf(const char *format,...) __attribute__((format(printf
Output printf formatted output to the stream.
size_t PutCString(llvm::StringRef cstr)
Output a C string to the stream.
void SetIndentLevel(unsigned level)
Set the current indentation level.
void IndentLess(unsigned amount=2)
Decrement the current indentation level.
void IndentMore(unsigned amount=2)
Increment the current indentation level.
unsigned GetIndentLevel() const
Get the current indentation level.
void AddItem(const ObjectSP &item)
ObjectSP GetItemAtIndex(size_t idx) const
ObjectSP GetValueForKey(llvm::StringRef key) const
void ForEach(std::function< bool(llvm::StringRef key, Object *object)> const &callback) const
Dictionary * GetAsDictionary()
virtual bool IsValid() const
void Dump(lldb_private::Stream &s, bool pretty_print=true) const
std::shared_ptr< Object > ObjectSP
std::shared_ptr< Array > ArraySP
static ObjectSP ParseJSONFromFile(const FileSpec &file, Status &error)
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()
bool GetDisplayRecognizedArguments() const
ImportStdModule GetImportStdModule() const
bool GetDisableSTDIO() const
bool GetMoveToNearestCode() const
~TargetProperties() override
void AppendExecutableSearchPaths(const FileSpec &)
void SetInheritTCC(bool b)
bool GetEnableSyntheticValue() const
void UpdateLaunchInfoFromProperties()
ProcessLaunchInfo m_launch_info
uint64_t GetExprAllocAlign() const
MemoryModuleLoadLevel GetMemoryModuleLoadLevel() const
llvm::StringRef GetArg0() const
uint32_t GetMaximumMemReadSize() const
void SetRunArguments(const Args &args)
FileSpec GetStandardErrorPath() const
bool GetEnableNotifyAboutFixIts() const
bool SetPreferDynamicValue(lldb::DynamicValueType d)
void SetDisplayRecognizedArguments(bool b)
std::optional< bool > GetExperimentalPropertyValue(size_t prop_idx, ExecutionContext *exe_ctx=nullptr) const
bool GetDisableASLR() const
bool GetUseFastStepping() const
const ProcessLaunchInfo & GetProcessLaunchInfo() const
Environment ComputeEnvironment() const
void Arg0ValueChangedCallback()
bool GetUserSpecifiedTrapHandlerNames(Args &args) const
uint64_t GetExprErrorLimit() const
bool GetEnableAutoImportClangModules() const
bool GetDebugUtilityExpression() const
void CheckJITObjectsDir()
bool GetSkipPrologue() const
DynamicClassInfoHelper GetDynamicClassInfoHelper() const
FileSpec GetStandardOutputPath() const
void InputPathValueChangedCallback()
void SetDisplayRuntimeSupportValues(bool b)
uint32_t GetMaximumNumberOfChildrenToDisplay() const
void SetRequireHardwareBreakpoints(bool b)
void SetDisableSTDIO(bool b)
bool GetAutoInstallMainExecutable() const
RealpathPrefixes GetSourceRealpathPrefixes() const
uint64_t GetNumberOfRetriesWithFixits() const
uint64_t GetExprAllocSize() const
llvm::StringRef GetExpressionPrefixContents()
PathMappingList & GetObjectPathMap() const
const char * GetDisassemblyFlavor() const
void SetPreloadSymbols(bool b)
FileSpec GetStandardInputPath() const
bool GetInheritTCC() const
void InheritTCCValueChangedCallback()
lldb::DynamicValueType GetPreferDynamicValue() const
void DisableSTDIOValueChangedCallback()
InlineStrategy GetInlineStrategy() const
Environment GetTargetEnvironment() const
bool GetDisplayRuntimeSupportValues() const
void SetDetachOnError(bool b)
void SetUserSpecifiedTrapHandlerNames(const Args &args)
bool GetUseHexImmediates() const
bool GetPreloadSymbols() const
uint32_t GetMaxZeroPaddingInFloatFormat() const
uint64_t GetExprAllocAddress() const
void DetachOnErrorValueChangedCallback()
LoadCWDlldbinitFile GetLoadCWDlldbinitFile() const
Environment GetInheritedEnvironment() const
void SetArg0(llvm::StringRef arg)
void EnvVarsValueChangedCallback()
bool GetInjectLocalVariables(ExecutionContext *exe_ctx) const
bool ShowHexVariableValuesWithLeadingZeroes() const
SourceLanguage GetLanguage() const
void OutputPathValueChangedCallback()
Environment GetEnvironment() const
void SetProcessLaunchInfo(const ProcessLaunchInfo &launch_info)
void RunArgsValueChangedCallback()
FileSpec GetSaveJITObjectsDir() const
void SetEnvironment(Environment env)
LoadScriptFromSymFile GetLoadScriptFromSymbolFile() const
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
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
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
llvm::json::Value ToJSON(Target &target, const lldb_private::StatisticsOptions &options)
StatsDuration & GetCreateTime()
StatsSuccessFail & GetExpressionStats()
void SetLaunchOrAttachTime()
const ArchSpec & GetSpec() const
const Arch & operator=(const ArchSpec &spec)
Arch(const ArchSpec &spec)
void SetActionFromString(const std::string &strings)
void SetActionFromStrings(const std::vector< std::string > &strings)
StopHookResult HandleStop(ExecutionContext &exc_ctx, lldb::StreamSP output_sp) override
void GetSubclassDescription(Stream &s, lldb::DescriptionLevel level) const override
Status SetScriptCallback(std::string class_name, StructuredData::ObjectSP extra_args_sp)
StopHookResult HandleStop(ExecutionContext &exc_ctx, lldb::StreamSP output) override
void GetSubclassDescription(Stream &s, lldb::DescriptionLevel level) const override
void SetSpecifier(SymbolContextSpecifier *specifier)
std::unique_ptr< ThreadSpec > m_thread_spec_up
void SetThreadSpecifier(ThreadSpec *specifier)
StopHook(const StopHook &rhs)
bool ExecutionContextPasses(const ExecutionContext &exe_ctx)
void GetDescription(Stream &s, lldb::DescriptionLevel level) const
void Dump(Stream *s) const override
static llvm::StringRef GetFlavorString()
static ModuleList GetModuleListFromEvent(const Event *event_ptr)
~TargetEventData() override
static const TargetEventData * GetEventDataFromEvent(const Event *event_ptr)
TargetEventData(const lldb::TargetSP &target_sp)
lldb::TargetSP m_target_sp
static lldb::TargetSP GetTargetFromEvent(const Event *event_ptr)
void ModulesDidLoad(ModuleList &module_list)
lldb::ThreadSP CalculateThread() override
StopHookCollection m_stop_hooks
Module * GetExecutableModulePointer()
void Dump(Stream *s, lldb::DescriptionLevel description_level)
Dump a description of this object to a Stream.
bool m_suppress_stop_hooks
void DisableAllBreakpoints(bool internal_also=false)
lldb::WatchpointSP CreateWatchpoint(lldb::addr_t addr, size_t size, const CompilerType *type, uint32_t kind, Status &error)
void ApplyNameToBreakpoints(BreakpointName &bp_name)
StopHookSP CreateStopHook(StopHook::StopHookKind kind)
Add an empty stop hook to the Target's stop hook list, and returns a shared pointer to it in new_hook...
lldb::TraceSP GetTrace()
Get the Trace object containing processor trace information of this target.
PathMappingList & GetImageSearchPathList()
void FinalizeFileActions(ProcessLaunchInfo &info)
lldb::addr_t GetCallableLoadAddress(lldb::addr_t load_addr, AddressClass addr_class=AddressClass::eInvalid) const
Get load_addr as a callable code load address for this target.
lldb::addr_t GetOpcodeLoadAddress(lldb::addr_t load_addr, AddressClass addr_class=AddressClass::eInvalid) const
Get load_addr as an opcode for this target.
lldb::BreakpointSP CreateScriptedBreakpoint(const llvm::StringRef class_name, const FileSpecList *containingModules, const FileSpecList *containingSourceFiles, bool internal, bool request_hardware, StructuredData::ObjectSP extra_args_sp, Status *creation_error=nullptr)
static Target * GetTargetFromContexts(const ExecutionContext *exe_ctx_ptr, const SymbolContext *sc_ptr)
lldb::addr_t GetBreakableLoadAddress(lldb::addr_t addr)
void ClearDummySignals(Args &signal_names)
Clear the dummy signals in signal_names from the target, or all signals if signal_names is empty.
static void ImageSearchPathsChanged(const PathMappingList &path_list, void *baton)
llvm::Expected< lldb_private::Address > GetEntryPointAddress()
This method will return the address of the starting function for this binary, e.g.
bool IgnoreWatchpointByID(lldb::watch_id_t watch_id, uint32_t ignore_count)
lldb::BreakpointSP CreateFuncRegexBreakpoint(const FileSpecList *containingModules, const FileSpecList *containingSourceFiles, RegularExpression func_regexp, lldb::LanguageType requested_language, LazyBool skip_prologue, bool internal, bool request_hardware)
lldb::BreakpointSP GetBreakpointByID(lldb::break_id_t break_id)
std::shared_ptr< StopHook > StopHookSP
void SymbolsDidLoad(ModuleList &module_list)
bool ClearAllWatchpointHistoricValues()
void SetTrace(const lldb::TraceSP &trace_sp)
Set the Trace object containing processor trace information of this target.
BreakpointList & GetBreakpointList(bool internal=false)
CompilerType GetRegisterType(const std::string &name, const lldb_private::RegisterFlags &flags, uint32_t byte_size)
BreakpointNameList m_breakpoint_names
llvm::StringRef GetABIName() const
Returns the name of the target's ABI plugin.
SourceManager & GetSourceManager()
lldb::SearchFilterSP GetSearchFilterForModuleList(const FileSpecList *containingModuleList)
StopHookSP GetStopHookByID(lldb::user_id_t uid)
llvm::StringMap< DummySignalValues > m_dummy_signals
These are used to set the signal state when you don't have a process and more usefully in the Dummy t...
lldb::ProcessSP m_process_sp
lldb::SearchFilterSP m_search_filter_sp
PersistentExpressionState * GetPersistentExpressionStateForLanguage(lldb::LanguageType language)
void UpdateSignalsFromDummy(lldb::UnixSignalsSP signals_sp, lldb::StreamSP warning_stream_sp)
Updates the signals in signals_sp using the stored dummy signals.
bool m_is_dummy_target
Used to not run stop hooks for expressions.
static bool UpdateSignalFromDummy(lldb::UnixSignalsSP signals_sp, const DummySignalElement &element)
PathMappingList m_image_search_paths
bool ModuleIsExcludedForUnconstrainedSearches(const FileSpec &module_spec)
Return whether this FileSpec corresponds to a module that should be considered for general searches.
lldb::StackFrameSP CalculateStackFrame() override
SectionLoadList & GetSectionLoadList()
lldb::addr_t GetPersistentSymbol(ConstString name)
void PrimeFromDummyTarget(Target &target)
static void SettingsTerminate()
bool EnableWatchpointByID(lldb::watch_id_t watch_id)
bool ResolveFileAddress(lldb::addr_t load_addr, Address &so_addr)
bool ClearAllWatchpointHitCounts()
size_t ReadMemoryFromFileCache(const Address &addr, void *dst, size_t dst_len, Status &error)
void ClearAllLoadedSections()
std::vector< lldb::TypeSystemSP > GetScratchTypeSystems(bool create_on_demand=true)
size_t ReadScalarIntegerFromMemory(const Address &addr, uint32_t byte_size, bool is_signed, Scalar &scalar, Status &error, bool force_live_memory=false)
void AddNameToBreakpoint(BreakpointID &id, llvm::StringRef name, Status &error)
void DeleteCurrentProcess()
BreakpointList m_internal_breakpoint_list
void DisableAllowedBreakpoints()
bool SetSectionUnloaded(const lldb::SectionSP §ion_sp)
lldb::TargetSP CalculateTarget() override
const lldb::ProcessSP & GetProcessSP() const
void ClearModules(bool delete_locations)
bool RemoveBreakpointByID(lldb::break_id_t break_id)
lldb::ModuleSP GetOrCreateModule(const ModuleSpec &module_spec, bool notify, Status *error_ptr=nullptr)
Find a binary on the system and return its Module, or return an existing Module that is already in th...
static bool ResetSignalFromDummy(lldb::UnixSignalsSP signals_sp, const DummySignalElement &element)
Architecture * GetArchitecturePlugin() const
llvm::json::Value ReportStatistics(const lldb_private::StatisticsOptions &options)
Get metrics associated with this target in JSON format.
FunctionCaller * GetFunctionCallerForLanguage(lldb::LanguageType language, const CompilerType &return_type, const Address &function_address, const ValueList &arg_value_list, const char *name, Status &error)
void EnableAllBreakpoints(bool internal_also=false)
Status Launch(ProcessLaunchInfo &launch_info, Stream *stream)
bool DisableBreakpointByID(lldb::break_id_t break_id)
lldb::BreakpointSP CreateBreakpointAtUserEntry(Status &error)
BreakpointName * FindBreakpointName(ConstString name, bool can_create, Status &error)
llvm::Expected< lldb::TraceSP > CreateTrace()
Create a Trace object for the current target using the using the default supported tracing technology...
lldb::TraceSP m_trace_sp
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
lldb::SourceManagerUP m_source_manager_up
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 RemoveWatchpointByID(lldb::watch_id_t watch_id)
size_t ReadStringFromMemory(const Address &addr, char *dst, size_t max_bytes, Status &error, size_t type_width, bool force_live_memory=true)
Read a NULL terminated string from memory.
void DeleteBreakpointName(ConstString name)
void NotifyWillClearList(const ModuleList &module_list) override
bool SetArchitecture(const ArchSpec &arch_spec, bool set_platform=false, bool merge=true)
Set the architecture for this target.
void NotifyModuleAdded(const ModuleList &module_list, const lldb::ModuleSP &module_sp) override
Implementing of ModuleList::Notifier.
llvm::Expected< lldb::TypeSystemSP > GetScratchTypeSystemForLanguage(lldb::LanguageType language, bool create_on_demand=true)
void ConfigureBreakpointName(BreakpointName &bp_name, const BreakpointOptions &options, const BreakpointName::Permissions &permissions)
lldb::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)
lldb::ExpressionVariableSP GetPersistentVariable(ConstString name)
void NotifyModulesRemoved(lldb_private::ModuleList &module_list) override
size_t ReadCStringFromMemory(const Address &addr, std::string &out_str, Status &error, bool force_live_memory=false)
std::recursive_mutex m_mutex
An API mutex that is used by the lldb::SB* classes make the SB interface thread safe.
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::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
Status SerializeBreakpointsToFile(const FileSpec &file, const BreakpointIDList &bp_ids, bool append)
void DidExec()
Called as the last function in Process::DidExec().
void SaveScriptedLaunchInfo(lldb_private::ProcessInfo &process_info)
lldb::user_id_t m_stop_hook_next_id
void RemoveAllStopHooks()
static FileSpecList GetDefaultExecutableSearchPaths()
lldb::BreakpointSP CreateExceptionBreakpoint(enum lldb::LanguageType language, bool catch_bp, bool throw_bp, bool internal, Args *additional_args=nullptr, Status *additional_args_error=nullptr)
lldb::SearchFilterSP GetSearchFilterForModule(const FileSpec *containingModule)
llvm::StringMapEntry< DummySignalValues > DummySignalElement
std::recursive_mutex & GetAPIMutex()
static llvm::StringRef GetStaticBroadcasterClass()
static FileSpecList GetDefaultDebugFileSearchPaths()
void EnableAllowedBreakpoints()
llvm::Error SetLabel(llvm::StringRef label)
Set a label for a target.
uint32_t m_latest_stop_hook_id
@ eBroadcastBitModulesLoaded
@ eBroadcastBitSymbolsLoaded
@ eBroadcastBitModulesUnloaded
@ eBroadcastBitWatchpointChanged
@ eBroadcastBitBreakpointChanged
void RemoveAllowedBreakpoints()
bool DisableAllWatchpoints(bool end_to_end=true)
lldb::addr_t GetReasonableReadSize(const Address &addr)
Return a recommended size for memory reads at addr, optimizing for cache usage.
lldb::PlatformSP m_platform_sp
The platform for this target.
llvm::Expected< std::unique_ptr< UtilityFunction > > CreateUtilityFunction(std::string expression, std::string name, lldb::LanguageType language, ExecutionContext &exe_ctx)
Creates and installs a UtilityFunction for the given language.
static TargetProperties & GetGlobalProperties()
Status Install(ProcessLaunchInfo *launch_info)
lldb::PlatformSP GetPlatform()
void NotifyModuleRemoved(const ModuleList &module_list, const lldb::ModuleSP &module_sp) override
lldb::BreakpointSP CreateAddressInModuleBreakpoint(lldb::addr_t file_addr, bool internal, const FileSpec &file_spec, bool request_hardware)
lldb::BreakpointSP CreateBreakpoint(const FileSpecList *containingModules, const FileSpec &file, uint32_t line_no, uint32_t column, lldb::addr_t offset, LazyBool check_inlines, LazyBool skip_prologue, bool internal, bool request_hardware, LazyBool move_to_nearest_code)
bool ResolveLoadAddress(lldb::addr_t load_addr, Address &so_addr, uint32_t stop_id=SectionLoadHistory::eStopIDNow)
void RemoveAllBreakpoints(bool internal_also=false)
lldb::BreakpointSP CreateSourceRegexBreakpoint(const FileSpecList *containingModules, const FileSpecList *source_file_list, const std::unordered_set< std::string > &function_names, RegularExpression source_regex, bool internal, bool request_hardware, LazyBool move_to_nearest_code)
static ArchSpec GetDefaultArchitecture()
void ResetBreakpointHitCounts()
Resets the hit count of all breakpoints.
const ModuleList & GetImages() const
Get accessor for the images for this process.
const ArchSpec & GetArchitecture() const
WatchpointList & GetWatchpointList()
bool EnableBreakpointByID(lldb::break_id_t break_id)
uint64_t ReadUnsignedIntegerFromMemory(const Address &addr, size_t integer_byte_size, uint64_t fail_value, Status &error, bool force_live_memory=false)
bool IgnoreAllWatchpoints(uint32_t ignore_count)
void AddBreakpoint(lldb::BreakpointSP breakpoint_sp, bool internal)
TypeSystemMap m_scratch_type_system_map
void AddBreakpointName(std::unique_ptr< BreakpointName > bp_name)
SectionLoadHistory m_section_load_history
void GetBreakpointNames(std::vector< std::string > &names)
Target(Debugger &debugger, const ArchSpec &target_arch, const lldb::PlatformSP &platform_sp, bool is_dummy_target)
Construct with optional file and arch.
size_t UnloadModuleSections(const lldb::ModuleSP &module_sp)
bool m_valid
This records the last natural stop at which we ran a stop-hook.
bool DisableWatchpointByID(lldb::watch_id_t watch_id)
void AddDummySignal(llvm::StringRef name, LazyBool pass, LazyBool print, LazyBool stop)
Add a signal to the Target's list of stored signals/actions.
lldb::WatchpointSP m_last_created_watchpoint
Status CreateBreakpointsFromFile(const FileSpec &file, BreakpointIDList &new_bps)
void SetREPL(lldb::LanguageType language, lldb::REPLSP repl_sp)
void SetExecutableModule(lldb::ModuleSP &module_sp, LoadDependentFiles load_dependent_files=eLoadDependentsDefault)
Set the main executable module.
lldb::StackFrameRecognizerManagerUP m_frame_recognizer_manager_up
Stores the frame recognizers of this target.
lldb::REPLSP GetREPL(Status &err, lldb::LanguageType language, const char *repl_options, bool can_create)
UserExpression * GetUserExpressionForLanguage(llvm::StringRef expr, llvm::StringRef prefix, SourceLanguage language, Expression::ResultType desired_type, const EvaluateExpressionOptions &options, ValueObject *ctx_obj, Status &error)
ModuleList m_images
The list of images for this process (shared libraries and anything dynamically loaded).
lldb::ProcessSP CalculateProcess() override
void PrintDummySignals(Stream &strm, Args &signals)
Print all the signals set in this target.
void SetPlatform(const lldb::PlatformSP &platform_sp)
bool SetSectionLoadAddress(const lldb::SectionSP §ion, lldb::addr_t load_addr, bool warn_multiple=false)
Status Attach(ProcessAttachInfo &attach_info, Stream *stream)
static void SetDefaultArchitecture(const ArchSpec &arch)
lldb::BreakpointSP m_last_created_breakpoint
void RemoveNameFromBreakpoint(lldb::BreakpointSP &bp_sp, ConstString name)
bool RemoveStopHookByID(lldb::user_id_t uid)
static void SettingsInitialize()
bool EnableAllWatchpoints(bool end_to_end=true)
std::recursive_mutex m_private_mutex
When the private state thread calls SB API's - usually because it is running OS plugin or Python Thre...
lldb::ExpressionResults EvaluateExpression(llvm::StringRef expression, ExecutionContextScope *exe_scope, lldb::ValueObjectSP &result_valobj_sp, const EvaluateExpressionOptions &options=EvaluateExpressionOptions(), std::string *fixed_expression=nullptr, ValueObject *ctx_obj=nullptr)
bool MergeArchitecture(const ArchSpec &arch_spec)
uint32_t GetSize(bool can_update=true)
lldb::ThreadSP GetThreadAtIndex(uint32_t idx, bool can_update=true)
static llvm::Expected< lldb::TraceSP > FindPluginForLiveProcess(llvm::StringRef plugin_name, Process &process)
Find a trace plug-in to trace a live process.
llvm::Expected< lldb::TypeSystemSP > GetTypeSystemForLanguage(lldb::LanguageType language, Module *module, bool can_create)
void ForEach(std::function< bool(lldb::TypeSystemSP)> const &callback)
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, Status &error, 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...
static lldb::ValueObjectSP Create(ExecutionContextScope *exe_scope, lldb::ByteOrder byte_order, uint32_t addr_byte_size, lldb::addr_t address=LLDB_INVALID_ADDRESS)
lldb::watch_id_t Add(const lldb::WatchpointSP &wp_sp, bool notify)
Add a Watchpoint to the list.
void SetEnabledAll(bool enabled)
lldb::WatchpointSP FindByID(lldb::watch_id_t watchID) const
Returns a shared pointer to the watchpoint with id watchID, const version.
void GetListMutex(std::unique_lock< std::recursive_mutex > &lock)
Sets the passed in Locker to hold the Watchpoint List mutex.
WatchpointIterable Watchpoints() const
void RemoveAll(bool notify)
bool Remove(lldb::watch_id_t watchID, bool notify)
Removes the watchpoint given by watchID from this list.
const lldb::WatchpointSP FindByAddress(lldb::addr_t addr) const
Returns a shared pointer to the watchpoint at address addr - const version.
#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
@ SelectMostRelevantFrame
A class that represents a running process on the host machine.
@ eMemoryModuleLoadLevelPartial
@ eMemoryModuleLoadLevelComplete
@ eMemoryModuleLoadLevelMinimal
Log * GetLog(Cat mask)
Retrieve the Log object for the channel associated with the given log enum.
@ eLoadScriptFromSymFileTrue
@ eLoadScriptFromSymFileFalse
@ eLoadScriptFromSymFileWarn
@ eDynamicClassInfoHelperCopyRealizedClassList
@ eDynamicClassInfoHelperGetRealizedClassList
@ eDynamicClassInfoHelperAuto
@ eDynamicClassInfoHelperRealizedClassesStruct
OptionEnumValues GetDynamicValueTypes()
@ eImportStdModuleFallback
const char * StateAsCString(lldb::StateType state)
Converts a StateType to a C string.
llvm::ArrayRef< OptionEnumValueElement > OptionEnumValues
@ eInlineBreakpointsNever
@ eInlineBreakpointsAlways
@ eInlineBreakpointsHeaders
std::shared_ptr< lldb_private::OptionValueProperties > OptionValuePropertiesSP
std::shared_ptr< lldb_private::Trace > TraceSP
std::shared_ptr< lldb_private::TypeSystem > TypeSystemSP
std::shared_ptr< lldb_private::ABI > ABISP
std::shared_ptr< lldb_private::StackFrame > StackFrameSP
std::shared_ptr< lldb_private::SearchFilter > SearchFilterSP
std::shared_ptr< lldb_private::BreakpointResolver > BreakpointResolverSP
DescriptionLevel
Description levels for "void GetDescription(Stream *, DescriptionLevel)" calls.
@ eDescriptionLevelVerbose
std::shared_ptr< lldb_private::Thread > ThreadSP
std::shared_ptr< lldb_private::ValueObject > ValueObjectSP
std::shared_ptr< lldb_private::ExpressionVariable > ExpressionVariableSP
std::shared_ptr< lldb_private::UnixSignals > UnixSignalsSP
std::shared_ptr< lldb_private::Platform > PlatformSP
StateType
Process and Thread States.
@ eStateConnected
Process is connected to remote debug services, but not launched or attached to anything yet.
@ eStateStopped
Process or thread is stopped and can be examined.
@ eStateAttaching
Process is currently trying to attach.
@ eStateExited
Process has exited and can't be examined.
std::shared_ptr< lldb_private::RegisterTypeBuilder > RegisterTypeBuilderSP
LanguageType
Programming language type.
@ eLanguageTypeMipsAssembler
Mips_Assembler.
@ eLanguageTypeUnknown
Unknown or invalid language value.
@ eLanguageTypeC
Non-standardized C, such as K&R.
std::shared_ptr< lldb_private::Stream > StreamSP
std::shared_ptr< lldb_private::Breakpoint > BreakpointSP
ExpressionResults
The results of expression evaluation.
std::shared_ptr< lldb_private::Process > ProcessSP
std::shared_ptr< lldb_private::BreakpointPrecondition > BreakpointPreconditionSP
std::shared_ptr< lldb_private::Event > EventSP
ReturnStatus
Command Return Status Types.
@ eReturnStatusSuccessContinuingResult
@ eReturnStatusSuccessContinuingNoResult
std::shared_ptr< lldb_private::Watchpoint > WatchpointSP
std::shared_ptr< lldb_private::Listener > ListenerSP
std::shared_ptr< lldb_private::DataBuffer > DataBufferSP
std::shared_ptr< lldb_private::Section > SectionSP
std::shared_ptr< lldb_private::Target > TargetSP
std::shared_ptr< lldb_private::Module > ModuleSP
std::shared_ptr< lldb_private::REPL > REPLSP
A SmallBitVector that represents a set of source languages (lldb::LanguageType).
llvm::SmallBitVector bitvector
std::optional< lldb::LanguageType > GetSingularLanguage()
If the set contains a single language only, return it.
const char * string_value
A type-erased pair of llvm::dwarf::SourceLanguageName and version.
lldb::LanguageType AsLanguageType() const
llvm::StringRef GetDescription() const
A mix in class that contains a generic user ID.
lldb::user_id_t GetID() const
Get accessor for the user ID.