LLDB  mainline
ValueObject.cpp
Go to the documentation of this file.
1 //===-- ValueObject.cpp ---------------------------------------------------===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 
10 
11 #include "lldb/Core/Address.h"
12 #include "lldb/Core/Declaration.h"
13 #include "lldb/Core/Module.h"
28 #include "lldb/Host/Config.h"
32 #include "lldb/Symbol/Type.h"
33 #include "lldb/Symbol/Variable.h"
35 #include "lldb/Target/Language.h"
37 #include "lldb/Target/Process.h"
38 #include "lldb/Target/StackFrame.h"
39 #include "lldb/Target/Target.h"
40 #include "lldb/Target/Thread.h"
41 #include "lldb/Target/ThreadList.h"
44 #include "lldb/Utility/Flags.h"
45 #include "lldb/Utility/LLDBLog.h"
46 #include "lldb/Utility/Log.h"
47 #include "lldb/Utility/Scalar.h"
48 #include "lldb/Utility/Stream.h"
51 
52 #include "llvm/Support/Compiler.h"
53 
54 #include <algorithm>
55 #include <cstdint>
56 #include <cstdlib>
57 #include <memory>
58 #include <optional>
59 #include <tuple>
60 
61 #include <cassert>
62 #include <cinttypes>
63 #include <cstdio>
64 #include <cstring>
65 
66 #include <lldb/Core/ValueObject.h>
67 
68 namespace lldb_private {
70 }
71 namespace lldb_private {
72 class SymbolContextScope;
73 }
74 
75 using namespace lldb;
76 using namespace lldb_private;
77 
79 
80 // ValueObject constructor
81 ValueObject::ValueObject(ValueObject &parent)
82  : m_parent(&parent), m_update_point(parent.GetUpdatePoint()),
83  m_manager(parent.GetManager()), m_id(++g_value_obj_uid) {
88  m_manager->ManageObject(this);
89 }
90 
91 // ValueObject constructor
93  ValueObjectManager &manager,
94  AddressType child_ptr_or_ref_addr_type)
95  : m_update_point(exe_scope), m_manager(&manager),
96  m_address_type_of_ptr_or_ref_children(child_ptr_or_ref_addr_type),
97  m_id(++g_value_obj_uid) {
98  if (exe_scope) {
99  TargetSP target_sp(exe_scope->CalculateTarget());
100  if (target_sp) {
101  const ArchSpec &arch = target_sp->GetArchitecture();
104  }
105  }
106  m_manager->ManageObject(this);
107 }
108 
109 // Destructor
110 ValueObject::~ValueObject() = default;
111 
112 bool ValueObject::UpdateValueIfNeeded(bool update_format) {
113 
114  bool did_change_formats = false;
115 
116  if (update_format)
117  did_change_formats = UpdateFormatsIfNeeded();
118 
119  // If this is a constant value, then our success is predicated on whether we
120  // have an error or not
121  if (GetIsConstant()) {
122  // if you are constant, things might still have changed behind your back
123  // (e.g. you are a frozen object and things have changed deeper than you
124  // cared to freeze-dry yourself) in this case, your value has not changed,
125  // but "computed" entries might have, so you might now have a different
126  // summary, or a different object description. clear these so we will
127  // recompute them
128  if (update_format && !did_change_formats)
131  return m_error.Success();
132  }
133 
134  bool first_update = IsChecksumEmpty();
135 
136  if (NeedsUpdating()) {
138 
139  // Save the old value using swap to avoid a string copy which also will
140  // clear our m_value_str
141  if (m_value_str.empty()) {
142  m_flags.m_old_value_valid = false;
143  } else {
144  m_flags.m_old_value_valid = true;
147  }
148 
150 
151  if (IsInScope()) {
152  const bool value_was_valid = GetValueIsValid();
153  SetValueDidChange(false);
154 
155  m_error.Clear();
156 
157  // Call the pure virtual function to update the value
158 
159  bool need_compare_checksums = false;
160  llvm::SmallVector<uint8_t, 16> old_checksum;
161 
162  if (!first_update && CanProvideValue()) {
163  need_compare_checksums = true;
164  old_checksum.resize(m_value_checksum.size());
165  std::copy(m_value_checksum.begin(), m_value_checksum.end(),
166  old_checksum.begin());
167  }
168 
169  bool success = UpdateValue();
170 
171  SetValueIsValid(success);
172 
173  if (success) {
175  const uint64_t max_checksum_size = 128;
176  m_data.Checksum(m_value_checksum, max_checksum_size);
177  } else {
178  need_compare_checksums = false;
179  m_value_checksum.clear();
180  }
181 
182  assert(!need_compare_checksums ||
183  (!old_checksum.empty() && !m_value_checksum.empty()));
184 
185  if (first_update)
186  SetValueDidChange(false);
187  else if (!m_flags.m_value_did_change && !success) {
188  // The value wasn't gotten successfully, so we mark this as changed if
189  // the value used to be valid and now isn't
190  SetValueDidChange(value_was_valid);
191  } else if (need_compare_checksums) {
192  SetValueDidChange(memcmp(&old_checksum[0], &m_value_checksum[0],
193  m_value_checksum.size()));
194  }
195 
196  } else {
197  m_error.SetErrorString("out of scope");
198  }
199  }
200  return m_error.Success();
201 }
202 
205  LLDB_LOGF(log,
206  "[%s %p] checking for FormatManager revisions. ValueObject "
207  "rev: %d - Global rev: %d",
208  GetName().GetCString(), static_cast<void *>(this),
211 
212  bool any_change = false;
213 
216  any_change = true;
217 
221 #if LLDB_ENABLE_PYTHON
224 #endif
225  }
226 
227  return any_change;
228 }
229 
232  // We have to clear the value string here so ConstResult children will notice
233  // if their values are changed by hand (i.e. with SetValueAsCString).
235 }
236 
242  SetValueFormat(lldb::TypeFormatImplSP());
243  SetSummaryFormat(lldb::TypeSummaryImplSP());
244  SetSyntheticChildren(lldb::SyntheticChildrenSP());
245 }
246 
248  CompilerType compiler_type(GetCompilerTypeImpl());
249 
251  if (m_override_type.IsValid())
252  return m_override_type;
253  else
254  return compiler_type;
255  }
256 
258 
259  ProcessSP process_sp(
261 
262  if (!process_sp)
263  return compiler_type;
264 
265  if (auto *runtime =
266  process_sp->GetLanguageRuntime(GetObjectRuntimeLanguage())) {
267  if (std::optional<CompilerType> complete_type =
268  runtime->GetRuntimeType(compiler_type)) {
269  m_override_type = *complete_type;
270  if (m_override_type.IsValid())
271  return m_override_type;
272  }
273  }
274  return compiler_type;
275 }
276 
277 
278 
280  UpdateValueIfNeeded(false);
281  return m_data;
282 }
283 
285  UpdateValueIfNeeded(false);
286  return m_error;
287 }
288 
290  const DataExtractor &data) {
291  if (UpdateValueIfNeeded(false)) {
292  if (m_location_str.empty()) {
293  StreamString sstr;
294 
295  Value::ValueType value_type = value.GetValueType();
296 
297  switch (value_type) {
299  m_location_str = "invalid";
300  break;
303  RegisterInfo *reg_info = value.GetRegisterInfo();
304  if (reg_info) {
305  if (reg_info->name)
306  m_location_str = reg_info->name;
307  else if (reg_info->alt_name)
308  m_location_str = reg_info->alt_name;
309  if (m_location_str.empty())
310  m_location_str = (reg_info->encoding == lldb::eEncodingVector)
311  ? "vector"
312  : "scalar";
313  }
314  }
315  if (m_location_str.empty())
316  m_location_str = "scalar";
317  break;
318 
322  uint32_t addr_nibble_size = data.GetAddressByteSize() * 2;
323  sstr.Printf("0x%*.*llx", addr_nibble_size, addr_nibble_size,
326  } break;
327  }
328  }
329  }
330  return m_location_str.c_str();
331 }
332 
335  false)) // make sure that you are up to date before returning anything
336  {
338  Value tmp_value(m_value);
339  scalar = tmp_value.ResolveValue(&exe_ctx);
340  if (scalar.IsValid()) {
341  const uint32_t bitfield_bit_size = GetBitfieldBitSize();
342  if (bitfield_bit_size)
343  return scalar.ExtractBitfield(bitfield_bit_size,
345  return true;
346  }
347  }
348  return false;
349 }
350 
353  LazyBool is_logical_true = language->IsLogicalTrue(*this, error);
354  switch (is_logical_true) {
355  case eLazyBoolYes:
356  case eLazyBoolNo:
357  return (is_logical_true == true);
358  case eLazyBoolCalculate:
359  break;
360  }
361  }
362 
363  Scalar scalar_value;
364 
365  if (!ResolveValue(scalar_value)) {
366  error.SetErrorString("failed to get a scalar result");
367  return false;
368  }
369 
370  bool ret;
371  ret = scalar_value.ULongLong(1) != 0;
372  error.Clear();
373  return ret;
374 }
375 
376 ValueObjectSP ValueObject::GetChildAtIndex(size_t idx, bool can_create) {
377  ValueObjectSP child_sp;
378  // We may need to update our value if we are dynamic
379  if (IsPossibleDynamicType())
380  UpdateValueIfNeeded(false);
381  if (idx < GetNumChildren()) {
382  // Check if we have already made the child value object?
383  if (can_create && !m_children.HasChildAtIndex(idx)) {
384  // No we haven't created the child at this index, so lets have our
385  // subclass do it and cache the result for quick future access.
386  m_children.SetChildAtIndex(idx, CreateChildAtIndex(idx, false, 0));
387  }
388 
389  ValueObject *child = m_children.GetChildAtIndex(idx);
390  if (child != nullptr)
391  return child->GetSP();
392  }
393  return child_sp;
394 }
395 
396 lldb::ValueObjectSP
397 ValueObject::GetChildAtIndexPath(llvm::ArrayRef<size_t> idxs,
398  size_t *index_of_error) {
399  if (idxs.size() == 0)
400  return GetSP();
401  ValueObjectSP root(GetSP());
402  for (size_t idx : idxs) {
403  root = root->GetChildAtIndex(idx, true);
404  if (!root) {
405  if (index_of_error)
406  *index_of_error = idx;
407  return root;
408  }
409  }
410  return root;
411 }
412 
414  llvm::ArrayRef<std::pair<size_t, bool>> idxs, size_t *index_of_error) {
415  if (idxs.size() == 0)
416  return GetSP();
417  ValueObjectSP root(GetSP());
418  for (std::pair<size_t, bool> idx : idxs) {
419  root = root->GetChildAtIndex(idx.first, idx.second);
420  if (!root) {
421  if (index_of_error)
422  *index_of_error = idx.first;
423  return root;
424  }
425  }
426  return root;
427 }
428 
429 lldb::ValueObjectSP
430 ValueObject::GetChildAtNamePath(llvm::ArrayRef<ConstString> names,
431  ConstString *name_of_error) {
432  if (names.size() == 0)
433  return GetSP();
434  ValueObjectSP root(GetSP());
435  for (ConstString name : names) {
436  root = root->GetChildMemberWithName(name, true);
437  if (!root) {
438  if (name_of_error)
439  *name_of_error = name;
440  return root;
441  }
442  }
443  return root;
444 }
445 
447  llvm::ArrayRef<std::pair<ConstString, bool>> names,
448  ConstString *name_of_error) {
449  if (names.size() == 0)
450  return GetSP();
451  ValueObjectSP root(GetSP());
452  for (std::pair<ConstString, bool> name : names) {
453  root = root->GetChildMemberWithName(name.first, name.second);
454  if (!root) {
455  if (name_of_error)
456  *name_of_error = name.first;
457  return root;
458  }
459  }
460  return root;
461 }
462 
464  bool omit_empty_base_classes = true;
466  omit_empty_base_classes);
467 }
468 
470  bool can_create) {
471  // We may need to update our value if we are dynamic.
472  if (IsPossibleDynamicType())
473  UpdateValueIfNeeded(false);
474 
475  // When getting a child by name, it could be buried inside some base classes
476  // (which really aren't part of the expression path), so we need a vector of
477  // indexes that can get us down to the correct child.
478  std::vector<uint32_t> child_indexes;
479  bool omit_empty_base_classes = true;
480 
481  if (!GetCompilerType().IsValid())
482  return ValueObjectSP();
483 
484  const size_t num_child_indexes =
486  name.GetCString(), omit_empty_base_classes, child_indexes);
487  if (num_child_indexes == 0)
488  return nullptr;
489 
490  ValueObjectSP child_sp = GetSP();
491  for (uint32_t idx : child_indexes)
492  if (child_sp)
493  child_sp = child_sp->GetChildAtIndex(idx, can_create);
494  return child_sp;
495 }
496 
499 
500  if (max < UINT32_MAX) {
502  size_t children_count = m_children.GetChildrenCount();
503  return children_count <= max ? children_count : max;
504  } else
505  return CalculateNumChildren(max);
506  }
507 
510  }
511  return m_children.GetChildrenCount();
512 }
513 
515  bool has_children = false;
516  const uint32_t type_info = GetTypeInfo();
517  if (type_info) {
518  if (type_info & (eTypeHasChildren | eTypeIsPointer | eTypeIsReference))
519  has_children = true;
520  } else {
521  has_children = GetNumChildren() > 0;
522  }
523  return has_children;
524 }
525 
526 // Should only be called by ValueObject::GetNumChildren()
527 void ValueObject::SetNumChildren(size_t num_children) {
529  m_children.SetChildrenCount(num_children);
530 }
531 
533  bool synthetic_array_member,
534  int32_t synthetic_index) {
535  ValueObject *valobj = nullptr;
536 
537  bool omit_empty_base_classes = true;
538  bool ignore_array_bounds = synthetic_array_member;
539  std::string child_name_str;
540  uint32_t child_byte_size = 0;
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;
547 
548  const bool transparent_pointers = !synthetic_array_member;
549  CompilerType child_compiler_type;
550 
552 
553  child_compiler_type = GetCompilerType().GetChildCompilerTypeAtIndex(
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) {
559  if (synthetic_index)
560  child_byte_offset += child_byte_size * synthetic_index;
561 
562  ConstString child_name;
563  if (!child_name_str.empty())
564  child_name.SetCString(child_name_str.c_str());
565 
566  valobj = new ValueObjectChild(
567  *this, child_compiler_type, child_name, child_byte_size,
568  child_byte_offset, child_bitfield_bit_size, child_bitfield_bit_offset,
569  child_is_base_class, child_is_deref_of_parent, eAddressTypeInvalid,
570  language_flags);
571  }
572 
573  // In case of an incomplete type, try to use the ValueObject's
574  // synthetic value to create the child ValueObject.
575  if (!valobj && synthetic_array_member) {
576  if (ValueObjectSP synth_valobj_sp = GetSyntheticValue()) {
577  valobj = synth_valobj_sp
578  ->GetChildAtIndex(synthetic_index, synthetic_array_member)
579  .get();
580  }
581  }
582 
583  return valobj;
584 }
585 
587  std::string &destination,
588  lldb::LanguageType lang) {
589  return GetSummaryAsCString(summary_ptr, destination,
590  TypeSummaryOptions().SetLanguage(lang));
591 }
592 
594  std::string &destination,
595  const TypeSummaryOptions &options) {
596  destination.clear();
597 
598  // If we have a forcefully completed type, don't try and show a summary from
599  // a valid summary string or function because the type is not complete and
600  // no member variables or member functions will be available.
601  if (GetCompilerType().IsForcefullyCompleted()) {
602  destination = "<incomplete type>";
603  return true;
604  }
605 
606  // ideally we would like to bail out if passing NULL, but if we do so we end
607  // up not providing the summary for function pointers anymore
608  if (/*summary_ptr == NULL ||*/ m_flags.m_is_getting_summary)
609  return false;
610 
612 
613  TypeSummaryOptions actual_options(options);
614 
615  if (actual_options.GetLanguage() == lldb::eLanguageTypeUnknown)
616  actual_options.SetLanguage(GetPreferredDisplayLanguage());
617 
618  // this is a hot path in code and we prefer to avoid setting this string all
619  // too often also clearing out other information that we might care to see in
620  // a crash log. might be useful in very specific situations though.
621  /*Host::SetCrashDescriptionWithFormat("Trying to fetch a summary for %s %s.
622  Summary provider's description is %s",
623  GetTypeName().GetCString(),
624  GetName().GetCString(),
625  summary_ptr->GetDescription().c_str());*/
626 
627  if (UpdateValueIfNeeded(false) && summary_ptr) {
628  if (HasSyntheticValue())
629  m_synthetic_value->UpdateValueIfNeeded(); // the summary might depend on
630  // the synthetic children being
631  // up-to-date (e.g. ${svar%#})
632  summary_ptr->FormatObject(this, destination, actual_options);
633  }
635  return !destination.empty();
636 }
637 
639  if (UpdateValueIfNeeded(true) && m_summary_str.empty()) {
640  TypeSummaryOptions summary_options;
641  summary_options.SetLanguage(lang);
643  summary_options);
644  }
645  if (m_summary_str.empty())
646  return nullptr;
647  return m_summary_str.c_str();
648 }
649 
651  const TypeSummaryOptions &options) {
652  return GetSummaryAsCString(GetSummaryFormat().get(), destination, options);
653 }
654 
655 bool ValueObject::IsCStringContainer(bool check_pointer) {
656  CompilerType pointee_or_element_compiler_type;
657  const Flags type_flags(GetTypeInfo(&pointee_or_element_compiler_type));
658  bool is_char_arr_ptr(type_flags.AnySet(eTypeIsArray | eTypeIsPointer) &&
659  pointee_or_element_compiler_type.IsCharType());
660  if (!is_char_arr_ptr)
661  return false;
662  if (!check_pointer)
663  return true;
664  if (type_flags.Test(eTypeIsArray))
665  return true;
666  addr_t cstr_address = LLDB_INVALID_ADDRESS;
667  AddressType cstr_address_type = eAddressTypeInvalid;
668  cstr_address = GetPointerValue(&cstr_address_type);
669  return (cstr_address != LLDB_INVALID_ADDRESS);
670 }
671 
673  uint32_t item_count) {
674  CompilerType pointee_or_element_compiler_type;
675  const uint32_t type_info = GetTypeInfo(&pointee_or_element_compiler_type);
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))
679  return 0;
680 
681  if (item_count == 0)
682  return 0;
683 
685 
686  std::optional<uint64_t> item_type_size =
687  pointee_or_element_compiler_type.GetByteSize(
688  exe_ctx.GetBestExecutionContextScope());
689  if (!item_type_size)
690  return 0;
691  const uint64_t bytes = item_count * *item_type_size;
692  const uint64_t offset = item_idx * *item_type_size;
693 
694  if (item_idx == 0 && item_count == 1) // simply a deref
695  {
696  if (is_pointer_type) {
697  Status error;
698  ValueObjectSP pointee_sp = Dereference(error);
699  if (error.Fail() || pointee_sp.get() == nullptr)
700  return 0;
701  return pointee_sp->GetData(data, error);
702  } else {
703  ValueObjectSP child_sp = GetChildAtIndex(0, true);
704  if (child_sp.get() == nullptr)
705  return 0;
706  Status error;
707  return child_sp->GetData(data, error);
708  }
709  return true;
710  } else /* (items > 1) */
711  {
712  Status error;
713  lldb_private::DataBufferHeap *heap_buf_ptr = nullptr;
714  lldb::DataBufferSP data_sp(heap_buf_ptr =
716 
717  AddressType addr_type;
718  lldb::addr_t addr = is_pointer_type ? GetPointerValue(&addr_type)
719  : GetAddressOf(true, &addr_type);
720 
721  switch (addr_type) {
722  case eAddressTypeFile: {
723  ModuleSP module_sp(GetModule());
724  if (module_sp) {
725  addr = addr + offset;
726  Address so_addr;
727  module_sp->ResolveFileAddress(addr, so_addr);
729  Target *target = exe_ctx.GetTargetPtr();
730  if (target) {
731  heap_buf_ptr->SetByteSize(bytes);
732  size_t bytes_read = target->ReadMemory(
733  so_addr, heap_buf_ptr->GetBytes(), bytes, error, true);
734  if (error.Success()) {
735  data.SetData(data_sp);
736  return bytes_read;
737  }
738  }
739  }
740  } break;
741  case eAddressTypeLoad: {
743  Process *process = exe_ctx.GetProcessPtr();
744  if (process) {
745  heap_buf_ptr->SetByteSize(bytes);
746  size_t bytes_read = process->ReadMemory(
747  addr + offset, heap_buf_ptr->GetBytes(), bytes, error);
748  if (error.Success() || bytes_read > 0) {
749  data.SetData(data_sp);
750  return bytes_read;
751  }
752  }
753  } break;
754  case eAddressTypeHost: {
755  auto max_bytes =
757  if (max_bytes && *max_bytes > offset) {
758  size_t bytes_read = std::min<uint64_t>(*max_bytes - offset, bytes);
760  if (addr == 0 || addr == LLDB_INVALID_ADDRESS)
761  break;
762  heap_buf_ptr->CopyData((uint8_t *)(addr + offset), bytes_read);
763  data.SetData(data_sp);
764  return bytes_read;
765  }
766  } break;
767  case eAddressTypeInvalid:
768  break;
769  }
770  }
771  return 0;
772 }
773 
775  UpdateValueIfNeeded(false);
777  error = m_value.GetValueAsData(&exe_ctx, data, GetModule().get());
778  if (error.Fail()) {
779  if (m_data.GetByteSize()) {
780  data = m_data;
781  error.Clear();
782  return data.GetByteSize();
783  } else {
784  return 0;
785  }
786  }
789  return data.GetByteSize();
790 }
791 
793  error.Clear();
794  // Make sure our value is up to date first so that our location and location
795  // type is valid.
796  if (!UpdateValueIfNeeded(false)) {
797  error.SetErrorString("unable to read value");
798  return false;
799  }
800 
801  uint64_t count = 0;
802  const Encoding encoding = GetCompilerType().GetEncoding(count);
803 
804  const size_t byte_size = GetByteSize().value_or(0);
805 
806  Value::ValueType value_type = m_value.GetValueType();
807 
808  switch (value_type) {
810  error.SetErrorString("invalid location");
811  return false;
813  Status set_error =
814  m_value.GetScalar().SetValueFromData(data, encoding, byte_size);
815 
816  if (!set_error.Success()) {
817  error.SetErrorStringWithFormat("unable to set scalar value: %s",
818  set_error.AsCString());
819  return false;
820  }
821  } break;
823  // If it is a load address, then the scalar value is the storage location
824  // of the data, and we have to shove this value down to that load location.
826  Process *process = exe_ctx.GetProcessPtr();
827  if (process) {
829  size_t bytes_written = process->WriteMemory(
830  target_addr, data.GetDataStart(), byte_size, error);
831  if (!error.Success())
832  return false;
833  if (bytes_written != byte_size) {
834  error.SetErrorString("unable to write value to memory");
835  return false;
836  }
837  }
838  } break;
840  // If it is a host address, then we stuff the scalar as a DataBuffer into
841  // the Value's data.
842  DataBufferSP buffer_sp(new DataBufferHeap(byte_size, 0));
843  m_data.SetData(buffer_sp, 0);
844  data.CopyByteOrderedData(0, byte_size,
845  const_cast<uint8_t *>(m_data.GetDataStart()),
846  byte_size, m_data.GetByteOrder());
847  m_value.GetScalar() = (uintptr_t)m_data.GetDataStart();
848  } break;
850  break;
851  }
852 
853  // If we have reached this point, then we have successfully changed the
854  // value.
855  SetNeedsUpdate();
856  return true;
857 }
858 
859 static bool CopyStringDataToBufferSP(const StreamString &source,
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());
865  return true;
866 }
867 
868 std::pair<size_t, bool>
869 ValueObject::ReadPointedString(lldb::WritableDataBufferSP &buffer_sp,
870  Status &error, uint32_t max_length,
871  bool honor_array, Format item_format) {
872  bool was_capped = false;
873  StreamString s;
875  Target *target = exe_ctx.GetTargetPtr();
876 
877  if (!target) {
878  s << "<no target to read from>";
879  error.SetErrorString("no target to read from");
880  CopyStringDataToBufferSP(s, buffer_sp);
881  return {0, was_capped};
882  }
883 
884  if (max_length == 0)
885  max_length = target->GetMaximumSizeOfStringSummary();
886 
887  size_t bytes_read = 0;
888  size_t total_bytes_read = 0;
889 
890  CompilerType compiler_type = GetCompilerType();
891  CompilerType elem_or_pointee_compiler_type;
892  const Flags type_flags(GetTypeInfo(&elem_or_pointee_compiler_type));
893  if (type_flags.AnySet(eTypeIsArray | eTypeIsPointer) &&
894  elem_or_pointee_compiler_type.IsCharType()) {
895  addr_t cstr_address = LLDB_INVALID_ADDRESS;
896  AddressType cstr_address_type = eAddressTypeInvalid;
897 
898  size_t cstr_len = 0;
899  bool capped_data = false;
900  const bool is_array = type_flags.Test(eTypeIsArray);
901  if (is_array) {
902  // We have an array
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) {
907  capped_data = true;
908  cstr_len = max_length;
909  }
910  }
911  cstr_address = GetAddressOf(true, &cstr_address_type);
912  } else {
913  // We have a pointer
914  cstr_address = GetPointerValue(&cstr_address_type);
915  }
916 
917  if (cstr_address == 0 || cstr_address == LLDB_INVALID_ADDRESS) {
918  if (cstr_address_type == eAddressTypeHost && is_array) {
919  const char *cstr = GetDataExtractor().PeekCStr(0);
920  if (cstr == nullptr) {
921  s << "<invalid address>";
922  error.SetErrorString("invalid address");
923  CopyStringDataToBufferSP(s, buffer_sp);
924  return {0, was_capped};
925  }
926  s << llvm::StringRef(cstr, cstr_len);
927  CopyStringDataToBufferSP(s, buffer_sp);
928  return {cstr_len, was_capped};
929  } else {
930  s << "<invalid address>";
931  error.SetErrorString("invalid address");
932  CopyStringDataToBufferSP(s, buffer_sp);
933  return {0, was_capped};
934  }
935  }
936 
937  Address cstr_so_addr(cstr_address);
938  DataExtractor data;
939  if (cstr_len > 0 && honor_array) {
940  // I am using GetPointeeData() here to abstract the fact that some
941  // ValueObjects are actually frozen pointers in the host but the pointed-
942  // to data lives in the debuggee, and GetPointeeData() automatically
943  // takes care of this
944  GetPointeeData(data, 0, cstr_len);
945 
946  if ((bytes_read = data.GetByteSize()) > 0) {
947  total_bytes_read = bytes_read;
948  for (size_t offset = 0; offset < bytes_read; offset++)
949  s.Printf("%c", *data.PeekData(offset, 1));
950  if (capped_data)
951  was_capped = true;
952  }
953  } else {
954  cstr_len = max_length;
955  const size_t k_max_buf_size = 64;
956 
957  size_t offset = 0;
958 
959  int cstr_len_displayed = -1;
960  bool capped_cstr = false;
961  // I am using GetPointeeData() here to abstract the fact that some
962  // ValueObjects are actually frozen pointers in the host but the pointed-
963  // to data lives in the debuggee, and GetPointeeData() automatically
964  // takes care of this
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;
971 
972  if (len == 0)
973  break;
974  cstr_len_displayed += len;
975  if (len > bytes_read)
976  len = bytes_read;
977  if (len > cstr_len)
978  len = cstr_len;
979 
980  for (size_t offset = 0; offset < bytes_read; offset++)
981  s.Printf("%c", *data.PeekData(offset, 1));
982 
983  if (len < k_max_buf_size)
984  break;
985 
986  if (len >= cstr_len) {
987  capped_cstr = true;
988  break;
989  }
990 
991  cstr_len -= len;
992  offset += len;
993  }
994 
995  if (cstr_len_displayed >= 0) {
996  if (capped_cstr)
997  was_capped = true;
998  }
999  }
1000  } else {
1001  error.SetErrorString("not a string object");
1002  s << "<not a string object>";
1003  }
1004  CopyStringDataToBufferSP(s, buffer_sp);
1005  return {total_bytes_read, was_capped};
1006 }
1007 
1009  if (!UpdateValueIfNeeded(true))
1010  return nullptr;
1011 
1012  // Return cached value.
1013  if (!m_object_desc_str.empty())
1014  return m_object_desc_str.c_str();
1015 
1017  Process *process = exe_ctx.GetProcessPtr();
1018  if (!process)
1019  return nullptr;
1020 
1021  // Returns the object description produced by one language runtime.
1022  auto get_object_description = [&](LanguageType language) -> const char * {
1023  if (LanguageRuntime *runtime = process->GetLanguageRuntime(language)) {
1024  StreamString s;
1025  if (runtime->GetObjectDescription(s, *this)) {
1027  return m_object_desc_str.c_str();
1028  }
1029  }
1030  return nullptr;
1031  };
1032 
1033  // Try the native language runtime first.
1034  LanguageType native_language = GetObjectRuntimeLanguage();
1035  if (const char *desc = get_object_description(native_language))
1036  return desc;
1037 
1038  // Try the Objective-C language runtime. This fallback is necessary
1039  // for Objective-C++ and mixed Objective-C / C++ programs.
1040  if (Language::LanguageIsCFamily(native_language))
1041  return get_object_description(eLanguageTypeObjC);
1042  return nullptr;
1043 }
1044 
1046  std::string &destination) {
1047  if (UpdateValueIfNeeded(false))
1048  return format.FormatObject(this, destination);
1049  else
1050  return false;
1051 }
1052 
1054  std::string &destination) {
1055  return GetValueAsCString(TypeFormatImpl_Format(format), destination);
1056 }
1057 
1059  if (UpdateValueIfNeeded(true)) {
1060  lldb::TypeFormatImplSP format_sp;
1061  lldb::Format my_format = GetFormat();
1062  if (my_format == lldb::eFormatDefault) {
1063  if (m_type_format_sp)
1064  format_sp = m_type_format_sp;
1065  else {
1067  my_format = eFormatUnsigned;
1068  else {
1070  const RegisterInfo *reg_info = m_value.GetRegisterInfo();
1071  if (reg_info)
1072  my_format = reg_info->format;
1073  } else {
1074  my_format = GetValue().GetCompilerType().GetFormat();
1075  }
1076  }
1077  }
1078  }
1079  if (my_format != m_last_format || m_value_str.empty()) {
1080  m_last_format = my_format;
1081  if (!format_sp)
1082  format_sp = std::make_shared<TypeFormatImpl_Format>(my_format);
1083  if (GetValueAsCString(*format_sp.get(), m_value_str)) {
1085  // The value was gotten successfully, so we consider the value as
1086  // changed if the value string differs
1088  }
1089  }
1090  }
1091  }
1092  if (m_value_str.empty())
1093  return nullptr;
1094  return m_value_str.c_str();
1095 }
1096 
1097 // if > 8bytes, 0 is returned. this method should mostly be used to read
1098 // address values out of pointers
1099 uint64_t ValueObject::GetValueAsUnsigned(uint64_t fail_value, bool *success) {
1100  // If our byte size is zero this is an aggregate type that has children
1101  if (CanProvideValue()) {
1102  Scalar scalar;
1103  if (ResolveValue(scalar)) {
1104  if (success)
1105  *success = true;
1106  scalar.MakeUnsigned();
1107  return scalar.ULongLong(fail_value);
1108  }
1109  // fallthrough, otherwise...
1110  }
1111 
1112  if (success)
1113  *success = false;
1114  return fail_value;
1115 }
1116 
1117 int64_t ValueObject::GetValueAsSigned(int64_t fail_value, bool *success) {
1118  // If our byte size is zero this is an aggregate type that has children
1119  if (CanProvideValue()) {
1120  Scalar scalar;
1121  if (ResolveValue(scalar)) {
1122  if (success)
1123  *success = true;
1124  scalar.MakeSigned();
1125  return scalar.SLongLong(fail_value);
1126  }
1127  // fallthrough, otherwise...
1128  }
1129 
1130  if (success)
1131  *success = false;
1132  return fail_value;
1133 }
1134 
1135 // if any more "special cases" are added to
1136 // ValueObject::DumpPrintableRepresentation() please keep this call up to date
1137 // by returning true for your new special cases. We will eventually move to
1138 // checking this call result before trying to display special cases
1140  ValueObjectRepresentationStyle val_obj_display, Format custom_format) {
1141  Flags flags(GetTypeInfo());
1142  if (flags.AnySet(eTypeIsArray | eTypeIsPointer) &&
1144  if (IsCStringContainer(true) &&
1145  (custom_format == eFormatCString || custom_format == eFormatCharArray ||
1146  custom_format == eFormatChar || custom_format == eFormatVectorOfChar))
1147  return true;
1148 
1149  if (flags.Test(eTypeIsArray)) {
1150  if ((custom_format == eFormatBytes) ||
1151  (custom_format == eFormatBytesWithASCII))
1152  return true;
1153 
1154  if ((custom_format == eFormatVectorOfChar) ||
1155  (custom_format == eFormatVectorOfFloat32) ||
1156  (custom_format == eFormatVectorOfFloat64) ||
1157  (custom_format == eFormatVectorOfSInt16) ||
1158  (custom_format == eFormatVectorOfSInt32) ||
1159  (custom_format == eFormatVectorOfSInt64) ||
1160  (custom_format == eFormatVectorOfSInt8) ||
1161  (custom_format == eFormatVectorOfUInt128) ||
1162  (custom_format == eFormatVectorOfUInt16) ||
1163  (custom_format == eFormatVectorOfUInt32) ||
1164  (custom_format == eFormatVectorOfUInt64) ||
1165  (custom_format == eFormatVectorOfUInt8))
1166  return true;
1167  }
1168  }
1169  return false;
1170 }
1171 
1173  Stream &s, ValueObjectRepresentationStyle val_obj_display,
1174  Format custom_format, PrintableRepresentationSpecialCases special,
1175  bool do_dump_error) {
1176 
1177  Flags flags(GetTypeInfo());
1178 
1179  bool allow_special =
1181  const bool only_special = false;
1182 
1183  if (allow_special) {
1184  if (flags.AnySet(eTypeIsArray | eTypeIsPointer) &&
1186  // when being asked to get a printable display an array or pointer type
1187  // directly, try to "do the right thing"
1188 
1189  if (IsCStringContainer(true) &&
1190  (custom_format == eFormatCString ||
1191  custom_format == eFormatCharArray || custom_format == eFormatChar ||
1192  custom_format ==
1193  eFormatVectorOfChar)) // print char[] & char* directly
1194  {
1195  Status error;
1196  lldb::WritableDataBufferSP buffer_sp;
1197  std::pair<size_t, bool> read_string = ReadPointedString(
1198  buffer_sp, error, 0, (custom_format == eFormatVectorOfChar) ||
1199  (custom_format == eFormatCharArray));
1200  lldb_private::formatters::StringPrinter::
1201  ReadBufferAndDumpToStreamOptions options(*this);
1202  options.SetData(DataExtractor(
1203  buffer_sp, lldb::eByteOrderInvalid,
1204  8)); // none of this matters for a string - pass some defaults
1205  options.SetStream(&s);
1206  options.SetPrefixToken(nullptr);
1207  options.SetQuote('"');
1208  options.SetSourceSize(buffer_sp->GetByteSize());
1209  options.SetIsTruncated(read_string.second);
1210  options.SetBinaryZeroIsTerminator(custom_format != eFormatVectorOfChar);
1213  options);
1214  return !error.Fail();
1215  }
1216 
1217  if (custom_format == eFormatEnum)
1218  return false;
1219 
1220  // this only works for arrays, because I have no way to know when the
1221  // pointed memory ends, and no special \0 end of data marker
1222  if (flags.Test(eTypeIsArray)) {
1223  if ((custom_format == eFormatBytes) ||
1224  (custom_format == eFormatBytesWithASCII)) {
1225  const size_t count = GetNumChildren();
1226 
1227  s << '[';
1228  for (size_t low = 0; low < count; low++) {
1229 
1230  if (low)
1231  s << ',';
1232 
1233  ValueObjectSP child = GetChildAtIndex(low, true);
1234  if (!child.get()) {
1235  s << "<invalid child>";
1236  continue;
1237  }
1238  child->DumpPrintableRepresentation(
1240  custom_format);
1241  }
1242 
1243  s << ']';
1244 
1245  return true;
1246  }
1247 
1248  if ((custom_format == eFormatVectorOfChar) ||
1249  (custom_format == eFormatVectorOfFloat32) ||
1250  (custom_format == eFormatVectorOfFloat64) ||
1251  (custom_format == eFormatVectorOfSInt16) ||
1252  (custom_format == eFormatVectorOfSInt32) ||
1253  (custom_format == eFormatVectorOfSInt64) ||
1254  (custom_format == eFormatVectorOfSInt8) ||
1255  (custom_format == eFormatVectorOfUInt128) ||
1256  (custom_format == eFormatVectorOfUInt16) ||
1257  (custom_format == eFormatVectorOfUInt32) ||
1258  (custom_format == eFormatVectorOfUInt64) ||
1259  (custom_format == eFormatVectorOfUInt8)) // arrays of bytes, bytes
1260  // with ASCII or any vector
1261  // format should be printed
1262  // directly
1263  {
1264  const size_t count = GetNumChildren();
1265 
1266  Format format = FormatManager::GetSingleItemFormat(custom_format);
1267 
1268  s << '[';
1269  for (size_t low = 0; low < count; low++) {
1270 
1271  if (low)
1272  s << ',';
1273 
1274  ValueObjectSP child = GetChildAtIndex(low, true);
1275  if (!child.get()) {
1276  s << "<invalid child>";
1277  continue;
1278  }
1279  child->DumpPrintableRepresentation(
1281  }
1282 
1283  s << ']';
1284 
1285  return true;
1286  }
1287  }
1288 
1289  if ((custom_format == eFormatBoolean) ||
1290  (custom_format == eFormatBinary) || (custom_format == eFormatChar) ||
1291  (custom_format == eFormatCharPrintable) ||
1292  (custom_format == eFormatComplexFloat) ||
1293  (custom_format == eFormatDecimal) || (custom_format == eFormatHex) ||
1294  (custom_format == eFormatHexUppercase) ||
1295  (custom_format == eFormatFloat) || (custom_format == eFormatOctal) ||
1296  (custom_format == eFormatOSType) ||
1297  (custom_format == eFormatUnicode16) ||
1298  (custom_format == eFormatUnicode32) ||
1299  (custom_format == eFormatUnsigned) ||
1300  (custom_format == eFormatPointer) ||
1301  (custom_format == eFormatComplexInteger) ||
1302  (custom_format == eFormatComplex) ||
1303  (custom_format == eFormatDefault)) // use the [] operator
1304  return false;
1305  }
1306  }
1307 
1308  if (only_special)
1309  return false;
1310 
1311  bool var_success = false;
1312 
1313  {
1314  llvm::StringRef str;
1315 
1316  // this is a local stream that we are using to ensure that the data pointed
1317  // to by cstr survives long enough for us to copy it to its destination -
1318  // it is necessary to have this temporary storage area for cases where our
1319  // desired output is not backed by some other longer-term storage
1320  StreamString strm;
1321 
1322  if (custom_format != eFormatInvalid)
1323  SetFormat(custom_format);
1324 
1325  switch (val_obj_display) {
1327  str = GetValueAsCString();
1328  break;
1329 
1331  str = GetSummaryAsCString();
1332  break;
1333 
1335  str = GetObjectDescription();
1336  break;
1337 
1339  str = GetLocationAsCString();
1340  break;
1341 
1343  strm.Printf("%" PRIu64 "", (uint64_t)GetNumChildren());
1344  str = strm.GetString();
1345  break;
1346 
1348  str = GetTypeName().GetStringRef();
1349  break;
1350 
1352  str = GetName().GetStringRef();
1353  break;
1354 
1356  GetExpressionPath(strm);
1357  str = strm.GetString();
1358  break;
1359  }
1360 
1361  if (str.empty()) {
1362  if (val_obj_display == eValueObjectRepresentationStyleValue)
1363  str = GetSummaryAsCString();
1364  else if (val_obj_display == eValueObjectRepresentationStyleSummary) {
1365  if (!CanProvideValue()) {
1366  strm.Printf("%s @ %s", GetTypeName().AsCString(),
1368  str = strm.GetString();
1369  } else
1370  str = GetValueAsCString();
1371  }
1372  }
1373 
1374  if (!str.empty())
1375  s << str;
1376  else {
1377  if (m_error.Fail()) {
1378  if (do_dump_error)
1379  s.Printf("<%s>", m_error.AsCString());
1380  else
1381  return false;
1382  } else if (val_obj_display == eValueObjectRepresentationStyleSummary)
1383  s.PutCString("<no summary available>");
1384  else if (val_obj_display == eValueObjectRepresentationStyleValue)
1385  s.PutCString("<no value available>");
1386  else if (val_obj_display ==
1388  s.PutCString("<not a valid Objective-C object>"); // edit this if we
1389  // have other runtimes
1390  // that support a
1391  // description
1392  else
1393  s.PutCString("<no printable representation>");
1394  }
1395 
1396  // we should only return false here if we could not do *anything* even if
1397  // we have an error message as output, that's a success from our callers'
1398  // perspective, so return true
1399  var_success = true;
1400 
1401  if (custom_format != eFormatInvalid)
1403  }
1404 
1405  return var_success;
1406 }
1407 
1408 addr_t ValueObject::GetAddressOf(bool scalar_is_load_address,
1409  AddressType *address_type) {
1410  // Can't take address of a bitfield
1411  if (IsBitfield())
1412  return LLDB_INVALID_ADDRESS;
1413 
1414  if (!UpdateValueIfNeeded(false))
1415  return LLDB_INVALID_ADDRESS;
1416 
1417  switch (m_value.GetValueType()) {
1419  return LLDB_INVALID_ADDRESS;
1421  if (scalar_is_load_address) {
1422  if (address_type)
1423  *address_type = eAddressTypeLoad;
1425  }
1426  break;
1427 
1430  if (address_type)
1431  *address_type = m_value.GetValueAddressType();
1433  } break;
1435  if (address_type)
1436  *address_type = m_value.GetValueAddressType();
1437  return LLDB_INVALID_ADDRESS;
1438  } break;
1439  }
1440  if (address_type)
1441  *address_type = eAddressTypeInvalid;
1442  return LLDB_INVALID_ADDRESS;
1443 }
1444 
1446  addr_t address = LLDB_INVALID_ADDRESS;
1447  if (address_type)
1448  *address_type = eAddressTypeInvalid;
1449 
1450  if (!UpdateValueIfNeeded(false))
1451  return address;
1452 
1453  switch (m_value.GetValueType()) {
1455  return LLDB_INVALID_ADDRESS;
1458  break;
1459 
1463  lldb::offset_t data_offset = 0;
1464  address = m_data.GetAddress(&data_offset);
1465  } break;
1466  }
1467 
1468  if (address_type)
1469  *address_type = GetAddressTypeOfChildren();
1470 
1471  return address;
1472 }
1473 
1474 bool ValueObject::SetValueFromCString(const char *value_str, Status &error) {
1475  error.Clear();
1476  // Make sure our value is up to date first so that our location and location
1477  // type is valid.
1478  if (!UpdateValueIfNeeded(false)) {
1479  error.SetErrorString("unable to read value");
1480  return false;
1481  }
1482 
1483  uint64_t count = 0;
1484  const Encoding encoding = GetCompilerType().GetEncoding(count);
1485 
1486  const size_t byte_size = GetByteSize().value_or(0);
1487 
1488  Value::ValueType value_type = m_value.GetValueType();
1489 
1490  if (value_type == Value::ValueType::Scalar) {
1491  // If the value is already a scalar, then let the scalar change itself:
1492  m_value.GetScalar().SetValueFromCString(value_str, encoding, byte_size);
1493  } else if (byte_size <= 16) {
1494  // If the value fits in a scalar, then make a new scalar and again let the
1495  // scalar code do the conversion, then figure out where to put the new
1496  // value.
1497  Scalar new_scalar;
1498  error = new_scalar.SetValueFromCString(value_str, encoding, byte_size);
1499  if (error.Success()) {
1500  switch (value_type) {
1502  // If it is a load address, then the scalar value is the storage
1503  // location of the data, and we have to shove this value down to that
1504  // load location.
1506  Process *process = exe_ctx.GetProcessPtr();
1507  if (process) {
1508  addr_t target_addr =
1510  size_t bytes_written = process->WriteScalarToMemory(
1511  target_addr, new_scalar, byte_size, error);
1512  if (!error.Success())
1513  return false;
1514  if (bytes_written != byte_size) {
1515  error.SetErrorString("unable to write value to memory");
1516  return false;
1517  }
1518  }
1519  } break;
1521  // If it is a host address, then we stuff the scalar as a DataBuffer
1522  // into the Value's data.
1523  DataExtractor new_data;
1524  new_data.SetByteOrder(m_data.GetByteOrder());
1525 
1526  DataBufferSP buffer_sp(new DataBufferHeap(byte_size, 0));
1527  m_data.SetData(buffer_sp, 0);
1528  bool success = new_scalar.GetData(new_data);
1529  if (success) {
1530  new_data.CopyByteOrderedData(
1531  0, byte_size, const_cast<uint8_t *>(m_data.GetDataStart()),
1532  byte_size, m_data.GetByteOrder());
1533  }
1534  m_value.GetScalar() = (uintptr_t)m_data.GetDataStart();
1535 
1536  } break;
1538  error.SetErrorString("invalid location");
1539  return false;
1542  break;
1543  }
1544  } else {
1545  return false;
1546  }
1547  } else {
1548  // We don't support setting things bigger than a scalar at present.
1549  error.SetErrorString("unable to write aggregate data type");
1550  return false;
1551  }
1552 
1553  // If we have reached this point, then we have successfully changed the
1554  // value.
1555  SetNeedsUpdate();
1556  return true;
1557 }
1558 
1560  decl.Clear();
1561  return false;
1562 }
1563 
1565  ValueObject *valobj) {
1566  m_synthetic_children[key] = valobj;
1567 }
1568 
1570  ValueObjectSP synthetic_child_sp;
1571  std::map<ConstString, ValueObject *>::const_iterator pos =
1572  m_synthetic_children.find(key);
1573  if (pos != m_synthetic_children.end())
1574  synthetic_child_sp = pos->second->GetSP();
1575  return synthetic_child_sp;
1576 }
1577 
1580  Process *process = exe_ctx.GetProcessPtr();
1581  if (process)
1582  return process->IsPossibleDynamicValue(*this);
1583  else
1584  return GetCompilerType().IsPossibleDynamicType(nullptr, true, true);
1585 }
1586 
1588  Process *process(GetProcessSP().get());
1589  if (!process)
1590  return false;
1591 
1592  // We trust that the compiler did the right thing and marked runtime support
1593  // values as artificial.
1594  if (!GetVariable() || !GetVariable()->IsArtificial())
1595  return false;
1596 
1597  if (auto *runtime = process->GetLanguageRuntime(GetVariable()->GetLanguage()))
1598  if (runtime->IsAllowedRuntimeValue(GetName()))
1599  return false;
1600 
1601  return true;
1602 }
1603 
1606  return language->IsNilReference(*this);
1607  }
1608  return false;
1609 }
1610 
1613  return language->IsUninitializedReference(*this);
1614  }
1615  return false;
1616 }
1617 
1618 // This allows you to create an array member using and index that doesn't not
1619 // fall in the normal bounds of the array. Many times structure can be defined
1620 // as: struct Collection {
1621 // uint32_t item_count;
1622 // Item item_array[0];
1623 // };
1624 // The size of the "item_array" is 1, but many times in practice there are more
1625 // items in "item_array".
1626 
1627 ValueObjectSP ValueObject::GetSyntheticArrayMember(size_t index,
1628  bool can_create) {
1629  ValueObjectSP synthetic_child_sp;
1630  if (IsPointerType() || IsArrayType()) {
1631  std::string index_str = llvm::formatv("[{0}]", index);
1632  ConstString index_const_str(index_str);
1633  // Check if we have already created a synthetic array member in this valid
1634  // object. If we have we will re-use it.
1635  synthetic_child_sp = GetSyntheticChild(index_const_str);
1636  if (!synthetic_child_sp) {
1637  ValueObject *synthetic_child;
1638  // We haven't made a synthetic array member for INDEX yet, so lets make
1639  // one and cache it for any future reference.
1640  synthetic_child = CreateChildAtIndex(0, true, index);
1641 
1642  // Cache the value if we got one back...
1643  if (synthetic_child) {
1644  AddSyntheticChild(index_const_str, 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;
1648  }
1649  }
1650  }
1651  return synthetic_child_sp;
1652 }
1653 
1655  bool can_create) {
1656  ValueObjectSP synthetic_child_sp;
1657  if (IsScalarType()) {
1658  std::string index_str = llvm::formatv("[{0}-{1}]", from, to);
1659  ConstString index_const_str(index_str);
1660  // Check if we have already created a synthetic array member in this valid
1661  // object. If we have we will re-use it.
1662  synthetic_child_sp = GetSyntheticChild(index_const_str);
1663  if (!synthetic_child_sp) {
1664  uint32_t bit_field_size = to - from + 1;
1665  uint32_t bit_field_offset = from;
1666  if (GetDataExtractor().GetByteOrder() == eByteOrderBig)
1667  bit_field_offset =
1668  GetByteSize().value_or(0) * 8 - bit_field_size - bit_field_offset;
1669  // We haven't made a synthetic array member for INDEX yet, so lets make
1670  // one and cache it for any future reference.
1671  ValueObjectChild *synthetic_child = new ValueObjectChild(
1672  *this, GetCompilerType(), index_const_str, GetByteSize().value_or(0),
1673  0, bit_field_size, bit_field_offset, false, false,
1674  eAddressTypeInvalid, 0);
1675 
1676  // Cache the value if we got one back...
1677  if (synthetic_child) {
1678  AddSyntheticChild(index_const_str, 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;
1682  }
1683  }
1684  }
1685  return synthetic_child_sp;
1686 }
1687 
1689  uint32_t offset, const CompilerType &type, bool can_create,
1690  ConstString name_const_str) {
1691 
1692  ValueObjectSP synthetic_child_sp;
1693 
1694  if (name_const_str.IsEmpty()) {
1695  name_const_str.SetString("@" + std::to_string(offset));
1696  }
1697 
1698  // Check if we have already created a synthetic array member in this valid
1699  // object. If we have we will re-use it.
1700  synthetic_child_sp = GetSyntheticChild(name_const_str);
1701 
1702  if (synthetic_child_sp.get())
1703  return synthetic_child_sp;
1704 
1705  if (!can_create)
1706  return {};
1707 
1709  std::optional<uint64_t> size =
1710  type.GetByteSize(exe_ctx.GetBestExecutionContextScope());
1711  if (!size)
1712  return {};
1713  ValueObjectChild *synthetic_child =
1714  new ValueObjectChild(*this, type, name_const_str, *size, offset, 0, 0,
1715  false, false, eAddressTypeInvalid, 0);
1716  if (synthetic_child) {
1717  AddSyntheticChild(name_const_str, 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;
1721  }
1722  return synthetic_child_sp;
1723 }
1724 
1726  const CompilerType &type,
1727  bool can_create,
1728  ConstString name_const_str) {
1729  ValueObjectSP synthetic_child_sp;
1730 
1731  if (name_const_str.IsEmpty()) {
1732  char name_str[128];
1733  snprintf(name_str, sizeof(name_str), "base%s@%i",
1734  type.GetTypeName().AsCString("<unknown>"), offset);
1735  name_const_str.SetCString(name_str);
1736  }
1737 
1738  // Check if we have already created a synthetic array member in this valid
1739  // object. If we have we will re-use it.
1740  synthetic_child_sp = GetSyntheticChild(name_const_str);
1741 
1742  if (synthetic_child_sp.get())
1743  return synthetic_child_sp;
1744 
1745  if (!can_create)
1746  return {};
1747 
1748  const bool is_base_class = true;
1749 
1751  std::optional<uint64_t> size =
1752  type.GetByteSize(exe_ctx.GetBestExecutionContextScope());
1753  if (!size)
1754  return {};
1755  ValueObjectChild *synthetic_child =
1756  new ValueObjectChild(*this, type, name_const_str, *size, offset, 0, 0,
1757  is_base_class, false, eAddressTypeInvalid, 0);
1758  if (synthetic_child) {
1759  AddSyntheticChild(name_const_str, synthetic_child);
1760  synthetic_child_sp = synthetic_child->GetSP();
1761  synthetic_child_sp->SetName(name_const_str);
1762  }
1763  return synthetic_child_sp;
1764 }
1765 
1766 // your expression path needs to have a leading . or -> (unless it somehow
1767 // "looks like" an array, in which case it has a leading [ symbol). while the [
1768 // is meaningful and should be shown to the user, . and -> are just parser
1769 // design, but by no means added information for the user.. strip them off
1770 static const char *SkipLeadingExpressionPathSeparators(const char *expression) {
1771  if (!expression || !expression[0])
1772  return expression;
1773  if (expression[0] == '.')
1774  return expression + 1;
1775  if (expression[0] == '-' && expression[1] == '>')
1776  return expression + 2;
1777  return expression;
1778 }
1779 
1780 ValueObjectSP
1782  bool can_create) {
1783  ValueObjectSP synthetic_child_sp;
1784  ConstString name_const_string(expression);
1785  // Check if we have already created a synthetic array member in this valid
1786  // object. If we have we will re-use it.
1787  synthetic_child_sp = GetSyntheticChild(name_const_string);
1788  if (!synthetic_child_sp) {
1789  // We haven't made a synthetic array member for expression yet, so lets
1790  // make one and cache it for any future reference.
1791  synthetic_child_sp = GetValueForExpressionPath(
1792  expression, nullptr, nullptr,
1793  GetValueForExpressionPathOptions().SetSyntheticChildrenTraversal(
1795  None));
1796 
1797  // Cache the value if we got one back...
1798  if (synthetic_child_sp.get()) {
1799  // FIXME: this causes a "real" child to end up with its name changed to
1800  // the contents of expression
1801  AddSyntheticChild(name_const_string, synthetic_child_sp.get());
1802  synthetic_child_sp->SetName(
1804  }
1805  }
1806  return synthetic_child_sp;
1807 }
1808 
1810  TargetSP target_sp(GetTargetSP());
1811  if (target_sp && !target_sp->GetEnableSyntheticValue()) {
1812  m_synthetic_value = nullptr;
1813  return;
1814  }
1815 
1816  lldb::SyntheticChildrenSP current_synth_sp(m_synthetic_children_sp);
1817 
1819  return;
1820 
1821  if (m_synthetic_children_sp.get() == nullptr)
1822  return;
1823 
1824  if (current_synth_sp == m_synthetic_children_sp && m_synthetic_value)
1825  return;
1826 
1828 }
1829 
1831  if (use_dynamic == eNoDynamicValues)
1832  return;
1833 
1834  if (!m_dynamic_value && !IsDynamic()) {
1836  Process *process = exe_ctx.GetProcessPtr();
1837  if (process && process->IsPossibleDynamicValue(*this)) {
1839  m_dynamic_value = new ValueObjectDynamicValue(*this, use_dynamic);
1840  }
1841  }
1842 }
1843 
1845  if (use_dynamic == eNoDynamicValues)
1846  return ValueObjectSP();
1847 
1848  if (!IsDynamic() && m_dynamic_value == nullptr) {
1849  CalculateDynamicValue(use_dynamic);
1850  }
1851  if (m_dynamic_value)
1852  return m_dynamic_value->GetSP();
1853  else
1854  return ValueObjectSP();
1855 }
1856 
1859 
1860  if (m_synthetic_value)
1861  return m_synthetic_value->GetSP();
1862  else
1863  return ValueObjectSP();
1864 }
1865 
1868 
1869  if (m_synthetic_children_sp.get() == nullptr)
1870  return false;
1871 
1873 
1874  return m_synthetic_value != nullptr;
1875 }
1876 
1878  if (GetParent()) {
1879  if (GetParent()->IsBaseClass())
1880  return GetParent()->GetNonBaseClassParent();
1881  else
1882  return GetParent();
1883  }
1884  return nullptr;
1885 }
1886 
1888  if (!IsBaseClass()) {
1889  depth = 0;
1890  return false;
1891  }
1892  if (GetParent()) {
1893  GetParent()->IsBaseClass(depth);
1894  depth = depth + 1;
1895  return true;
1896  }
1897  // TODO: a base of no parent? weird..
1898  depth = 1;
1899  return true;
1900 }
1901 
1903  GetExpressionPathFormat epformat) {
1904  // synthetic children do not actually "exist" as part of the hierarchy, and
1905  // sometimes they are consed up in ways that don't make sense from an
1906  // underlying language/API standpoint. So, use a special code path here to
1907  // return something that can hopefully be used in expression
1910 
1912  if (IsPointerOrReferenceType()) {
1913  s.Printf("((%s)0x%" PRIx64 ")", GetTypeName().AsCString("void"),
1914  GetValueAsUnsigned(0));
1915  return;
1916  } else {
1917  uint64_t load_addr =
1919  if (load_addr != LLDB_INVALID_ADDRESS) {
1920  s.Printf("(*( (%s *)0x%" PRIx64 "))", GetTypeName().AsCString("void"),
1921  load_addr);
1922  return;
1923  }
1924  }
1925  }
1926 
1927  if (CanProvideValue()) {
1928  s.Printf("((%s)%s)", GetTypeName().AsCString("void"),
1929  GetValueAsCString());
1930  return;
1931  }
1932 
1933  return;
1934  }
1935 
1936  const bool is_deref_of_parent = IsDereferenceOfParent();
1937 
1938  if (is_deref_of_parent &&
1940  // this is the original format of GetExpressionPath() producing code like
1941  // *(a_ptr).memberName, which is entirely fine, until you put this into
1942  // StackFrame::GetValueForVariableExpressionPath() which prefers to see
1943  // a_ptr->memberName. the eHonorPointers mode is meant to produce strings
1944  // in this latter format
1945  s.PutCString("*(");
1946  }
1947 
1948  ValueObject *parent = GetParent();
1949 
1950  if (parent)
1951  parent->GetExpressionPath(s, epformat);
1952 
1953  // if we are a deref_of_parent just because we are synthetic array members
1954  // made up to allow ptr[%d] syntax to work in variable printing, then add our
1955  // name ([%d]) to the expression path
1959 
1960  if (!IsBaseClass()) {
1961  if (!is_deref_of_parent) {
1962  ValueObject *non_base_class_parent = GetNonBaseClassParent();
1963  if (non_base_class_parent &&
1964  !non_base_class_parent->GetName().IsEmpty()) {
1965  CompilerType non_base_class_parent_compiler_type =
1966  non_base_class_parent->GetCompilerType();
1967  if (non_base_class_parent_compiler_type) {
1968  if (parent && parent->IsDereferenceOfParent() &&
1970  s.PutCString("->");
1971  } else {
1972  const uint32_t non_base_class_parent_type_info =
1973  non_base_class_parent_compiler_type.GetTypeInfo();
1974 
1975  if (non_base_class_parent_type_info & eTypeIsPointer) {
1976  s.PutCString("->");
1977  } else if ((non_base_class_parent_type_info & eTypeHasChildren) &&
1978  !(non_base_class_parent_type_info & eTypeIsArray)) {
1979  s.PutChar('.');
1980  }
1981  }
1982  }
1983  }
1984 
1985  const char *name = GetName().GetCString();
1986  if (name)
1987  s.PutCString(name);
1988  }
1989  }
1990 
1991  if (is_deref_of_parent &&
1993  s.PutChar(')');
1994  }
1995 }
1996 
1998  llvm::StringRef expression, ExpressionPathScanEndReason *reason_to_stop,
1999  ExpressionPathEndResultType *final_value_type,
2000  const GetValueForExpressionPathOptions &options,
2001  ExpressionPathAftermath *final_task_on_target) {
2002 
2003  ExpressionPathScanEndReason dummy_reason_to_stop =
2005  ExpressionPathEndResultType dummy_final_value_type =
2007  ExpressionPathAftermath dummy_final_task_on_target =
2009 
2010  ValueObjectSP ret_val = GetValueForExpressionPath_Impl(
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);
2015 
2016  if (!final_task_on_target ||
2017  *final_task_on_target == ValueObject::eExpressionPathAftermathNothing)
2018  return ret_val;
2019 
2020  if (ret_val.get() &&
2021  ((final_value_type ? *final_value_type : dummy_final_value_type) ==
2022  eExpressionPathEndResultTypePlain)) // I can only deref and takeaddress
2023  // of plain objects
2024  {
2025  if ((final_task_on_target ? *final_task_on_target
2026  : dummy_final_task_on_target) ==
2028  Status error;
2029  ValueObjectSP final_value = ret_val->Dereference(error);
2030  if (error.Fail() || !final_value.get()) {
2031  if (reason_to_stop)
2032  *reason_to_stop =
2034  if (final_value_type)
2036  return ValueObjectSP();
2037  } else {
2038  if (final_task_on_target)
2039  *final_task_on_target = ValueObject::eExpressionPathAftermathNothing;
2040  return final_value;
2041  }
2042  }
2043  if (*final_task_on_target ==
2045  Status error;
2046  ValueObjectSP final_value = ret_val->AddressOf(error);
2047  if (error.Fail() || !final_value.get()) {
2048  if (reason_to_stop)
2049  *reason_to_stop =
2051  if (final_value_type)
2053  return ValueObjectSP();
2054  } else {
2055  if (final_task_on_target)
2056  *final_task_on_target = ValueObject::eExpressionPathAftermathNothing;
2057  return final_value;
2058  }
2059  }
2060  }
2061  return ret_val; // final_task_on_target will still have its original value, so
2062  // you know I did not do it
2063 }
2064 
2066  llvm::StringRef expression, ExpressionPathScanEndReason *reason_to_stop,
2067  ExpressionPathEndResultType *final_result,
2068  const GetValueForExpressionPathOptions &options,
2069  ExpressionPathAftermath *what_next) {
2070  ValueObjectSP root = GetSP();
2071 
2072  if (!root)
2073  return nullptr;
2074 
2075  llvm::StringRef remainder = expression;
2076 
2077  while (true) {
2078  llvm::StringRef temp_expression = remainder;
2079 
2080  CompilerType root_compiler_type = root->GetCompilerType();
2081  CompilerType pointee_compiler_type;
2082  Flags pointee_compiler_type_info;
2083 
2084  Flags root_compiler_type_info(
2085  root_compiler_type.GetTypeInfo(&pointee_compiler_type));
2086  if (pointee_compiler_type)
2087  pointee_compiler_type_info.Reset(pointee_compiler_type.GetTypeInfo());
2088 
2089  if (temp_expression.empty()) {
2091  return root;
2092  }
2093 
2094  switch (temp_expression.front()) {
2095  case '-': {
2096  temp_expression = temp_expression.drop_front();
2097  if (options.m_check_dot_vs_arrow_syntax &&
2098  root_compiler_type_info.Test(eTypeIsPointer)) // if you are trying to
2099  // use -> on a
2100  // non-pointer and I
2101  // must catch the error
2102  {
2103  *reason_to_stop =
2106  return ValueObjectSP();
2107  }
2108  if (root_compiler_type_info.Test(eTypeIsObjC) && // if yo are trying to
2109  // extract an ObjC IVar
2110  // when this is forbidden
2111  root_compiler_type_info.Test(eTypeIsPointer) &&
2112  options.m_no_fragile_ivar) {
2113  *reason_to_stop =
2116  return ValueObjectSP();
2117  }
2118  if (!temp_expression.startswith(">")) {
2119  *reason_to_stop =
2122  return ValueObjectSP();
2123  }
2124  }
2125  [[fallthrough]];
2126  case '.': // or fallthrough from ->
2127  {
2128  if (options.m_check_dot_vs_arrow_syntax &&
2129  temp_expression.front() == '.' &&
2130  root_compiler_type_info.Test(eTypeIsPointer)) // if you are trying to
2131  // use . on a pointer
2132  // and I must catch the
2133  // error
2134  {
2135  *reason_to_stop =
2138  return nullptr;
2139  }
2140  temp_expression = temp_expression.drop_front(); // skip . or >
2141 
2142  size_t next_sep_pos = temp_expression.find_first_of("-.[", 1);
2143  ConstString child_name;
2144  if (next_sep_pos == llvm::StringRef::npos) // if no other separator just
2145  // expand this last layer
2146  {
2147  child_name.SetString(temp_expression);
2148  ValueObjectSP child_valobj_sp =
2149  root->GetChildMemberWithName(child_name, true);
2150 
2151  if (child_valobj_sp.get()) // we know we are done, so just return
2152  {
2153  *reason_to_stop =
2156  return child_valobj_sp;
2157  } else {
2158  switch (options.m_synthetic_children_traversal) {
2160  None:
2161  break;
2164  if (root->IsSynthetic()) {
2165  child_valobj_sp = root->GetNonSyntheticValue();
2166  if (child_valobj_sp.get())
2167  child_valobj_sp =
2168  child_valobj_sp->GetChildMemberWithName(child_name, true);
2169  }
2170  break;
2172  ToSynthetic:
2173  if (!root->IsSynthetic()) {
2174  child_valobj_sp = root->GetSyntheticValue();
2175  if (child_valobj_sp.get())
2176  child_valobj_sp =
2177  child_valobj_sp->GetChildMemberWithName(child_name, true);
2178  }
2179  break;
2181  Both:
2182  if (root->IsSynthetic()) {
2183  child_valobj_sp = root->GetNonSyntheticValue();
2184  if (child_valobj_sp.get())
2185  child_valobj_sp =
2186  child_valobj_sp->GetChildMemberWithName(child_name, true);
2187  } else {
2188  child_valobj_sp = root->GetSyntheticValue();
2189  if (child_valobj_sp.get())
2190  child_valobj_sp =
2191  child_valobj_sp->GetChildMemberWithName(child_name, true);
2192  }
2193  break;
2194  }
2195  }
2196 
2197  // if we are here and options.m_no_synthetic_children is true,
2198  // child_valobj_sp is going to be a NULL SP, so we hit the "else"
2199  // branch, and return an error
2200  if (child_valobj_sp.get()) // if it worked, just return
2201  {
2202  *reason_to_stop =
2205  return child_valobj_sp;
2206  } else {
2207  *reason_to_stop =
2210  return nullptr;
2211  }
2212  } else // other layers do expand
2213  {
2214  llvm::StringRef next_separator = temp_expression.substr(next_sep_pos);
2215 
2216  child_name.SetString(temp_expression.slice(0, next_sep_pos));
2217 
2218  ValueObjectSP child_valobj_sp =
2219  root->GetChildMemberWithName(child_name, true);
2220  if (child_valobj_sp.get()) // store the new root and move on
2221  {
2222  root = child_valobj_sp;
2223  remainder = next_separator;
2225  continue;
2226  } else {
2227  switch (options.m_synthetic_children_traversal) {
2229  None:
2230  break;
2233  if (root->IsSynthetic()) {
2234  child_valobj_sp = root->GetNonSyntheticValue();
2235  if (child_valobj_sp.get())
2236  child_valobj_sp =
2237  child_valobj_sp->GetChildMemberWithName(child_name, true);
2238  }
2239  break;
2241  ToSynthetic:
2242  if (!root->IsSynthetic()) {
2243  child_valobj_sp = root->GetSyntheticValue();
2244  if (child_valobj_sp.get())
2245  child_valobj_sp =
2246  child_valobj_sp->GetChildMemberWithName(child_name, true);
2247  }
2248  break;
2250  Both:
2251  if (root->IsSynthetic()) {
2252  child_valobj_sp = root->GetNonSyntheticValue();
2253  if (child_valobj_sp.get())
2254  child_valobj_sp =
2255  child_valobj_sp->GetChildMemberWithName(child_name, true);
2256  } else {
2257  child_valobj_sp = root->GetSyntheticValue();
2258  if (child_valobj_sp.get())
2259  child_valobj_sp =
2260  child_valobj_sp->GetChildMemberWithName(child_name, true);
2261  }
2262  break;
2263  }
2264  }
2265 
2266  // if we are here and options.m_no_synthetic_children is true,
2267  // child_valobj_sp is going to be a NULL SP, so we hit the "else"
2268  // branch, and return an error
2269  if (child_valobj_sp.get()) // if it worked, move on
2270  {
2271  root = child_valobj_sp;
2272  remainder = next_separator;
2274  continue;
2275  } else {
2276  *reason_to_stop =
2279  return nullptr;
2280  }
2281  }
2282  break;
2283  }
2284  case '[': {
2285  if (!root_compiler_type_info.Test(eTypeIsArray) &&
2286  !root_compiler_type_info.Test(eTypeIsPointer) &&
2287  !root_compiler_type_info.Test(
2288  eTypeIsVector)) // if this is not a T[] nor a T*
2289  {
2290  if (!root_compiler_type_info.Test(
2291  eTypeIsScalar)) // if this is not even a scalar...
2292  {
2293  if (options.m_synthetic_children_traversal ==
2295  None) // ...only chance left is synthetic
2296  {
2297  *reason_to_stop =
2300  return ValueObjectSP();
2301  }
2302  } else if (!options.m_allow_bitfields_syntax) // if this is a scalar,
2303  // check that we can
2304  // expand bitfields
2305  {
2306  *reason_to_stop =
2309  return ValueObjectSP();
2310  }
2311  }
2312  if (temp_expression[1] ==
2313  ']') // if this is an unbounded range it only works for arrays
2314  {
2315  if (!root_compiler_type_info.Test(eTypeIsArray)) {
2316  *reason_to_stop =
2319  return nullptr;
2320  } else // even if something follows, we cannot expand unbounded ranges,
2321  // just let the caller do it
2322  {
2323  *reason_to_stop =
2325  *final_result =
2327  return root;
2328  }
2329  }
2330 
2331  size_t close_bracket_position = temp_expression.find(']', 1);
2332  if (close_bracket_position ==
2333  llvm::StringRef::npos) // if there is no ], this is a syntax error
2334  {
2335  *reason_to_stop =
2338  return nullptr;
2339  }
2340 
2341  llvm::StringRef bracket_expr =
2342  temp_expression.slice(1, close_bracket_position);
2343 
2344  // If this was an empty expression it would have been caught by the if
2345  // above.
2346  assert(!bracket_expr.empty());
2347 
2348  if (!bracket_expr.contains('-')) {
2349  // if no separator, this is of the form [N]. Note that this cannot be
2350  // an unbounded range of the form [], because that case was handled
2351  // above with an unconditional return.
2352  unsigned long index = 0;
2353  if (bracket_expr.getAsInteger(0, index)) {
2354  *reason_to_stop =
2357  return nullptr;
2358  }
2359 
2360  // from here on we do have a valid 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)
2368  child_valobj_sp =
2369  root->GetSyntheticValue()->GetChildAtIndex(index, true);
2370  if (child_valobj_sp) {
2371  root = child_valobj_sp;
2372  remainder =
2373  temp_expression.substr(close_bracket_position + 1); // skip ]
2375  continue;
2376  } else {
2377  *reason_to_stop =
2380  return nullptr;
2381  }
2382  } else if (root_compiler_type_info.Test(eTypeIsPointer)) {
2383  if (*what_next ==
2384  ValueObject::
2385  eExpressionPathAftermathDereference && // if this is a
2386  // ptr-to-scalar, I
2387  // am accessing it
2388  // by index and I
2389  // would have
2390  // deref'ed anyway,
2391  // then do it now
2392  // and use this as
2393  // a bitfield
2394  pointee_compiler_type_info.Test(eTypeIsScalar)) {
2395  Status error;
2396  root = root->Dereference(error);
2397  if (error.Fail() || !root) {
2398  *reason_to_stop =
2401  return nullptr;
2402  } else {
2403  *what_next = eExpressionPathAftermathNothing;
2404  continue;
2405  }
2406  } else {
2407  if (root->GetCompilerType().GetMinimumLanguage() ==
2409  pointee_compiler_type_info.AllClear(eTypeIsPointer) &&
2410  root->HasSyntheticValue() &&
2411  (options.m_synthetic_children_traversal ==
2413  SyntheticChildrenTraversal::ToSynthetic ||
2416  SyntheticChildrenTraversal::Both)) {
2417  root = root->GetSyntheticValue()->GetChildAtIndex(index, true);
2418  } else
2419  root = root->GetSyntheticArrayMember(index, true);
2420  if (!root) {
2421  *reason_to_stop =
2424  return nullptr;
2425  } else {
2426  remainder =
2427  temp_expression.substr(close_bracket_position + 1); // skip ]
2429  continue;
2430  }
2431  }
2432  } else if (root_compiler_type_info.Test(eTypeIsScalar)) {
2433  root = root->GetSyntheticBitFieldChild(index, index, true);
2434  if (!root) {
2435  *reason_to_stop =
2438  return nullptr;
2439  } else // we do not know how to expand members of bitfields, so we
2440  // just return and let the caller do any further processing
2441  {
2442  *reason_to_stop = ValueObject::
2445  return root;
2446  }
2447  } else if (root_compiler_type_info.Test(eTypeIsVector)) {
2448  root = root->GetChildAtIndex(index, true);
2449  if (!root) {
2450  *reason_to_stop =
2453  return ValueObjectSP();
2454  } else {
2455  remainder =
2456  temp_expression.substr(close_bracket_position + 1); // skip ]
2458  continue;
2459  }
2460  } else if (options.m_synthetic_children_traversal ==
2462  SyntheticChildrenTraversal::ToSynthetic ||
2465  SyntheticChildrenTraversal::Both) {
2466  if (root->HasSyntheticValue())
2467  root = root->GetSyntheticValue();
2468  else if (!root->IsSynthetic()) {
2469  *reason_to_stop =
2472  return nullptr;
2473  }
2474  // if we are here, then root itself is a synthetic VO.. should be
2475  // good to go
2476 
2477  if (!root) {
2478  *reason_to_stop =
2481  return nullptr;
2482  }
2483  root = root->GetChildAtIndex(index, true);
2484  if (!root) {
2485  *reason_to_stop =
2488  return nullptr;
2489  } else {
2490  remainder =
2491  temp_expression.substr(close_bracket_position + 1); // skip ]
2493  continue;
2494  }
2495  } else {
2496  *reason_to_stop =
2499  return nullptr;
2500  }
2501  } else {
2502  // we have a low and a high index
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)) {
2508  *reason_to_stop =
2511  return nullptr;
2512  }
2513 
2514  if (low_index > high_index) // swap indices if required
2515  std::swap(low_index, high_index);
2516 
2517  if (root_compiler_type_info.Test(
2518  eTypeIsScalar)) // expansion only works for scalars
2519  {
2520  root = root->GetSyntheticBitFieldChild(low_index, high_index, true);
2521  if (!root) {
2522  *reason_to_stop =
2525  return nullptr;
2526  } else {
2527  *reason_to_stop = ValueObject::
2530  return root;
2531  }
2532  } else if (root_compiler_type_info.Test(
2533  eTypeIsPointer) && // if this is a ptr-to-scalar, I am
2534  // accessing it by index and I would
2535  // have deref'ed anyway, then do it
2536  // now and use this as a bitfield
2537  *what_next ==
2539  pointee_compiler_type_info.Test(eTypeIsScalar)) {
2540  Status error;
2541  root = root->Dereference(error);
2542  if (error.Fail() || !root) {
2543  *reason_to_stop =
2546  return nullptr;
2547  } else {
2549  continue;
2550  }
2551  } else {
2552  *reason_to_stop =
2555  return root;
2556  }
2557  }
2558  break;
2559  }
2560  default: // some non-separator is in the way
2561  {
2562  *reason_to_stop =
2565  return nullptr;
2566  }
2567  }
2568  }
2569 }
2570 
2572 
2574  ValueObjectPrinter printer(this, &s, options);
2575  printer.PrintValueObject();
2576 }
2577 
2579  ValueObjectSP valobj_sp;
2580 
2581  if (UpdateValueIfNeeded(false) && m_error.Success()) {
2583 
2584  DataExtractor data;
2587 
2588  if (IsBitfield()) {
2590  m_error = v.GetValueAsData(&exe_ctx, data, GetModule().get());
2591  } else
2592  m_error = m_value.GetValueAsData(&exe_ctx, data, GetModule().get());
2593 
2594  valobj_sp = ValueObjectConstResult::Create(
2595  exe_ctx.GetBestExecutionContextScope(), GetCompilerType(), name, data,
2596  GetAddressOf());
2597  }
2598 
2599  if (!valobj_sp) {
2601  valobj_sp = ValueObjectConstResult::Create(
2603  }
2604  return valobj_sp;
2605 }
2606 
2608  lldb::DynamicValueType dynValue, bool synthValue) {
2609  ValueObjectSP result_sp(GetSP());
2610 
2611  switch (dynValue) {
2614  if (!result_sp->IsDynamic()) {
2615  if (result_sp->GetDynamicValue(dynValue))
2616  result_sp = result_sp->GetDynamicValue(dynValue);
2617  }
2618  } break;
2619  case lldb::eNoDynamicValues: {
2620  if (result_sp->IsDynamic()) {
2621  if (result_sp->GetStaticValue())
2622  result_sp = result_sp->GetStaticValue();
2623  }
2624  } break;
2625  }
2626 
2627  if (synthValue) {
2628  if (!result_sp->IsSynthetic()) {
2629  if (result_sp->GetSyntheticValue())
2630  result_sp = result_sp->GetSyntheticValue();
2631  }
2632  } else {
2633  if (result_sp->IsSynthetic()) {
2634  if (result_sp->GetNonSyntheticValue())
2635  result_sp = result_sp->GetNonSyntheticValue();
2636  }
2637  }
2638 
2639  return result_sp;
2640 }
2641 
2643  if (m_deref_valobj)
2644  return m_deref_valobj->GetSP();
2645 
2646  const bool is_pointer_or_reference_type = IsPointerOrReferenceType();
2647  if (is_pointer_or_reference_type) {
2648  bool omit_empty_base_classes = true;
2649  bool ignore_array_bounds = false;
2650 
2651  std::string child_name_str;
2652  uint32_t child_byte_size = 0;
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;
2659  CompilerType compiler_type = GetCompilerType();
2660  CompilerType child_compiler_type;
2661  uint64_t language_flags = 0;
2662 
2664 
2665  child_compiler_type = compiler_type.GetChildCompilerTypeAtIndex(
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) {
2671  ConstString child_name;
2672  if (!child_name_str.empty())
2673  child_name.SetCString(child_name_str.c_str());
2674 
2676  *this, child_compiler_type, child_name, child_byte_size,
2677  child_byte_offset, child_bitfield_bit_size, child_bitfield_bit_offset,
2678  child_is_base_class, child_is_deref_of_parent, eAddressTypeInvalid,
2679  language_flags);
2680  }
2681 
2682  // In case of incomplete child compiler type, use the pointee type and try
2683  // to recreate a new ValueObjectChild using it.
2684  if (!m_deref_valobj) {
2685  // FIXME(#59012): C++ stdlib formatters break with incomplete types (e.g.
2686  // `std::vector<int> &`). Remove ObjC restriction once that's resolved.
2688  HasSyntheticValue()) {
2689  child_compiler_type = compiler_type.GetPointeeType();
2690 
2691  if (child_compiler_type) {
2692  ConstString child_name;
2693  if (!child_name_str.empty())
2694  child_name.SetCString(child_name_str.c_str());
2695 
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,
2700  child_is_deref_of_parent, eAddressTypeInvalid, language_flags);
2701  }
2702  }
2703  }
2704 
2705  } else if (HasSyntheticValue()) {
2706  m_deref_valobj =
2708  ->GetChildMemberWithName(ConstString("$$dereference$$"), true)
2709  .get();
2710  } else if (IsSynthetic()) {
2711  m_deref_valobj =
2712  GetChildMemberWithName(ConstString("$$dereference$$"), true).get();
2713  }
2714 
2715  if (m_deref_valobj) {
2716  error.Clear();
2717  return m_deref_valobj->GetSP();
2718  } else {
2719  StreamString strm;
2720  GetExpressionPath(strm);
2721 
2722  if (is_pointer_or_reference_type)
2723  error.SetErrorStringWithFormat("dereference failed: (%s) %s",
2724  GetTypeName().AsCString("<invalid type>"),
2725  strm.GetData());
2726  else
2727  error.SetErrorStringWithFormat("not a pointer or reference type: (%s) %s",
2728  GetTypeName().AsCString("<invalid type>"),
2729  strm.GetData());
2730  return ValueObjectSP();
2731  }
2732 }
2733 
2735  if (m_addr_of_valobj_sp)
2736  return m_addr_of_valobj_sp;
2737 
2738  AddressType address_type = eAddressTypeInvalid;
2739  const bool scalar_is_load_address = false;
2740  addr_t addr = GetAddressOf(scalar_is_load_address, &address_type);
2741  error.Clear();
2742  if (addr != LLDB_INVALID_ADDRESS && address_type != eAddressTypeHost) {
2743  switch (address_type) {
2744  case eAddressTypeInvalid: {
2745  StreamString expr_path_strm;
2746  GetExpressionPath(expr_path_strm);
2747  error.SetErrorStringWithFormat("'%s' is not in memory",
2748  expr_path_strm.GetData());
2749  } break;
2750 
2751  case eAddressTypeFile:
2752  case eAddressTypeLoad: {
2753  CompilerType compiler_type = GetCompilerType();
2754  if (compiler_type) {
2755  std::string name(1, '&');
2756  name.append(m_name.AsCString(""));
2759  exe_ctx.GetBestExecutionContextScope(),
2760  compiler_type.GetPointerType(), ConstString(name.c_str()), addr,
2762  }
2763  } break;
2764  default:
2765  break;
2766  }
2767  } else {
2768  StreamString expr_path_strm;
2769  GetExpressionPath(expr_path_strm);
2770  error.SetErrorStringWithFormat("'%s' doesn't have a valid address",
2771  expr_path_strm.GetData());
2772  }
2773 
2774  return m_addr_of_valobj_sp;
2775 }
2776 
2777 ValueObjectSP ValueObject::Cast(const CompilerType &compiler_type) {
2778  return ValueObjectCast::Create(*this, GetName(), compiler_type);
2779 }
2780 
2781 lldb::ValueObjectSP ValueObject::Clone(ConstString new_name) {
2782  return ValueObjectCast::Create(*this, new_name, GetCompilerType());
2783 }
2784 
2785 ValueObjectSP ValueObject::CastPointerType(const char *name,
2786  CompilerType &compiler_type) {
2787  ValueObjectSP valobj_sp;
2788  AddressType address_type;
2789  addr_t ptr_value = GetPointerValue(&address_type);
2790 
2791  if (ptr_value != LLDB_INVALID_ADDRESS) {
2792  Address ptr_addr(ptr_value);
2794  valobj_sp = ValueObjectMemory::Create(
2795  exe_ctx.GetBestExecutionContextScope(), name, ptr_addr, compiler_type);
2796  }
2797  return valobj_sp;
2798 }
2799 
2800 ValueObjectSP ValueObject::CastPointerType(const char *name, TypeSP &type_sp) {
2801  ValueObjectSP valobj_sp;
2802  AddressType address_type;
2803  addr_t ptr_value = GetPointerValue(&address_type);
2804 
2805  if (ptr_value != LLDB_INVALID_ADDRESS) {
2806  Address ptr_addr(ptr_value);
2808  valobj_sp = ValueObjectMemory::Create(
2809  exe_ctx.GetBestExecutionContextScope(), name, ptr_addr, type_sp);
2810  }
2811  return valobj_sp;
2812 }
2813 
2814 ValueObject::EvaluationPoint::EvaluationPoint() : m_mod_id(), m_exe_ctx_ref() {}
2815 
2817  bool use_selected)
2818  : m_mod_id(), m_exe_ctx_ref() {
2819  ExecutionContext exe_ctx(exe_scope);
2820  TargetSP target_sp(exe_ctx.GetTargetSP());
2821  if (target_sp) {
2822  m_exe_ctx_ref.SetTargetSP(target_sp);
2823  ProcessSP process_sp(exe_ctx.GetProcessSP());
2824  if (!process_sp)
2825  process_sp = target_sp->GetProcessSP();
2826 
2827  if (process_sp) {
2828  m_mod_id = process_sp->GetModID();
2829  m_exe_ctx_ref.SetProcessSP(process_sp);
2830 
2831  ThreadSP thread_sp(exe_ctx.GetThreadSP());
2832 
2833  if (!thread_sp) {
2834  if (use_selected)
2835  thread_sp = process_sp->GetThreadList().GetSelectedThread();
2836  }
2837 
2838  if (thread_sp) {
2839  m_exe_ctx_ref.SetThreadSP(thread_sp);
2840 
2841  StackFrameSP frame_sp(exe_ctx.GetFrameSP());
2842  if (!frame_sp) {
2843  if (use_selected)
2844  frame_sp = thread_sp->GetSelectedFrame();
2845  }
2846  if (frame_sp)
2847  m_exe_ctx_ref.SetFrameSP(frame_sp);
2848  }
2849  }
2850  }
2851 }
2852 
2854  const ValueObject::EvaluationPoint &rhs)
2855  : m_mod_id(), m_exe_ctx_ref(rhs.m_exe_ctx_ref) {}
2856 
2858 
2859 // This function checks the EvaluationPoint against the current process state.
2860 // If the current state matches the evaluation point, or the evaluation point
2861 // is already invalid, then we return false, meaning "no change". If the
2862 // current state is different, we update our state, and return true meaning
2863 // "yes, change". If we did see a change, we also set m_needs_update to true,
2864 // so future calls to NeedsUpdate will return true. exe_scope will be set to
2865 // the current execution context scope.
2866 
2868  bool accept_invalid_exe_ctx) {
2869  // Start with the target, if it is NULL, then we're obviously not going to
2870  // get any further:
2871  const bool thread_and_frame_only_if_stopped = true;
2872  ExecutionContext exe_ctx(
2873  m_exe_ctx_ref.Lock(thread_and_frame_only_if_stopped));
2874 
2875  if (exe_ctx.GetTargetPtr() == nullptr)
2876  return false;
2877 
2878  // If we don't have a process nothing can change.
2879  Process *process = exe_ctx.GetProcessPtr();
2880  if (process == nullptr)
2881  return false;
2882 
2883  // If our stop id is the current stop ID, nothing has changed:
2884  ProcessModID current_mod_id = process->GetModID();
2885 
2886  // If the current stop id is 0, either we haven't run yet, or the process
2887  // state has been cleared. In either case, we aren't going to be able to sync
2888  // with the process state.
2889  if (current_mod_id.GetStopID() == 0)
2890  return false;
2891 
2892  bool changed = false;
2893  const bool was_valid = m_mod_id.IsValid();
2894  if (was_valid) {
2895  if (m_mod_id == current_mod_id) {
2896  // Everything is already up to date in this object, no need to update the
2897  // execution context scope.
2898  changed = false;
2899  } else {
2900  m_mod_id = current_mod_id;
2901  m_needs_update = true;
2902  changed = true;
2903  }
2904  }
2905 
2906  // Now re-look up the thread and frame in case the underlying objects have
2907  // gone away & been recreated. That way we'll be sure to return a valid
2908  // exe_scope. If we used to have a thread or a frame but can't find it
2909  // anymore, then mark ourselves as invalid.
2910 
2911  if (!accept_invalid_exe_ctx) {
2912  if (m_exe_ctx_ref.HasThreadRef()) {
2913  ThreadSP thread_sp(m_exe_ctx_ref.GetThreadSP());
2914  if (thread_sp) {
2915  if (m_exe_ctx_ref.HasFrameRef()) {
2916  StackFrameSP frame_sp(m_exe_ctx_ref.GetFrameSP());
2917  if (!frame_sp) {
2918  // We used to have a frame, but now it is gone
2919  SetInvalid();
2920  changed = was_valid;
2921  }
2922  }
2923  } else {
2924  // We used to have a thread, but now it is gone
2925  SetInvalid();
2926  changed = was_valid;
2927  }
2928  }
2929  }
2930 
2931  return changed;
2932 }
2933 
2935  ProcessSP process_sp(m_exe_ctx_ref.GetProcessSP());
2936  if (process_sp)
2937  m_mod_id = process_sp->GetModID();
2938  m_needs_update = false;
2939 }
2940 
2942  if ((clear_mask & eClearUserVisibleDataItemsValue) ==
2944  m_value_str.clear();
2945 
2946  if ((clear_mask & eClearUserVisibleDataItemsLocation) ==
2948  m_location_str.clear();
2949 
2950  if ((clear_mask & eClearUserVisibleDataItemsSummary) ==
2952  m_summary_str.clear();
2953 
2954  if ((clear_mask & eClearUserVisibleDataItemsDescription) ==
2956  m_object_desc_str.clear();
2957 
2958  if ((clear_mask & eClearUserVisibleDataItemsSyntheticChildren) ==
2960  if (m_synthetic_value)
2961  m_synthetic_value = nullptr;
2962  }
2963 }
2964 
2966  if (m_parent) {
2968  return m_parent->GetSymbolContextScope();
2969  }
2970  return nullptr;
2971 }
2972 
2973 lldb::ValueObjectSP
2975  llvm::StringRef expression,
2976  const ExecutionContext &exe_ctx) {
2977  return CreateValueObjectFromExpression(name, expression, exe_ctx,
2979 }
2980 
2982  llvm::StringRef name, llvm::StringRef expression,
2983  const ExecutionContext &exe_ctx, const EvaluateExpressionOptions &options) {
2984  lldb::ValueObjectSP retval_sp;
2985  lldb::TargetSP target_sp(exe_ctx.GetTargetSP());
2986  if (!target_sp)
2987  return retval_sp;
2988  if (expression.empty())
2989  return retval_sp;
2990  target_sp->EvaluateExpression(expression, exe_ctx.GetFrameSP().get(),
2991  retval_sp, options);
2992  if (retval_sp && !name.empty())
2993  retval_sp->SetName(ConstString(name));
2994  return retval_sp;
2995 }
2996 
2998  llvm::StringRef name, uint64_t address, const ExecutionContext &exe_ctx,
2999  CompilerType type) {
3000  if (type) {
3001  CompilerType pointer_type(type.GetPointerType());
3002  if (pointer_type) {
3003  lldb::DataBufferSP buffer(
3004  new lldb_private::DataBufferHeap(&address, sizeof(lldb::addr_t)));
3005  lldb::ValueObjectSP ptr_result_valobj_sp(ValueObjectConstResult::Create(
3006  exe_ctx.GetBestExecutionContextScope(), pointer_type,
3007  ConstString(name), buffer, exe_ctx.GetByteOrder(),
3008  exe_ctx.GetAddressByteSize()));
3009  if (ptr_result_valobj_sp) {
3010  ptr_result_valobj_sp->GetValue().SetValueType(
3012  Status err;
3013  ptr_result_valobj_sp = ptr_result_valobj_sp->Dereference(err);
3014  if (ptr_result_valobj_sp && !name.empty())
3015  ptr_result_valobj_sp->SetName(ConstString(name));
3016  }
3017  return ptr_result_valobj_sp;
3018  }
3019  }
3020  return lldb::ValueObjectSP();
3021 }
3022 
3024  llvm::StringRef name, const DataExtractor &data,
3025  const ExecutionContext &exe_ctx, CompilerType type) {
3026  lldb::ValueObjectSP new_value_sp;
3027  new_value_sp = ValueObjectConstResult::Create(
3028  exe_ctx.GetBestExecutionContextScope(), type, ConstString(name), data,
3030  new_value_sp->SetAddressTypeOfChildren(eAddressTypeLoad);
3031  if (new_value_sp && !name.empty())
3032  new_value_sp->SetName(ConstString(name));
3033  return new_value_sp;
3034 }
3035 
3037  ValueObject *root(GetRoot());
3038  if (root != this)
3039  return root->GetModule();
3040  return lldb::ModuleSP();
3041 }
3042 
3044  if (m_root)
3045  return m_root;
3046  return (m_root = FollowParentChain([](ValueObject *vo) -> bool {
3047  return (vo->m_parent != nullptr);
3048  }));
3049 }
3050 
3051 ValueObject *
3052 ValueObject::FollowParentChain(std::function<bool(ValueObject *)> f) {
3053  ValueObject *vo = this;
3054  while (vo) {
3055  if (!f(vo))
3056  break;
3057  vo = vo->m_parent;
3058  }
3059  return vo;
3060 }
3061 
3064  ValueObject *root(GetRoot());
3065  if (root != this)
3066  return root->GetAddressTypeOfChildren();
3067  }
3069 }
3070 
3072  ValueObject *with_dv_info = this;
3073  while (with_dv_info) {
3074  if (with_dv_info->HasDynamicValueTypeInfo())
3075  return with_dv_info->GetDynamicValueTypeImpl();
3076  with_dv_info = with_dv_info->m_parent;
3077  }
3078  return lldb::eNoDynamicValues;
3079 }
3080 
3082  const ValueObject *with_fmt_info = this;
3083  while (with_fmt_info) {
3084  if (with_fmt_info->m_format != lldb::eFormatDefault)
3085  return with_fmt_info->m_format;
3086  with_fmt_info = with_fmt_info->m_parent;
3087  }
3088  return m_format;
3089 }
3090 
3094  if (GetRoot()) {
3095  if (GetRoot() == this) {
3096  if (StackFrameSP frame_sp = GetFrameSP()) {
3097  const SymbolContext &sc(
3098  frame_sp->GetSymbolContext(eSymbolContextCompUnit));
3099  if (CompileUnit *cu = sc.comp_unit)
3100  type = cu->GetLanguage();
3101  }
3102  } else {
3104  }
3105  }
3106  }
3107  return (m_preferred_display_language = type); // only compute it once
3108 }
3109 
3113 }
3114 
3116  // we need to support invalid types as providers of values because some bare-
3117  // board debugging scenarios have no notion of types, but still manage to
3118  // have raw numeric values for things like registers. sigh.
3119  CompilerType type = GetCompilerType();
3120  return (!type.IsValid()) || (0 != (type.GetTypeInfo() & eTypeHasValue));
3121 }
3122 
3123 
3124 
3125 ValueObjectSP ValueObject::Persist() {
3126  if (!UpdateValueIfNeeded())
3127  return nullptr;
3128 
3129  TargetSP target_sp(GetTargetSP());
3130  if (!target_sp)
3131  return nullptr;
3132 
3133  PersistentExpressionState *persistent_state =
3134  target_sp->GetPersistentExpressionStateForLanguage(
3136 
3137  if (!persistent_state)
3138  return nullptr;
3139 
3140  ConstString name = persistent_state->GetNextPersistentVariableName();
3141 
3142  ValueObjectSP const_result_sp =
3143  ValueObjectConstResult::Create(target_sp.get(), GetValue(), name);
3144 
3145  ExpressionVariableSP persistent_var_sp =
3146  persistent_state->CreatePersistentVariable(const_result_sp);
3147  persistent_var_sp->m_live_sp = persistent_var_sp->m_frozen_sp;
3148  persistent_var_sp->m_flags |= ExpressionVariable::EVIsProgramReference;
3149 
3150  return persistent_var_sp->GetValueObject();
3151 }
lldb_private::ValueObject::IsBitfield
bool IsBitfield()
Definition: ValueObject.h:428
lldb_private::ValueObject::MaybeCalculateCompleteType
virtual CompilerType MaybeCalculateCompleteType()
Definition: ValueObject.cpp:247
lldb_private::ValueObject::PrintableRepresentationSpecialCases
PrintableRepresentationSpecialCases
Definition: ValueObject.h:532
lldb_private::ValueObject::eExpressionPathScanEndReasonNoSuchChild
@ eExpressionPathScanEndReasonNoSuchChild
Child element not found.
Definition: ValueObject.h:127
lldb_private::ValueObject::GetData
virtual uint64_t GetData(DataExtractor &data, Status &error)
Definition: ValueObject.cpp:774
lldb::eFormatVectorOfUInt64
@ eFormatVectorOfUInt64
Definition: lldb-enumerations.h:188
lldb::eFormatOSType
@ eFormatOSType
OS character codes encoded into an integer 'PICT' 'text' etc...
Definition: lldb-enumerations.h:174
lldb::eFormatPointer
@ eFormatPointer
Definition: lldb-enumerations.h:179
lldb_private::ValueObject::eExpressionPathAftermathTakeAddress
@ eExpressionPathAftermathTakeAddress
Take target's address.
Definition: ValueObject.h:179
lldb_private::formatters::StringPrinter::DumpToStreamOptions::SetPrefixToken
void SetPrefixToken(const std::string &p)
Definition: StringPrinter.h:37
lldb_private::ValueObject::GetValueForExpressionPath
lldb::ValueObjectSP GetValueForExpressionPath(llvm::StringRef expression, ExpressionPathScanEndReason *reason_to_stop=nullptr, ExpressionPathEndResultType *final_value_type=nullptr, const GetValueForExpressionPathOptions &options=GetValueForExpressionPathOptions::DefaultOptions(), ExpressionPathAftermath *final_task_on_target=nullptr)
Definition: ValueObject.cpp:1997
lldb_private::Value::ValueType::Scalar
@ Scalar
A raw scalar value.
lldb_private::ValueObject::GetValueForExpressionPathOptions::SyntheticChildrenTraversal::FromSynthetic
@ FromSynthetic
lldb_private::ValueObject::GetValueAsUnsigned
virtual uint64_t GetValueAsUnsigned(uint64_t fail_value, bool *success=nullptr)
Definition: ValueObject.cpp:1099
lldb_private::ExecutionContext
Definition: ExecutionContext.h:292
lldb_private::SymbolContext::comp_unit
CompileUnit * comp_unit
The CompileUnit for a given query.
Definition: SymbolContext.h:319
lldb_private::ArchSpec::GetByteOrder
lldb::ByteOrder GetByteOrder() const
Returns the byte order for the architecture specification.
Definition: ArchSpec.cpp:741
lldb_private::Value::GetValueAddressType
AddressType GetValueAddressType() const
Definition: Value.cpp:109
lldb_private::ValueObject::eClearUserVisibleDataItemsDescription
@ eClearUserVisibleDataItemsDescription
Definition: ValueObject.h:187
lldb_private::ValueObject::GetChildAtIndexPath
lldb::ValueObjectSP GetChildAtIndexPath(llvm::ArrayRef< size_t > idxs, size_t *index_of_error=nullptr)
Definition: ValueObject.cpp:397
lldb-private-types.h
Scalar.h
lldb_private::CompilerType::IsCharType
bool IsCharType() const
Definition: CompilerType.cpp:84
lldb_private::ValueObject::IsInScope
virtual bool IsInScope()
Definition: ValueObject.h:420
lldb_private::ProcessModID::GetStopID
uint32_t GetStopID() const
Definition: Process.h:257
ExpressionVariable.h
lldb_private::ValueObject::CanProvideValue
virtual bool CanProvideValue()
Definition: ValueObject.cpp:3115
lldb_private::ExecutionContext::GetThreadSP
const lldb::ThreadSP & GetThreadSP() const
Get accessor to get the thread shared pointer.
Definition: ExecutionContext.h:464
lldb_private::ExecutionContextRef::SetProcessSP
void SetProcessSP(const lldb::ProcessSP &process_sp)
Set accessor that creates a weak reference to the process referenced in process_sp.
Definition: ExecutionContext.cpp:461
lldb_private::ArchSpec
Definition: ArchSpec.h:32
lldb_private::ValueObject::eExpressionPathAftermathNothing
@ eExpressionPathAftermathNothing
Just return it.
Definition: ValueObject.h:175
lldb::eFormatVectorOfChar
@ eFormatVectorOfChar
Definition: lldb-enumerations.h:180
lldb_private::DataExtractor::GetAddress
uint64_t GetAddress(lldb::offset_t *offset_ptr) const
Extract an address from *offset_ptr.
Definition: DataExtractor.cpp:649
lldb_private::TypeSummaryImpl::FormatObject
virtual bool FormatObject(ValueObject *valobj, std::string &dest, const TypeSummaryOptions &options)=0
lldb_private::ValueObject::IsRuntimeSupportValue
virtual bool IsRuntimeSupportValue()
Definition: ValueObject.cpp:1587
lldb_private::ValueObject::ClearUserVisibleData
void ClearUserVisibleData(uint32_t items=ValueObject::eClearUserVisibleDataItemsAllStrings)
Definition: ValueObject.cpp:2941
lldb_private::ValueObject::SetValueIsValid
void SetValueIsValid(bool valid)
Definition: ValueObject.h:980
lldb::eFormatVectorOfUInt128
@ eFormatVectorOfUInt128
Definition: lldb-enumerations.h:192
lldb_private::ValueObject::~ValueObject
virtual ~ValueObject()
lldb_private::ValueObject::GetUpdatePoint
const EvaluationPoint & GetUpdatePoint() const
Definition: ValueObject.h:326
lldb_private::ValueObject::GetValueForExpressionPathOptions
Definition: ValueObject.h:196
lldb_private::ProcessModID::IsValid
bool IsValid() const
Definition: Process.h:275
lldb_private::Process::ReadMemory
virtual size_t ReadMemory(lldb::addr_t vm_addr, void *buf, size_t size, Status &error)
Read of memory from a process.
Definition: Process.cpp:1926
lldb_private::ValueObject::IsNilReference
bool IsNilReference()
Definition: ValueObject.cpp:1604
lldb::Format
Format
Display format definitions.
Definition: lldb-enumerations.h:156
lldb_private::Scalar::GetData
bool GetData(DataExtractor &data, size_t limit_byte_size=UINT32_MAX) const
Definition: Scalar.cpp:84
lldb_private::Flags::AnySet
bool AnySet(ValueType mask) const
Test one or more flags.
Definition: Flags.h:90
CompileUnit.h
lldb_private::ValueObject::GetValue
const Value & GetValue() const
Definition: ValueObject.h:497
lldb_private::DataBufferHeap::SetByteSize
lldb::offset_t SetByteSize(lldb::offset_t byte_size)
Set the number of bytes in the data buffer.
Definition: DataBufferHeap.cpp:47
lldb_private::CompilerType::GetByteSize
std::optional< uint64_t > GetByteSize(ExecutionContextScope *exe_scope) const
Return the size of the type in bytes.
Definition: CompilerType.cpp:560
lldb_private::TypeSummaryImpl
Definition: TypeSummary.h:45
lldb_private::ValueObject::IsDynamic
virtual bool IsDynamic()
Definition: ValueObject.h:637
lldb_private::ValueObject::GetPointeeData
virtual size_t GetPointeeData(DataExtractor &data, uint32_t item_idx=0, uint32_t item_count=1)
Definition: ValueObject.cpp:672
lldb_private::Value
Definition: Value.h:38
lldb::eNoDynamicValues
@ eNoDynamicValues
Definition: lldb-enumerations.h:502
lldb_private::ExecutionContext::GetProcessPtr
Process * GetProcessPtr() const
Returns a pointer to the process object.
Definition: ExecutionContext.cpp:206
lldb_private::Value::GetValueAsData
Status GetValueAsData(ExecutionContext *exe_ctx, DataExtractor &data, Module *module)
Definition: Value.cpp:299
lldb_private::ValueObject::Persist
lldb::ValueObjectSP Persist()
Definition: ValueObject.cpp:3125
lldb_private::Value::ValueType::Invalid
@ Invalid
lldb_private::ValueObject::eClearUserVisibleDataItemsLocation
@ eClearUserVisibleDataItemsLocation
Definition: ValueObject.h:186
lldb_private::ValueObject::IsSynthetic
virtual bool IsSynthetic()
Definition: ValueObject.h:598
lldb_private::ValueObject::m_manager
ValueObjectManager * m_manager
This object is managed by the root object (any ValueObject that gets created without a parent....
Definition: ValueObject.h:876
lldb_private::Value::ValueType::FileAddress
@ FileAddress
A file address value.
lldb_private::Value::GetValueType
ValueType GetValueType() const
Definition: Value.cpp:107
lldb_private::ValueObject::eValueObjectRepresentationStyleValue
@ eValueObjectRepresentationStyleValue
Definition: ValueObject.h:113
lldb_private::ValueObject::EvaluationPoint::SetUpdated
void SetUpdated()
Definition: ValueObject.cpp:2934
lldb_private::ValueObject::eExpressionPathScanEndReasonRangeOperatorInvalid
@ eExpressionPathScanEndReasonRangeOperatorInvalid
[] not valid on objects other than scalars, pointers or arrays.
Definition: ValueObject.h:141
FormatManager.h
lldb_private::ValueObject::Bitflags::m_is_getting_summary
bool m_is_getting_summary
Definition: ValueObject.h:914
lldb_private::AddressType
AddressType
Definition: lldb-private-enumerations.h:30
lldb_private::CompilerType::GetIndexOfChildMemberWithName
size_t GetIndexOfChildMemberWithName(const char *name, bool omit_empty_base_classes, std::vector< uint32_t > &child_indexes) const
Lookup a child member given a name.
Definition: CompilerType.cpp:736
lldb_private::TargetProperties::GetMaximumSizeOfStringSummary
uint32_t GetMaximumSizeOfStringSummary() const
Definition: Target.cpp:4509
lldb_private::CompilerType::GetTypeName
ConstString GetTypeName(bool BaseOnly=false) const
Definition: CompilerType.cpp:322
lldb_private::ExecutionContext::GetByteOrder
lldb::ByteOrder GetByteOrder() const
Definition: ExecutionContext.cpp:182
lldb_private::ValueObject::GetValueForExpressionPathOptions::SyntheticChildrenTraversal::None
@ None
lldb_private::Flags::AllClear
bool AllClear(ValueType mask) const
Test if all bits in mask are clear.
Definition: Flags.h:103
lldb_private::ValueObject::SetFormat
virtual void SetFormat(lldb::Format format)
Definition: ValueObject.h:705
lldb_private::eLazyBoolYes
@ eLazyBoolYes
Definition: lldb-private-enumerations.h:115
lldb_private::ValueObject::m_name
ConstString m_name
The name of this object.
Definition: ValueObject.h:849
lldb_private::Scalar
Definition: Scalar.h:34
LLDB_LOGF
#define LLDB_LOGF(log,...)
Definition: Log.h:344
lldb_private::ValueObject::FollowParentChain
ValueObject * FollowParentChain(std::function< bool(ValueObject *)>)
Given a ValueObject, loop over itself and its parent, and its parent's parent, .
Definition: ValueObject.cpp:3052
lldb_private::ClusterManager
Definition: SharedCluster.h:22
lldb_private::Process
Definition: Process.h:338
lldb_private::Scalar::SetValueFromCString
Status SetValueFromCString(const char *s, lldb::Encoding encoding, size_t byte_size)
Definition: Scalar.cpp:630
lldb_private::ValueObject::eClearUserVisibleDataItemsSummary
@ eClearUserVisibleDataItemsSummary
Definition: ValueObject.h:185
lldb_private::ValueObject::m_location_str
std::string m_location_str
Cached location string that will get cleared if/when the value is updated.
Definition: ValueObject.h:861
lldb_private::ValueObjectCast::Create
static lldb::ValueObjectSP Create(ValueObject &parent, ConstString name, const CompilerType &cast_type)
Definition: ValueObjectCast.cpp:25
lldb_private::swap
void swap(AdaptedConstIterator< C, E, A > &lhs, AdaptedConstIterator< C, E, A > &rhs)
Definition: Iterable.h:147
Module.h
lldb_private::DataVisualization::GetCurrentRevision
static uint32_t GetCurrentRevision()
Definition: DataVisualization.cpp:22
lldb_private::ValueObject::m_object_desc_str
std::string m_object_desc_str
Cached result of the "object printer".
Definition: ValueObject.h:866
lldb_private::eAddressTypeHost
@ eAddressTypeHost
Address is an address in the process that is running this code.
Definition: lldb-private-enumerations.h:36
lldb_private::DataBufferHeap::CopyData
void CopyData(const void *src, lldb::offset_t src_len)
Makes a copy of the src_len bytes in src.
Definition: DataBufferHeap.cpp:53
lldb_private::formatters::StringPrinter::ReadBufferAndDumpToStream
static bool ReadBufferAndDumpToStream(const ReadBufferAndDumpToStreamOptions &options)
lldb_private::EvaluateExpressionOptions
Definition: Target.h:277
lldb_private::DataExtractor::PeekData
const uint8_t * PeekData(lldb::offset_t offset, lldb::offset_t length) const
Peek at a bytes at offset.
Definition: DataExtractor.h:832
lldb_private::ValueObject::SetValueDidChange
void SetValueDidChange(bool value_changed)
Definition: ValueObject.h:976
lldb_private::ValueObject::GetPointerValue
lldb::addr_t GetPointerValue(AddressType *address_type=nullptr)
Definition: ValueObject.cpp:1445
lldb::eFormatVectorOfSInt16
@ eFormatVectorOfSInt16
Definition: lldb-enumerations.h:183
lldb::eFormatVectorOfSInt32
@ eFormatVectorOfSInt32
Definition: lldb-enumerations.h:185
lldb_private::ValueObject::GetValueAsSigned
virtual int64_t GetValueAsSigned(int64_t fail_value, bool *success=nullptr)
Definition: ValueObject.cpp:1117
lldb_private::ValueObject::GetQualifiedRepresentationIfAvailable
lldb::ValueObjectSP GetQualifiedRepresentationIfAvailable(lldb::DynamicValueType dynValue, bool synthValue)
Definition: ValueObject.cpp:2607
lldb::LanguageType
LanguageType
Programming language type.
Definition: lldb-enumerations.h:443
lldb_private::Flags
Definition: Flags.h:22
SkipLeadingExpressionPathSeparators
static const char * SkipLeadingExpressionPathSeparators(const char *expression)
Definition: ValueObject.cpp:1770
lldb::eFormatBoolean
@ eFormatBoolean
Definition: lldb-enumerations.h:159
lldb_private::ValueObject::ValueObject
ValueObject(ExecutionContextScope *exe_scope, ValueObjectManager &manager, AddressType child_ptr_or_ref_addr_type=eAddressTypeLoad)
Use this constructor to create a "root variable object".
Definition: ValueObject.cpp:92
lldb_private::ConstString::SetCString
void SetCString(const char *cstr)
Set the C string value.
Definition: ConstString.cpp:301
lldb_private::ClusterManager::ManageObject
void ManageObject(T *new_object)
Definition: SharedCluster.h:33
lldb_private::ConstString::AsCString
const char * AsCString(const char *value_if_empty=nullptr) const
Get the string value as a C string.
Definition: ConstString.h:192
lldb_private::ValueObject::eExpressionPathAftermathDereference
@ eExpressionPathAftermathDereference
Dereference the target.
Definition: ValueObject.h:177
lldb_private::DataVisualization::GetSyntheticChildren
static lldb::SyntheticChildrenSP GetSyntheticChildren(ValueObject &valobj, lldb::DynamicValueType use_dynamic)
Definition: DataVisualization.cpp:53
lldb_private::Value::ValueType::LoadAddress
@ LoadAddress
A load address value.
lldb_private::Process::GetModID
ProcessModID GetModID() const
Get the Modification ID of the process.
Definition: Process.h:1383
lldb_private::ValueObjectMemory::Create
static lldb::ValueObjectSP Create(ExecutionContextScope *exe_scope, llvm::StringRef name, const Address &address, lldb::TypeSP &type_sp)
Definition: ValueObjectMemory.cpp:32
lldb_private::ValueObject::m_summary_str
std::string m_summary_str
Cached summary string that will get cleared if/when the value is updated.
Definition: ValueObject.h:863
lldb::offset_t
uint64_t offset_t
Definition: lldb-types.h:87
lldb_private::Flags::Test
bool Test(ValueType bit) const
Test a single flag bit.
Definition: Flags.h:96
lldb_private::ValueObject::m_override_type
CompilerType m_override_type
If the type of the value object should be overridden, the type to impose.
Definition: ValueObject.h:868
lldb_private::ValueObject::GetBitfieldBitSize
virtual uint32_t GetBitfieldBitSize()
Definition: ValueObject.h:424
lldb_private::ValueObject::SetPreferredDisplayLanguage
void SetPreferredDisplayLanguage(lldb::LanguageType lt)
Definition: ValueObject.h:713
lldb_private::ValueObjectDynamicValue
A ValueObject that represents memory at a given address, viewed as some set lldb type.
Definition: ValueObjectDynamicValue.h:34
lldb_private::ValueObject::IsPointerType
virtual bool IsPointerType()
Definition: ValueObject.h:382
StackFrame.h
ValueObjectMemory.h
lldb_private::DataVisualization::GetFormat
static lldb::TypeFormatImplSP GetFormat(ValueObject &valobj, lldb::DynamicValueType use_dynamic)
Definition: DataVisualization.cpp:31
lldb_private::ValueObject::m_value_checksum
llvm::SmallVector< uint8_t, 16 > m_value_checksum
Definition: ValueObject.h:898
lldb_private::ValueObject::ValueObjectSynthetic
friend class ValueObjectSynthetic
Definition: ValueObject.h:935
lldb_private::Stream
Definition: Stream.h:28
lldb_private::formatters::StringPrinter::DumpToStreamOptions::SetSourceSize
void SetSourceSize(uint32_t s)
Definition: StringPrinter.h:53
lldb::eFormatBytesWithASCII
@ eFormatBytesWithASCII
Definition: lldb-enumerations.h:162
lldb_private::ValueObject::m_children
ChildrenManager m_children
Definition: ValueObject.h:878
lldb::addr_t
uint64_t addr_t
Definition: lldb-types.h:83
Language.h
lldb_private::ValueObject::eValueObjectRepresentationStyleName
@ eValueObjectRepresentationStyleName
Definition: ValueObject.h:119
lldb_private::ValueObject::m_synthetic_value
ValueObject * m_synthetic_value
Definition: ValueObject.h:882
lldb_private::ValueObject::GetRoot
ValueObject * GetRoot()
Definition: ValueObject.cpp:3043
lldb_private::ValueObject::IsArrayType
virtual bool IsArrayType()
Definition: ValueObject.h:384
lldb_private::LazyBool
LazyBool
Definition: lldb-private-enumerations.h:115
lldb_private::ValueObject::GetValueForExpressionPathOptions::SyntheticChildrenTraversal
SyntheticChildrenTraversal
Definition: ValueObject.h:197
lldb_private::ValueObject::IsPointerOrReferenceType
virtual bool IsPointerOrReferenceType()
Definition: ValueObject.h:388
lldb_private::ValueObject::m_preferred_display_language
lldb::LanguageType m_preferred_display_language
Definition: ValueObject.h:900
ValueObjectDynamicValue.h
lldb_private::ValueObject::GetDataExtractor
DataExtractor & GetDataExtractor()
Definition: ValueObject.cpp:279
lldb_private::Process::WriteMemory
size_t WriteMemory(lldb::addr_t vm_addr, const void *buf, size_t size, Status &error)
Write memory to a process.
Definition: Process.cpp:2125
lldb_private::ValueObject::m_synthetic_children
std::map< ConstString, ValueObject * > m_synthetic_children
Definition: ValueObject.h:879
lldb_private::SymbolContext
Definition: SymbolContext.h:33
lldb_private::Target
Definition: Target.h:469
lldb_private::CompilerType::GetIndexOfChildWithName
uint32_t GetIndexOfChildWithName(const char *name, bool omit_empty_base_classes) const
Lookup a child given a name.
Definition: CompilerType.cpp:806
lldb_private::ValueObject::m_old_value_str
std::string m_old_value_str
Cached old value string from the last time the value was gotten.
Definition: ValueObject.h:859
lldb_private::DataExtractor::SetData
lldb::offset_t SetData(const void *bytes, lldb::offset_t length, lldb::ByteOrder byte_order)
Set data with a buffer that is caller owned.
Definition: DataExtractor.cpp:223
lldb_private::ValueObject::GetTypeName
virtual ConstString GetTypeName()
Definition: ValueObject.h:365
lldb_private::Language::LanguageIsCFamily
static bool LanguageIsCFamily(lldb::LanguageType language)
Equivalent to LanguageIsC||LanguageIsObjC||LanguageIsCPlusPlus.
Definition: Language.cpp:285
lldb_private::Scalar::SetValueFromData
Status SetValueFromData(const DataExtractor &data, lldb::Encoding encoding, size_t byte_size)
Definition: Scalar.cpp:701
lldb_private::StreamString::GetString
llvm::StringRef GetString() const
Definition: StreamString.cpp:51
lldb_private::ValueObject::GetExpressionPath
virtual void GetExpressionPath(Stream &s, GetExpressionPathFormat=eGetExpressionPathFormatDereferencePointers)
Definition: ValueObject.cpp:1902
lldb_private::ValueObject::UpdateChildrenAddressType
void UpdateChildrenAddressType()
Definition: ValueObject.h:1007
lldb_private::ValueObject::eValueObjectRepresentationStyleLocation
@ eValueObjectRepresentationStyleLocation
Definition: ValueObject.h:116
Process.h
lldb_private::ValueObject::GetExpressionPathFormat
GetExpressionPathFormat
Definition: ValueObject.h:107
lldb_private::ValueObject::GetError
const Status & GetError()
Definition: ValueObject.cpp:284
lldb_private::TypeSummaryOptions::SetLanguage
TypeSummaryOptions & SetLanguage(lldb::LanguageType)
Definition: TypeSummary.cpp:37
lldb_private::CompileUnit
Definition: CompileUnit.h:38
ValueObjectSyntheticFilter.h
lldb_private::DataExtractor::PeekCStr
const char * PeekCStr(lldb::offset_t offset) const
Peek at a C string at offset.
Definition: DataExtractor.cpp:832
lldb_private::ValueObject::GetValueForExpressionPathOptions::m_no_fragile_ivar
bool m_no_fragile_ivar
Definition: ValueObject.h:205
lldb_private::ValueObject::IsUninitializedReference
bool IsUninitializedReference()
Definition: ValueObject.cpp:1611
lldb_private::ValueObject::GetDynamicValue
virtual lldb::ValueObjectSP GetDynamicValue(lldb::DynamicValueType valueType)
Definition: ValueObject.cpp:1844
lldb_private::formatters::StringPrinter::DumpToStreamOptions::SetBinaryZeroIsTerminator
void SetBinaryZeroIsTerminator(bool e)
Definition: StringPrinter.h:61
lldb_private::Value::GetRegisterInfo
RegisterInfo * GetRegisterInfo() const
Definition: Value.cpp:124
lldb_private::ValueObject::m_data
DataExtractor m_data
A data extractor that can be used to extract the value.
Definition: ValueObject.h:851
lldb_private::ValueObject::eClearUserVisibleDataItemsValue
@ eClearUserVisibleDataItemsValue
Definition: ValueObject.h:184
lldb_private::TypeFormatImpl::FormatObject
virtual bool FormatObject(ValueObject *valobj, std::string &dest) const =0
lldb_private::TypeFormatImpl
Definition: TypeFormat.h:24
lldb::eFormatVectorOfSInt8
@ eFormatVectorOfSInt8
Definition: lldb-enumerations.h:181
lldb_private::ValueObject::GetValueForExpressionPathOptions::m_check_dot_vs_arrow_syntax
bool m_check_dot_vs_arrow_syntax
Definition: ValueObject.h:204
lldb_private::ValueObject::GetValueForExpressionPathOptions::SyntheticChildrenTraversal::Both
@ Both
lldb_private::ValueObject::GetChildAtIndex
virtual lldb::ValueObjectSP GetChildAtIndex(size_t idx, bool can_create)
Definition: ValueObject.cpp:376
lldb_private::ValueObjectPrinter
Definition: ValueObjectPrinter.h:23
Target.h
lldb_private::ValueObject::GetProcessSP
lldb::ProcessSP GetProcessSP() const
Definition: ValueObject.h:338
lldb_private::DataExtractor::SetByteOrder
void SetByteOrder(lldb::ByteOrder byte_order)
Set the byte_order value.
Definition: DataExtractor.h:931
lldb_private::Value::GetScalar
const Scalar & GetScalar() const
Definition: Value.h:112
lldb::eFormatBytes
@ eFormatBytes
Definition: lldb-enumerations.h:161
lldb_private::ValueObject::CreateValueObjectFromExpression
static lldb::ValueObjectSP CreateValueObjectFromExpression(llvm::StringRef name, llvm::StringRef expression, const ExecutionContext &exe_ctx)
Definition: ValueObject.cpp:2974
lldb_private::TypeSummaryOptions::GetLanguage
lldb::LanguageType GetLanguage() const
Definition: TypeSummary.cpp:31
lldb_private::ValueObject::ValueObjectChild
friend class ValueObjectChild
Definition: ValueObject.h:931
lldb_private::CompilerType::GetPointeeType
CompilerType GetPointeeType() const
If this type is a pointer type, return the type that the pointer points to, else return an invalid ty...
Definition: CompilerType.cpp:466
lldb_private::ValueObject::SetSyntheticChildren
void SetSyntheticChildren(const lldb::SyntheticChildrenSP &synth_sp)
Definition: ValueObject.h:737
error
static llvm::raw_ostream & error(Stream &strm)
Definition: CommandReturnObject.cpp:17
lldb_private::ExecutionContextRef::SetFrameSP
void SetFrameSP(const lldb::StackFrameSP &frame_sp)
Set accessor that creates a weak reference to the frame referenced in frame_sp.
Definition: ExecutionContext.cpp:483
lldb::eFormatVectorOfFloat64
@ eFormatVectorOfFloat64
Definition: lldb-enumerations.h:191
lldb_private::ValueObject::GetSummaryFormat
lldb::TypeSummaryImplSP GetSummaryFormat()
Definition: ValueObject.h:717
lldb_private::ValueObject::m_address_type_of_ptr_or_ref_children
AddressType m_address_type_of_ptr_or_ref_children
Definition: ValueObject.h:896
lldb_private::ValueObject::GetSymbolContextScope
virtual SymbolContextScope * GetSymbolContextScope()
Definition: ValueObject.cpp:2965
lldb_private::Status::Success
bool Success() const
Test for success condition.
Definition: Status.cpp:287
lldb_private::ValueObject::m_deref_valobj
ValueObject * m_deref_valobj
Definition: ValueObject.h:883
lldb::eFormatVectorOfUInt32
@ eFormatVectorOfUInt32
Definition: lldb-enumerations.h:186
lldb_private::ExecutionContext::GetAddressByteSize
uint32_t GetAddressByteSize() const
Definition: ExecutionContext.cpp:174
lldb::eDynamicDontRunTarget
@ eDynamicDontRunTarget
Definition: lldb-enumerations.h:504
lldb_private::PersistentExpressionState::GetNextPersistentVariableName
virtual ConstString GetNextPersistentVariableName(bool is_error=false)=0
Return a new persistent variable name with the specified prefix.
lldb_private::CompilerType::IsPossibleDynamicType
bool IsPossibleDynamicType(CompilerType *target_type, bool check_cplusplus, bool check_objc) const
Definition: CompilerType.cpp:247
lldb_private::ValueObject::MightHaveChildren
virtual bool MightHaveChildren()
Find out if a ValueObject might have children.
Definition: ValueObject.cpp:514
lldb_private::ValueObject::ExpressionPathEndResultType
ExpressionPathEndResultType
Definition: ValueObject.h:159
lldb_private::ValueObject::m_last_format_mgr_revision
uint32_t m_last_format_mgr_revision
Definition: ValueObject.h:891
lldb_private::ConstString::SetString
void SetString(const llvm::StringRef &s)
Definition: ConstString.cpp:305
lldb_private::ValueObject::SetValueFormat
void SetValueFormat(lldb::TypeFormatImplSP format)
Definition: ValueObject.h:727
lldb_private::DataExtractor::GetAddressByteSize
uint32_t GetAddressByteSize() const
Get the current address size.
Definition: DataExtractor.h:264
lldb_private::ValueObject::eExpressionPathEndResultTypeUnboundedRange
@ eExpressionPathEndResultTypeUnboundedRange
A range [].
Definition: ValueObject.h:167
lldb_private::DataExtractor
Definition: DataExtractor.h:48
lldb_private::ConstString::GetStringRef
llvm::StringRef GetStringRef() const
Get the string value as a llvm::StringRef.
Definition: ConstString.h:201
lldb_private::ValueObject::ReadPointedString
std::pair< size_t, bool > ReadPointedString(lldb::WritableDataBufferSP &buffer_sp, Status &error, uint32_t max_length=0, bool honor_array=true, lldb::Format item_format=lldb::eFormatCharArray)
Definition: ValueObject.cpp:869
lldb_private::eAddressTypeInvalid
@ eAddressTypeInvalid
Definition: lldb-private-enumerations.h:31
lldb_private::Scalar::ULongLong
unsigned long long ULongLong(unsigned long long fail_value=0) const
Definition: Scalar.cpp:334
lldb_private::ValueObject::Dereference
virtual lldb::ValueObjectSP Dereference(Status &error)
Definition: ValueObject.cpp:2642
lldb_private::ValueObject::NeedsUpdating
bool NeedsUpdating()
Definition: ValueObject.h:695
Log.h
lldb_private::ExecutionContextScope
Definition: ExecutionContextScope.h:32
lldb_private::formatters::StringPrinter::DumpToStreamOptions::SetQuote
void SetQuote(char q)
Definition: StringPrinter.h:49
lldb_private::ValueObject::IsPossibleDynamicType
virtual bool IsPossibleDynamicType()
Definition: ValueObject.cpp:1578
lldb_private::ValueObject::CalculateNumChildren
virtual size_t CalculateNumChildren(uint32_t max=UINT32_MAX)=0
Should only be called by ValueObject::GetNumChildren().
lldb_private::ValueObject::GetDynamicValueTypeImpl
virtual lldb::DynamicValueType GetDynamicValueTypeImpl()
Definition: ValueObject.h:956
lldb_private::ConstString::IsEmpty
bool IsEmpty() const
Test for empty string.
Definition: ConstString.h:303
lldb_private::ValueObject::IsBaseClass
virtual bool IsBaseClass()
Definition: ValueObject.h:398
lldb_private::ValueObject::GetChildMemberWithName
virtual lldb::ValueObjectSP GetChildMemberWithName(ConstString name, bool can_create)
Definition: ValueObject.cpp:469
lldb_private::ValueObject::eExpressionPathScanEndReasonArrayRangeOperatorMet
@ eExpressionPathScanEndReasonArrayRangeOperatorMet
[] is good for arrays, but I cannot parse it.
Definition: ValueObject.h:143
lldb_private::ValueObject::GetFormat
lldb::Format GetFormat() const
Definition: ValueObject.cpp:3081
lldb_private::ValueObject::ExpressionPathAftermath
ExpressionPathAftermath
Definition: ValueObject.h:173
lldb_private::ValueObject::SetPreferredDisplayLanguageIfNeeded
void SetPreferredDisplayLanguageIfNeeded(lldb::LanguageType)
Definition: ValueObject.cpp:3110
lldb_private::ValueObject::GetSP
lldb::ValueObjectSP GetSP()
Definition: ValueObject.h:555
lldb_private::ValueObject::eExpressionPathScanEndReasonBitfieldRangeOperatorMet
@ eExpressionPathScanEndReasonBitfieldRangeOperatorMet
[] is good for bitfields, but I cannot parse after it.
Definition: ValueObject.h:145
lldb_private::CompilerType::GetFormat
lldb::Format GetFormat() const
Definition: CompilerType.cpp:581
lldb_private::Scalar::SLongLong
long long SLongLong(long long fail_value=0) const
Definition: Scalar.cpp:330
lldb_private::formatters::StringPrinter::ReadBufferAndDumpToStreamOptions::SetIsTruncated
void SetIsTruncated(bool t)
Definition: StringPrinter.h:140
lldb_private::ValueObject::EvaluationPoint::m_mod_id
ProcessModID m_mod_id
Definition: ValueObject.h:318
lldb_private::Status::Fail
bool Fail() const
Test for error condition.
Definition: Status.cpp:181
lldb_private::ValueObject::ChildrenManager::GetChildAtIndex
ValueObject * GetChildAtIndex(size_t idx)
Definition: ValueObject.h:805
lldb_private::StreamString::GetData
const char * GetData() const
Definition: StreamString.h:43
lldb_private::ValueObject::IsDereferenceOfParent
virtual bool IsDereferenceOfParent()
Definition: ValueObject.h:402
Declaration.h
lldb_private::ValueObject::UpdateValue
virtual bool UpdateValue()=0
lldb_private::ValueObject::ResolveValue
virtual bool ResolveValue(Scalar &scalar)
Definition: ValueObject.cpp:333
lldb_private::CompilerType::GetChildCompilerTypeAtIndex
CompilerType GetChildCompilerTypeAtIndex(ExecutionContext *exe_ctx, size_t idx, bool transparent_pointers, bool omit_empty_base_classes, bool ignore_array_bounds, std::string &child_name, uint32_t &child_byte_size, int32_t &child_byte_offset, uint32_t &child_bitfield_bit_size, uint32_t &child_bitfield_bit_offset, bool &child_is_base_class, bool &child_is_deref_of_parent, ValueObject *valobj, uint64_t &language_flags) const
Definition: CompilerType.cpp:684
lldb_private::ValueObject::eValueObjectRepresentationStyleChildrenCount
@ eValueObjectRepresentationStyleChildrenCount
Definition: ValueObject.h:117
lldb_private::DataExtractor::SetAddressByteSize
void SetAddressByteSize(uint32_t addr_size)
Set the address byte size.
Definition: DataExtractor.h:845
StreamString.h
lldb_private::ValueObject::eExpressionPathScanEndReasonDereferencingFailed
@ eExpressionPathScanEndReasonDereferencingFailed
Impossible to apply * operator.
Definition: ValueObject.h:151
Type.h
lldb_private::ValueObject::CreateValueObjectFromAddress
static lldb::ValueObjectSP CreateValueObjectFromAddress(llvm::StringRef name, uint64_t address, const ExecutionContext &exe_ctx, CompilerType type)
Definition: ValueObject.cpp:2997
lldb_private::ValueObject::m_last_format
lldb::Format m_last_format
Definition: ValueObject.h:890
lldb_private::ValueObject::CalculateSyntheticValue
virtual void CalculateSyntheticValue()
Definition: ValueObject.cpp:1809
lldb_private::ValueObject::eExpressionPathScanEndReasonFragileIVarNotAllowed
@ eExpressionPathScanEndReasonFragileIVarNotAllowed
ObjC ivar expansion not allowed.
Definition: ValueObject.h:137
lldb_private::DataExtractor::GetDataStart
const uint8_t * GetDataStart() const
Get the data start pointer.
Definition: DataExtractor.h:422
lldb_private::ValueObject::Bitflags::m_is_array_item_for_pointer
bool m_is_array_item_for_pointer
Definition: ValueObject.h:912
lldb_private::DataExtractor::GetByteOrder
lldb::ByteOrder GetByteOrder() const
Get the current byte order value.
Definition: DataExtractor.h:594
lldb_private::ConstString
Definition: ConstString.h:39
lldb_private::Language::LanguageIsObjC
static bool LanguageIsObjC(lldb::LanguageType language)
Definition: Language.cpp:263
lldb_private::ValueObject::GetValueForExpressionPathOptions::m_allow_bitfields_syntax
bool m_allow_bitfields_syntax
Definition: ValueObject.h:206
lldb_private::ValueObject::GetSyntheticBitFieldChild
lldb::ValueObjectSP GetSyntheticBitFieldChild(uint32_t from, uint32_t to, bool can_create)
Definition: ValueObject.cpp:1654
lldb_private::ValueObject::eExpressionPathScanEndReasonDotInsteadOfArrow
@ eExpressionPathScanEndReasonDotInsteadOfArrow
. used when -> should be used.
Definition: ValueObject.h:133
lldb_private::StreamString
Definition: StreamString.h:23
lldb_private::ValueObject::CalculateDynamicValue
virtual void CalculateDynamicValue(lldb::DynamicValueType use_dynamic)
Definition: ValueObject.cpp:1830
lldb_private::ExecutionContextRef::SetThreadSP
void SetThreadSP(const lldb::ThreadSP &thread_sp)
Set accessor that creates a weak reference to the thread referenced in thread_sp.
Definition: ExecutionContext.cpp:471
lldb_private::ValueObject::UpdateValueIfNeeded
bool UpdateValueIfNeeded(bool update_format=true)
Definition: ValueObject.cpp:112
lldb_private::ValueObject::ChildrenManager::HasChildAtIndex
bool HasChildAtIndex(size_t idx)
Definition: ValueObject.h:800
lldb_private::ValueObject::eValueObjectRepresentationStyleLanguageSpecific
@ eValueObjectRepresentationStyleLanguageSpecific
Definition: ValueObject.h:115
lldb_private::ValueObject::eExpressionPathScanEndReasonTakingAddressFailed
@ eExpressionPathScanEndReasonTakingAddressFailed
Impossible to apply & operator.
Definition: ValueObject.h:149
lldb_private::ValueObject::CastPointerType
virtual lldb::ValueObjectSP CastPointerType(const char *name, CompilerType &ast_type)
Definition: ValueObject.cpp:2785
lldb_private::ValueObject::GetIndexOfChildWithName
virtual size_t GetIndexOfChildWithName(ConstString name)
Definition: ValueObject.cpp:463
lldb_private::Value::ValueType
ValueType
Type that describes Value::m_value.
Definition: Value.h:41
lldb_private::ValueObject::GetSyntheticChildAtOffset
virtual lldb::ValueObjectSP GetSyntheticChildAtOffset(uint32_t offset, const CompilerType &type, bool can_create, ConstString name_const_str=ConstString())
Definition: ValueObject.cpp:1688
lldb_private::ValueObject::GetObjectDescription
const char * GetObjectDescription()
Definition: ValueObject.cpp:1008
ValueObjectPrinter.h
lldb_private::ValueObject::CreateConstantValue
virtual lldb::ValueObjectSP CreateConstantValue(ConstString name)
Definition: ValueObject.cpp:2578
lldb_private::ValueObject::SetSummaryFormat
void SetSummaryFormat(lldb::TypeSummaryImplSP format)
Definition: ValueObject.h:722
lldb_private::ValueObject::eExpressionPathScanEndReasonEndOfString
@ eExpressionPathScanEndReasonEndOfString
Out of data to parse.
Definition: ValueObject.h:125
lldb::eFormatDecimal
@ eFormatDecimal
Definition: lldb-enumerations.h:168
lldb_private::ValueObject::m_synthetic_children_sp
lldb::SyntheticChildrenSP m_synthetic_children_sp
Definition: ValueObject.h:894
ValueObjectCast.h
lldb_private::ValueObject::GetParent
virtual ValueObject * GetParent()
Definition: ValueObject.h:753
lldb_private::Scalar::ExtractBitfield
bool ExtractBitfield(uint32_t bit_size, uint32_t bit_offset)
Definition: Scalar.cpp:798
lldb_private::ValueObject::eExpressionPathScanEndReasonUnknown
@ eExpressionPathScanEndReasonUnknown
Definition: ValueObject.h:156
lldb::DynamicValueType
DynamicValueType
Definition: lldb-enumerations.h:501
lldb_private::ValueObject::m_type_format_sp
lldb::TypeFormatImplSP m_type_format_sp
Definition: ValueObject.h:893
lldb_private::ValueObject::GetExecutionContextRef
const ExecutionContextRef & GetExecutionContextRef() const
Definition: ValueObject.h:330
lldb_private::LanguageRuntime
Definition: LanguageRuntime.h:61
ThreadList.h
lldb::eFormatVectorOfUInt16
@ eFormatVectorOfUInt16
Definition: lldb-enumerations.h:184
lldb_private::ValueObject::Cast
virtual lldb::ValueObjectSP Cast(const CompilerType &compiler_type)
Definition: ValueObject.cpp:2777
lldb_private::ValueObject::eExpressionPathScanEndReasonUnexpectedSymbol
@ eExpressionPathScanEndReasonUnexpectedSymbol
Something is malformed in he expression.
Definition: ValueObject.h:147
lldb::eLanguageTypeObjC
@ eLanguageTypeObjC
Objective-C.
Definition: lldb-enumerations.h:460
string
string(SUBSTRING ${p} 10 -1 pStripped) if($
Definition: Plugins/CMakeLists.txt:40
lldb_private::eAddressTypeLoad
@ eAddressTypeLoad
Address is an address as in the current target inferior process.
Definition: lldb-private-enumerations.h:34
lldb_private::ValueObject::eExpressionPathEndResultTypeBitfield
@ eExpressionPathEndResultTypeBitfield
A bitfield.
Definition: ValueObject.h:163
lldb_private::CompilerType::GetEncoding
lldb::Encoding GetEncoding(uint64_t &count) const
Definition: CompilerType.cpp:574
Thread.h
lldb_private::Stream::PutChar
size_t PutChar(char ch)
Definition: Stream.cpp:104
lldb_private::ValueObject::m_format
lldb::Format m_format
Definition: ValueObject.h:889
lldb_private::ValueObject::GetSyntheticArrayMember
lldb::ValueObjectSP GetSyntheticArrayMember(size_t index, bool can_create)
Definition: ValueObject.cpp:1627
CompilerType.h
lldb_private::ValueObject::ChildrenManager::SetChildAtIndex
void SetChildAtIndex(size_t idx, ValueObject *valobj)
Definition: ValueObject.h:811
Address.h
lldb_private::CompilerType::IsValid
bool IsValid() const
Definition: CompilerType.h:124
lldb_private::ValueObject::IsLogicalTrue
virtual bool IsLogicalTrue(Status &error)
Definition: ValueObject.cpp:351
lldb_private::Language::FindPlugin
static Language * FindPlugin(lldb::LanguageType language)
Definition: Language.cpp:53
lldb_private::Flags::Reset
void Reset(ValueType flags)
Set accessor for all flags.
Definition: Flags.h:52
ValueObject.h
lldb_private::Scalar::MakeUnsigned
bool MakeUnsigned()
Definition: Scalar.cpp:259
lldb_private::ArchSpec::GetAddressByteSize
uint32_t GetAddressByteSize() const
Returns the size in bytes of an address of the current architecture.
Definition: ArchSpec.cpp:694
lldb_private::SymbolContextScope
Definition: SymbolContextScope.h:64
lldb::eFormatChar
@ eFormatChar
Definition: lldb-enumerations.h:163
lldb_private::ValueObject::SetValueFromCString
virtual bool SetValueFromCString(const char *value_str, Status &error)
Definition: ValueObject.cpp:1474
lldb_private::ValueObject::GetPreferredDisplayLanguage
virtual lldb::LanguageType GetPreferredDisplayLanguage()
Definition: ValueObject.cpp:3091
ValueObjectConstResult.h
lldb_private::Value::ResolveValue
Scalar & ResolveValue(ExecutionContext *exe_ctx)
Definition: Value.cpp:561
lldb_private::ValueObject::m_update_point
EvaluationPoint m_update_point
Stores both the stop id and the full context at which this value was last updated.
Definition: ValueObject.h:847
lldb_private::ValueObject::GetSummaryAsCString
const char * GetSummaryAsCString(lldb::LanguageType lang=lldb::eLanguageTypeUnknown)
Definition: ValueObject.cpp:638
lldb_private::Declaration::Clear
void Clear()
Clear the object's state.
Definition: Declaration.h:57
lldb_private::ValueObject::GetBitfieldBitOffset
virtual uint32_t GetBitfieldBitOffset()
Definition: ValueObject.h:426
lldb_private::ValueObject::GetNonBaseClassParent
ValueObject * GetNonBaseClassParent()
Definition: ValueObject.cpp:1877
lldb_private::ValueObject::GetNumChildren
size_t GetNumChildren(uint32_t max=UINT32_MAX)
Definition: ValueObject.cpp:497
CopyStringDataToBufferSP
static bool CopyStringDataToBufferSP(const StreamString &source, lldb::WritableDataBufferSP &destination)
Definition: ValueObject.cpp:859
lldb_private::ValueObject::eValueObjectRepresentationStyleExpressionPath
@ eValueObjectRepresentationStyleExpressionPath
Definition: ValueObject.h:120
lldb::eFormatUnicode16
@ eFormatUnicode16
Definition: lldb-enumerations.h:176
lldb_private::ValueObject::GetValueAsCString
virtual const char * GetValueAsCString()
Definition: ValueObject.cpp:1058
lldb::eFormatUnsigned
@ eFormatUnsigned
Definition: lldb-enumerations.h:178
lldb_private::ValueObject::Bitflags::m_is_bitfield_for_scalar
bool m_is_bitfield_for_scalar
Definition: ValueObject.h:913
lldb_private::ExecutionContext::GetProcessSP
const lldb::ProcessSP & GetProcessSP() const
Get accessor to get the process shared pointer.
Definition: ExecutionContext.h:459
lldb_private::ValueObject::GetIsConstant
virtual bool GetIsConstant() const
Definition: ValueObject.h:693
lldb_private::ValueObject::eExpressionPathScanEndReasonArrowInsteadOfDot
@ eExpressionPathScanEndReasonArrowInsteadOfDot
-> used when . should be used.
Definition: ValueObject.h:135
lldb_private::Process::IsPossibleDynamicValue
bool IsPossibleDynamicValue(ValueObject &in_value)
Definition: Process.cpp:1541
lldb_private::ValueObject::HasDynamicValueTypeInfo
virtual bool HasDynamicValueTypeInfo()
Definition: ValueObject.h:960
lldb::eEncodingVector
@ eEncodingVector
vector registers
Definition: lldb-enumerations.h:152
lldb_private::Status
Definition: Status.h:44
lldb_private::ValueObject
ValueObject:
Definition: ValueObject.h:105
lldb_private::CompilerType::GetPointerType
CompilerType GetPointerType() const
Return a new CompilerType that is a pointer to this type.
Definition: CompilerType.cpp:474
lldb_private::ValueObject::IsCStringContainer
bool IsCStringContainer(bool check_pointer=false)
Returns true if this is a char* or a char[] if it is a char* and check_pointer is true,...
Definition: ValueObject.cpp:655
DataVisualization.h
lldb_private::ValueObject::eGetExpressionPathFormatHonorPointers
@ eGetExpressionPathFormatHonorPointers
Definition: ValueObject.h:109
lldb_private::ValueObject::GetName
ConstString GetName() const
Definition: ValueObject.h:467
TypeSummary.h
lldb_private::Target::ReadMemory
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)
Definition: Target.cpp:1781
lldb::eByteOrderInvalid
@ eByteOrderInvalid
Definition: lldb-enumerations.h:140
lldb::eLanguageTypeUnknown
@ eLanguageTypeUnknown
Unknown or invalid language value.
Definition: lldb-enumerations.h:444
uint32_t
lldb_private::ValueObject::Bitflags::m_value_did_change
bool m_value_did_change
Definition: ValueObject.h:910
lldb_private::eLazyBoolNo
@ eLazyBoolNo
Definition: lldb-private-enumerations.h:115
lldb_private::ValueObject::Clone
virtual lldb::ValueObjectSP Clone(ConstString new_name)
Creates a copy of the ValueObject with a new name and setting the current ValueObject as its parent.
Definition: ValueObject.cpp:2781
lldb_private::ValueObject::CreateChildAtIndex
virtual ValueObject * CreateChildAtIndex(size_t idx, bool synthetic_array_member, int32_t synthetic_index)
Should only be called by ValueObject::GetChildAtIndex().
Definition: ValueObject.cpp:532
lldb_private::ValueObject::EvaluationPoint::SyncWithProcessState
bool SyncWithProcessState(bool accept_invalid_exe_ctx)
Definition: ValueObject.cpp:2867
lldb_private::ExecutionContext::GetBestExecutionContextScope
ExecutionContextScope * GetBestExecutionContextScope() const
Definition: ExecutionContext.cpp:214
lldb_private::ValueObjectPrinter::PrintValueObject
bool PrintValueObject()
Definition: ValueObjectPrinter.cpp:73
lldb_private::Language
Definition: Language.h:29
DumpValueObjectOptions.h
lldb_private::ValueObject::EvaluationPoint::~EvaluationPoint
~EvaluationPoint()
lldb_private::ExpressionVariable::EVIsProgramReference
@ EVIsProgramReference
This variable is a reference to a (possibly invalid) area managed by the target program.
Definition: ExpressionVariable.h:86
lldb_private::Address
Definition: Address.h:59
lldb_private::ExecutionContext::GetFrameSP
const lldb::StackFrameSP & GetFrameSP() const
Get accessor to get the frame shared pointer.
Definition: ExecutionContext.h:469
lldb_private::ValueObject::m_value
Value m_value
Definition: ValueObject.h:852
lldb_private::Value::ValueType::HostAddress
@ HostAddress
A host address value (for memory in the process that < A is using liblldb).
lldb_private::ProcessModID
Definition: Process.h:219
lldb_private::ValueObject::m_parent
ValueObject * m_parent
The parent value object, or nullptr if this has no parent.
Definition: ValueObject.h:840
lldb::eFormatCString
@ eFormatCString
NULL terminated C strings.
Definition: lldb-enumerations.h:167
lldb_private::ValueObject::GetCompilerTypeImpl
virtual CompilerType GetCompilerTypeImpl()=0
lldb_private::ValueObject::eExpressionPathScanEndReasonSyntheticValueMissing
@ eExpressionPathScanEndReasonSyntheticValueMissing
getting the synthetic children failed.
Definition: ValueObject.h:155
lldb_private::eAddressTypeFile
@ eAddressTypeFile
Address is an address as found in an object or symbol file.
Definition: lldb-private-enumerations.h:32
lldb_private::CompilerType::GetTypeInfo
uint32_t GetTypeInfo(CompilerType *pointee_or_element_compiler_type=nullptr) const
Definition: CompilerType.cpp:337
lldb_private::ValueObject::GetValueForExpressionPathOptions::m_synthetic_children_traversal
SyntheticChildrenTraversal m_synthetic_children_traversal
Definition: ValueObject.h:207
lldb_private::ValueObject::GetDeclaration
virtual bool GetDeclaration(Declaration &decl)
Definition: ValueObject.cpp:1559
lldb_private::Status::SetErrorString
void SetErrorString(llvm::StringRef err_str)
Set the current error string to err_str.
Definition: Status.cpp:241
lldb_private::ValueObject::eExpressionPathEndResultTypePlain
@ eExpressionPathEndResultTypePlain
Anything but...
Definition: ValueObject.h:161
lldb::eFormatVectorOfSInt64
@ eFormatVectorOfSInt64
Definition: lldb-enumerations.h:187
lldb_private::ValueObject::eGetExpressionPathFormatDereferencePointers
@ eGetExpressionPathFormatDereferencePointers
Definition: ValueObject.h:108
lldb_private::CompilerType::IsArrayType
bool IsArrayType(CompilerType *element_type=nullptr, uint64_t *size=nullptr, bool *is_incomplete=nullptr) const
Definition: CompilerType.cpp:53
lldb_private::ValueObject::EvaluationPoint
Definition: ValueObject.h:260
lldb_private::Process::GetLanguageRuntime
LanguageRuntime * GetLanguageRuntime(lldb::LanguageType language)
Definition: Process.cpp:1513
UINT32_MAX
#define UINT32_MAX
Definition: lldb-defines.h:19
lldb_private::Value::GetContextType
ContextType GetContextType() const
Definition: Value.h:87
lldb_private::ValueObject::GetCompilerType
CompilerType GetCompilerType()
Definition: ValueObject.h:352
lldb_private::ValueObject::UpdateFormatsIfNeeded
bool UpdateFormatsIfNeeded()
Definition: ValueObject.cpp:203
lldb_private::ValueObject::m_root
ValueObject * m_root
The root of the hierarchy for this ValueObject (or nullptr if never calculated).
Definition: ValueObject.h:843
lldb::eFormatCharPrintable
@ eFormatCharPrintable
Only printable characters, '.' if not printable.
Definition: lldb-enumerations.h:164
lldb_private::ValueObject::Bitflags::m_children_count_valid
bool m_children_count_valid
Definition: ValueObject.h:911
ValueObjectChild.h
lldb_private::TypeSummaryOptions
Definition: TypeSummary.h:26
lldb_private::ValueObject::GetDynamicValueType
lldb::DynamicValueType GetDynamicValueType()
Definition: ValueObject.cpp:3071
TypeFormat.h
lldb::eFormatCharArray
@ eFormatCharArray
Print characters with no single quotes, used for character arrays that can contain non printable char...
Definition: lldb-enumerations.h:194
lldb_private::ValueObject::eValueObjectRepresentationStyleType
@ eValueObjectRepresentationStyleType
Definition: ValueObject.h:118
lldb::Encoding
Encoding
Register encoding definitions.
Definition: lldb-enumerations.h:147
lldb_private::ValueObject::GetSyntheticChild
lldb::ValueObjectSP GetSyntheticChild(ConstString key) const
Definition: ValueObject.cpp:1569
lldb_private::ValueObject::GetSyntheticBase
virtual lldb::ValueObjectSP GetSyntheticBase(uint32_t offset, const CompilerType &type, bool can_create, ConstString name_const_str=ConstString())
Definition: ValueObject.cpp:1725
lldb_private::ValueObject::GetModule
virtual lldb::ModuleSP GetModule()
Return the module associated with this value object in case the value is from an executable file and ...
Definition: ValueObject.cpp:3036
lldb_private::ValueObject::GetTypeInfo
virtual uint32_t GetTypeInfo(CompilerType *pointee_or_element_compiler_type=nullptr)
Definition: ValueObject.h:378
LLDB_INVALID_ADDRESS
#define LLDB_INVALID_ADDRESS
Definition: lldb-defines.h:74
lldb_private::ConstString::GetCString
const char * GetCString() const
Get the string value as a C string.
Definition: ConstString.h:215
g_value_obj_uid
static user_id_t g_value_obj_uid
Definition: ValueObject.cpp:78
lldb_private::ExecutionContext::GetTargetSP
const lldb::TargetSP & GetTargetSP() const
Get accessor to get the target shared pointer.
Definition: ExecutionContext.h:454
lldb_private::ValueObject::GetValueIsValid
bool GetValueIsValid() const
Definition: ValueObject.h:545
lldb_private::CompilerType
Generic representation of a type in a programming language.
Definition: CompilerType.h:36
lldb_private::ValueObjectConstResult::Create
static lldb::ValueObjectSP Create(ExecutionContextScope *exe_scope, lldb::ByteOrder byte_order, uint32_t addr_byte_size, lldb::addr_t address=LLDB_INVALID_ADDRESS)
Definition: ValueObjectConstResult.cpp:29
lldb_private::ValueObject::GetLocationAsCString
virtual const char * GetLocationAsCString()
Definition: ValueObject.h:508
lldb_private::Stream::Printf
size_t Printf(const char *format,...) __attribute__((format(printf
Output printf formatted output to the stream.
Definition: Stream.cpp:107
lldb_private::ValueObject::m_value_str
std::string m_value_str
Cached value string that will get cleared if/when the value is updated.
Definition: ValueObject.h:857
lldb_private::ValueObject::GetVariable
virtual lldb::VariableSP GetVariable()
Definition: ValueObject.h:785
lldb_private::Value::GetCompilerType
const CompilerType & GetCompilerType()
Definition: Value.cpp:223
lldb::eFormatBinary
@ eFormatBinary
Definition: lldb-enumerations.h:160
LanguageRuntime.h
lldb_private::Process::WriteScalarToMemory
size_t WriteScalarToMemory(lldb::addr_t vm_addr, const Scalar &scalar, size_t size, Status &error)
Write all or part of a scalar value to memory.
Definition: Process.cpp:2207
lldb_private::ValueObject::HasSpecialPrintableRepresentation
bool HasSpecialPrintableRepresentation(ValueObjectRepresentationStyle val_obj_display, lldb::Format custom_format)
Definition: ValueObject.cpp:1139
lldb_private::Value::ContextType::RegisterInfo
@ RegisterInfo
RegisterInfo * (can be a scalar or a vector register).
lldb_private::ValueObject::ExpressionPathScanEndReason
ExpressionPathScanEndReason
Definition: ValueObject.h:123
lldb_private::ValueObject::IsScalarType
virtual bool IsScalarType()
Definition: ValueObject.h:386
lldb_private::DumpValueObjectOptions
Definition: DumpValueObjectOptions.h:22
lldb_private::ValueObject::EvaluationPoint::m_exe_ctx_ref
ExecutionContextRef m_exe_ctx_ref
Definition: ValueObject.h:320
lldb::eFormatComplexInteger
@ eFormatComplexInteger
Integer complex type.
Definition: lldb-enumerations.h:193
lldb_private::PersistentExpressionState
Definition: ExpressionVariable.h:204
lldb::user_id_t
uint64_t user_id_t
Definition: lldb-types.h:84
lldb_private::ValueObject::EvaluationPoint::SetNeedsUpdate
void SetNeedsUpdate()
Definition: ValueObject.h:286
SymbolContext.h
lldb_private::ValueObject::SetData
virtual bool SetData(DataExtractor &data, Status &error)
Definition: ValueObject.cpp:792
lldb_private::LLDBLog::DataFormatters
@ DataFormatters
lldb_private::formatters::StringPrinter::StringElementType::ASCII
@ ASCII
lldb_private
A class that represents a running process on the host machine.
Definition: SBCommandInterpreterRunOptions.h:16
lldb_private::ValueObject::AddSyntheticChild
void AddSyntheticChild(ConstString key, ValueObject *valobj)
Definition: ValueObject.cpp:1564
lldb_private::ValueObject::m_flags
struct lldb_private::ValueObject::Bitflags m_flags
lldb::eFormatHex
@ eFormatHex
Definition: lldb-enumerations.h:170
lldb_private::TypeFormatImpl_Format
Definition: TypeFormat.h:159
lldb_private::eLazyBoolCalculate
@ eLazyBoolCalculate
Definition: lldb-private-enumerations.h:115
lldb_private::ValueObject::GetAddressOf
virtual lldb::addr_t GetAddressOf(bool scalar_is_load_address=true, AddressType *address_type=nullptr)
Definition: ValueObject.cpp:1408
lldb_private::ValueObject::GetChildAtNamePath
lldb::ValueObjectSP GetChildAtNamePath(llvm::ArrayRef< ConstString > names, ConstString *name_of_error=nullptr)
Definition: ValueObject.cpp:430
lldb_private::ExecutionContextScope::CalculateTarget
virtual lldb::TargetSP CalculateTarget()=0
lldb_private::ValueObject::SetNumChildren
void SetNumChildren(size_t num_children)
Definition: ValueObject.cpp:527
lldb_private::ValueObject::PrintableRepresentationSpecialCases::eAllow
@ eAllow
lldb::eFormatUnicode32
@ eFormatUnicode32
Definition: lldb-enumerations.h:177
lldb_private::ValueObject::Bitflags::m_did_calculate_complete_objc_class_type
bool m_did_calculate_complete_objc_class_type
Definition: ValueObject.h:914
lldb::eFormatEnum
@ eFormatEnum
Definition: lldb-enumerations.h:169
lldb_private::ExecutionContextRef::SetTargetSP
void SetTargetSP(const lldb::TargetSP &target_sp)
Set accessor that creates a weak reference to the target referenced in target_sp.
Definition: ExecutionContext.cpp:457
lldb::eDynamicCanRunTarget
@ eDynamicCanRunTarget
Definition: lldb-enumerations.h:503
lldb::eByteOrderBig
@ eByteOrderBig
Definition: lldb-enumerations.h:141
lldb_private::Scalar::MakeSigned
bool MakeSigned()
Definition: Scalar.cpp:241
lldb_private::ValueObject::eExpressionPathEndResultTypeInvalid
@ eExpressionPathEndResultTypeInvalid
Definition: ValueObject.h:170
lldb_private::Status::Clear
void Clear()
Clear the object state.
Definition: Status.cpp:167
lldb_private::ValueObject::Bitflags::m_old_value_valid
bool m_old_value_valid
Definition: ValueObject.h:911
lldb_private::ValueObject::GetValueForExpressionPathOptions::SyntheticChildrenTraversal::ToSynthetic
@ ToSynthetic
Flags.h
lldb_private::ValueObject::GetTargetSP
lldb::TargetSP GetTargetSP() const
Definition: ValueObject.h:334
lldb_private::formatters::StringPrinter::ReadBufferAndDumpToStreamOptions::SetData
void SetData(DataExtractor &&d)
Definition: StringPrinter.h:136
lldb_private::ValueObject::ValueObjectRepresentationStyle
ValueObjectRepresentationStyle
Definition: ValueObject.h:112
lldb_private::DataExtractor::CopyByteOrderedData
lldb::offset_t CopyByteOrderedData(lldb::offset_t src_offset, lldb::offset_t src_len, void *dst, lldb::offset_t dst_len, lldb::ByteOrder dst_byte_order) const
Copy dst_len bytes from *offset_ptr and ensure the copied data is treated as a value that can be swap...
Definition: DataExtractor.cpp:690
StringPrinter.h
lldb_private::ValueObject::CreateValueObjectFromData
static lldb::ValueObjectSP CreateValueObjectFromData(llvm::StringRef name, const DataExtractor &data, const ExecutionContext &exe_ctx, CompilerType type)
Definition: ValueObject.cpp:3023
lldb_private::ValueObject::m_dynamic_value
ValueObject * m_dynamic_value
Definition: ValueObject.h:881
lldb_private::ValueObject::EvaluationPoint::EvaluationPoint
EvaluationPoint()
Definition: ValueObject.cpp:2814
lldb_private::ValueObject::DumpPrintableRepresentation
bool DumpPrintableRepresentation(Stream &s, ValueObjectRepresentationStyle val_obj_display=eValueObjectRepresentationStyleSummary, lldb::Format custom_format=lldb::eFormatInvalid, PrintableRepresentationSpecialCases special=PrintableRepresentationSpecialCases::eAllow, bool do_dump_error=true)
Definition: ValueObject.cpp:1172
lldb_private::ValueObject::ClearDynamicTypeInformation
void ClearDynamicTypeInformation()
Definition: ValueObject.cpp:237
Stream.h
lldb_private::ValueObject::Bitflags::m_is_synthetic_children_generated
bool m_is_synthetic_children_generated
Definition: ValueObject.h:915
lldb_private::Log
Definition: Log.h:115
lldb_private::Stream::PutCString
size_t PutCString(llvm::StringRef cstr)
Output a C string to the stream.
Definition: Stream.cpp:63
lldb_private::ValueObject::ChildrenManager::GetChildrenCount
size_t GetChildrenCount()
Definition: ValueObject.h:820
lldb::eFormatVectorOfFloat32
@ eFormatVectorOfFloat32
Definition: lldb-enumerations.h:190
lldb::eFormatComplexFloat
@ eFormatComplexFloat
Definition: lldb-enumerations.h:166
lldb_private::ValueObject::m_error
Status m_error
An error object that can describe any errors that occur when updating values.
Definition: ValueObject.h:855
lldb_private::ValueObject::AddressOf
virtual lldb::ValueObjectSP AddressOf(Status &error)
Definition: ValueObject.cpp:2734
lldb_private::ValueObject::HasSyntheticValue
virtual bool HasSyntheticValue()
Definition: ValueObject.cpp:1866
lldb_private::ValueObject::Dump
void Dump(Stream &s)
Definition: ValueObject.cpp:2571
lldb_private::PersistentExpressionState::CreatePersistentVariable
virtual lldb::ExpressionVariableSP CreatePersistentVariable(const lldb::ValueObjectSP &valobj_sp)=0
lldb_private::ValueObject::GetLocationAsCStringImpl
const char * GetLocationAsCStringImpl(const Value &value, const DataExtractor &data)
Definition: ValueObject.cpp:289
lldb_private::formatters::StringPrinter::DumpToStreamOptions::SetStream
void SetStream(Stream *s)
Definition: StringPrinter.h:33
lldb_private::ValueObject::eExpressionPathEndResultTypeBoundedRange
@ eExpressionPathEndResultTypeBoundedRange
A range [low-high].
Definition: ValueObject.h:165
lldb_private::DataExtractor::Checksum
void Checksum(llvm::SmallVectorImpl< uint8_t > &dest, uint64_t max_data=0)
Definition: DataExtractor.cpp:1029
lldb_private::ValueObjectChild
A child of another ValueObject.
Definition: ValueObjectChild.h:28
Variable.h
lldb_private::GetLog
Log * GetLog(Cat mask)
Retrieve the Log object for the channel associated with the given log enum.
Definition: Log.h:309
lldb_private::ValueObject::IsChecksumEmpty
bool IsChecksumEmpty()
Definition: ValueObject.h:998
lldb_private::ValueObject::eClearUserVisibleDataItemsSyntheticChildren
@ eClearUserVisibleDataItemsSyntheticChildren
Definition: ValueObject.h:188
lldb::eFormatFloat
@ eFormatFloat
Definition: lldb-enumerations.h:172
lldb_private::Declaration
Definition: Declaration.h:24
DataBuffer.h
lldb_private::DataExtractor::GetByteSize
uint64_t GetByteSize() const
Get the number of bytes contained in this object.
Definition: DataExtractor.h:270
lldb_private::DataBufferHeap
Definition: DataBufferHeap.h:30
lldb_private::ValueObject::eValueObjectRepresentationStyleSummary
@ eValueObjectRepresentationStyleSummary
Definition: ValueObject.h:114
lldb
Definition: SBAddress.h:15
lldb_private::ValueObject::eExpressionPathScanEndReasonRangeOperatorNotAllowed
@ eExpressionPathScanEndReasonRangeOperatorNotAllowed
[] not allowed by options.
Definition: ValueObject.h:139
lldb_private::ValueObject::GetByteSize
virtual std::optional< uint64_t > GetByteSize()=0
lldb_private::ValueObject::eExpressionPathScanEndReasonEmptyRangeNotAllowed
@ eExpressionPathScanEndReasonEmptyRangeNotAllowed
[] only allowed for arrays.
Definition: ValueObject.h:131
lldb_private::ValueObject::GetSyntheticValue
lldb::ValueObjectSP GetSyntheticValue()
Definition: ValueObject.cpp:1857
lldb_private::ValueObject::GetFrameSP
lldb::StackFrameSP GetFrameSP() const
Definition: ValueObject.h:346
lldb_private::ValueObject::GetSyntheticExpressionPathChild
lldb::ValueObjectSP GetSyntheticExpressionPathChild(const char *expression, bool can_create)
Definition: ValueObject.cpp:1781
LLDBLog.h
lldb::eFormatVectorOfUInt8
@ eFormatVectorOfUInt8
Definition: lldb-enumerations.h:182
lldb_private::ValueObject::m_addr_of_valobj_sp
lldb::ValueObjectSP m_addr_of_valobj_sp
We have to hold onto a shared pointer to this one because it is created as an independent ValueObject...
Definition: ValueObject.h:887
lldb::eFormatDefault
@ eFormatDefault
Definition: lldb-enumerations.h:157
lldb_private::FormatManager::GetSingleItemFormat
static lldb::Format GetSingleItemFormat(lldb::Format vector_format)
Definition: FormatManager.cpp:419
lldb_private::ExecutionContext::GetTargetPtr
Target * GetTargetPtr() const
Returns a pointer to the target object.
Definition: ExecutionContext.cpp:198
ExecutionContext.h
lldb::eFormatComplex
@ eFormatComplex
Floating point complex type.
Definition: lldb-enumerations.h:165
lldb_private::DataVisualization::GetSummaryFormat
static lldb::TypeSummaryImplSP GetSummaryFormat(ValueObject &valobj, lldb::DynamicValueType use_dynamic)
Definition: DataVisualization.cpp:42
DataBufferHeap.h
UINT64_MAX
#define UINT64_MAX
Definition: lldb-defines.h:23
lldb::eFormatOctal
@ eFormatOctal
Definition: lldb-enumerations.h:173
lldb_private::ValueObject::GetAddressTypeOfChildren
AddressType GetAddressTypeOfChildren()
Definition: ValueObject.cpp:3062
lldb_private::ValueObject::GetObjectRuntimeLanguage
virtual lldb::LanguageType GetObjectRuntimeLanguage()
Definition: ValueObject.h:373
lldb_private::Scalar::IsValid
bool IsValid() const
Definition: Scalar.h:106
lldb::eFormatHexUppercase
@ eFormatHexUppercase
Definition: lldb-enumerations.h:171
lldb::eFormatInvalid
@ eFormatInvalid
Definition: lldb-enumerations.h:158
lldb_private::ValueObject::ChildrenManager::SetChildrenCount
void SetChildrenCount(size_t count)
Definition: ValueObject.h:818
lldb_private::Status::AsCString
const char * AsCString(const char *default_error_str="unknown error") const
Get the error string associated with the current error.
Definition: Status.cpp:130
lldb_private::ValueObject::SetNeedsUpdate
void SetNeedsUpdate()
Definition: ValueObject.cpp:230
lldb_private::ValueObject::GetValueForExpressionPath_Impl
lldb::ValueObjectSP GetValueForExpressionPath_Impl(llvm::StringRef expression_cstr, ExpressionPathScanEndReason *reason_to_stop, ExpressionPathEndResultType *final_value_type, const GetValueForExpressionPathOptions &options, ExpressionPathAftermath *final_task_on_target)
Definition: ValueObject.cpp:2065