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