28 #include "lldb/Host/Config.h"
52 #include "llvm/Support/Compiler.h"
82 : m_parent(&parent), m_update_point(parent.GetUpdatePoint()),
95 : m_update_point(exe_scope), m_manager(&manager),
96 m_address_type_of_ptr_or_ref_children(child_ptr_or_ref_addr_type),
101 const ArchSpec &arch = target_sp->GetArchitecture();
114 bool did_change_formats =
false;
128 if (update_format && !did_change_formats)
159 bool need_compare_checksums =
false;
160 llvm::SmallVector<uint8_t, 16> old_checksum;
163 need_compare_checksums =
true;
166 old_checksum.begin());
175 const uint64_t max_checksum_size = 128;
178 need_compare_checksums =
false;
182 assert(!need_compare_checksums ||
191 }
else if (need_compare_checksums) {
206 "[%s %p] checking for FormatManager revisions. ValueObject "
207 "rev: %d - Global rev: %d",
208 GetName().GetCString(),
static_cast<void *
>(
this),
212 bool any_change =
false;
221 #if LLDB_ENABLE_PYTHON
254 return compiler_type;
259 ProcessSP process_sp(
263 return compiler_type;
267 if (std::optional<CompilerType> complete_type =
268 runtime->GetRuntimeType(compiler_type)) {
274 return compiler_type;
297 switch (value_type) {
307 else if (reg_info->alt_name)
323 sstr.
Printf(
"0x%*.*llx", addr_nibble_size, addr_nibble_size,
342 if (bitfield_bit_size)
353 LazyBool is_logical_true = language->IsLogicalTrue(*
this,
error);
354 switch (is_logical_true) {
357 return (is_logical_true ==
true);
366 error.SetErrorString(
"failed to get a scalar result");
377 ValueObjectSP child_sp;
390 if (child !=
nullptr)
391 return child->
GetSP();
398 size_t *index_of_error) {
399 if (idxs.size() == 0)
401 ValueObjectSP root(
GetSP());
402 for (
size_t idx : idxs) {
403 root = root->GetChildAtIndex(idx,
true);
406 *index_of_error = idx;
414 llvm::ArrayRef<std::pair<size_t, bool>> idxs,
size_t *index_of_error) {
415 if (idxs.size() == 0)
417 ValueObjectSP root(
GetSP());
418 for (std::pair<size_t, bool> idx : idxs) {
419 root = root->GetChildAtIndex(idx.first, idx.second);
422 *index_of_error = idx.first;
432 if (names.size() == 0)
434 ValueObjectSP root(
GetSP());
436 root = root->GetChildMemberWithName(name,
true);
439 *name_of_error = name;
447 llvm::ArrayRef<std::pair<ConstString, bool>> names,
449 if (names.size() == 0)
451 ValueObjectSP root(
GetSP());
452 for (std::pair<ConstString, bool> name : names) {
453 root = root->GetChildMemberWithName(name.first, name.second);
456 *name_of_error = name.first;
464 bool omit_empty_base_classes =
true;
466 omit_empty_base_classes);
478 std::vector<uint32_t> child_indexes;
479 bool omit_empty_base_classes =
true;
482 return ValueObjectSP();
484 const size_t num_child_indexes =
486 name.
GetCString(), omit_empty_base_classes, child_indexes);
487 if (num_child_indexes == 0)
490 ValueObjectSP child_sp =
GetSP();
493 child_sp = child_sp->GetChildAtIndex(idx, can_create);
503 return children_count <= max ? children_count : max;
515 bool has_children =
false;
518 if (type_info & (eTypeHasChildren | eTypeIsPointer | eTypeIsReference))
533 bool synthetic_array_member,
534 int32_t synthetic_index) {
537 bool omit_empty_base_classes =
true;
538 bool ignore_array_bounds = synthetic_array_member;
541 int32_t child_byte_offset = 0;
542 uint32_t child_bitfield_bit_size = 0;
543 uint32_t child_bitfield_bit_offset = 0;
544 bool child_is_base_class =
false;
545 bool child_is_deref_of_parent =
false;
546 uint64_t language_flags = 0;
548 const bool transparent_pointers = !synthetic_array_member;
554 &exe_ctx, idx, transparent_pointers, omit_empty_base_classes,
555 ignore_array_bounds, child_name_str, child_byte_size, child_byte_offset,
556 child_bitfield_bit_size, child_bitfield_bit_offset, child_is_base_class,
557 child_is_deref_of_parent,
this, language_flags);
558 if (child_compiler_type) {
560 child_byte_offset += child_byte_size * synthetic_index;
563 if (!child_name_str.empty())
564 child_name.
SetCString(child_name_str.c_str());
567 *
this, child_compiler_type, child_name, child_byte_size,
568 child_byte_offset, child_bitfield_bit_size, child_bitfield_bit_offset,
575 if (!valobj && synthetic_array_member) {
577 valobj = synth_valobj_sp
602 destination =
"<incomplete type>";
632 summary_ptr->
FormatObject(
this, destination, actual_options);
635 return !destination.empty();
658 bool is_char_arr_ptr(type_flags.
AnySet(eTypeIsArray | eTypeIsPointer) &&
659 pointee_or_element_compiler_type.
IsCharType());
660 if (!is_char_arr_ptr)
664 if (type_flags.
Test(eTypeIsArray))
676 const bool is_pointer_type = type_info & eTypeIsPointer;
677 const bool is_array_type = type_info & eTypeIsArray;
678 if (!(is_pointer_type || is_array_type))
686 std::optional<uint64_t> item_type_size =
691 const uint64_t bytes = item_count * *item_type_size;
692 const uint64_t offset = item_idx * *item_type_size;
694 if (item_idx == 0 && item_count == 1)
696 if (is_pointer_type) {
699 if (
error.Fail() || pointee_sp.get() ==
nullptr)
701 return pointee_sp->GetData(data,
error);
704 if (child_sp.get() ==
nullptr)
707 return child_sp->GetData(data,
error);
714 lldb::DataBufferSP data_sp(heap_buf_ptr =
725 addr = addr + offset;
727 module_sp->ResolveFileAddress(addr, so_addr);
733 so_addr, heap_buf_ptr->GetBytes(), bytes,
error,
true);
734 if (
error.Success()) {
747 addr + offset, heap_buf_ptr->GetBytes(), bytes,
error);
748 if (
error.Success() || bytes_read > 0) {
757 if (max_bytes && *max_bytes > offset) {
758 size_t bytes_read = std::min<uint64_t>(*max_bytes - offset, bytes);
762 heap_buf_ptr->
CopyData((uint8_t *)(addr + offset), bytes_read);
797 error.SetErrorString(
"unable to read value");
804 const size_t byte_size =
GetByteSize().value_or(0);
808 switch (value_type) {
810 error.SetErrorString(
"invalid location");
817 error.SetErrorStringWithFormat(
"unable to set scalar value: %s",
831 if (!
error.Success())
833 if (bytes_written != byte_size) {
834 error.SetErrorString(
"unable to write value to memory");
860 lldb::WritableDataBufferSP &destination) {
861 llvm::StringRef src = source.
GetString();
862 src = src.rtrim(
'\0');
863 destination = std::make_shared<DataBufferHeap>(src.size(), 0);
864 memcpy(destination->GetBytes(), src.data(), src.size());
868 std::pair<size_t, bool>
871 bool honor_array,
Format item_format) {
872 bool was_capped =
false;
878 s <<
"<no target to read from>";
879 error.SetErrorString(
"no target to read from");
881 return {0, was_capped};
887 size_t bytes_read = 0;
888 size_t total_bytes_read = 0;
893 if (type_flags.
AnySet(eTypeIsArray | eTypeIsPointer) &&
899 bool capped_data =
false;
900 const bool is_array = type_flags.
Test(eTypeIsArray);
903 uint64_t array_size = 0;
904 if (compiler_type.
IsArrayType(
nullptr, &array_size)) {
905 cstr_len = array_size;
906 if (cstr_len > max_length) {
908 cstr_len = max_length;
920 if (cstr ==
nullptr) {
921 s <<
"<invalid address>";
922 error.SetErrorString(
"invalid address");
924 return {0, was_capped};
926 s << llvm::StringRef(cstr, cstr_len);
928 return {cstr_len, was_capped};
930 s <<
"<invalid address>";
931 error.SetErrorString(
"invalid address");
933 return {0, was_capped};
937 Address cstr_so_addr(cstr_address);
939 if (cstr_len > 0 && honor_array) {
947 total_bytes_read = bytes_read;
948 for (
size_t offset = 0; offset < bytes_read; offset++)
954 cstr_len = max_length;
955 const size_t k_max_buf_size = 64;
959 int cstr_len_displayed = -1;
960 bool capped_cstr =
false;
965 while ((bytes_read =
GetPointeeData(data, offset, k_max_buf_size)) > 0) {
966 total_bytes_read += bytes_read;
967 const char *cstr = data.
PeekCStr(0);
968 size_t len = strnlen(cstr, k_max_buf_size);
969 if (cstr_len_displayed < 0)
970 cstr_len_displayed = len;
974 cstr_len_displayed += len;
975 if (len > bytes_read)
980 for (
size_t offset = 0; offset < bytes_read; offset++)
983 if (len < k_max_buf_size)
986 if (len >= cstr_len) {
995 if (cstr_len_displayed >= 0) {
1001 error.SetErrorString(
"not a string object");
1002 s <<
"<not a string object>";
1005 return {total_bytes_read, was_capped};
1022 auto get_object_description = [&](
LanguageType language) ->
const char * {
1025 if (runtime->GetObjectDescription(s, *
this)) {
1035 if (
const char *desc = get_object_description(native_language))
1060 lldb::TypeFormatImplSP format_sp;
1072 my_format = reg_info->format;
1082 format_sp = std::make_shared<TypeFormatImpl_Format>(my_format);
1142 if (flags.
AnySet(eTypeIsArray | eTypeIsPointer) &&
1149 if (flags.
Test(eTypeIsArray)) {
1175 bool do_dump_error) {
1179 bool allow_special =
1181 const bool only_special =
false;
1183 if (allow_special) {
1184 if (flags.
AnySet(eTypeIsArray | eTypeIsPointer) &&
1196 lldb::WritableDataBufferSP buffer_sp;
1200 lldb_private::formatters::StringPrinter::
1201 ReadBufferAndDumpToStreamOptions options(*
this);
1214 return !
error.Fail();
1222 if (flags.
Test(eTypeIsArray)) {
1228 for (
size_t low = 0; low < count; low++) {
1235 s <<
"<invalid child>";
1238 child->DumpPrintableRepresentation(
1269 for (
size_t low = 0; low < count; low++) {
1276 s <<
"<invalid child>";
1279 child->DumpPrintableRepresentation(
1311 bool var_success =
false;
1314 llvm::StringRef str;
1325 switch (val_obj_display) {
1386 else if (val_obj_display ==
1388 s.
PutCString(
"<not a valid Objective-C object>");
1393 s.
PutCString(
"<no printable representation>");
1421 if (scalar_is_load_address) {
1479 error.SetErrorString(
"unable to read value");
1486 const size_t byte_size =
GetByteSize().value_or(0);
1493 }
else if (byte_size <= 16) {
1499 if (
error.Success()) {
1500 switch (value_type) {
1511 target_addr, new_scalar, byte_size,
error);
1512 if (!
error.Success())
1514 if (bytes_written != byte_size) {
1515 error.SetErrorString(
"unable to write value to memory");
1528 bool success = new_scalar.
GetData(new_data);
1538 error.SetErrorString(
"invalid location");
1549 error.SetErrorString(
"unable to write aggregate data type");
1570 ValueObjectSP synthetic_child_sp;
1571 std::map<ConstString, ValueObject *>::const_iterator pos =
1574 synthetic_child_sp = pos->second->GetSP();
1575 return synthetic_child_sp;
1598 if (runtime->IsAllowedRuntimeValue(
GetName()))
1606 return language->IsNilReference(*
this);
1613 return language->IsUninitializedReference(*
this);
1629 ValueObjectSP synthetic_child_sp;
1631 std::string index_str = llvm::formatv(
"[{0}]", index);
1636 if (!synthetic_child_sp) {
1643 if (synthetic_child) {
1645 synthetic_child_sp = synthetic_child->
GetSP();
1646 synthetic_child_sp->SetName(
ConstString(index_str));
1647 synthetic_child_sp->m_flags.m_is_array_item_for_pointer =
true;
1651 return synthetic_child_sp;
1656 ValueObjectSP synthetic_child_sp;
1658 std::string index_str = llvm::formatv(
"[{0}-{1}]", from, to);
1663 if (!synthetic_child_sp) {
1664 uint32_t bit_field_size = to - from + 1;
1668 GetByteSize().value_or(0) * 8 - bit_field_size - bit_field_offset;
1673 0, bit_field_size, bit_field_offset,
false,
false,
1677 if (synthetic_child) {
1679 synthetic_child_sp = synthetic_child->
GetSP();
1680 synthetic_child_sp->SetName(
ConstString(index_str));
1681 synthetic_child_sp->m_flags.m_is_bitfield_for_scalar =
true;
1685 return synthetic_child_sp;
1692 ValueObjectSP synthetic_child_sp;
1694 if (name_const_str.
IsEmpty()) {
1695 name_const_str.
SetString(
"@" + std::to_string(offset));
1702 if (synthetic_child_sp.get())
1703 return synthetic_child_sp;
1709 std::optional<uint64_t> size =
1716 if (synthetic_child) {
1718 synthetic_child_sp = synthetic_child->
GetSP();
1719 synthetic_child_sp->SetName(name_const_str);
1720 synthetic_child_sp->m_flags.m_is_child_at_offset =
true;
1722 return synthetic_child_sp;
1729 ValueObjectSP synthetic_child_sp;
1731 if (name_const_str.
IsEmpty()) {
1733 snprintf(name_str,
sizeof(name_str),
"base%s@%i",
1742 if (synthetic_child_sp.get())
1743 return synthetic_child_sp;
1748 const bool is_base_class =
true;
1751 std::optional<uint64_t> size =
1758 if (synthetic_child) {
1760 synthetic_child_sp = synthetic_child->
GetSP();
1761 synthetic_child_sp->SetName(name_const_str);
1763 return synthetic_child_sp;
1771 if (!expression || !expression[0])
1773 if (expression[0] ==
'.')
1774 return expression + 1;
1775 if (expression[0] ==
'-' && expression[1] ==
'>')
1776 return expression + 2;
1783 ValueObjectSP synthetic_child_sp;
1788 if (!synthetic_child_sp) {
1792 expression,
nullptr,
nullptr,
1798 if (synthetic_child_sp.get()) {
1802 synthetic_child_sp->SetName(
1806 return synthetic_child_sp;
1811 if (target_sp && !target_sp->GetEnableSyntheticValue()) {
1846 return ValueObjectSP();
1854 return ValueObjectSP();
1863 return ValueObjectSP();
1917 uint64_t load_addr =
1938 if (is_deref_of_parent &&
1961 if (!is_deref_of_parent) {
1963 if (non_base_class_parent &&
1967 if (non_base_class_parent_compiler_type) {
1972 const uint32_t non_base_class_parent_type_info =
1973 non_base_class_parent_compiler_type.
GetTypeInfo();
1975 if (non_base_class_parent_type_info & eTypeIsPointer) {
1977 }
else if ((non_base_class_parent_type_info & eTypeHasChildren) &&
1978 !(non_base_class_parent_type_info & eTypeIsArray)) {
1991 if (is_deref_of_parent &&
2011 expression, reason_to_stop ? reason_to_stop : &dummy_reason_to_stop,
2012 final_value_type ? final_value_type : &dummy_final_value_type, options,
2013 final_task_on_target ? final_task_on_target
2014 : &dummy_final_task_on_target);
2016 if (!final_task_on_target ||
2020 if (ret_val.get() &&
2021 ((final_value_type ? *final_value_type : dummy_final_value_type) ==
2025 if ((final_task_on_target ? *final_task_on_target
2026 : dummy_final_task_on_target) ==
2029 ValueObjectSP final_value = ret_val->Dereference(
error);
2030 if (
error.Fail() || !final_value.get()) {
2034 if (final_value_type)
2036 return ValueObjectSP();
2038 if (final_task_on_target)
2043 if (*final_task_on_target ==
2046 ValueObjectSP final_value = ret_val->AddressOf(
error);
2047 if (
error.Fail() || !final_value.get()) {
2051 if (final_value_type)
2053 return ValueObjectSP();
2055 if (final_task_on_target)
2070 ValueObjectSP root =
GetSP();
2075 llvm::StringRef remainder = expression;
2078 llvm::StringRef temp_expression = remainder;
2080 CompilerType root_compiler_type = root->GetCompilerType();
2082 Flags pointee_compiler_type_info;
2084 Flags root_compiler_type_info(
2085 root_compiler_type.
GetTypeInfo(&pointee_compiler_type));
2086 if (pointee_compiler_type)
2089 if (temp_expression.empty()) {
2094 switch (temp_expression.front()) {
2096 temp_expression = temp_expression.drop_front();
2098 root_compiler_type_info.
Test(eTypeIsPointer))
2106 return ValueObjectSP();
2108 if (root_compiler_type_info.
Test(eTypeIsObjC) &&
2111 root_compiler_type_info.
Test(eTypeIsPointer) &&
2116 return ValueObjectSP();
2118 if (!temp_expression.startswith(
">")) {
2122 return ValueObjectSP();
2129 temp_expression.front() ==
'.' &&
2130 root_compiler_type_info.
Test(eTypeIsPointer))
2140 temp_expression = temp_expression.drop_front();
2142 size_t next_sep_pos = temp_expression.find_first_of(
"-.[", 1);
2144 if (next_sep_pos == llvm::StringRef::npos)
2148 ValueObjectSP child_valobj_sp =
2149 root->GetChildMemberWithName(child_name,
true);
2151 if (child_valobj_sp.get())
2156 return child_valobj_sp;
2164 if (root->IsSynthetic()) {
2165 child_valobj_sp = root->GetNonSyntheticValue();
2166 if (child_valobj_sp.get())
2168 child_valobj_sp->GetChildMemberWithName(child_name,
true);
2173 if (!root->IsSynthetic()) {
2174 child_valobj_sp = root->GetSyntheticValue();
2175 if (child_valobj_sp.get())
2177 child_valobj_sp->GetChildMemberWithName(child_name,
true);
2182 if (root->IsSynthetic()) {
2183 child_valobj_sp = root->GetNonSyntheticValue();
2184 if (child_valobj_sp.get())
2186 child_valobj_sp->GetChildMemberWithName(child_name,
true);
2188 child_valobj_sp = root->GetSyntheticValue();
2189 if (child_valobj_sp.get())
2191 child_valobj_sp->GetChildMemberWithName(child_name,
true);
2200 if (child_valobj_sp.get())
2205 return child_valobj_sp;
2214 llvm::StringRef next_separator = temp_expression.substr(next_sep_pos);
2216 child_name.
SetString(temp_expression.slice(0, next_sep_pos));
2218 ValueObjectSP child_valobj_sp =
2219 root->GetChildMemberWithName(child_name,
true);
2220 if (child_valobj_sp.get())
2222 root = child_valobj_sp;
2223 remainder = next_separator;
2233 if (root->IsSynthetic()) {
2234 child_valobj_sp = root->GetNonSyntheticValue();
2235 if (child_valobj_sp.get())
2237 child_valobj_sp->GetChildMemberWithName(child_name,
true);
2242 if (!root->IsSynthetic()) {
2243 child_valobj_sp = root->GetSyntheticValue();
2244 if (child_valobj_sp.get())
2246 child_valobj_sp->GetChildMemberWithName(child_name,
true);
2251 if (root->IsSynthetic()) {
2252 child_valobj_sp = root->GetNonSyntheticValue();
2253 if (child_valobj_sp.get())
2255 child_valobj_sp->GetChildMemberWithName(child_name,
true);
2257 child_valobj_sp = root->GetSyntheticValue();
2258 if (child_valobj_sp.get())
2260 child_valobj_sp->GetChildMemberWithName(child_name,
true);
2269 if (child_valobj_sp.get())
2271 root = child_valobj_sp;
2272 remainder = next_separator;
2285 if (!root_compiler_type_info.
Test(eTypeIsArray) &&
2286 !root_compiler_type_info.
Test(eTypeIsPointer) &&
2287 !root_compiler_type_info.
Test(
2290 if (!root_compiler_type_info.
Test(
2300 return ValueObjectSP();
2309 return ValueObjectSP();
2312 if (temp_expression[1] ==
2315 if (!root_compiler_type_info.
Test(eTypeIsArray)) {
2331 size_t close_bracket_position = temp_expression.find(
']', 1);
2332 if (close_bracket_position ==
2333 llvm::StringRef::npos)
2341 llvm::StringRef bracket_expr =
2342 temp_expression.slice(1, close_bracket_position);
2346 assert(!bracket_expr.empty());
2348 if (!bracket_expr.contains(
'-')) {
2352 unsigned long index = 0;
2353 if (bracket_expr.getAsInteger(0, index)) {
2361 if (root_compiler_type_info.
Test(eTypeIsArray)) {
2362 ValueObjectSP child_valobj_sp = root->GetChildAtIndex(index,
true);
2363 if (!child_valobj_sp)
2364 child_valobj_sp = root->GetSyntheticArrayMember(index,
true);
2365 if (!child_valobj_sp)
2366 if (root->HasSyntheticValue() &&
2367 root->GetSyntheticValue()->GetNumChildren() > index)
2369 root->GetSyntheticValue()->GetChildAtIndex(index,
true);
2370 if (child_valobj_sp) {
2371 root = child_valobj_sp;
2373 temp_expression.substr(close_bracket_position + 1);
2382 }
else if (root_compiler_type_info.
Test(eTypeIsPointer)) {
2394 pointee_compiler_type_info.
Test(eTypeIsScalar)) {
2396 root = root->Dereference(
error);
2397 if (
error.Fail() || !root) {
2407 if (root->GetCompilerType().GetMinimumLanguage() ==
2409 pointee_compiler_type_info.
AllClear(eTypeIsPointer) &&
2410 root->HasSyntheticValue() &&
2413 SyntheticChildrenTraversal::ToSynthetic ||
2416 SyntheticChildrenTraversal::Both)) {
2417 root = root->GetSyntheticValue()->GetChildAtIndex(index,
true);
2419 root = root->GetSyntheticArrayMember(index,
true);
2427 temp_expression.substr(close_bracket_position + 1);
2432 }
else if (root_compiler_type_info.
Test(eTypeIsScalar)) {
2433 root = root->GetSyntheticBitFieldChild(index, index,
true);
2447 }
else if (root_compiler_type_info.
Test(eTypeIsVector)) {
2448 root = root->GetChildAtIndex(index,
true);
2453 return ValueObjectSP();
2456 temp_expression.substr(close_bracket_position + 1);
2462 SyntheticChildrenTraversal::ToSynthetic ||
2465 SyntheticChildrenTraversal::Both) {
2466 if (root->HasSyntheticValue())
2467 root = root->GetSyntheticValue();
2468 else if (!root->IsSynthetic()) {
2483 root = root->GetChildAtIndex(index,
true);
2491 temp_expression.substr(close_bracket_position + 1);
2503 llvm::StringRef sleft, sright;
2504 unsigned long low_index, high_index;
2505 std::tie(sleft, sright) = bracket_expr.split(
'-');
2506 if (sleft.getAsInteger(0, low_index) ||
2507 sright.getAsInteger(0, high_index)) {
2514 if (low_index > high_index)
2517 if (root_compiler_type_info.
Test(
2520 root = root->GetSyntheticBitFieldChild(low_index, high_index,
true);
2532 }
else if (root_compiler_type_info.
Test(
2539 pointee_compiler_type_info.
Test(eTypeIsScalar)) {
2541 root = root->Dereference(
error);
2542 if (
error.Fail() || !root) {
2579 ValueObjectSP valobj_sp;
2609 ValueObjectSP result_sp(
GetSP());
2614 if (!result_sp->IsDynamic()) {
2615 if (result_sp->GetDynamicValue(dynValue))
2616 result_sp = result_sp->GetDynamicValue(dynValue);
2620 if (result_sp->IsDynamic()) {
2621 if (result_sp->GetStaticValue())
2622 result_sp = result_sp->GetStaticValue();
2628 if (!result_sp->IsSynthetic()) {
2629 if (result_sp->GetSyntheticValue())
2630 result_sp = result_sp->GetSyntheticValue();
2633 if (result_sp->IsSynthetic()) {
2634 if (result_sp->GetNonSyntheticValue())
2635 result_sp = result_sp->GetNonSyntheticValue();
2647 if (is_pointer_or_reference_type) {
2648 bool omit_empty_base_classes =
true;
2649 bool ignore_array_bounds =
false;
2653 int32_t child_byte_offset = 0;
2654 uint32_t child_bitfield_bit_size = 0;
2655 uint32_t child_bitfield_bit_offset = 0;
2656 bool child_is_base_class =
false;
2657 bool child_is_deref_of_parent =
false;
2658 const bool transparent_pointers =
false;
2661 uint64_t language_flags = 0;
2666 &exe_ctx, 0, transparent_pointers, omit_empty_base_classes,
2667 ignore_array_bounds, child_name_str, child_byte_size, child_byte_offset,
2668 child_bitfield_bit_size, child_bitfield_bit_offset, child_is_base_class,
2669 child_is_deref_of_parent,
this, language_flags);
2670 if (child_compiler_type && child_byte_size) {
2672 if (!child_name_str.empty())
2673 child_name.
SetCString(child_name_str.c_str());
2676 *
this, child_compiler_type, child_name, child_byte_size,
2677 child_byte_offset, child_bitfield_bit_size, child_bitfield_bit_offset,
2691 if (child_compiler_type) {
2693 if (!child_name_str.empty())
2694 child_name.
SetCString(child_name_str.c_str());
2697 *
this, child_compiler_type, child_name, child_byte_size,
2698 child_byte_offset, child_bitfield_bit_size,
2699 child_bitfield_bit_offset, child_is_base_class,
2708 ->GetChildMemberWithName(
ConstString(
"$$dereference$$"),
true)
2722 if (is_pointer_or_reference_type)
2723 error.SetErrorStringWithFormat(
"dereference failed: (%s) %s",
2727 error.SetErrorStringWithFormat(
"not a pointer or reference type: (%s) %s",
2730 return ValueObjectSP();
2739 const bool scalar_is_load_address =
false;
2743 switch (address_type) {
2747 error.SetErrorStringWithFormat(
"'%s' is not in memory",
2754 if (compiler_type) {
2770 error.SetErrorStringWithFormat(
"'%s' doesn't have a valid address",
2787 ValueObjectSP valobj_sp;
2801 ValueObjectSP valobj_sp;
2809 exe_ctx.GetBestExecutionContextScope(), name, ptr_addr, type_sp);
2818 : m_mod_id(), m_exe_ctx_ref() {
2825 process_sp = target_sp->GetProcessSP();
2835 thread_sp = process_sp->GetThreadList().GetSelectedThread();
2844 frame_sp = thread_sp->GetSelectedFrame();
2855 : m_mod_id(), m_exe_ctx_ref(rhs.m_exe_ctx_ref) {}
2868 bool accept_invalid_exe_ctx) {
2871 const bool thread_and_frame_only_if_stopped =
true;
2873 m_exe_ctx_ref.Lock(thread_and_frame_only_if_stopped));
2880 if (process ==
nullptr)
2892 bool changed =
false;
2893 const bool was_valid = m_mod_id.
IsValid();
2895 if (m_mod_id == current_mod_id) {
2900 m_mod_id = current_mod_id;
2901 m_needs_update =
true;
2911 if (!accept_invalid_exe_ctx) {
2912 if (m_exe_ctx_ref.HasThreadRef()) {
2913 ThreadSP thread_sp(m_exe_ctx_ref.GetThreadSP());
2915 if (m_exe_ctx_ref.HasFrameRef()) {
2916 StackFrameSP frame_sp(m_exe_ctx_ref.GetFrameSP());
2920 changed = was_valid;
2926 changed = was_valid;
2935 ProcessSP process_sp(m_exe_ctx_ref.GetProcessSP());
2937 m_mod_id = process_sp->GetModID();
2938 m_needs_update =
false;
2975 llvm::StringRef expression,
2982 llvm::StringRef name, llvm::StringRef expression,
2984 lldb::ValueObjectSP retval_sp;
2988 if (expression.empty())
2990 target_sp->EvaluateExpression(expression, exe_ctx.
GetFrameSP().get(),
2991 retval_sp, options);
2992 if (retval_sp && !name.empty())
3003 lldb::DataBufferSP buffer(
3009 if (ptr_result_valobj_sp) {
3010 ptr_result_valobj_sp->GetValue().SetValueType(
3013 ptr_result_valobj_sp = ptr_result_valobj_sp->Dereference(err);
3014 if (ptr_result_valobj_sp && !name.empty())
3017 return ptr_result_valobj_sp;
3020 return lldb::ValueObjectSP();
3026 lldb::ValueObjectSP new_value_sp;
3031 if (new_value_sp && !name.empty())
3033 return new_value_sp;
3040 return lldb::ModuleSP();
3073 while (with_dv_info) {
3076 with_dv_info = with_dv_info->
m_parent;
3083 while (with_fmt_info) {
3086 with_fmt_info = with_fmt_info->
m_parent;
3098 frame_sp->GetSymbolContext(eSymbolContextCompUnit));
3100 type = cu->GetLanguage();
3134 target_sp->GetPersistentExpressionStateForLanguage(
3137 if (!persistent_state)
3142 ValueObjectSP const_result_sp =
3145 ExpressionVariableSP persistent_var_sp =
3147 persistent_var_sp->m_live_sp = persistent_var_sp->m_frozen_sp;
3150 return persistent_var_sp->GetValueObject();