1 //===-- ValueObject.h -------------------------------------------*- C++ -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 #ifndef liblldb_ValueObject_h_
11 #define liblldb_ValueObject_h_
17 // Other libraries and framework includes
20 #include "lldb/lldb-private.h"
21 #include "lldb/Core/DataExtractor.h"
22 #include "lldb/Core/Error.h"
23 #include "lldb/Core/Flags.h"
24 #include "lldb/Core/ConstString.h"
25 #include "lldb/Core/UserID.h"
26 #include "lldb/Core/Value.h"
27 #include "lldb/Target/ExecutionContext.h"
28 #include "lldb/Target/ExecutionContextScope.h"
29 #include "lldb/Target/Process.h"
30 #include "lldb/Target/StackID.h"
31 #include "lldb/Utility/SharedCluster.h"
33 namespace lldb_private {
37 /// This abstract class provides an interface to a particular value, be it a register, a local or global variable,
38 /// that is evaluated in some particular scope. The ValueObject also has the capibility of being the "child" of
39 /// some other variable object, and in turn of having children.
40 /// If a ValueObject is a root variable object - having no parent - then it must be constructed with respect to some
41 /// particular ExecutionContextScope. If it is a child, it inherits the ExecutionContextScope from its parent.
42 /// The ValueObject will update itself if necessary before fetching its value, summary, object description, etc.
43 /// But it will always update itself in the ExecutionContextScope with which it was originally created.
45 /// A brief note on life cycle management for ValueObjects. This is a little tricky because a ValueObject can contain
46 /// various other ValueObjects - the Dynamic Value, its children, the dereference value, etc. Any one of these can be
47 /// handed out as a shared pointer, but for that contained value object to be valid, the root object and potentially other
48 /// of the value objects need to stay around.
49 /// We solve this problem by handing out shared pointers to the Value Object and any of its dependents using a shared
50 /// ClusterManager. This treats each shared pointer handed out for the entire cluster as a reference to the whole
51 /// cluster. The whole cluster will stay around until the last reference is released.
53 /// The ValueObject mostly handle this automatically, if a value object is made with a Parent ValueObject, then it adds
54 /// itself to the ClusterManager of the parent.
56 /// It does mean that external to the ValueObjects we should only ever make available ValueObjectSP's, never ValueObjects
57 /// or pointers to them. So all the "Root level" ValueObject derived constructors should be private, and
58 /// should implement a Create function that new's up object and returns a Shared Pointer that it gets from the GetSP() method.
60 /// However, if you are making an derived ValueObject that will be contained in a parent value object, you should just
61 /// hold onto a pointer to it internally, and by virtue of passing the parent ValueObject into its constructor, it will
62 /// be added to the ClusterManager for the parent. Then if you ever hand out a Shared Pointer to the contained ValueObject,
63 /// just do so by calling GetSP() on the contained object.
65 class ValueObject : public UserID
69 enum GetExpressionPathFormat
71 eGetExpressionPathFormatDereferencePointers = 1,
72 eGetExpressionPathFormatHonorPointers
75 enum ValueObjectRepresentationStyle
77 eValueObjectRepresentationStyleValue = 1,
78 eValueObjectRepresentationStyleSummary,
79 eValueObjectRepresentationStyleLanguageSpecific,
80 eValueObjectRepresentationStyleLocation,
81 eValueObjectRepresentationStyleChildrenCount,
82 eValueObjectRepresentationStyleType,
83 eValueObjectRepresentationStyleName,
84 eValueObjectRepresentationStyleExpressionPath
87 enum ExpressionPathScanEndReason
89 eExpressionPathScanEndReasonEndOfString = 1, // out of data to parse
90 eExpressionPathScanEndReasonNoSuchChild, // child element not found
91 eExpressionPathScanEndReasonEmptyRangeNotAllowed, // [] only allowed for arrays
92 eExpressionPathScanEndReasonDotInsteadOfArrow, // . used when -> should be used
93 eExpressionPathScanEndReasonArrowInsteadOfDot, // -> used when . should be used
94 eExpressionPathScanEndReasonFragileIVarNotAllowed, // ObjC ivar expansion not allowed
95 eExpressionPathScanEndReasonRangeOperatorNotAllowed, // [] not allowed by options
96 eExpressionPathScanEndReasonRangeOperatorInvalid, // [] not valid on objects other than scalars, pointers or arrays
97 eExpressionPathScanEndReasonArrayRangeOperatorMet, // [] is good for arrays, but I cannot parse it
98 eExpressionPathScanEndReasonBitfieldRangeOperatorMet, // [] is good for bitfields, but I cannot parse after it
99 eExpressionPathScanEndReasonUnexpectedSymbol, // something is malformed in the expression
100 eExpressionPathScanEndReasonTakingAddressFailed, // impossible to apply & operator
101 eExpressionPathScanEndReasonDereferencingFailed, // impossible to apply * operator
102 eExpressionPathScanEndReasonRangeOperatorExpanded, // [] was expanded into a VOList
103 eExpressionPathScanEndReasonSyntheticValueMissing, // getting the synthetic children failed
104 eExpressionPathScanEndReasonUnknown = 0xFFFF
107 enum ExpressionPathEndResultType
109 eExpressionPathEndResultTypePlain = 1, // anything but...
110 eExpressionPathEndResultTypeBitfield, // a bitfield
111 eExpressionPathEndResultTypeBoundedRange, // a range [low-high]
112 eExpressionPathEndResultTypeUnboundedRange, // a range []
113 eExpressionPathEndResultTypeValueObjectList, // several items in a VOList
114 eExpressionPathEndResultTypeInvalid = 0xFFFF
117 enum ExpressionPathAftermath
119 eExpressionPathAftermathNothing = 1, // just return it
120 eExpressionPathAftermathDereference, // dereference the target
121 eExpressionPathAftermathTakeAddress // take target's address
124 enum ClearUserVisibleDataItems
126 eClearUserVisibleDataItemsNothing = 1u << 0,
127 eClearUserVisibleDataItemsValue = 1u << 1,
128 eClearUserVisibleDataItemsSummary = 1u << 2,
129 eClearUserVisibleDataItemsLocation = 1u << 3,
130 eClearUserVisibleDataItemsDescription = 1u << 4,
131 eClearUserVisibleDataItemsSyntheticChildren = 1u << 5,
132 eClearUserVisibleDataItemsAllStrings = eClearUserVisibleDataItemsValue | eClearUserVisibleDataItemsSummary | eClearUserVisibleDataItemsLocation | eClearUserVisibleDataItemsDescription,
133 eClearUserVisibleDataItemsAll = 0xFFFF
136 struct GetValueForExpressionPathOptions
138 bool m_check_dot_vs_arrow_syntax;
139 bool m_no_fragile_ivar;
140 bool m_allow_bitfields_syntax;
141 bool m_no_synthetic_children;
143 GetValueForExpressionPathOptions(bool dot = false,
144 bool no_ivar = false,
145 bool bitfield = true,
146 bool no_synth = false) :
147 m_check_dot_vs_arrow_syntax(dot),
148 m_no_fragile_ivar(no_ivar),
149 m_allow_bitfields_syntax(bitfield),
150 m_no_synthetic_children(no_synth)
154 GetValueForExpressionPathOptions&
155 DoCheckDotVsArrowSyntax()
157 m_check_dot_vs_arrow_syntax = true;
161 GetValueForExpressionPathOptions&
162 DontCheckDotVsArrowSyntax()
164 m_check_dot_vs_arrow_syntax = false;
168 GetValueForExpressionPathOptions&
171 m_no_fragile_ivar = false;
175 GetValueForExpressionPathOptions&
176 DontAllowFragileIVar()
178 m_no_fragile_ivar = true;
182 GetValueForExpressionPathOptions&
183 DoAllowBitfieldSyntax()
185 m_allow_bitfields_syntax = true;
189 GetValueForExpressionPathOptions&
190 DontAllowBitfieldSyntax()
192 m_allow_bitfields_syntax = false;
196 GetValueForExpressionPathOptions&
197 DoAllowSyntheticChildren()
199 m_no_synthetic_children = false;
203 GetValueForExpressionPathOptions&
204 DontAllowSyntheticChildren()
206 m_no_synthetic_children = true;
210 static const GetValueForExpressionPathOptions
213 static GetValueForExpressionPathOptions g_default_options;
215 return g_default_options;
220 class EvaluationPoint
226 EvaluationPoint (ExecutionContextScope *exe_scope, bool use_selected = false);
228 EvaluationPoint (const EvaluationPoint &rhs);
232 const ExecutionContextRef &
233 GetExecutionContextRef() const
235 return m_exe_ctx_ref;
238 // Set the EvaluationPoint to the values in exe_scope,
239 // Return true if the Evaluation Point changed.
240 // Since the ExecutionContextScope is always going to be valid currently,
241 // the Updated Context will also always be valid.
244 // SetContext (ExecutionContextScope *exe_scope);
250 m_mod_id.SetInvalid();
256 return !m_mod_id.IsValid();
266 SetUpdateID (ProcessModID new_id)
272 IsFirstEvaluation () const
274 return m_first_update;
280 m_needs_update = true;
289 SyncWithProcessState();
290 return m_needs_update;
296 if (!m_mod_id.IsValid())
298 else if (SyncWithProcessState ())
300 if (!m_mod_id.IsValid())
309 // Use the stop id to mark us as invalid, leave the thread id and the stack id around for logging and
311 m_mod_id.SetInvalid();
313 // Can't update an invalid state.
314 m_needs_update = false;
320 SyncWithProcessState ();
322 ProcessModID m_mod_id; // This is the stop id when this ValueObject was last evaluated.
323 ExecutionContextRef m_exe_ctx_ref;
328 const EvaluationPoint &
329 GetUpdatePoint () const
331 return m_update_point;
337 return m_update_point;
340 const ExecutionContextRef &
341 GetExecutionContextRef() const
343 return m_update_point.GetExecutionContextRef();
349 return m_update_point.GetExecutionContextRef().GetTargetSP();
355 return m_update_point.GetExecutionContextRef().GetProcessSP();
361 return m_update_point.GetExecutionContextRef().GetThreadSP();
367 return m_update_point.GetExecutionContextRef().GetFrameSP();
373 virtual ~ValueObject();
378 // this vends a TypeImpl that is useful at the SB API layer
382 //------------------------------------------------------------------
383 // Sublasses must implement the functions below.
384 //------------------------------------------------------------------
388 virtual lldb::ValueType
389 GetValueType() const = 0;
391 //------------------------------------------------------------------
392 // Sublasses can implement the functions below.
393 //------------------------------------------------------------------
398 GetQualifiedTypeName();
400 virtual lldb::LanguageType
401 GetObjectRuntimeLanguage();
404 GetTypeInfo (ClangASTType *pointee_or_element_clang_type = NULL);
416 IsPointerOrReferenceType ();
419 IsPossibleDynamicType ();
431 IsDereferenceOfParent ()
437 IsIntegerType (bool &is_signed);
440 GetBaseClassPath (Stream &s);
443 GetExpressionPath (Stream &s, bool qualify_cxx_base_classes, GetExpressionPathFormat = eGetExpressionPathFormatDereferencePointers);
446 GetValueForExpressionPath(const char* expression,
447 const char** first_unparsed = NULL,
448 ExpressionPathScanEndReason* reason_to_stop = NULL,
449 ExpressionPathEndResultType* final_value_type = NULL,
450 const GetValueForExpressionPathOptions& options = GetValueForExpressionPathOptions::DefaultOptions(),
451 ExpressionPathAftermath* final_task_on_target = NULL);
454 GetValuesForExpressionPath(const char* expression,
455 lldb::ValueObjectListSP& list,
456 const char** first_unparsed = NULL,
457 ExpressionPathScanEndReason* reason_to_stop = NULL,
458 ExpressionPathEndResultType* final_value_type = NULL,
459 const GetValueForExpressionPathOptions& options = GetValueForExpressionPathOptions::DefaultOptions(),
460 ExpressionPathAftermath* final_task_on_target = NULL);
475 GetBitfieldBitSize ()
481 GetBitfieldBitOffset ()
489 return (GetBitfieldBitSize() != 0) || (GetBitfieldBitOffset() != 0);
493 IsArrayItemForPointer()
495 return m_is_array_item_for_pointer;
499 GetValueAsCString ();
502 GetValueAsCString (const lldb_private::TypeFormatImpl& format,
503 std::string& destination);
506 GetValueAsCString (lldb::Format format,
507 std::string& destination);
510 GetValueAsUnsigned (uint64_t fail_value, bool *success = NULL);
513 GetValueAsSigned (int64_t fail_value, bool *success = NULL);
516 SetValueFromCString (const char *value_str, Error& error);
518 // Return the module associated with this value object in case the
519 // value is from an executable file and might have its data in
520 // sections of the file. This can be used for variables.
521 virtual lldb::ModuleSP
528 GetDeclaration (Declaration &decl);
530 //------------------------------------------------------------------
531 // The functions below should NOT be modified by sublasses
532 //------------------------------------------------------------------
539 virtual lldb::ValueObjectSP
540 GetChildAtIndex (size_t idx, bool can_create);
542 // this will always create the children if necessary
544 GetChildAtIndexPath (const std::initializer_list<size_t> &idxs,
545 size_t* index_of_error = NULL);
548 GetChildAtIndexPath (const std::vector<size_t> &idxs,
549 size_t* index_of_error = NULL);
552 GetChildAtIndexPath (const std::initializer_list< std::pair<size_t, bool> > &idxs,
553 size_t* index_of_error = NULL);
556 GetChildAtIndexPath (const std::vector< std::pair<size_t, bool> > &idxs,
557 size_t* index_of_error = NULL);
559 // this will always create the children if necessary
561 GetChildAtNamePath (const std::initializer_list<ConstString> &names,
562 ConstString* name_of_error = NULL);
565 GetChildAtNamePath (const std::vector<ConstString> &names,
566 ConstString* name_of_error = NULL);
569 GetChildAtNamePath (const std::initializer_list< std::pair<ConstString, bool> > &names,
570 ConstString* name_of_error = NULL);
573 GetChildAtNamePath (const std::vector< std::pair<ConstString, bool> > &names,
574 ConstString* name_of_error = NULL);
576 virtual lldb::ValueObjectSP
577 GetChildMemberWithName (const ConstString &name, bool can_create);
580 GetIndexOfChildWithName (const ConstString &name);
592 ResolveValue (Scalar &scalar);
595 GetLocationAsCString ();
598 GetSummaryAsCString ();
601 GetSummaryAsCString (TypeSummaryImpl* summary_ptr,
602 std::string& destination);
605 GetObjectDescription ();
608 HasSpecialPrintableRepresentation (ValueObjectRepresentationStyle val_obj_display,
609 lldb::Format custom_format);
611 enum PrintableRepresentationSpecialCases
613 ePrintableRepresentationSpecialCasesDisable = 0,
614 ePrintableRepresentationSpecialCasesAllow = 1,
615 ePrintableRepresentationSpecialCasesOnly = 3
619 DumpPrintableRepresentation (Stream& s,
620 ValueObjectRepresentationStyle val_obj_display = eValueObjectRepresentationStyleSummary,
621 lldb::Format custom_format = lldb::eFormatInvalid,
622 PrintableRepresentationSpecialCases special = ePrintableRepresentationSpecialCasesAllow,
623 bool do_dump_error = true);
625 GetValueIsValid () const;
628 GetValueDidChange ();
631 UpdateValueIfNeeded (bool update_format = true);
634 UpdateFormatsIfNeeded();
639 return m_manager->GetSharedPointer(this);
643 SetName (const ConstString &name);
646 GetAddressOf (bool scalar_is_load_address = true,
647 AddressType *address_type = NULL);
650 GetPointerValue (AddressType *address_type = NULL);
653 GetSyntheticChild (const ConstString &key) const;
656 GetSyntheticArrayMember (size_t index, bool can_create);
659 GetSyntheticArrayMemberFromPointer (size_t index, bool can_create);
662 GetSyntheticArrayMemberFromArray (size_t index, bool can_create);
665 GetSyntheticBitFieldChild (uint32_t from, uint32_t to, bool can_create);
668 GetSyntheticExpressionPathChild(const char* expression, bool can_create);
670 virtual lldb::ValueObjectSP
671 GetSyntheticChildAtOffset(uint32_t offset, const ClangASTType& type, bool can_create);
673 virtual lldb::ValueObjectSP
674 GetDynamicValue (lldb::DynamicValueType valueType);
676 lldb::DynamicValueType
677 GetDynamicValueType ();
679 virtual lldb::ValueObjectSP
682 virtual lldb::ValueObjectSP
683 GetNonSyntheticValue ();
686 GetSyntheticValue (bool use_synthetic = true);
692 IsSynthetic() { return false; }
694 virtual lldb::ValueObjectSP
695 CreateConstantValue (const ConstString &name);
697 virtual lldb::ValueObjectSP
698 Dereference (Error &error);
700 virtual lldb::ValueObjectSP
701 AddressOf (Error &error);
706 return LLDB_INVALID_ADDRESS;
710 SetLiveAddress(lldb::addr_t addr = LLDB_INVALID_ADDRESS,
711 AddressType address_type = eAddressTypeLoad)
715 virtual lldb::ValueObjectSP
716 Cast (const ClangASTType &clang_ast_type);
718 virtual lldb::ValueObjectSP
719 CastPointerType (const char *name,
720 ClangASTType &ast_type);
722 virtual lldb::ValueObjectSP
723 CastPointerType (const char *name,
724 lldb::TypeSP &type_sp);
726 // The backing bits of this value object were updated, clear any
727 // descriptive string, so we know we have to refetch them
731 ClearUserVisibleData(eClearUserVisibleDataItemsValue |
732 eClearUserVisibleDataItemsSummary |
733 eClearUserVisibleDataItemsDescription);
742 virtual SymbolContextScope *
743 GetSymbolContextScope();
750 const DumpValueObjectOptions& options);
752 static lldb::ValueObjectSP
753 CreateValueObjectFromExpression (const char* name,
754 const char* expression,
755 const ExecutionContext& exe_ctx);
757 static lldb::ValueObjectSP
758 CreateValueObjectFromAddress (const char* name,
760 const ExecutionContext& exe_ctx,
763 static lldb::ValueObjectSP
764 CreateValueObjectFromData (const char* name,
766 const ExecutionContext& exe_ctx,
770 LogValueObject (Log *log);
773 LogValueObject (Log *log,
774 const DumpValueObjectOptions& options);
777 // returns true if this is a char* or a char[]
778 // if it is a char* and check_pointer is true,
779 // it also checks that the pointer is valid
781 IsCStringContainer (bool check_pointer = false);
784 ReadPointedString (Stream& s,
786 uint32_t max_length = 0,
787 bool honor_array = true,
788 lldb::Format item_format = lldb::eFormatCharArray);
791 GetPointeeData (DataExtractor& data,
792 uint32_t item_idx = 0,
793 uint32_t item_count = 1);
796 GetData (DataExtractor& data);
799 SetData (DataExtractor &data, Error &error);
802 GetIsConstant () const
804 return m_update_point.IsConstant();
810 m_update_point.SetIsConstant();
817 SetFormat (lldb::Format format)
819 if (format != m_format)
820 ClearUserVisibleData(eClearUserVisibleDataItemsValue);
824 lldb::TypeSummaryImplSP
827 UpdateFormatsIfNeeded();
828 return m_type_summary_sp;
832 SetSummaryFormat(lldb::TypeSummaryImplSP format)
834 m_type_summary_sp = format;
835 ClearUserVisibleData(eClearUserVisibleDataItemsSummary);
839 SetValueFormat(lldb::TypeFormatImplSP format)
841 m_type_format_sp = format;
842 ClearUserVisibleData(eClearUserVisibleDataItemsValue);
845 lldb::TypeFormatImplSP
848 UpdateFormatsIfNeeded();
849 return m_type_format_sp;
853 SetSyntheticChildren(const lldb::SyntheticChildrenSP &synth_sp)
855 if (synth_sp.get() == m_synthetic_children_sp.get())
857 ClearUserVisibleData(eClearUserVisibleDataItemsSyntheticChildren);
858 m_synthetic_children_sp = synth_sp;
861 lldb::SyntheticChildrenSP
862 GetSyntheticChildren()
864 UpdateFormatsIfNeeded();
865 return m_synthetic_children_sp;
868 // Use GetParent for display purposes, but if you want to tell the parent to update itself
869 // then use m_parent. The ValueObjectDynamicValue's parent is not the correct parent for
870 // displaying, they are really siblings, so for display it needs to route through to its grandparent.
871 virtual ValueObject *
877 virtual const ValueObject *
884 GetNonBaseClassParent();
887 SetAddressTypeOfChildren(AddressType at)
889 m_address_type_of_ptr_or_ref_children = at;
893 GetAddressTypeOfChildren();
898 m_did_calculate_complete_objc_class_type = true;
901 //------------------------------------------------------------------
902 /// Find out if a ValueObject might have children.
904 /// This call is much more efficient than CalculateNumChildren() as
905 /// it doesn't need to complete the underlying type. This is designed
906 /// to be used in a UI environment in order to detect if the
907 /// disclosure triangle should be displayed or not.
909 /// This function returns true for class, union, structure,
910 /// pointers, references, arrays and more. Again, it does so without
911 /// doing any expensive type completion.
914 /// Returns \b true if the ValueObject might have children, or \b
916 //------------------------------------------------------------------
921 typedef ClusterManager<ValueObject> ValueObjectManager;
923 class ChildrenManager
927 m_mutex(Mutex::eMutexTypeRecursive),
933 HasChildAtIndex (size_t idx)
935 Mutex::Locker locker(m_mutex);
936 ChildrenIterator iter = m_children.find(idx);
937 ChildrenIterator end = m_children.end();
938 return (iter != end);
942 GetChildAtIndex (size_t idx)
944 Mutex::Locker locker(m_mutex);
945 ChildrenIterator iter = m_children.find(idx);
946 ChildrenIterator end = m_children.end();
954 SetChildAtIndex (size_t idx, ValueObject* valobj)
956 ChildrenPair pair(idx,valobj); // we do not need to be mutex-protected to make a pair
957 Mutex::Locker locker(m_mutex);
958 m_children.insert(pair);
962 SetChildrenCount (size_t count)
964 m_children_count = count;
970 return m_children_count;
976 m_children_count = 0;
977 Mutex::Locker locker(m_mutex);
982 typedef std::map<size_t, ValueObject*> ChildrenMap;
983 typedef ChildrenMap::iterator ChildrenIterator;
984 typedef ChildrenMap::value_type ChildrenPair;
986 ChildrenMap m_children;
987 size_t m_children_count;
990 //------------------------------------------------------------------
991 // Classes that inherit from ValueObject can see and modify these
992 //------------------------------------------------------------------
993 ValueObject * m_parent; // The parent value object, or NULL if this has no parent
994 ValueObject * m_root; // The root of the hierarchy for this ValueObject (or NULL if never calculated)
995 EvaluationPoint m_update_point; // Stores both the stop id and the full context at which this value was last
996 // updated. When we are asked to update the value object, we check whether
997 // the context & stop id are the same before updating.
998 ConstString m_name; // The name of this object
999 DataExtractor m_data; // A data extractor that can be used to extract the value.
1001 Error m_error; // An error object that can describe any errors that occur when updating values.
1002 std::string m_value_str; // Cached value string that will get cleared if/when the value is updated.
1003 std::string m_old_value_str;// Cached old value string from the last time the value was gotten
1004 std::string m_location_str; // Cached location string that will get cleared if/when the value is updated.
1005 std::string m_summary_str; // Cached summary string that will get cleared if/when the value is updated.
1006 std::string m_object_desc_str; // Cached result of the "object printer". This differs from the summary
1007 // in that the summary is consed up by us, the object_desc_string is builtin.
1009 ClangASTType m_override_type;// If the type of the value object should be overridden, the type to impose.
1011 ValueObjectManager *m_manager; // This object is managed by the root object (any ValueObject that gets created
1012 // without a parent.) The manager gets passed through all the generations of
1013 // dependent objects, and will keep the whole cluster of objects alive as long
1014 // as a shared pointer to any of them has been handed out. Shared pointers to
1015 // value objects must always be made with the GetSP method.
1017 ChildrenManager m_children;
1018 std::map<ConstString, ValueObject *> m_synthetic_children;
1020 ValueObject* m_dynamic_value;
1021 ValueObject* m_synthetic_value;
1022 ValueObject* m_deref_valobj;
1024 lldb::ValueObjectSP m_addr_of_valobj_sp; // We have to hold onto a shared pointer to this one because it is created
1025 // as an independent ValueObjectConstResult, which isn't managed by us.
1027 lldb::Format m_format;
1028 lldb::Format m_last_format;
1029 uint32_t m_last_format_mgr_revision;
1030 lldb::TypeSummaryImplSP m_type_summary_sp;
1031 lldb::TypeFormatImplSP m_type_format_sp;
1032 lldb::SyntheticChildrenSP m_synthetic_children_sp;
1033 ProcessModID m_user_id_of_forced_summary;
1034 AddressType m_address_type_of_ptr_or_ref_children;
1036 bool m_value_is_valid:1,
1037 m_value_did_change:1,
1038 m_children_count_valid:1,
1039 m_old_value_valid:1,
1040 m_is_deref_of_parent:1,
1041 m_is_array_item_for_pointer:1,
1042 m_is_bitfield_for_scalar:1,
1043 m_is_child_at_offset:1,
1044 m_is_getting_summary:1,
1045 m_did_calculate_complete_objc_class_type:1;
1047 friend class ClangExpressionDeclMap; // For GetValue
1048 friend class ClangExpressionVariable; // For SetName
1049 friend class Target; // For SetName
1050 friend class ValueObjectConstResultImpl;
1052 //------------------------------------------------------------------
1053 // Constructors and Destructors
1054 //------------------------------------------------------------------
1056 // Use the no-argument constructor to make a constant variable object (with no ExecutionContextScope.)
1060 // Use this constructor to create a "root variable object". The ValueObject will be locked to this context
1061 // through-out its lifespan.
1063 ValueObject (ExecutionContextScope *exe_scope,
1064 AddressType child_ptr_or_ref_addr_type = eAddressTypeLoad);
1066 // Use this constructor to create a ValueObject owned by another ValueObject. It will inherit the ExecutionContext
1069 ValueObject (ValueObject &parent);
1071 ValueObjectManager *
1081 CalculateDynamicValue (lldb::DynamicValueType use_dynamic);
1083 virtual lldb::DynamicValueType
1084 GetDynamicValueTypeImpl ()
1086 return lldb::eNoDynamicValues;
1090 HasDynamicValueTypeInfo ()
1096 CalculateSyntheticValue (bool use_synthetic = true);
1098 // Should only be called by ValueObject::GetChildAtIndex()
1099 // Returns a ValueObject managed by this ValueObject's manager.
1100 virtual ValueObject *
1101 CreateChildAtIndex (size_t idx, bool synthetic_array_member, int32_t synthetic_index);
1103 // Should only be called by ValueObject::GetNumChildren()
1105 CalculateNumChildren() = 0;
1108 SetNumChildren (size_t num_children);
1111 SetValueDidChange (bool value_changed);
1114 SetValueIsValid (bool valid);
1117 ClearUserVisibleData(uint32_t items = ValueObject::eClearUserVisibleDataItemsAllStrings);
1120 AddSyntheticChild (const ConstString &key,
1121 ValueObject *valobj);
1124 GetDataExtractor ();
1127 ClearDynamicTypeInformation ();
1129 //------------------------------------------------------------------
1130 // Sublasses must implement the functions below.
1131 //------------------------------------------------------------------
1133 virtual ClangASTType
1134 GetClangTypeImpl () = 0;
1137 GetLocationAsCStringImpl (const Value& value,
1138 const DataExtractor& data);
1141 //------------------------------------------------------------------
1142 // For ValueObject only
1143 //------------------------------------------------------------------
1145 virtual ClangASTType
1146 MaybeCalculateCompleteType ();
1149 GetValueForExpressionPath_Impl(const char* expression_cstr,
1150 const char** first_unparsed,
1151 ExpressionPathScanEndReason* reason_to_stop,
1152 ExpressionPathEndResultType* final_value_type,
1153 const GetValueForExpressionPathOptions& options,
1154 ExpressionPathAftermath* final_task_on_target);
1156 // this method will ONLY expand [] expressions into a VOList and return
1157 // the number of elements it added to the VOList
1158 // it will NOT loop through expanding the follow-up of the expression_cstr
1159 // for all objects in the list
1161 ExpandArraySliceExpression(const char* expression_cstr,
1162 const char** first_unparsed,
1163 lldb::ValueObjectSP root,
1164 lldb::ValueObjectListSP& list,
1165 ExpressionPathScanEndReason* reason_to_stop,
1166 ExpressionPathEndResultType* final_value_type,
1167 const GetValueForExpressionPathOptions& options,
1168 ExpressionPathAftermath* final_task_on_target);
1171 DISALLOW_COPY_AND_ASSIGN (ValueObject);
1175 } // namespace lldb_private
1177 #endif // liblldb_ValueObject_h_