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  llvm::StringRef src = source.GetString();
853  src.consume_back(llvm::StringRef("\0", 1));
854  destination = std::make_shared<DataBufferHeap>(src.size(), 0);
855  memcpy(destination->GetBytes(), src.data(), src.size());
856  return true;
857 }
858 
859 std::pair<size_t, bool>
860 ValueObject::ReadPointedString(lldb::DataBufferSP &buffer_sp, Status &error,
861  uint32_t max_length, bool honor_array,
862  Format item_format) {
863  bool was_capped = false;
864  StreamString s;
866  Target *target = exe_ctx.GetTargetPtr();
867 
868  if (!target) {
869  s << "<no target to read from>";
870  error.SetErrorString("no target to read from");
871  CopyStringDataToBufferSP(s, buffer_sp);
872  return {0, was_capped};
873  }
874 
875  if (max_length == 0)
876  max_length = target->GetMaximumSizeOfStringSummary();
877 
878  size_t bytes_read = 0;
879  size_t total_bytes_read = 0;
880 
881  CompilerType compiler_type = GetCompilerType();
882  CompilerType elem_or_pointee_compiler_type;
883  const Flags type_flags(GetTypeInfo(&elem_or_pointee_compiler_type));
884  if (type_flags.AnySet(eTypeIsArray | eTypeIsPointer) &&
885  elem_or_pointee_compiler_type.IsCharType()) {
886  addr_t cstr_address = LLDB_INVALID_ADDRESS;
887  AddressType cstr_address_type = eAddressTypeInvalid;
888 
889  size_t cstr_len = 0;
890  bool capped_data = false;
891  const bool is_array = type_flags.Test(eTypeIsArray);
892  if (is_array) {
893  // We have an array
894  uint64_t array_size = 0;
895  if (compiler_type.IsArrayType(nullptr, &array_size)) {
896  cstr_len = array_size;
897  if (cstr_len > max_length) {
898  capped_data = true;
899  cstr_len = max_length;
900  }
901  }
902  cstr_address = GetAddressOf(true, &cstr_address_type);
903  } else {
904  // We have a pointer
905  cstr_address = GetPointerValue(&cstr_address_type);
906  }
907 
908  if (cstr_address == 0 || cstr_address == LLDB_INVALID_ADDRESS) {
909  if (cstr_address_type == eAddressTypeHost && is_array) {
910  const char *cstr = GetDataExtractor().PeekCStr(0);
911  if (cstr == nullptr) {
912  s << "<invalid address>";
913  error.SetErrorString("invalid address");
914  CopyStringDataToBufferSP(s, buffer_sp);
915  return {0, was_capped};
916  }
917  s << llvm::StringRef(cstr, cstr_len);
918  CopyStringDataToBufferSP(s, buffer_sp);
919  return {cstr_len, was_capped};
920  } else {
921  s << "<invalid address>";
922  error.SetErrorString("invalid address");
923  CopyStringDataToBufferSP(s, buffer_sp);
924  return {0, was_capped};
925  }
926  }
927 
928  Address cstr_so_addr(cstr_address);
929  DataExtractor data;
930  if (cstr_len > 0 && honor_array) {
931  // I am using GetPointeeData() here to abstract the fact that some
932  // ValueObjects are actually frozen pointers in the host but the pointed-
933  // to data lives in the debuggee, and GetPointeeData() automatically
934  // takes care of this
935  GetPointeeData(data, 0, cstr_len);
936 
937  if ((bytes_read = data.GetByteSize()) > 0) {
938  total_bytes_read = bytes_read;
939  for (size_t offset = 0; offset < bytes_read; offset++)
940  s.Printf("%c", *data.PeekData(offset, 1));
941  if (capped_data)
942  was_capped = true;
943  }
944  } else {
945  cstr_len = max_length;
946  const size_t k_max_buf_size = 64;
947 
948  size_t offset = 0;
949 
950  int cstr_len_displayed = -1;
951  bool capped_cstr = false;
952  // I am using GetPointeeData() here to abstract the fact that some
953  // ValueObjects are actually frozen pointers in the host but the pointed-
954  // to data lives in the debuggee, and GetPointeeData() automatically
955  // takes care of this
956  while ((bytes_read = GetPointeeData(data, offset, k_max_buf_size)) > 0) {
957  total_bytes_read += bytes_read;
958  const char *cstr = data.PeekCStr(0);
959  size_t len = strnlen(cstr, k_max_buf_size);
960  if (cstr_len_displayed < 0)
961  cstr_len_displayed = len;
962 
963  if (len == 0)
964  break;
965  cstr_len_displayed += len;
966  if (len > bytes_read)
967  len = bytes_read;
968  if (len > cstr_len)
969  len = cstr_len;
970 
971  for (size_t offset = 0; offset < bytes_read; offset++)
972  s.Printf("%c", *data.PeekData(offset, 1));
973 
974  if (len < k_max_buf_size)
975  break;
976 
977  if (len >= cstr_len) {
978  capped_cstr = true;
979  break;
980  }
981 
982  cstr_len -= len;
983  offset += len;
984  }
985 
986  if (cstr_len_displayed >= 0) {
987  if (capped_cstr)
988  was_capped = true;
989  }
990  }
991  } else {
992  error.SetErrorString("not a string object");
993  s << "<not a string object>";
994  }
995  CopyStringDataToBufferSP(s, buffer_sp);
996  return {total_bytes_read, was_capped};
997 }
998 
1000  if (!UpdateValueIfNeeded(true))
1001  return nullptr;
1002 
1003  // Return cached value.
1004  if (!m_object_desc_str.empty())
1005  return m_object_desc_str.c_str();
1006 
1008  Process *process = exe_ctx.GetProcessPtr();
1009  if (!process)
1010  return nullptr;
1011 
1012  // Returns the object description produced by one language runtime.
1013  auto get_object_description = [&](LanguageType language) -> const char * {
1014  if (LanguageRuntime *runtime = process->GetLanguageRuntime(language)) {
1015  StreamString s;
1016  if (runtime->GetObjectDescription(s, *this)) {
1018  return m_object_desc_str.c_str();
1019  }
1020  }
1021  return nullptr;
1022  };
1023 
1024  // Try the native language runtime first.
1025  LanguageType native_language = GetObjectRuntimeLanguage();
1026  if (const char *desc = get_object_description(native_language))
1027  return desc;
1028 
1029  // Try the Objective-C language runtime. This fallback is necessary
1030  // for Objective-C++ and mixed Objective-C / C++ programs.
1031  if (Language::LanguageIsCFamily(native_language))
1032  return get_object_description(eLanguageTypeObjC);
1033  return nullptr;
1034 }
1035 
1037  std::string &destination) {
1038  if (UpdateValueIfNeeded(false))
1039  return format.FormatObject(this, destination);
1040  else
1041  return false;
1042 }
1043 
1045  std::string &destination) {
1046  return GetValueAsCString(TypeFormatImpl_Format(format), destination);
1047 }
1048 
1050  if (UpdateValueIfNeeded(true)) {
1051  lldb::TypeFormatImplSP format_sp;
1052  lldb::Format my_format = GetFormat();
1053  if (my_format == lldb::eFormatDefault) {
1054  if (m_type_format_sp)
1055  format_sp = m_type_format_sp;
1056  else {
1058  my_format = eFormatUnsigned;
1059  else {
1061  const RegisterInfo *reg_info = m_value.GetRegisterInfo();
1062  if (reg_info)
1063  my_format = reg_info->format;
1064  } else {
1065  my_format = GetValue().GetCompilerType().GetFormat();
1066  }
1067  }
1068  }
1069  }
1070  if (my_format != m_last_format || m_value_str.empty()) {
1071  m_last_format = my_format;
1072  if (!format_sp)
1073  format_sp = std::make_shared<TypeFormatImpl_Format>(my_format);
1074  if (GetValueAsCString(*format_sp.get(), m_value_str)) {
1076  // The value was gotten successfully, so we consider the value as
1077  // changed if the value string differs
1079  }
1080  }
1081  }
1082  }
1083  if (m_value_str.empty())
1084  return nullptr;
1085  return m_value_str.c_str();
1086 }
1087 
1088 // if > 8bytes, 0 is returned. this method should mostly be used to read
1089 // address values out of pointers
1090 uint64_t ValueObject::GetValueAsUnsigned(uint64_t fail_value, bool *success) {
1091  // If our byte size is zero this is an aggregate type that has children
1092  if (CanProvideValue()) {
1093  Scalar scalar;
1094  if (ResolveValue(scalar)) {
1095  if (success)
1096  *success = true;
1097  scalar.MakeUnsigned();
1098  return scalar.ULongLong(fail_value);
1099  }
1100  // fallthrough, otherwise...
1101  }
1102 
1103  if (success)
1104  *success = false;
1105  return fail_value;
1106 }
1107 
1108 int64_t ValueObject::GetValueAsSigned(int64_t fail_value, bool *success) {
1109  // If our byte size is zero this is an aggregate type that has children
1110  if (CanProvideValue()) {
1111  Scalar scalar;
1112  if (ResolveValue(scalar)) {
1113  if (success)
1114  *success = true;
1115  scalar.MakeSigned();
1116  return scalar.SLongLong(fail_value);
1117  }
1118  // fallthrough, otherwise...
1119  }
1120 
1121  if (success)
1122  *success = false;
1123  return fail_value;
1124 }
1125 
1126 // if any more "special cases" are added to
1127 // ValueObject::DumpPrintableRepresentation() please keep this call up to date
1128 // by returning true for your new special cases. We will eventually move to
1129 // checking this call result before trying to display special cases
1131  ValueObjectRepresentationStyle val_obj_display, Format custom_format) {
1132  Flags flags(GetTypeInfo());
1133  if (flags.AnySet(eTypeIsArray | eTypeIsPointer) &&
1135  if (IsCStringContainer(true) &&
1136  (custom_format == eFormatCString || custom_format == eFormatCharArray ||
1137  custom_format == eFormatChar || custom_format == eFormatVectorOfChar))
1138  return true;
1139 
1140  if (flags.Test(eTypeIsArray)) {
1141  if ((custom_format == eFormatBytes) ||
1142  (custom_format == eFormatBytesWithASCII))
1143  return true;
1144 
1145  if ((custom_format == eFormatVectorOfChar) ||
1146  (custom_format == eFormatVectorOfFloat32) ||
1147  (custom_format == eFormatVectorOfFloat64) ||
1148  (custom_format == eFormatVectorOfSInt16) ||
1149  (custom_format == eFormatVectorOfSInt32) ||
1150  (custom_format == eFormatVectorOfSInt64) ||
1151  (custom_format == eFormatVectorOfSInt8) ||
1152  (custom_format == eFormatVectorOfUInt128) ||
1153  (custom_format == eFormatVectorOfUInt16) ||
1154  (custom_format == eFormatVectorOfUInt32) ||
1155  (custom_format == eFormatVectorOfUInt64) ||
1156  (custom_format == eFormatVectorOfUInt8))
1157  return true;
1158  }
1159  }
1160  return false;
1161 }
1162 
1164  Stream &s, ValueObjectRepresentationStyle val_obj_display,
1165  Format custom_format, PrintableRepresentationSpecialCases special,
1166  bool do_dump_error) {
1167 
1168  Flags flags(GetTypeInfo());
1169 
1170  bool allow_special =
1172  const bool only_special = false;
1173 
1174  if (allow_special) {
1175  if (flags.AnySet(eTypeIsArray | eTypeIsPointer) &&
1177  // when being asked to get a printable display an array or pointer type
1178  // directly, try to "do the right thing"
1179 
1180  if (IsCStringContainer(true) &&
1181  (custom_format == eFormatCString ||
1182  custom_format == eFormatCharArray || custom_format == eFormatChar ||
1183  custom_format ==
1184  eFormatVectorOfChar)) // print char[] & char* directly
1185  {
1186  Status error;
1187  lldb::DataBufferSP buffer_sp;
1188  std::pair<size_t, bool> read_string = ReadPointedString(
1189  buffer_sp, error, 0, (custom_format == eFormatVectorOfChar) ||
1190  (custom_format == eFormatCharArray));
1191  lldb_private::formatters::StringPrinter::
1192  ReadBufferAndDumpToStreamOptions options(*this);
1193  options.SetData(DataExtractor(
1194  buffer_sp, lldb::eByteOrderInvalid,
1195  8)); // none of this matters for a string - pass some defaults
1196  options.SetStream(&s);
1197  options.SetPrefixToken(nullptr);
1198  options.SetQuote('"');
1199  options.SetSourceSize(buffer_sp->GetByteSize());
1200  options.SetIsTruncated(read_string.second);
1201  options.SetBinaryZeroIsTerminator(custom_format != eFormatVectorOfChar);
1204  options);
1205  return !error.Fail();
1206  }
1207 
1208  if (custom_format == eFormatEnum)
1209  return false;
1210 
1211  // this only works for arrays, because I have no way to know when the
1212  // pointed memory ends, and no special \0 end of data marker
1213  if (flags.Test(eTypeIsArray)) {
1214  if ((custom_format == eFormatBytes) ||
1215  (custom_format == eFormatBytesWithASCII)) {
1216  const size_t count = GetNumChildren();
1217 
1218  s << '[';
1219  for (size_t low = 0; low < count; low++) {
1220 
1221  if (low)
1222  s << ',';
1223 
1224  ValueObjectSP child = GetChildAtIndex(low, true);
1225  if (!child.get()) {
1226  s << "<invalid child>";
1227  continue;
1228  }
1229  child->DumpPrintableRepresentation(
1231  custom_format);
1232  }
1233 
1234  s << ']';
1235 
1236  return true;
1237  }
1238 
1239  if ((custom_format == eFormatVectorOfChar) ||
1240  (custom_format == eFormatVectorOfFloat32) ||
1241  (custom_format == eFormatVectorOfFloat64) ||
1242  (custom_format == eFormatVectorOfSInt16) ||
1243  (custom_format == eFormatVectorOfSInt32) ||
1244  (custom_format == eFormatVectorOfSInt64) ||
1245  (custom_format == eFormatVectorOfSInt8) ||
1246  (custom_format == eFormatVectorOfUInt128) ||
1247  (custom_format == eFormatVectorOfUInt16) ||
1248  (custom_format == eFormatVectorOfUInt32) ||
1249  (custom_format == eFormatVectorOfUInt64) ||
1250  (custom_format == eFormatVectorOfUInt8)) // arrays of bytes, bytes
1251  // with ASCII or any vector
1252  // format should be printed
1253  // directly
1254  {
1255  const size_t count = GetNumChildren();
1256 
1257  Format format = FormatManager::GetSingleItemFormat(custom_format);
1258 
1259  s << '[';
1260  for (size_t low = 0; low < count; low++) {
1261 
1262  if (low)
1263  s << ',';
1264 
1265  ValueObjectSP child = GetChildAtIndex(low, true);
1266  if (!child.get()) {
1267  s << "<invalid child>";
1268  continue;
1269  }
1270  child->DumpPrintableRepresentation(
1272  }
1273 
1274  s << ']';
1275 
1276  return true;
1277  }
1278  }
1279 
1280  if ((custom_format == eFormatBoolean) ||
1281  (custom_format == eFormatBinary) || (custom_format == eFormatChar) ||
1282  (custom_format == eFormatCharPrintable) ||
1283  (custom_format == eFormatComplexFloat) ||
1284  (custom_format == eFormatDecimal) || (custom_format == eFormatHex) ||
1285  (custom_format == eFormatHexUppercase) ||
1286  (custom_format == eFormatFloat) || (custom_format == eFormatOctal) ||
1287  (custom_format == eFormatOSType) ||
1288  (custom_format == eFormatUnicode16) ||
1289  (custom_format == eFormatUnicode32) ||
1290  (custom_format == eFormatUnsigned) ||
1291  (custom_format == eFormatPointer) ||
1292  (custom_format == eFormatComplexInteger) ||
1293  (custom_format == eFormatComplex) ||
1294  (custom_format == eFormatDefault)) // use the [] operator
1295  return false;
1296  }
1297  }
1298 
1299  if (only_special)
1300  return false;
1301 
1302  bool var_success = false;
1303 
1304  {
1305  llvm::StringRef str;
1306 
1307  // this is a local stream that we are using to ensure that the data pointed
1308  // to by cstr survives long enough for us to copy it to its destination -
1309  // it is necessary to have this temporary storage area for cases where our
1310  // desired output is not backed by some other longer-term storage
1311  StreamString strm;
1312 
1313  if (custom_format != eFormatInvalid)
1314  SetFormat(custom_format);
1315 
1316  switch (val_obj_display) {
1318  str = GetValueAsCString();
1319  break;
1320 
1322  str = GetSummaryAsCString();
1323  break;
1324 
1326  str = GetObjectDescription();
1327  break;
1328 
1330  str = GetLocationAsCString();
1331  break;
1332 
1334  strm.Printf("%" PRIu64 "", (uint64_t)GetNumChildren());
1335  str = strm.GetString();
1336  break;
1337 
1339  str = GetTypeName().GetStringRef();
1340  break;
1341 
1343  str = GetName().GetStringRef();
1344  break;
1345 
1347  GetExpressionPath(strm);
1348  str = strm.GetString();
1349  break;
1350  }
1351 
1352  if (str.empty()) {
1353  if (val_obj_display == eValueObjectRepresentationStyleValue)
1354  str = GetSummaryAsCString();
1355  else if (val_obj_display == eValueObjectRepresentationStyleSummary) {
1356  if (!CanProvideValue()) {
1357  strm.Printf("%s @ %s", GetTypeName().AsCString(),
1359  str = strm.GetString();
1360  } else
1361  str = GetValueAsCString();
1362  }
1363  }
1364 
1365  if (!str.empty())
1366  s << str;
1367  else {
1368  if (m_error.Fail()) {
1369  if (do_dump_error)
1370  s.Printf("<%s>", m_error.AsCString());
1371  else
1372  return false;
1373  } else if (val_obj_display == eValueObjectRepresentationStyleSummary)
1374  s.PutCString("<no summary available>");
1375  else if (val_obj_display == eValueObjectRepresentationStyleValue)
1376  s.PutCString("<no value available>");
1377  else if (val_obj_display ==
1379  s.PutCString("<not a valid Objective-C object>"); // edit this if we
1380  // have other runtimes
1381  // that support a
1382  // description
1383  else
1384  s.PutCString("<no printable representation>");
1385  }
1386 
1387  // we should only return false here if we could not do *anything* even if
1388  // we have an error message as output, that's a success from our callers'
1389  // perspective, so return true
1390  var_success = true;
1391 
1392  if (custom_format != eFormatInvalid)
1394  }
1395 
1396  return var_success;
1397 }
1398 
1399 addr_t ValueObject::GetAddressOf(bool scalar_is_load_address,
1400  AddressType *address_type) {
1401  // Can't take address of a bitfield
1402  if (IsBitfield())
1403  return LLDB_INVALID_ADDRESS;
1404 
1405  if (!UpdateValueIfNeeded(false))
1406  return LLDB_INVALID_ADDRESS;
1407 
1408  switch (m_value.GetValueType()) {
1410  return LLDB_INVALID_ADDRESS;
1412  if (scalar_is_load_address) {
1413  if (address_type)
1414  *address_type = eAddressTypeLoad;
1416  }
1417  break;
1418 
1421  if (address_type)
1422  *address_type = m_value.GetValueAddressType();
1424  } break;
1426  if (address_type)
1427  *address_type = m_value.GetValueAddressType();
1428  return LLDB_INVALID_ADDRESS;
1429  } break;
1430  }
1431  if (address_type)
1432  *address_type = eAddressTypeInvalid;
1433  return LLDB_INVALID_ADDRESS;
1434 }
1435 
1437  addr_t address = LLDB_INVALID_ADDRESS;
1438  if (address_type)
1439  *address_type = eAddressTypeInvalid;
1440 
1441  if (!UpdateValueIfNeeded(false))
1442  return address;
1443 
1444  switch (m_value.GetValueType()) {
1446  return LLDB_INVALID_ADDRESS;
1449  break;
1450 
1454  lldb::offset_t data_offset = 0;
1455  address = m_data.GetAddress(&data_offset);
1456  } break;
1457  }
1458 
1459  if (address_type)
1460  *address_type = GetAddressTypeOfChildren();
1461 
1462  return address;
1463 }
1464 
1465 bool ValueObject::SetValueFromCString(const char *value_str, Status &error) {
1466  error.Clear();
1467  // Make sure our value is up to date first so that our location and location
1468  // type is valid.
1469  if (!UpdateValueIfNeeded(false)) {
1470  error.SetErrorString("unable to read value");
1471  return false;
1472  }
1473 
1474  uint64_t count = 0;
1475  const Encoding encoding = GetCompilerType().GetEncoding(count);
1476 
1477  const size_t byte_size = GetByteSize().getValueOr(0);
1478 
1479  Value::ValueType value_type = m_value.GetValueType();
1480 
1481  if (value_type == Value::ValueType::Scalar) {
1482  // If the value is already a scalar, then let the scalar change itself:
1483  m_value.GetScalar().SetValueFromCString(value_str, encoding, byte_size);
1484  } else if (byte_size <= 16) {
1485  // If the value fits in a scalar, then make a new scalar and again let the
1486  // scalar code do the conversion, then figure out where to put the new
1487  // value.
1488  Scalar new_scalar;
1489  error = new_scalar.SetValueFromCString(value_str, encoding, byte_size);
1490  if (error.Success()) {
1491  switch (value_type) {
1493  // If it is a load address, then the scalar value is the storage
1494  // location of the data, and we have to shove this value down to that
1495  // load location.
1497  Process *process = exe_ctx.GetProcessPtr();
1498  if (process) {
1499  addr_t target_addr =
1501  size_t bytes_written = process->WriteScalarToMemory(
1502  target_addr, new_scalar, byte_size, error);
1503  if (!error.Success())
1504  return false;
1505  if (bytes_written != byte_size) {
1506  error.SetErrorString("unable to write value to memory");
1507  return false;
1508  }
1509  }
1510  } break;
1512  // If it is a host address, then we stuff the scalar as a DataBuffer
1513  // into the Value's data.
1514  DataExtractor new_data;
1515  new_data.SetByteOrder(m_data.GetByteOrder());
1516 
1517  DataBufferSP buffer_sp(new DataBufferHeap(byte_size, 0));
1518  m_data.SetData(buffer_sp, 0);
1519  bool success = new_scalar.GetData(new_data);
1520  if (success) {
1521  new_data.CopyByteOrderedData(
1522  0, byte_size, const_cast<uint8_t *>(m_data.GetDataStart()),
1523  byte_size, m_data.GetByteOrder());
1524  }
1525  m_value.GetScalar() = (uintptr_t)m_data.GetDataStart();
1526 
1527  } break;
1529  error.SetErrorString("invalid location");
1530  return false;
1533  break;
1534  }
1535  } else {
1536  return false;
1537  }
1538  } else {
1539  // We don't support setting things bigger than a scalar at present.
1540  error.SetErrorString("unable to write aggregate data type");
1541  return false;
1542  }
1543 
1544  // If we have reached this point, then we have successfully changed the
1545  // value.
1546  SetNeedsUpdate();
1547  return true;
1548 }
1549 
1551  decl.Clear();
1552  return false;
1553 }
1554 
1556  ValueObject *valobj) {
1557  m_synthetic_children[key] = valobj;
1558 }
1559 
1561  ValueObjectSP synthetic_child_sp;
1562  std::map<ConstString, ValueObject *>::const_iterator pos =
1563  m_synthetic_children.find(key);
1564  if (pos != m_synthetic_children.end())
1565  synthetic_child_sp = pos->second->GetSP();
1566  return synthetic_child_sp;
1567 }
1568 
1571  Process *process = exe_ctx.GetProcessPtr();
1572  if (process)
1573  return process->IsPossibleDynamicValue(*this);
1574  else
1575  return GetCompilerType().IsPossibleDynamicType(nullptr, true, true);
1576 }
1577 
1579  Process *process(GetProcessSP().get());
1580  if (!process)
1581  return false;
1582 
1583  // We trust that the compiler did the right thing and marked runtime support
1584  // values as artificial.
1585  if (!GetVariable() || !GetVariable()->IsArtificial())
1586  return false;
1587 
1588  if (auto *runtime = process->GetLanguageRuntime(GetVariable()->GetLanguage()))
1589  if (runtime->IsAllowedRuntimeValue(GetName()))
1590  return false;
1591 
1592  return true;
1593 }
1594 
1597  return language->IsNilReference(*this);
1598  }
1599  return false;
1600 }
1601 
1604  return language->IsUninitializedReference(*this);
1605  }
1606  return false;
1607 }
1608 
1609 // This allows you to create an array member using and index that doesn't not
1610 // fall in the normal bounds of the array. Many times structure can be defined
1611 // as: struct Collection {
1612 // uint32_t item_count;
1613 // Item item_array[0];
1614 // };
1615 // The size of the "item_array" is 1, but many times in practice there are more
1616 // items in "item_array".
1617 
1618 ValueObjectSP ValueObject::GetSyntheticArrayMember(size_t index,
1619  bool can_create) {
1620  ValueObjectSP synthetic_child_sp;
1621  if (IsPointerType() || IsArrayType()) {
1622  std::string index_str = llvm::formatv("[{0}]", index);
1623  ConstString index_const_str(index_str);
1624  // Check if we have already created a synthetic array member in this valid
1625  // object. If we have we will re-use it.
1626  synthetic_child_sp = GetSyntheticChild(index_const_str);
1627  if (!synthetic_child_sp) {
1628  ValueObject *synthetic_child;
1629  // We haven't made a synthetic array member for INDEX yet, so lets make
1630  // one and cache it for any future reference.
1631  synthetic_child = CreateChildAtIndex(0, true, index);
1632 
1633  // Cache the value if we got one back...
1634  if (synthetic_child) {
1635  AddSyntheticChild(index_const_str, synthetic_child);
1636  synthetic_child_sp = synthetic_child->GetSP();
1637  synthetic_child_sp->SetName(ConstString(index_str));
1638  synthetic_child_sp->m_flags.m_is_array_item_for_pointer = true;
1639  }
1640  }
1641  }
1642  return synthetic_child_sp;
1643 }
1644 
1646  bool can_create) {
1647  ValueObjectSP synthetic_child_sp;
1648  if (IsScalarType()) {
1649  std::string index_str = llvm::formatv("[{0}-{1}]", from, to);
1650  ConstString index_const_str(index_str);
1651  // Check if we have already created a synthetic array member in this valid
1652  // object. If we have we will re-use it.
1653  synthetic_child_sp = GetSyntheticChild(index_const_str);
1654  if (!synthetic_child_sp) {
1655  uint32_t bit_field_size = to - from + 1;
1656  uint32_t bit_field_offset = from;
1657  if (GetDataExtractor().GetByteOrder() == eByteOrderBig)
1658  bit_field_offset =
1659  GetByteSize().getValueOr(0) * 8 - bit_field_size - bit_field_offset;
1660  // We haven't made a synthetic array member for INDEX yet, so lets make
1661  // one and cache it for any future reference.
1662  ValueObjectChild *synthetic_child = new ValueObjectChild(
1663  *this, GetCompilerType(), index_const_str,
1664  GetByteSize().getValueOr(0), 0, bit_field_size, bit_field_offset,
1665  false, false, eAddressTypeInvalid, 0);
1666 
1667  // Cache the value if we got one back...
1668  if (synthetic_child) {
1669  AddSyntheticChild(index_const_str, synthetic_child);
1670  synthetic_child_sp = synthetic_child->GetSP();
1671  synthetic_child_sp->SetName(ConstString(index_str));
1672  synthetic_child_sp->m_flags.m_is_bitfield_for_scalar = true;
1673  }
1674  }
1675  }
1676  return synthetic_child_sp;
1677 }
1678 
1680  uint32_t offset, const CompilerType &type, bool can_create,
1681  ConstString name_const_str) {
1682 
1683  ValueObjectSP synthetic_child_sp;
1684 
1685  if (name_const_str.IsEmpty()) {
1686  name_const_str.SetString("@" + std::to_string(offset));
1687  }
1688 
1689  // Check if we have already created a synthetic array member in this valid
1690  // object. If we have we will re-use it.
1691  synthetic_child_sp = GetSyntheticChild(name_const_str);
1692 
1693  if (synthetic_child_sp.get())
1694  return synthetic_child_sp;
1695 
1696  if (!can_create)
1697  return {};
1698 
1700  llvm::Optional<uint64_t> size =
1701  type.GetByteSize(exe_ctx.GetBestExecutionContextScope());
1702  if (!size)
1703  return {};
1704  ValueObjectChild *synthetic_child =
1705  new ValueObjectChild(*this, type, name_const_str, *size, offset, 0, 0,
1706  false, false, eAddressTypeInvalid, 0);
1707  if (synthetic_child) {
1708  AddSyntheticChild(name_const_str, synthetic_child);
1709  synthetic_child_sp = synthetic_child->GetSP();
1710  synthetic_child_sp->SetName(name_const_str);
1711  synthetic_child_sp->m_flags.m_is_child_at_offset = true;
1712  }
1713  return synthetic_child_sp;
1714 }
1715 
1717  const CompilerType &type,
1718  bool can_create,
1719  ConstString name_const_str) {
1720  ValueObjectSP synthetic_child_sp;
1721 
1722  if (name_const_str.IsEmpty()) {
1723  char name_str[128];
1724  snprintf(name_str, sizeof(name_str), "base%s@%i",
1725  type.GetTypeName().AsCString("<unknown>"), offset);
1726  name_const_str.SetCString(name_str);
1727  }
1728 
1729  // Check if we have already created a synthetic array member in this valid
1730  // object. If we have we will re-use it.
1731  synthetic_child_sp = GetSyntheticChild(name_const_str);
1732 
1733  if (synthetic_child_sp.get())
1734  return synthetic_child_sp;
1735 
1736  if (!can_create)
1737  return {};
1738 
1739  const bool is_base_class = true;
1740 
1742  llvm::Optional<uint64_t> size =
1743  type.GetByteSize(exe_ctx.GetBestExecutionContextScope());
1744  if (!size)
1745  return {};
1746  ValueObjectChild *synthetic_child =
1747  new ValueObjectChild(*this, type, name_const_str, *size, offset, 0, 0,
1748  is_base_class, false, eAddressTypeInvalid, 0);
1749  if (synthetic_child) {
1750  AddSyntheticChild(name_const_str, synthetic_child);
1751  synthetic_child_sp = synthetic_child->GetSP();
1752  synthetic_child_sp->SetName(name_const_str);
1753  }
1754  return synthetic_child_sp;
1755 }
1756 
1757 // your expression path needs to have a leading . or -> (unless it somehow
1758 // "looks like" an array, in which case it has a leading [ symbol). while the [
1759 // is meaningful and should be shown to the user, . and -> are just parser
1760 // design, but by no means added information for the user.. strip them off
1761 static const char *SkipLeadingExpressionPathSeparators(const char *expression) {
1762  if (!expression || !expression[0])
1763  return expression;
1764  if (expression[0] == '.')
1765  return expression + 1;
1766  if (expression[0] == '-' && expression[1] == '>')
1767  return expression + 2;
1768  return expression;
1769 }
1770 
1771 ValueObjectSP
1773  bool can_create) {
1774  ValueObjectSP synthetic_child_sp;
1775  ConstString name_const_string(expression);
1776  // Check if we have already created a synthetic array member in this valid
1777  // object. If we have we will re-use it.
1778  synthetic_child_sp = GetSyntheticChild(name_const_string);
1779  if (!synthetic_child_sp) {
1780  // We haven't made a synthetic array member for expression yet, so lets
1781  // make one and cache it for any future reference.
1782  synthetic_child_sp = GetValueForExpressionPath(
1783  expression, nullptr, nullptr,
1784  GetValueForExpressionPathOptions().SetSyntheticChildrenTraversal(
1786  None));
1787 
1788  // Cache the value if we got one back...
1789  if (synthetic_child_sp.get()) {
1790  // FIXME: this causes a "real" child to end up with its name changed to
1791  // the contents of expression
1792  AddSyntheticChild(name_const_string, synthetic_child_sp.get());
1793  synthetic_child_sp->SetName(
1795  }
1796  }
1797  return synthetic_child_sp;
1798 }
1799 
1801  TargetSP target_sp(GetTargetSP());
1802  if (target_sp && !target_sp->GetEnableSyntheticValue()) {
1803  m_synthetic_value = nullptr;
1804  return;
1805  }
1806 
1807  lldb::SyntheticChildrenSP current_synth_sp(m_synthetic_children_sp);
1808 
1810  return;
1811 
1812  if (m_synthetic_children_sp.get() == nullptr)
1813  return;
1814 
1815  if (current_synth_sp == m_synthetic_children_sp && m_synthetic_value)
1816  return;
1817 
1819 }
1820 
1822  if (use_dynamic == eNoDynamicValues)
1823  return;
1824 
1825  if (!m_dynamic_value && !IsDynamic()) {
1827  Process *process = exe_ctx.GetProcessPtr();
1828  if (process && process->IsPossibleDynamicValue(*this)) {
1830  m_dynamic_value = new ValueObjectDynamicValue(*this, use_dynamic);
1831  }
1832  }
1833 }
1834 
1836  if (use_dynamic == eNoDynamicValues)
1837  return ValueObjectSP();
1838 
1839  if (!IsDynamic() && m_dynamic_value == nullptr) {
1840  CalculateDynamicValue(use_dynamic);
1841  }
1842  if (m_dynamic_value)
1843  return m_dynamic_value->GetSP();
1844  else
1845  return ValueObjectSP();
1846 }
1847 
1850 
1851  if (m_synthetic_value)
1852  return m_synthetic_value->GetSP();
1853  else
1854  return ValueObjectSP();
1855 }
1856 
1859 
1860  if (m_synthetic_children_sp.get() == nullptr)
1861  return false;
1862 
1864 
1865  return m_synthetic_value != nullptr;
1866 }
1867 
1869  if (GetParent()) {
1870  if (GetParent()->IsBaseClass())
1871  return GetParent()->GetNonBaseClassParent();
1872  else
1873  return GetParent();
1874  }
1875  return nullptr;
1876 }
1877 
1879  if (!IsBaseClass()) {
1880  depth = 0;
1881  return false;
1882  }
1883  if (GetParent()) {
1884  GetParent()->IsBaseClass(depth);
1885  depth = depth + 1;
1886  return true;
1887  }
1888  // TODO: a base of no parent? weird..
1889  depth = 1;
1890  return true;
1891 }
1892 
1894  GetExpressionPathFormat epformat) {
1895  // synthetic children do not actually "exist" as part of the hierarchy, and
1896  // sometimes they are consed up in ways that don't make sense from an
1897  // underlying language/API standpoint. So, use a special code path here to
1898  // return something that can hopefully be used in expression
1901 
1903  if (IsPointerOrReferenceType()) {
1904  s.Printf("((%s)0x%" PRIx64 ")", GetTypeName().AsCString("void"),
1905  GetValueAsUnsigned(0));
1906  return;
1907  } else {
1908  uint64_t load_addr =
1910  if (load_addr != LLDB_INVALID_ADDRESS) {
1911  s.Printf("(*( (%s *)0x%" PRIx64 "))", GetTypeName().AsCString("void"),
1912  load_addr);
1913  return;
1914  }
1915  }
1916  }
1917 
1918  if (CanProvideValue()) {
1919  s.Printf("((%s)%s)", GetTypeName().AsCString("void"),
1920  GetValueAsCString());
1921  return;
1922  }
1923 
1924  return;
1925  }
1926 
1927  const bool is_deref_of_parent = IsDereferenceOfParent();
1928 
1929  if (is_deref_of_parent &&
1931  // this is the original format of GetExpressionPath() producing code like
1932  // *(a_ptr).memberName, which is entirely fine, until you put this into
1933  // StackFrame::GetValueForVariableExpressionPath() which prefers to see
1934  // a_ptr->memberName. the eHonorPointers mode is meant to produce strings
1935  // in this latter format
1936  s.PutCString("*(");
1937  }
1938 
1939  ValueObject *parent = GetParent();
1940 
1941  if (parent)
1942  parent->GetExpressionPath(s, epformat);
1943 
1944  // if we are a deref_of_parent just because we are synthetic array members
1945  // made up to allow ptr[%d] syntax to work in variable printing, then add our
1946  // name ([%d]) to the expression path
1950 
1951  if (!IsBaseClass()) {
1952  if (!is_deref_of_parent) {
1953  ValueObject *non_base_class_parent = GetNonBaseClassParent();
1954  if (non_base_class_parent &&
1955  !non_base_class_parent->GetName().IsEmpty()) {
1956  CompilerType non_base_class_parent_compiler_type =
1957  non_base_class_parent->GetCompilerType();
1958  if (non_base_class_parent_compiler_type) {
1959  if (parent && parent->IsDereferenceOfParent() &&
1961  s.PutCString("->");
1962  } else {
1963  const uint32_t non_base_class_parent_type_info =
1964  non_base_class_parent_compiler_type.GetTypeInfo();
1965 
1966  if (non_base_class_parent_type_info & eTypeIsPointer) {
1967  s.PutCString("->");
1968  } else if ((non_base_class_parent_type_info & eTypeHasChildren) &&
1969  !(non_base_class_parent_type_info & eTypeIsArray)) {
1970  s.PutChar('.');
1971  }
1972  }
1973  }
1974  }
1975 
1976  const char *name = GetName().GetCString();
1977  if (name)
1978  s.PutCString(name);
1979  }
1980  }
1981 
1982  if (is_deref_of_parent &&
1984  s.PutChar(')');
1985  }
1986 }
1987 
1989  llvm::StringRef expression, ExpressionPathScanEndReason *reason_to_stop,
1990  ExpressionPathEndResultType *final_value_type,
1991  const GetValueForExpressionPathOptions &options,
1992  ExpressionPathAftermath *final_task_on_target) {
1993 
1994  ExpressionPathScanEndReason dummy_reason_to_stop =
1996  ExpressionPathEndResultType dummy_final_value_type =
1998  ExpressionPathAftermath dummy_final_task_on_target =
2000 
2001  ValueObjectSP ret_val = GetValueForExpressionPath_Impl(
2002  expression, reason_to_stop ? reason_to_stop : &dummy_reason_to_stop,
2003  final_value_type ? final_value_type : &dummy_final_value_type, options,
2004  final_task_on_target ? final_task_on_target
2005  : &dummy_final_task_on_target);
2006 
2007  if (!final_task_on_target ||
2008  *final_task_on_target == ValueObject::eExpressionPathAftermathNothing)
2009  return ret_val;
2010 
2011  if (ret_val.get() &&
2012  ((final_value_type ? *final_value_type : dummy_final_value_type) ==
2013  eExpressionPathEndResultTypePlain)) // I can only deref and takeaddress
2014  // of plain objects
2015  {
2016  if ((final_task_on_target ? *final_task_on_target
2017  : dummy_final_task_on_target) ==
2019  Status error;
2020  ValueObjectSP final_value = ret_val->Dereference(error);
2021  if (error.Fail() || !final_value.get()) {
2022  if (reason_to_stop)
2023  *reason_to_stop =
2025  if (final_value_type)
2027  return ValueObjectSP();
2028  } else {
2029  if (final_task_on_target)
2030  *final_task_on_target = ValueObject::eExpressionPathAftermathNothing;
2031  return final_value;
2032  }
2033  }
2034  if (*final_task_on_target ==
2036  Status error;
2037  ValueObjectSP final_value = ret_val->AddressOf(error);
2038  if (error.Fail() || !final_value.get()) {
2039  if (reason_to_stop)
2040  *reason_to_stop =
2042  if (final_value_type)
2044  return ValueObjectSP();
2045  } else {
2046  if (final_task_on_target)
2047  *final_task_on_target = ValueObject::eExpressionPathAftermathNothing;
2048  return final_value;
2049  }
2050  }
2051  }
2052  return ret_val; // final_task_on_target will still have its original value, so
2053  // you know I did not do it
2054 }
2055 
2057  llvm::StringRef expression, ExpressionPathScanEndReason *reason_to_stop,
2058  ExpressionPathEndResultType *final_result,
2059  const GetValueForExpressionPathOptions &options,
2060  ExpressionPathAftermath *what_next) {
2061  ValueObjectSP root = GetSP();
2062 
2063  if (!root)
2064  return nullptr;
2065 
2066  llvm::StringRef remainder = expression;
2067 
2068  while (true) {
2069  llvm::StringRef temp_expression = remainder;
2070 
2071  CompilerType root_compiler_type = root->GetCompilerType();
2072  CompilerType pointee_compiler_type;
2073  Flags pointee_compiler_type_info;
2074 
2075  Flags root_compiler_type_info(
2076  root_compiler_type.GetTypeInfo(&pointee_compiler_type));
2077  if (pointee_compiler_type)
2078  pointee_compiler_type_info.Reset(pointee_compiler_type.GetTypeInfo());
2079 
2080  if (temp_expression.empty()) {
2082  return root;
2083  }
2084 
2085  switch (temp_expression.front()) {
2086  case '-': {
2087  temp_expression = temp_expression.drop_front();
2088  if (options.m_check_dot_vs_arrow_syntax &&
2089  root_compiler_type_info.Test(eTypeIsPointer)) // if you are trying to
2090  // use -> on a
2091  // non-pointer and I
2092  // must catch the error
2093  {
2094  *reason_to_stop =
2097  return ValueObjectSP();
2098  }
2099  if (root_compiler_type_info.Test(eTypeIsObjC) && // if yo are trying to
2100  // extract an ObjC IVar
2101  // when this is forbidden
2102  root_compiler_type_info.Test(eTypeIsPointer) &&
2103  options.m_no_fragile_ivar) {
2104  *reason_to_stop =
2107  return ValueObjectSP();
2108  }
2109  if (!temp_expression.startswith(">")) {
2110  *reason_to_stop =
2113  return ValueObjectSP();
2114  }
2115  }
2116  LLVM_FALLTHROUGH;
2117  case '.': // or fallthrough from ->
2118  {
2119  if (options.m_check_dot_vs_arrow_syntax &&
2120  temp_expression.front() == '.' &&
2121  root_compiler_type_info.Test(eTypeIsPointer)) // if you are trying to
2122  // use . on a pointer
2123  // and I must catch the
2124  // error
2125  {
2126  *reason_to_stop =
2129  return nullptr;
2130  }
2131  temp_expression = temp_expression.drop_front(); // skip . or >
2132 
2133  size_t next_sep_pos = temp_expression.find_first_of("-.[", 1);
2134  ConstString child_name;
2135  if (next_sep_pos == llvm::StringRef::npos) // if no other separator just
2136  // expand this last layer
2137  {
2138  child_name.SetString(temp_expression);
2139  ValueObjectSP child_valobj_sp =
2140  root->GetChildMemberWithName(child_name, true);
2141 
2142  if (child_valobj_sp.get()) // we know we are done, so just return
2143  {
2144  *reason_to_stop =
2147  return child_valobj_sp;
2148  } else {
2149  switch (options.m_synthetic_children_traversal) {
2151  None:
2152  break;
2155  if (root->IsSynthetic()) {
2156  child_valobj_sp = root->GetNonSyntheticValue();
2157  if (child_valobj_sp.get())
2158  child_valobj_sp =
2159  child_valobj_sp->GetChildMemberWithName(child_name, true);
2160  }
2161  break;
2163  ToSynthetic:
2164  if (!root->IsSynthetic()) {
2165  child_valobj_sp = root->GetSyntheticValue();
2166  if (child_valobj_sp.get())
2167  child_valobj_sp =
2168  child_valobj_sp->GetChildMemberWithName(child_name, true);
2169  }
2170  break;
2172  Both:
2173  if (root->IsSynthetic()) {
2174  child_valobj_sp = root->GetNonSyntheticValue();
2175  if (child_valobj_sp.get())
2176  child_valobj_sp =
2177  child_valobj_sp->GetChildMemberWithName(child_name, true);
2178  } else {
2179  child_valobj_sp = root->GetSyntheticValue();
2180  if (child_valobj_sp.get())
2181  child_valobj_sp =
2182  child_valobj_sp->GetChildMemberWithName(child_name, true);
2183  }
2184  break;
2185  }
2186  }
2187 
2188  // if we are here and options.m_no_synthetic_children is true,
2189  // child_valobj_sp is going to be a NULL SP, so we hit the "else"
2190  // branch, and return an error
2191  if (child_valobj_sp.get()) // if it worked, just return
2192  {
2193  *reason_to_stop =
2196  return child_valobj_sp;
2197  } else {
2198  *reason_to_stop =
2201  return nullptr;
2202  }
2203  } else // other layers do expand
2204  {
2205  llvm::StringRef next_separator = temp_expression.substr(next_sep_pos);
2206 
2207  child_name.SetString(temp_expression.slice(0, next_sep_pos));
2208 
2209  ValueObjectSP child_valobj_sp =
2210  root->GetChildMemberWithName(child_name, true);
2211  if (child_valobj_sp.get()) // store the new root and move on
2212  {
2213  root = child_valobj_sp;
2214  remainder = next_separator;
2216  continue;
2217  } else {
2218  switch (options.m_synthetic_children_traversal) {
2220  None:
2221  break;
2224  if (root->IsSynthetic()) {
2225  child_valobj_sp = root->GetNonSyntheticValue();
2226  if (child_valobj_sp.get())
2227  child_valobj_sp =
2228  child_valobj_sp->GetChildMemberWithName(child_name, true);
2229  }
2230  break;
2232  ToSynthetic:
2233  if (!root->IsSynthetic()) {
2234  child_valobj_sp = root->GetSyntheticValue();
2235  if (child_valobj_sp.get())
2236  child_valobj_sp =
2237  child_valobj_sp->GetChildMemberWithName(child_name, true);
2238  }
2239  break;
2241  Both:
2242  if (root->IsSynthetic()) {
2243  child_valobj_sp = root->GetNonSyntheticValue();
2244  if (child_valobj_sp.get())
2245  child_valobj_sp =
2246  child_valobj_sp->GetChildMemberWithName(child_name, true);
2247  } else {
2248  child_valobj_sp = root->GetSyntheticValue();
2249  if (child_valobj_sp.get())
2250  child_valobj_sp =
2251  child_valobj_sp->GetChildMemberWithName(child_name, true);
2252  }
2253  break;
2254  }
2255  }
2256 
2257  // if we are here and options.m_no_synthetic_children is true,
2258  // child_valobj_sp is going to be a NULL SP, so we hit the "else"
2259  // branch, and return an error
2260  if (child_valobj_sp.get()) // if it worked, move on
2261  {
2262  root = child_valobj_sp;
2263  remainder = next_separator;
2265  continue;
2266  } else {
2267  *reason_to_stop =
2270  return nullptr;
2271  }
2272  }
2273  break;
2274  }
2275  case '[': {
2276  if (!root_compiler_type_info.Test(eTypeIsArray) &&
2277  !root_compiler_type_info.Test(eTypeIsPointer) &&
2278  !root_compiler_type_info.Test(
2279  eTypeIsVector)) // if this is not a T[] nor a T*
2280  {
2281  if (!root_compiler_type_info.Test(
2282  eTypeIsScalar)) // if this is not even a scalar...
2283  {
2284  if (options.m_synthetic_children_traversal ==
2286  None) // ...only chance left is synthetic
2287  {
2288  *reason_to_stop =
2291  return ValueObjectSP();
2292  }
2293  } else if (!options.m_allow_bitfields_syntax) // if this is a scalar,
2294  // check that we can
2295  // expand bitfields
2296  {
2297  *reason_to_stop =
2300  return ValueObjectSP();
2301  }
2302  }
2303  if (temp_expression[1] ==
2304  ']') // if this is an unbounded range it only works for arrays
2305  {
2306  if (!root_compiler_type_info.Test(eTypeIsArray)) {
2307  *reason_to_stop =
2310  return nullptr;
2311  } else // even if something follows, we cannot expand unbounded ranges,
2312  // just let the caller do it
2313  {
2314  *reason_to_stop =
2316  *final_result =
2318  return root;
2319  }
2320  }
2321 
2322  size_t close_bracket_position = temp_expression.find(']', 1);
2323  if (close_bracket_position ==
2324  llvm::StringRef::npos) // if there is no ], this is a syntax error
2325  {
2326  *reason_to_stop =
2329  return nullptr;
2330  }
2331 
2332  llvm::StringRef bracket_expr =
2333  temp_expression.slice(1, close_bracket_position);
2334 
2335  // If this was an empty expression it would have been caught by the if
2336  // above.
2337  assert(!bracket_expr.empty());
2338 
2339  if (!bracket_expr.contains('-')) {
2340  // if no separator, this is of the form [N]. Note that this cannot be
2341  // an unbounded range of the form [], because that case was handled
2342  // above with an unconditional return.
2343  unsigned long index = 0;
2344  if (bracket_expr.getAsInteger(0, index)) {
2345  *reason_to_stop =
2348  return nullptr;
2349  }
2350 
2351  // from here on we do have a valid index
2352  if (root_compiler_type_info.Test(eTypeIsArray)) {
2353  ValueObjectSP child_valobj_sp = root->GetChildAtIndex(index, true);
2354  if (!child_valobj_sp)
2355  child_valobj_sp = root->GetSyntheticArrayMember(index, true);
2356  if (!child_valobj_sp)
2357  if (root->HasSyntheticValue() &&
2358  root->GetSyntheticValue()->GetNumChildren() > index)
2359  child_valobj_sp =
2360  root->GetSyntheticValue()->GetChildAtIndex(index, true);
2361  if (child_valobj_sp) {
2362  root = child_valobj_sp;
2363  remainder =
2364  temp_expression.substr(close_bracket_position + 1); // skip ]
2366  continue;
2367  } else {
2368  *reason_to_stop =
2371  return nullptr;
2372  }
2373  } else if (root_compiler_type_info.Test(eTypeIsPointer)) {
2374  if (*what_next ==
2375  ValueObject::
2376  eExpressionPathAftermathDereference && // if this is a
2377  // ptr-to-scalar, I
2378  // am accessing it
2379  // by index and I
2380  // would have
2381  // deref'ed anyway,
2382  // then do it now
2383  // and use this as
2384  // a bitfield
2385  pointee_compiler_type_info.Test(eTypeIsScalar)) {
2386  Status error;
2387  root = root->Dereference(error);
2388  if (error.Fail() || !root) {
2389  *reason_to_stop =
2392  return nullptr;
2393  } else {
2394  *what_next = eExpressionPathAftermathNothing;
2395  continue;
2396  }
2397  } else {
2398  if (root->GetCompilerType().GetMinimumLanguage() ==
2400  pointee_compiler_type_info.AllClear(eTypeIsPointer) &&
2401  root->HasSyntheticValue() &&
2402  (options.m_synthetic_children_traversal ==
2404  SyntheticChildrenTraversal::ToSynthetic ||
2407  SyntheticChildrenTraversal::Both)) {
2408  root = root->GetSyntheticValue()->GetChildAtIndex(index, true);
2409  } else
2410  root = root->GetSyntheticArrayMember(index, true);
2411  if (!root) {
2412  *reason_to_stop =
2415  return nullptr;
2416  } else {
2417  remainder =
2418  temp_expression.substr(close_bracket_position + 1); // skip ]
2420  continue;
2421  }
2422  }
2423  } else if (root_compiler_type_info.Test(eTypeIsScalar)) {
2424  root = root->GetSyntheticBitFieldChild(index, index, true);
2425  if (!root) {
2426  *reason_to_stop =
2429  return nullptr;
2430  } else // we do not know how to expand members of bitfields, so we
2431  // just return and let the caller do any further processing
2432  {
2433  *reason_to_stop = ValueObject::
2436  return root;
2437  }
2438  } else if (root_compiler_type_info.Test(eTypeIsVector)) {
2439  root = root->GetChildAtIndex(index, true);
2440  if (!root) {
2441  *reason_to_stop =
2444  return ValueObjectSP();
2445  } else {
2446  remainder =
2447  temp_expression.substr(close_bracket_position + 1); // skip ]
2449  continue;
2450  }
2451  } else if (options.m_synthetic_children_traversal ==
2453  SyntheticChildrenTraversal::ToSynthetic ||
2456  SyntheticChildrenTraversal::Both) {
2457  if (root->HasSyntheticValue())
2458  root = root->GetSyntheticValue();
2459  else if (!root->IsSynthetic()) {
2460  *reason_to_stop =
2463  return nullptr;
2464  }
2465  // if we are here, then root itself is a synthetic VO.. should be
2466  // good to go
2467 
2468  if (!root) {
2469  *reason_to_stop =
2472  return nullptr;
2473  }
2474  root = root->GetChildAtIndex(index, true);
2475  if (!root) {
2476  *reason_to_stop =
2479  return nullptr;
2480  } else {
2481  remainder =
2482  temp_expression.substr(close_bracket_position + 1); // skip ]
2484  continue;
2485  }
2486  } else {
2487  *reason_to_stop =
2490  return nullptr;
2491  }
2492  } else {
2493  // we have a low and a high index
2494  llvm::StringRef sleft, sright;
2495  unsigned long low_index, high_index;
2496  std::tie(sleft, sright) = bracket_expr.split('-');
2497  if (sleft.getAsInteger(0, low_index) ||
2498  sright.getAsInteger(0, high_index)) {
2499  *reason_to_stop =
2502  return nullptr;
2503  }
2504 
2505  if (low_index > high_index) // swap indices if required
2506  std::swap(low_index, high_index);
2507 
2508  if (root_compiler_type_info.Test(
2509  eTypeIsScalar)) // expansion only works for scalars
2510  {
2511  root = root->GetSyntheticBitFieldChild(low_index, high_index, true);
2512  if (!root) {
2513  *reason_to_stop =
2516  return nullptr;
2517  } else {
2518  *reason_to_stop = ValueObject::
2521  return root;
2522  }
2523  } else if (root_compiler_type_info.Test(
2524  eTypeIsPointer) && // if this is a ptr-to-scalar, I am
2525  // accessing it by index and I would
2526  // have deref'ed anyway, then do it
2527  // now and use this as a bitfield
2528  *what_next ==
2530  pointee_compiler_type_info.Test(eTypeIsScalar)) {
2531  Status error;
2532  root = root->Dereference(error);
2533  if (error.Fail() || !root) {
2534  *reason_to_stop =
2537  return nullptr;
2538  } else {
2540  continue;
2541  }
2542  } else {
2543  *reason_to_stop =
2546  return root;
2547  }
2548  }
2549  break;
2550  }
2551  default: // some non-separator is in the way
2552  {
2553  *reason_to_stop =
2556  return nullptr;
2557  }
2558  }
2559  }
2560 }
2561 
2563 
2565  ValueObjectPrinter printer(this, &s, options);
2566  printer.PrintValueObject();
2567 }
2568 
2570  ValueObjectSP valobj_sp;
2571 
2572  if (UpdateValueIfNeeded(false) && m_error.Success()) {
2574 
2575  DataExtractor data;
2578 
2579  if (IsBitfield()) {
2581  m_error = v.GetValueAsData(&exe_ctx, data, GetModule().get());
2582  } else
2583  m_error = m_value.GetValueAsData(&exe_ctx, data, GetModule().get());
2584 
2585  valobj_sp = ValueObjectConstResult::Create(
2586  exe_ctx.GetBestExecutionContextScope(), GetCompilerType(), name, data,
2587  GetAddressOf());
2588  }
2589 
2590  if (!valobj_sp) {
2592  valobj_sp = ValueObjectConstResult::Create(
2594  }
2595  return valobj_sp;
2596 }
2597 
2599  lldb::DynamicValueType dynValue, bool synthValue) {
2600  ValueObjectSP result_sp(GetSP());
2601 
2602  switch (dynValue) {
2605  if (!result_sp->IsDynamic()) {
2606  if (result_sp->GetDynamicValue(dynValue))
2607  result_sp = result_sp->GetDynamicValue(dynValue);
2608  }
2609  } break;
2610  case lldb::eNoDynamicValues: {
2611  if (result_sp->IsDynamic()) {
2612  if (result_sp->GetStaticValue())
2613  result_sp = result_sp->GetStaticValue();
2614  }
2615  } break;
2616  }
2617 
2618  if (synthValue) {
2619  if (!result_sp->IsSynthetic()) {
2620  if (result_sp->GetSyntheticValue())
2621  result_sp = result_sp->GetSyntheticValue();
2622  }
2623  } else {
2624  if (result_sp->IsSynthetic()) {
2625  if (result_sp->GetNonSyntheticValue())
2626  result_sp = result_sp->GetNonSyntheticValue();
2627  }
2628  }
2629 
2630  return result_sp;
2631 }
2632 
2634  if (m_deref_valobj)
2635  return m_deref_valobj->GetSP();
2636 
2637  const bool is_pointer_or_reference_type = IsPointerOrReferenceType();
2638  if (is_pointer_or_reference_type) {
2639  bool omit_empty_base_classes = true;
2640  bool ignore_array_bounds = false;
2641 
2642  std::string child_name_str;
2643  uint32_t child_byte_size = 0;
2644  int32_t child_byte_offset = 0;
2645  uint32_t child_bitfield_bit_size = 0;
2646  uint32_t child_bitfield_bit_offset = 0;
2647  bool child_is_base_class = false;
2648  bool child_is_deref_of_parent = false;
2649  const bool transparent_pointers = false;
2650  CompilerType compiler_type = GetCompilerType();
2651  CompilerType child_compiler_type;
2652  uint64_t language_flags = 0;
2653 
2655 
2656  child_compiler_type = compiler_type.GetChildCompilerTypeAtIndex(
2657  &exe_ctx, 0, transparent_pointers, omit_empty_base_classes,
2658  ignore_array_bounds, child_name_str, child_byte_size, child_byte_offset,
2659  child_bitfield_bit_size, child_bitfield_bit_offset, child_is_base_class,
2660  child_is_deref_of_parent, this, language_flags);
2661  if (child_compiler_type && child_byte_size) {
2662  ConstString child_name;
2663  if (!child_name_str.empty())
2664  child_name.SetCString(child_name_str.c_str());
2665 
2667  *this, child_compiler_type, child_name, child_byte_size,
2668  child_byte_offset, child_bitfield_bit_size, child_bitfield_bit_offset,
2669  child_is_base_class, child_is_deref_of_parent, eAddressTypeInvalid,
2670  language_flags);
2671  }
2672 
2673  // In case of incomplete child compiler type, use the pointee type and try
2674  // to recreate a new ValueObjectChild using it.
2675  if (!m_deref_valobj) {
2676  if (HasSyntheticValue()) {
2677  child_compiler_type = compiler_type.GetPointeeType();
2678 
2679  if (child_compiler_type) {
2680  ConstString child_name;
2681  if (!child_name_str.empty())
2682  child_name.SetCString(child_name_str.c_str());
2683 
2685  *this, child_compiler_type, child_name, child_byte_size,
2686  child_byte_offset, child_bitfield_bit_size,
2687  child_bitfield_bit_offset, child_is_base_class,
2688  child_is_deref_of_parent, eAddressTypeInvalid, language_flags);
2689  }
2690  }
2691  }
2692 
2693  } else if (HasSyntheticValue()) {
2694  m_deref_valobj =
2696  ->GetChildMemberWithName(ConstString("$$dereference$$"), true)
2697  .get();
2698  } else if (IsSynthetic()) {
2699  m_deref_valobj =
2700  GetChildMemberWithName(ConstString("$$dereference$$"), true).get();
2701  }
2702 
2703  if (m_deref_valobj) {
2704  error.Clear();
2705  return m_deref_valobj->GetSP();
2706  } else {
2707  StreamString strm;
2708  GetExpressionPath(strm);
2709 
2710  if (is_pointer_or_reference_type)
2711  error.SetErrorStringWithFormat("dereference failed: (%s) %s",
2712  GetTypeName().AsCString("<invalid type>"),
2713  strm.GetData());
2714  else
2715  error.SetErrorStringWithFormat("not a pointer or reference type: (%s) %s",
2716  GetTypeName().AsCString("<invalid type>"),
2717  strm.GetData());
2718  return ValueObjectSP();
2719  }
2720 }
2721 
2723  if (m_addr_of_valobj_sp)
2724  return m_addr_of_valobj_sp;
2725 
2726  AddressType address_type = eAddressTypeInvalid;
2727  const bool scalar_is_load_address = false;
2728  addr_t addr = GetAddressOf(scalar_is_load_address, &address_type);
2729  error.Clear();
2730  if (addr != LLDB_INVALID_ADDRESS && address_type != eAddressTypeHost) {
2731  switch (address_type) {
2732  case eAddressTypeInvalid: {
2733  StreamString expr_path_strm;
2734  GetExpressionPath(expr_path_strm);
2735  error.SetErrorStringWithFormat("'%s' is not in memory",
2736  expr_path_strm.GetData());
2737  } break;
2738 
2739  case eAddressTypeFile:
2740  case eAddressTypeLoad: {
2741  CompilerType compiler_type = GetCompilerType();
2742  if (compiler_type) {
2743  std::string name(1, '&');
2744  name.append(m_name.AsCString(""));
2747  exe_ctx.GetBestExecutionContextScope(),
2748  compiler_type.GetPointerType(), ConstString(name.c_str()), addr,
2750  }
2751  } break;
2752  default:
2753  break;
2754  }
2755  } else {
2756  StreamString expr_path_strm;
2757  GetExpressionPath(expr_path_strm);
2758  error.SetErrorStringWithFormat("'%s' doesn't have a valid address",
2759  expr_path_strm.GetData());
2760  }
2761 
2762  return m_addr_of_valobj_sp;
2763 }
2764 
2765 ValueObjectSP ValueObject::Cast(const CompilerType &compiler_type) {
2766  return ValueObjectCast::Create(*this, GetName(), compiler_type);
2767 }
2768 
2769 lldb::ValueObjectSP ValueObject::Clone(ConstString new_name) {
2770  return ValueObjectCast::Create(*this, new_name, GetCompilerType());
2771 }
2772 
2773 ValueObjectSP ValueObject::CastPointerType(const char *name,
2774  CompilerType &compiler_type) {
2775  ValueObjectSP valobj_sp;
2776  AddressType address_type;
2777  addr_t ptr_value = GetPointerValue(&address_type);
2778 
2779  if (ptr_value != LLDB_INVALID_ADDRESS) {
2780  Address ptr_addr(ptr_value);
2782  valobj_sp = ValueObjectMemory::Create(
2783  exe_ctx.GetBestExecutionContextScope(), name, ptr_addr, compiler_type);
2784  }
2785  return valobj_sp;
2786 }
2787 
2788 ValueObjectSP ValueObject::CastPointerType(const char *name, TypeSP &type_sp) {
2789  ValueObjectSP valobj_sp;
2790  AddressType address_type;
2791  addr_t ptr_value = GetPointerValue(&address_type);
2792 
2793  if (ptr_value != LLDB_INVALID_ADDRESS) {
2794  Address ptr_addr(ptr_value);
2796  valobj_sp = ValueObjectMemory::Create(
2797  exe_ctx.GetBestExecutionContextScope(), name, ptr_addr, type_sp);
2798  }
2799  return valobj_sp;
2800 }
2801 
2802 ValueObject::EvaluationPoint::EvaluationPoint() : m_mod_id(), m_exe_ctx_ref() {}
2803 
2805  bool use_selected)
2806  : m_mod_id(), m_exe_ctx_ref(), m_needs_update(true) {
2807  ExecutionContext exe_ctx(exe_scope);
2808  TargetSP target_sp(exe_ctx.GetTargetSP());
2809  if (target_sp) {
2810  m_exe_ctx_ref.SetTargetSP(target_sp);
2811  ProcessSP process_sp(exe_ctx.GetProcessSP());
2812  if (!process_sp)
2813  process_sp = target_sp->GetProcessSP();
2814 
2815  if (process_sp) {
2816  m_mod_id = process_sp->GetModID();
2817  m_exe_ctx_ref.SetProcessSP(process_sp);
2818 
2819  ThreadSP thread_sp(exe_ctx.GetThreadSP());
2820 
2821  if (!thread_sp) {
2822  if (use_selected)
2823  thread_sp = process_sp->GetThreadList().GetSelectedThread();
2824  }
2825 
2826  if (thread_sp) {
2827  m_exe_ctx_ref.SetThreadSP(thread_sp);
2828 
2829  StackFrameSP frame_sp(exe_ctx.GetFrameSP());
2830  if (!frame_sp) {
2831  if (use_selected)
2832  frame_sp = thread_sp->GetSelectedFrame();
2833  }
2834  if (frame_sp)
2835  m_exe_ctx_ref.SetFrameSP(frame_sp);
2836  }
2837  }
2838  }
2839 }
2840 
2842  const ValueObject::EvaluationPoint &rhs)
2843  : m_mod_id(), m_exe_ctx_ref(rhs.m_exe_ctx_ref), m_needs_update(true) {}
2844 
2846 
2847 // This function checks the EvaluationPoint against the current process state.
2848 // If the current state matches the evaluation point, or the evaluation point
2849 // is already invalid, then we return false, meaning "no change". If the
2850 // current state is different, we update our state, and return true meaning
2851 // "yes, change". If we did see a change, we also set m_needs_update to true,
2852 // so future calls to NeedsUpdate will return true. exe_scope will be set to
2853 // the current execution context scope.
2854 
2856  bool accept_invalid_exe_ctx) {
2857  // Start with the target, if it is NULL, then we're obviously not going to
2858  // get any further:
2859  const bool thread_and_frame_only_if_stopped = true;
2860  ExecutionContext exe_ctx(
2861  m_exe_ctx_ref.Lock(thread_and_frame_only_if_stopped));
2862 
2863  if (exe_ctx.GetTargetPtr() == nullptr)
2864  return false;
2865 
2866  // If we don't have a process nothing can change.
2867  Process *process = exe_ctx.GetProcessPtr();
2868  if (process == nullptr)
2869  return false;
2870 
2871  // If our stop id is the current stop ID, nothing has changed:
2872  ProcessModID current_mod_id = process->GetModID();
2873 
2874  // If the current stop id is 0, either we haven't run yet, or the process
2875  // state has been cleared. In either case, we aren't going to be able to sync
2876  // with the process state.
2877  if (current_mod_id.GetStopID() == 0)
2878  return false;
2879 
2880  bool changed = false;
2881  const bool was_valid = m_mod_id.IsValid();
2882  if (was_valid) {
2883  if (m_mod_id == current_mod_id) {
2884  // Everything is already up to date in this object, no need to update the
2885  // execution context scope.
2886  changed = false;
2887  } else {
2888  m_mod_id = current_mod_id;
2889  m_needs_update = true;
2890  changed = true;
2891  }
2892  }
2893 
2894  // Now re-look up the thread and frame in case the underlying objects have
2895  // gone away & been recreated. That way we'll be sure to return a valid
2896  // exe_scope. If we used to have a thread or a frame but can't find it
2897  // anymore, then mark ourselves as invalid.
2898 
2899  if (!accept_invalid_exe_ctx) {
2900  if (m_exe_ctx_ref.HasThreadRef()) {
2901  ThreadSP thread_sp(m_exe_ctx_ref.GetThreadSP());
2902  if (thread_sp) {
2903  if (m_exe_ctx_ref.HasFrameRef()) {
2904  StackFrameSP frame_sp(m_exe_ctx_ref.GetFrameSP());
2905  if (!frame_sp) {
2906  // We used to have a frame, but now it is gone
2907  SetInvalid();
2908  changed = was_valid;
2909  }
2910  }
2911  } else {
2912  // We used to have a thread, but now it is gone
2913  SetInvalid();
2914  changed = was_valid;
2915  }
2916  }
2917  }
2918 
2919  return changed;
2920 }
2921 
2923  ProcessSP process_sp(m_exe_ctx_ref.GetProcessSP());
2924  if (process_sp)
2925  m_mod_id = process_sp->GetModID();
2926  m_needs_update = false;
2927 }
2928 
2930  if ((clear_mask & eClearUserVisibleDataItemsValue) ==
2932  m_value_str.clear();
2933 
2934  if ((clear_mask & eClearUserVisibleDataItemsLocation) ==
2936  m_location_str.clear();
2937 
2938  if ((clear_mask & eClearUserVisibleDataItemsSummary) ==
2940  m_summary_str.clear();
2941 
2942  if ((clear_mask & eClearUserVisibleDataItemsDescription) ==
2944  m_object_desc_str.clear();
2945 
2946  if ((clear_mask & eClearUserVisibleDataItemsSyntheticChildren) ==
2948  if (m_synthetic_value)
2949  m_synthetic_value = nullptr;
2950  }
2951 }
2952 
2954  if (m_parent) {
2956  return m_parent->GetSymbolContextScope();
2957  }
2958  return nullptr;
2959 }
2960 
2961 lldb::ValueObjectSP
2963  llvm::StringRef expression,
2964  const ExecutionContext &exe_ctx) {
2965  return CreateValueObjectFromExpression(name, expression, exe_ctx,
2967 }
2968 
2970  llvm::StringRef name, llvm::StringRef expression,
2971  const ExecutionContext &exe_ctx, const EvaluateExpressionOptions &options) {
2972  lldb::ValueObjectSP retval_sp;
2973  lldb::TargetSP target_sp(exe_ctx.GetTargetSP());
2974  if (!target_sp)
2975  return retval_sp;
2976  if (expression.empty())
2977  return retval_sp;
2978  target_sp->EvaluateExpression(expression, exe_ctx.GetFrameSP().get(),
2979  retval_sp, options);
2980  if (retval_sp && !name.empty())
2981  retval_sp->SetName(ConstString(name));
2982  return retval_sp;
2983 }
2984 
2986  llvm::StringRef name, uint64_t address, const ExecutionContext &exe_ctx,
2987  CompilerType type) {
2988  if (type) {
2989  CompilerType pointer_type(type.GetPointerType());
2990  if (pointer_type) {
2991  lldb::DataBufferSP buffer(
2992  new lldb_private::DataBufferHeap(&address, sizeof(lldb::addr_t)));
2993  lldb::ValueObjectSP ptr_result_valobj_sp(ValueObjectConstResult::Create(
2994  exe_ctx.GetBestExecutionContextScope(), pointer_type,
2995  ConstString(name), buffer, exe_ctx.GetByteOrder(),
2996  exe_ctx.GetAddressByteSize()));
2997  if (ptr_result_valobj_sp) {
2998  ptr_result_valobj_sp->GetValue().SetValueType(
3000  Status err;
3001  ptr_result_valobj_sp = ptr_result_valobj_sp->Dereference(err);
3002  if (ptr_result_valobj_sp && !name.empty())
3003  ptr_result_valobj_sp->SetName(ConstString(name));
3004  }
3005  return ptr_result_valobj_sp;
3006  }
3007  }
3008  return lldb::ValueObjectSP();
3009 }
3010 
3012  llvm::StringRef name, const DataExtractor &data,
3013  const ExecutionContext &exe_ctx, CompilerType type) {
3014  lldb::ValueObjectSP new_value_sp;
3015  new_value_sp = ValueObjectConstResult::Create(
3016  exe_ctx.GetBestExecutionContextScope(), type, ConstString(name), data,
3018  new_value_sp->SetAddressTypeOfChildren(eAddressTypeLoad);
3019  if (new_value_sp && !name.empty())
3020  new_value_sp->SetName(ConstString(name));
3021  return new_value_sp;
3022 }
3023 
3025  ValueObject *root(GetRoot());
3026  if (root != this)
3027  return root->GetModule();
3028  return lldb::ModuleSP();
3029 }
3030 
3032  if (m_root)
3033  return m_root;
3034  return (m_root = FollowParentChain([](ValueObject *vo) -> bool {
3035  return (vo->m_parent != nullptr);
3036  }));
3037 }
3038 
3039 ValueObject *
3040 ValueObject::FollowParentChain(std::function<bool(ValueObject *)> f) {
3041  ValueObject *vo = this;
3042  while (vo) {
3043  if (!f(vo))
3044  break;
3045  vo = vo->m_parent;
3046  }
3047  return vo;
3048 }
3049 
3052  ValueObject *root(GetRoot());
3053  if (root != this)
3054  return root->GetAddressTypeOfChildren();
3055  }
3057 }
3058 
3060  ValueObject *with_dv_info = this;
3061  while (with_dv_info) {
3062  if (with_dv_info->HasDynamicValueTypeInfo())
3063  return with_dv_info->GetDynamicValueTypeImpl();
3064  with_dv_info = with_dv_info->m_parent;
3065  }
3066  return lldb::eNoDynamicValues;
3067 }
3068 
3070  const ValueObject *with_fmt_info = this;
3071  while (with_fmt_info) {
3072  if (with_fmt_info->m_format != lldb::eFormatDefault)
3073  return with_fmt_info->m_format;
3074  with_fmt_info = with_fmt_info->m_parent;
3075  }
3076  return m_format;
3077 }
3078 
3082  if (GetRoot()) {
3083  if (GetRoot() == this) {
3084  if (StackFrameSP frame_sp = GetFrameSP()) {
3085  const SymbolContext &sc(
3086  frame_sp->GetSymbolContext(eSymbolContextCompUnit));
3087  if (CompileUnit *cu = sc.comp_unit)
3088  type = cu->GetLanguage();
3089  }
3090  } else {
3092  }
3093  }
3094  }
3095  return (m_preferred_display_language = type); // only compute it once
3096 }
3097 
3101 }
3102 
3104  // we need to support invalid types as providers of values because some bare-
3105  // board debugging scenarios have no notion of types, but still manage to
3106  // have raw numeric values for things like registers. sigh.
3107  CompilerType type = GetCompilerType();
3108  return (!type.IsValid()) || (0 != (type.GetTypeInfo() & eTypeHasValue));
3109 }
3110 
3111 
3112 
3113 ValueObjectSP ValueObject::Persist() {
3114  if (!UpdateValueIfNeeded())
3115  return nullptr;
3116 
3117  TargetSP target_sp(GetTargetSP());
3118  if (!target_sp)
3119  return nullptr;
3120 
3121  PersistentExpressionState *persistent_state =
3122  target_sp->GetPersistentExpressionStateForLanguage(
3124 
3125  if (!persistent_state)
3126  return nullptr;
3127 
3128  ConstString name = persistent_state->GetNextPersistentVariableName();
3129 
3130  ValueObjectSP const_result_sp =
3131  ValueObjectConstResult::Create(target_sp.get(), GetValue(), name);
3132 
3133  ExpressionVariableSP persistent_var_sp =
3134  persistent_state->CreatePersistentVariable(const_result_sp);
3135  persistent_var_sp->m_live_sp = persistent_var_sp->m_frozen_sp;
3136  persistent_var_sp->m_flags |= ExpressionVariable::EVIsProgramReference;
3137 
3138  return persistent_var_sp->GetValueObject();
3139 }
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:1988
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:1090
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:260
ExpressionVariable.h
lldb_private::ValueObject::CanProvideValue
virtual bool CanProvideValue()
Definition: ValueObject.cpp:3103
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:1578
lldb_private::ValueObject::ClearUserVisibleData
void ClearUserVisibleData(uint32_t items=ValueObject::eClearUserVisibleDataItemsAllStrings)
Definition: ValueObject.cpp:2929
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:278
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:1925
lldb_private::ValueObject::IsNilReference
bool IsNilReference()
Definition: ValueObject.cpp:1595
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:3113
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:2922
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:4187
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:3040
lldb_private::ClusterManager
Definition: SharedCluster.h:22
lldb_private::Process
Definition: Process.h:341
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:259
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:1436
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:1108
lldb_private::ValueObject::GetQualifiedRepresentationIfAvailable
lldb::ValueObjectSP GetQualifiedRepresentationIfAvailable(lldb::DynamicValueType dynValue, bool synthValue)
Definition: ValueObject.cpp:2598
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:1761
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:1364
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:3031
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:2118
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:451
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:1893
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:1602
lldb_private::ValueObject::GetDynamicValue
virtual lldb::ValueObjectSP GetDynamicValue(lldb::DynamicValueType valueType)
Definition: ValueObject.cpp:1835
lldb_private::formatters::StringPrinter::DumpToStreamOptions::SetBinaryZeroIsTerminator
void SetBinaryZeroIsTerminator(bool e)
Definition: StringPrinter.h:61
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:2962
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:2953
lldb_private::Status::Success
bool Success() const
Test for success condition.
Definition: Status.cpp:288
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:2633
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:1569
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:3069
lldb_private::ValueObject::ExpressionPathAftermath
ExpressionPathAftermath
Definition: ValueObject.h:173
lldb_private::ValueObject::SetPreferredDisplayLanguageIfNeeded
void SetPreferredDisplayLanguageIfNeeded(lldb::LanguageType)
Definition: ValueObject.cpp:3098
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:2985
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:860
lldb_private::ValueObject::CalculateSyntheticValue
virtual void CalculateSyntheticValue()
Definition: ValueObject.cpp:1800
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:1645
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:1821
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:2773
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:1679
lldb_private::ValueObject::GetObjectDescription
const char * GetObjectDescription()
Definition: ValueObject.cpp:999
ValueObjectPrinter.h
lldb_private::ValueObject::CreateConstantValue
virtual lldb::ValueObjectSP CreateConstantValue(ConstString name)
Definition: ValueObject.cpp:2569
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:2765
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:40
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:1618
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:1465
lldb_private::ValueObject::GetPreferredDisplayLanguage
virtual lldb::LanguageType GetPreferredDisplayLanguage()
Definition: ValueObject.cpp:3079
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:1868
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:1049
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:1540
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:1719
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:2769
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:2855
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:222
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:1550
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:1512
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:3059
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:1560
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:1716
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:3024
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:2197
lldb_private::ValueObject::HasSpecialPrintableRepresentation
bool HasSpecialPrintableRepresentation(ValueObjectRepresentationStyle val_obj_display, lldb::Format custom_format)
Definition: ValueObject.cpp:1130
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:1555
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:1399
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:3011
lldb_private::ValueObject::m_dynamic_value
ValueObject * m_dynamic_value
Definition: ValueObject.h:881
lldb_private::ValueObject::EvaluationPoint::EvaluationPoint
EvaluationPoint()
Definition: ValueObject.cpp:2802
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:1163
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:2722
lldb_private::ValueObject::HasSyntheticValue
virtual bool HasSyntheticValue()
Definition: ValueObject.cpp:1857
lldb_private::ValueObject::Dump
void Dump(Stream &s)
Definition: ValueObject.cpp:2562
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:1848
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:1772
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:3050
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:2056