28 #include "lldb/Host/Config.h"
52 #include "llvm/Support/Compiler.h"
81 : m_parent(&parent), m_update_point(parent.GetUpdatePoint()),
94 : m_update_point(exe_scope), m_manager(&manager),
95 m_address_type_of_ptr_or_ref_children(child_ptr_or_ref_addr_type),
100 const ArchSpec &arch = target_sp->GetArchitecture();
113 bool did_change_formats =
false;
127 if (update_format && !did_change_formats)
158 bool need_compare_checksums =
false;
159 llvm::SmallVector<uint8_t, 16> old_checksum;
162 need_compare_checksums =
true;
165 old_checksum.begin());
174 const uint64_t max_checksum_size = 128;
177 need_compare_checksums =
false;
181 assert(!need_compare_checksums ||
190 }
else if (need_compare_checksums) {
205 "[%s %p] checking for FormatManager revisions. ValueObject "
206 "rev: %d - Global rev: %d",
207 GetName().GetCString(),
static_cast<void *
>(
this),
211 bool any_change =
false;
220 #if LLDB_ENABLE_PYTHON
253 return compiler_type;
258 ProcessSP process_sp(
262 return compiler_type;
266 if (llvm::Optional<CompilerType> complete_type =
267 runtime->GetRuntimeType(compiler_type)) {
273 return compiler_type;
296 switch (value_type) {
306 else if (reg_info->alt_name)
322 sstr.
Printf(
"0x%*.*llx", addr_nibble_size, addr_nibble_size,
341 if (bitfield_bit_size)
352 LazyBool is_logical_true = language->IsLogicalTrue(*
this,
error);
353 switch (is_logical_true) {
356 return (is_logical_true ==
true);
365 error.SetErrorString(
"failed to get a scalar result");
376 ValueObjectSP child_sp;
389 if (child !=
nullptr)
390 return child->
GetSP();
397 size_t *index_of_error) {
398 if (idxs.size() == 0)
400 ValueObjectSP root(
GetSP());
401 for (
size_t idx : idxs) {
402 root = root->GetChildAtIndex(idx,
true);
405 *index_of_error = idx;
413 llvm::ArrayRef<std::pair<size_t, bool>> idxs,
size_t *index_of_error) {
414 if (idxs.size() == 0)
416 ValueObjectSP root(
GetSP());
417 for (std::pair<size_t, bool> idx : idxs) {
418 root = root->GetChildAtIndex(idx.first, idx.second);
421 *index_of_error = idx.first;
431 if (names.size() == 0)
433 ValueObjectSP root(
GetSP());
435 root = root->GetChildMemberWithName(name,
true);
438 *name_of_error = name;
446 llvm::ArrayRef<std::pair<ConstString, bool>> names,
448 if (names.size() == 0)
450 ValueObjectSP root(
GetSP());
451 for (std::pair<ConstString, bool> name : names) {
452 root = root->GetChildMemberWithName(name.first, name.second);
455 *name_of_error = name.first;
463 bool omit_empty_base_classes =
true;
465 omit_empty_base_classes);
477 std::vector<uint32_t> child_indexes;
478 bool omit_empty_base_classes =
true;
481 return ValueObjectSP();
483 const size_t num_child_indexes =
485 name.
GetCString(), omit_empty_base_classes, child_indexes);
486 if (num_child_indexes == 0)
489 ValueObjectSP child_sp =
GetSP();
492 child_sp = child_sp->GetChildAtIndex(idx, can_create);
502 return children_count <= max ? children_count : max;
514 bool has_children =
false;
517 if (type_info & (eTypeHasChildren | eTypeIsPointer | eTypeIsReference))
532 bool synthetic_array_member,
533 int32_t synthetic_index) {
536 bool omit_empty_base_classes =
true;
537 bool ignore_array_bounds = synthetic_array_member;
540 int32_t child_byte_offset = 0;
541 uint32_t child_bitfield_bit_size = 0;
542 uint32_t child_bitfield_bit_offset = 0;
543 bool child_is_base_class =
false;
544 bool child_is_deref_of_parent =
false;
545 uint64_t language_flags = 0;
547 const bool transparent_pointers = !synthetic_array_member;
553 &exe_ctx, idx, transparent_pointers, omit_empty_base_classes,
554 ignore_array_bounds, child_name_str, child_byte_size, child_byte_offset,
555 child_bitfield_bit_size, child_bitfield_bit_offset, child_is_base_class,
556 child_is_deref_of_parent,
this, language_flags);
557 if (child_compiler_type) {
559 child_byte_offset += child_byte_size * synthetic_index;
562 if (!child_name_str.empty())
563 child_name.
SetCString(child_name_str.c_str());
566 *
this, child_compiler_type, child_name, child_byte_size,
567 child_byte_offset, child_bitfield_bit_size, child_bitfield_bit_offset,
574 if (!valobj && synthetic_array_member) {
576 valobj = synth_valobj_sp
623 summary_ptr->
FormatObject(
this, destination, actual_options);
626 return !destination.empty();
649 bool is_char_arr_ptr(type_flags.
AnySet(eTypeIsArray | eTypeIsPointer) &&
650 pointee_or_element_compiler_type.
IsCharType());
651 if (!is_char_arr_ptr)
655 if (type_flags.
Test(eTypeIsArray))
667 const bool is_pointer_type = type_info & eTypeIsPointer;
668 const bool is_array_type = type_info & eTypeIsArray;
669 if (!(is_pointer_type || is_array_type))
677 llvm::Optional<uint64_t> item_type_size =
682 const uint64_t bytes = item_count * *item_type_size;
683 const uint64_t offset = item_idx * *item_type_size;
685 if (item_idx == 0 && item_count == 1)
687 if (is_pointer_type) {
690 if (
error.Fail() || pointee_sp.get() ==
nullptr)
692 return pointee_sp->GetData(data,
error);
695 if (child_sp.get() ==
nullptr)
698 return child_sp->GetData(data,
error);
705 lldb::DataBufferSP data_sp(heap_buf_ptr =
716 addr = addr + offset;
718 module_sp->ResolveFileAddress(addr, so_addr);
724 so_addr, heap_buf_ptr->GetBytes(), bytes,
error,
true);
725 if (
error.Success()) {
738 addr + offset, heap_buf_ptr->GetBytes(), bytes,
error);
739 if (
error.Success() || bytes_read > 0) {
748 if (max_bytes && *max_bytes > offset) {
749 size_t bytes_read = std::min<uint64_t>(*max_bytes - offset, bytes);
753 heap_buf_ptr->
CopyData((uint8_t *)(addr + offset), bytes_read);
788 error.SetErrorString(
"unable to read value");
795 const size_t byte_size =
GetByteSize().getValueOr(0);
799 switch (value_type) {
801 error.SetErrorString(
"invalid location");
808 error.SetErrorStringWithFormat(
"unable to set scalar value: %s",
822 if (!
error.Success())
824 if (bytes_written != byte_size) {
825 error.SetErrorString(
"unable to write value to memory");
851 lldb::WritableDataBufferSP &destination) {
852 llvm::StringRef src = source.
GetString();
853 src = src.rtrim(
'\0');
854 destination = std::make_shared<DataBufferHeap>(src.size(), 0);
855 memcpy(destination->GetBytes(), src.data(), src.size());
859 std::pair<size_t, bool>
862 bool honor_array,
Format item_format) {
863 bool was_capped =
false;
869 s <<
"<no target to read from>";
870 error.SetErrorString(
"no target to read from");
872 return {0, was_capped};
878 size_t bytes_read = 0;
879 size_t total_bytes_read = 0;
884 if (type_flags.
AnySet(eTypeIsArray | eTypeIsPointer) &&
890 bool capped_data =
false;
891 const bool is_array = type_flags.
Test(eTypeIsArray);
894 uint64_t array_size = 0;
895 if (compiler_type.
IsArrayType(
nullptr, &array_size)) {
896 cstr_len = array_size;
897 if (cstr_len > max_length) {
899 cstr_len = max_length;
911 if (cstr ==
nullptr) {
912 s <<
"<invalid address>";
913 error.SetErrorString(
"invalid address");
915 return {0, was_capped};
917 s << llvm::StringRef(cstr, cstr_len);
919 return {cstr_len, was_capped};
921 s <<
"<invalid address>";
922 error.SetErrorString(
"invalid address");
924 return {0, was_capped};
928 Address cstr_so_addr(cstr_address);
930 if (cstr_len > 0 && honor_array) {
938 total_bytes_read = bytes_read;
939 for (
size_t offset = 0; offset < bytes_read; offset++)
945 cstr_len = max_length;
946 const size_t k_max_buf_size = 64;
950 int cstr_len_displayed = -1;
951 bool capped_cstr =
false;
956 while ((bytes_read =
GetPointeeData(data, offset, k_max_buf_size)) > 0) {
957 total_bytes_read += bytes_read;
958 const char *cstr = data.
PeekCStr(0);
959 size_t len = strnlen(cstr, k_max_buf_size);
960 if (cstr_len_displayed < 0)
961 cstr_len_displayed = len;
965 cstr_len_displayed += len;
966 if (len > bytes_read)
971 for (
size_t offset = 0; offset < bytes_read; offset++)
974 if (len < k_max_buf_size)
977 if (len >= cstr_len) {
986 if (cstr_len_displayed >= 0) {
992 error.SetErrorString(
"not a string object");
993 s <<
"<not a string object>";
996 return {total_bytes_read, was_capped};
1013 auto get_object_description = [&](
LanguageType language) ->
const char * {
1016 if (runtime->GetObjectDescription(s, *
this)) {
1026 if (
const char *desc = get_object_description(native_language))
1051 lldb::TypeFormatImplSP format_sp;
1063 my_format = reg_info->format;
1073 format_sp = std::make_shared<TypeFormatImpl_Format>(my_format);
1133 if (flags.
AnySet(eTypeIsArray | eTypeIsPointer) &&
1140 if (flags.
Test(eTypeIsArray)) {
1166 bool do_dump_error) {
1170 bool allow_special =
1172 const bool only_special =
false;
1174 if (allow_special) {
1175 if (flags.
AnySet(eTypeIsArray | eTypeIsPointer) &&
1187 lldb::WritableDataBufferSP buffer_sp;
1191 lldb_private::formatters::StringPrinter::
1192 ReadBufferAndDumpToStreamOptions options(*
this);
1205 return !
error.Fail();
1213 if (flags.
Test(eTypeIsArray)) {
1219 for (
size_t low = 0; low < count; low++) {
1226 s <<
"<invalid child>";
1229 child->DumpPrintableRepresentation(
1260 for (
size_t low = 0; low < count; low++) {
1267 s <<
"<invalid child>";
1270 child->DumpPrintableRepresentation(
1302 bool var_success =
false;
1305 llvm::StringRef str;
1316 switch (val_obj_display) {
1377 else if (val_obj_display ==
1379 s.
PutCString(
"<not a valid Objective-C object>");
1384 s.
PutCString(
"<no printable representation>");
1412 if (scalar_is_load_address) {
1470 error.SetErrorString(
"unable to read value");
1477 const size_t byte_size =
GetByteSize().getValueOr(0);
1484 }
else if (byte_size <= 16) {
1490 if (
error.Success()) {
1491 switch (value_type) {
1502 target_addr, new_scalar, byte_size,
error);
1503 if (!
error.Success())
1505 if (bytes_written != byte_size) {
1506 error.SetErrorString(
"unable to write value to memory");
1519 bool success = new_scalar.
GetData(new_data);
1529 error.SetErrorString(
"invalid location");
1540 error.SetErrorString(
"unable to write aggregate data type");
1561 ValueObjectSP synthetic_child_sp;
1562 std::map<ConstString, ValueObject *>::const_iterator pos =
1565 synthetic_child_sp = pos->second->GetSP();
1566 return synthetic_child_sp;
1589 if (runtime->IsAllowedRuntimeValue(
GetName()))
1597 return language->IsNilReference(*
this);
1604 return language->IsUninitializedReference(*
this);
1620 ValueObjectSP synthetic_child_sp;
1622 std::string index_str = llvm::formatv(
"[{0}]", index);
1627 if (!synthetic_child_sp) {
1634 if (synthetic_child) {
1636 synthetic_child_sp = synthetic_child->
GetSP();
1637 synthetic_child_sp->SetName(
ConstString(index_str));
1638 synthetic_child_sp->m_flags.m_is_array_item_for_pointer =
true;
1642 return synthetic_child_sp;
1647 ValueObjectSP synthetic_child_sp;
1649 std::string index_str = llvm::formatv(
"[{0}-{1}]", from, to);
1654 if (!synthetic_child_sp) {
1655 uint32_t bit_field_size = to - from + 1;
1659 GetByteSize().getValueOr(0) * 8 - bit_field_size - bit_field_offset;
1664 GetByteSize().getValueOr(0), 0, bit_field_size, bit_field_offset,
1668 if (synthetic_child) {
1670 synthetic_child_sp = synthetic_child->
GetSP();
1671 synthetic_child_sp->SetName(
ConstString(index_str));
1672 synthetic_child_sp->m_flags.m_is_bitfield_for_scalar =
true;
1676 return synthetic_child_sp;
1683 ValueObjectSP synthetic_child_sp;
1685 if (name_const_str.
IsEmpty()) {
1686 name_const_str.
SetString(
"@" + std::to_string(offset));
1693 if (synthetic_child_sp.get())
1694 return synthetic_child_sp;
1700 llvm::Optional<uint64_t> size =
1707 if (synthetic_child) {
1709 synthetic_child_sp = synthetic_child->
GetSP();
1710 synthetic_child_sp->SetName(name_const_str);
1711 synthetic_child_sp->m_flags.m_is_child_at_offset =
true;
1713 return synthetic_child_sp;
1720 ValueObjectSP synthetic_child_sp;
1722 if (name_const_str.
IsEmpty()) {
1724 snprintf(name_str,
sizeof(name_str),
"base%s@%i",
1733 if (synthetic_child_sp.get())
1734 return synthetic_child_sp;
1739 const bool is_base_class =
true;
1742 llvm::Optional<uint64_t> size =
1749 if (synthetic_child) {
1751 synthetic_child_sp = synthetic_child->
GetSP();
1752 synthetic_child_sp->SetName(name_const_str);
1754 return synthetic_child_sp;
1762 if (!expression || !expression[0])
1764 if (expression[0] ==
'.')
1765 return expression + 1;
1766 if (expression[0] ==
'-' && expression[1] ==
'>')
1767 return expression + 2;
1774 ValueObjectSP synthetic_child_sp;
1779 if (!synthetic_child_sp) {
1783 expression,
nullptr,
nullptr,
1789 if (synthetic_child_sp.get()) {
1793 synthetic_child_sp->SetName(
1797 return synthetic_child_sp;
1802 if (target_sp && !target_sp->GetEnableSyntheticValue()) {
1837 return ValueObjectSP();
1845 return ValueObjectSP();
1854 return ValueObjectSP();
1908 uint64_t load_addr =
1929 if (is_deref_of_parent &&
1952 if (!is_deref_of_parent) {
1954 if (non_base_class_parent &&
1958 if (non_base_class_parent_compiler_type) {
1963 const uint32_t non_base_class_parent_type_info =
1964 non_base_class_parent_compiler_type.
GetTypeInfo();
1966 if (non_base_class_parent_type_info & eTypeIsPointer) {
1968 }
else if ((non_base_class_parent_type_info & eTypeHasChildren) &&
1969 !(non_base_class_parent_type_info & eTypeIsArray)) {
1982 if (is_deref_of_parent &&
2002 expression, reason_to_stop ? reason_to_stop : &dummy_reason_to_stop,
2003 final_value_type ? final_value_type : &dummy_final_value_type, options,
2004 final_task_on_target ? final_task_on_target
2005 : &dummy_final_task_on_target);
2007 if (!final_task_on_target ||
2011 if (ret_val.get() &&
2012 ((final_value_type ? *final_value_type : dummy_final_value_type) ==
2016 if ((final_task_on_target ? *final_task_on_target
2017 : dummy_final_task_on_target) ==
2020 ValueObjectSP final_value = ret_val->Dereference(
error);
2021 if (
error.Fail() || !final_value.get()) {
2025 if (final_value_type)
2027 return ValueObjectSP();
2029 if (final_task_on_target)
2034 if (*final_task_on_target ==
2037 ValueObjectSP final_value = ret_val->AddressOf(
error);
2038 if (
error.Fail() || !final_value.get()) {
2042 if (final_value_type)
2044 return ValueObjectSP();
2046 if (final_task_on_target)
2061 ValueObjectSP root =
GetSP();
2066 llvm::StringRef remainder = expression;
2069 llvm::StringRef temp_expression = remainder;
2071 CompilerType root_compiler_type = root->GetCompilerType();
2073 Flags pointee_compiler_type_info;
2075 Flags root_compiler_type_info(
2076 root_compiler_type.
GetTypeInfo(&pointee_compiler_type));
2077 if (pointee_compiler_type)
2080 if (temp_expression.empty()) {
2085 switch (temp_expression.front()) {
2087 temp_expression = temp_expression.drop_front();
2089 root_compiler_type_info.
Test(eTypeIsPointer))
2097 return ValueObjectSP();
2099 if (root_compiler_type_info.
Test(eTypeIsObjC) &&
2102 root_compiler_type_info.
Test(eTypeIsPointer) &&
2107 return ValueObjectSP();
2109 if (!temp_expression.startswith(
">")) {
2113 return ValueObjectSP();
2120 temp_expression.front() ==
'.' &&
2121 root_compiler_type_info.
Test(eTypeIsPointer))
2131 temp_expression = temp_expression.drop_front();
2133 size_t next_sep_pos = temp_expression.find_first_of(
"-.[", 1);
2135 if (next_sep_pos == llvm::StringRef::npos)
2139 ValueObjectSP child_valobj_sp =
2140 root->GetChildMemberWithName(child_name,
true);
2142 if (child_valobj_sp.get())
2147 return child_valobj_sp;
2155 if (root->IsSynthetic()) {
2156 child_valobj_sp = root->GetNonSyntheticValue();
2157 if (child_valobj_sp.get())
2159 child_valobj_sp->GetChildMemberWithName(child_name,
true);
2164 if (!root->IsSynthetic()) {
2165 child_valobj_sp = root->GetSyntheticValue();
2166 if (child_valobj_sp.get())
2168 child_valobj_sp->GetChildMemberWithName(child_name,
true);
2173 if (root->IsSynthetic()) {
2174 child_valobj_sp = root->GetNonSyntheticValue();
2175 if (child_valobj_sp.get())
2177 child_valobj_sp->GetChildMemberWithName(child_name,
true);
2179 child_valobj_sp = root->GetSyntheticValue();
2180 if (child_valobj_sp.get())
2182 child_valobj_sp->GetChildMemberWithName(child_name,
true);
2191 if (child_valobj_sp.get())
2196 return child_valobj_sp;
2205 llvm::StringRef next_separator = temp_expression.substr(next_sep_pos);
2207 child_name.
SetString(temp_expression.slice(0, next_sep_pos));
2209 ValueObjectSP child_valobj_sp =
2210 root->GetChildMemberWithName(child_name,
true);
2211 if (child_valobj_sp.get())
2213 root = child_valobj_sp;
2214 remainder = next_separator;
2224 if (root->IsSynthetic()) {
2225 child_valobj_sp = root->GetNonSyntheticValue();
2226 if (child_valobj_sp.get())
2228 child_valobj_sp->GetChildMemberWithName(child_name,
true);
2233 if (!root->IsSynthetic()) {
2234 child_valobj_sp = root->GetSyntheticValue();
2235 if (child_valobj_sp.get())
2237 child_valobj_sp->GetChildMemberWithName(child_name,
true);
2242 if (root->IsSynthetic()) {
2243 child_valobj_sp = root->GetNonSyntheticValue();
2244 if (child_valobj_sp.get())
2246 child_valobj_sp->GetChildMemberWithName(child_name,
true);
2248 child_valobj_sp = root->GetSyntheticValue();
2249 if (child_valobj_sp.get())
2251 child_valobj_sp->GetChildMemberWithName(child_name,
true);
2260 if (child_valobj_sp.get())
2262 root = child_valobj_sp;
2263 remainder = next_separator;
2276 if (!root_compiler_type_info.
Test(eTypeIsArray) &&
2277 !root_compiler_type_info.
Test(eTypeIsPointer) &&
2278 !root_compiler_type_info.
Test(
2281 if (!root_compiler_type_info.
Test(
2291 return ValueObjectSP();
2300 return ValueObjectSP();
2303 if (temp_expression[1] ==
2306 if (!root_compiler_type_info.
Test(eTypeIsArray)) {
2322 size_t close_bracket_position = temp_expression.find(
']', 1);
2323 if (close_bracket_position ==
2324 llvm::StringRef::npos)
2332 llvm::StringRef bracket_expr =
2333 temp_expression.slice(1, close_bracket_position);
2337 assert(!bracket_expr.empty());
2339 if (!bracket_expr.contains(
'-')) {
2343 unsigned long index = 0;
2344 if (bracket_expr.getAsInteger(0, index)) {
2352 if (root_compiler_type_info.
Test(eTypeIsArray)) {
2353 ValueObjectSP child_valobj_sp = root->GetChildAtIndex(index,
true);
2354 if (!child_valobj_sp)
2355 child_valobj_sp = root->GetSyntheticArrayMember(index,
true);
2356 if (!child_valobj_sp)
2357 if (root->HasSyntheticValue() &&
2358 root->GetSyntheticValue()->GetNumChildren() > index)
2360 root->GetSyntheticValue()->GetChildAtIndex(index,
true);
2361 if (child_valobj_sp) {
2362 root = child_valobj_sp;
2364 temp_expression.substr(close_bracket_position + 1);
2373 }
else if (root_compiler_type_info.
Test(eTypeIsPointer)) {
2385 pointee_compiler_type_info.
Test(eTypeIsScalar)) {
2387 root = root->Dereference(
error);
2388 if (
error.Fail() || !root) {
2398 if (root->GetCompilerType().GetMinimumLanguage() ==
2400 pointee_compiler_type_info.
AllClear(eTypeIsPointer) &&
2401 root->HasSyntheticValue() &&
2404 SyntheticChildrenTraversal::ToSynthetic ||
2407 SyntheticChildrenTraversal::Both)) {
2408 root = root->GetSyntheticValue()->GetChildAtIndex(index,
true);
2410 root = root->GetSyntheticArrayMember(index,
true);
2418 temp_expression.substr(close_bracket_position + 1);
2423 }
else if (root_compiler_type_info.
Test(eTypeIsScalar)) {
2424 root = root->GetSyntheticBitFieldChild(index, index,
true);
2438 }
else if (root_compiler_type_info.
Test(eTypeIsVector)) {
2439 root = root->GetChildAtIndex(index,
true);
2444 return ValueObjectSP();
2447 temp_expression.substr(close_bracket_position + 1);
2453 SyntheticChildrenTraversal::ToSynthetic ||
2456 SyntheticChildrenTraversal::Both) {
2457 if (root->HasSyntheticValue())
2458 root = root->GetSyntheticValue();
2459 else if (!root->IsSynthetic()) {
2474 root = root->GetChildAtIndex(index,
true);
2482 temp_expression.substr(close_bracket_position + 1);
2494 llvm::StringRef sleft, sright;
2495 unsigned long low_index, high_index;
2496 std::tie(sleft, sright) = bracket_expr.split(
'-');
2497 if (sleft.getAsInteger(0, low_index) ||
2498 sright.getAsInteger(0, high_index)) {
2505 if (low_index > high_index)
2508 if (root_compiler_type_info.
Test(
2511 root = root->GetSyntheticBitFieldChild(low_index, high_index,
true);
2523 }
else if (root_compiler_type_info.
Test(
2530 pointee_compiler_type_info.
Test(eTypeIsScalar)) {
2532 root = root->Dereference(
error);
2533 if (
error.Fail() || !root) {
2570 ValueObjectSP valobj_sp;
2600 ValueObjectSP result_sp(
GetSP());
2605 if (!result_sp->IsDynamic()) {
2606 if (result_sp->GetDynamicValue(dynValue))
2607 result_sp = result_sp->GetDynamicValue(dynValue);
2611 if (result_sp->IsDynamic()) {
2612 if (result_sp->GetStaticValue())
2613 result_sp = result_sp->GetStaticValue();
2619 if (!result_sp->IsSynthetic()) {
2620 if (result_sp->GetSyntheticValue())
2621 result_sp = result_sp->GetSyntheticValue();
2624 if (result_sp->IsSynthetic()) {
2625 if (result_sp->GetNonSyntheticValue())
2626 result_sp = result_sp->GetNonSyntheticValue();
2638 if (is_pointer_or_reference_type) {
2639 bool omit_empty_base_classes =
true;
2640 bool ignore_array_bounds =
false;
2644 int32_t child_byte_offset = 0;
2645 uint32_t child_bitfield_bit_size = 0;
2646 uint32_t child_bitfield_bit_offset = 0;
2647 bool child_is_base_class =
false;
2648 bool child_is_deref_of_parent =
false;
2649 const bool transparent_pointers =
false;
2652 uint64_t language_flags = 0;
2657 &exe_ctx, 0, transparent_pointers, omit_empty_base_classes,
2658 ignore_array_bounds, child_name_str, child_byte_size, child_byte_offset,
2659 child_bitfield_bit_size, child_bitfield_bit_offset, child_is_base_class,
2660 child_is_deref_of_parent,
this, language_flags);
2661 if (child_compiler_type && child_byte_size) {
2663 if (!child_name_str.empty())
2664 child_name.
SetCString(child_name_str.c_str());
2667 *
this, child_compiler_type, child_name, child_byte_size,
2668 child_byte_offset, child_bitfield_bit_size, child_bitfield_bit_offset,
2679 if (child_compiler_type) {
2681 if (!child_name_str.empty())
2682 child_name.
SetCString(child_name_str.c_str());
2685 *
this, child_compiler_type, child_name, child_byte_size,
2686 child_byte_offset, child_bitfield_bit_size,
2687 child_bitfield_bit_offset, child_is_base_class,
2696 ->GetChildMemberWithName(
ConstString(
"$$dereference$$"),
true)
2710 if (is_pointer_or_reference_type)
2711 error.SetErrorStringWithFormat(
"dereference failed: (%s) %s",
2715 error.SetErrorStringWithFormat(
"not a pointer or reference type: (%s) %s",
2718 return ValueObjectSP();
2727 const bool scalar_is_load_address =
false;
2731 switch (address_type) {
2735 error.SetErrorStringWithFormat(
"'%s' is not in memory",
2742 if (compiler_type) {
2758 error.SetErrorStringWithFormat(
"'%s' doesn't have a valid address",
2775 ValueObjectSP valobj_sp;
2789 ValueObjectSP valobj_sp;
2797 exe_ctx.GetBestExecutionContextScope(), name, ptr_addr, type_sp);
2806 : m_mod_id(), m_exe_ctx_ref() {
2813 process_sp = target_sp->GetProcessSP();
2823 thread_sp = process_sp->GetThreadList().GetSelectedThread();
2832 frame_sp = thread_sp->GetSelectedFrame();
2843 : m_mod_id(), m_exe_ctx_ref(rhs.m_exe_ctx_ref) {}
2856 bool accept_invalid_exe_ctx) {
2859 const bool thread_and_frame_only_if_stopped =
true;
2861 m_exe_ctx_ref.Lock(thread_and_frame_only_if_stopped));
2868 if (process ==
nullptr)
2880 bool changed =
false;
2881 const bool was_valid = m_mod_id.
IsValid();
2883 if (m_mod_id == current_mod_id) {
2888 m_mod_id = current_mod_id;
2889 m_needs_update =
true;
2899 if (!accept_invalid_exe_ctx) {
2900 if (m_exe_ctx_ref.HasThreadRef()) {
2901 ThreadSP thread_sp(m_exe_ctx_ref.GetThreadSP());
2903 if (m_exe_ctx_ref.HasFrameRef()) {
2904 StackFrameSP frame_sp(m_exe_ctx_ref.GetFrameSP());
2908 changed = was_valid;
2914 changed = was_valid;
2923 ProcessSP process_sp(m_exe_ctx_ref.GetProcessSP());
2925 m_mod_id = process_sp->GetModID();
2926 m_needs_update =
false;
2963 llvm::StringRef expression,
2970 llvm::StringRef name, llvm::StringRef expression,
2972 lldb::ValueObjectSP retval_sp;
2976 if (expression.empty())
2978 target_sp->EvaluateExpression(expression, exe_ctx.
GetFrameSP().get(),
2979 retval_sp, options);
2980 if (retval_sp && !name.empty())
2991 lldb::DataBufferSP buffer(
2997 if (ptr_result_valobj_sp) {
2998 ptr_result_valobj_sp->GetValue().SetValueType(
3001 ptr_result_valobj_sp = ptr_result_valobj_sp->Dereference(err);
3002 if (ptr_result_valobj_sp && !name.empty())
3005 return ptr_result_valobj_sp;
3008 return lldb::ValueObjectSP();
3014 lldb::ValueObjectSP new_value_sp;
3019 if (new_value_sp && !name.empty())
3021 return new_value_sp;
3028 return lldb::ModuleSP();
3061 while (with_dv_info) {
3064 with_dv_info = with_dv_info->
m_parent;
3071 while (with_fmt_info) {
3074 with_fmt_info = with_fmt_info->
m_parent;
3086 frame_sp->GetSymbolContext(eSymbolContextCompUnit));
3088 type = cu->GetLanguage();
3122 target_sp->GetPersistentExpressionStateForLanguage(
3125 if (!persistent_state)
3130 ValueObjectSP const_result_sp =
3133 ExpressionVariableSP persistent_var_sp =
3135 persistent_var_sp->m_live_sp = persistent_var_sp->m_frozen_sp;
3138 return persistent_var_sp->GetValueObject();