1254721Semaste//===-- ValueObject.h -------------------------------------------*- C++ -*-===//
2254721Semaste//
3254721Semaste//                     The LLVM Compiler Infrastructure
4254721Semaste//
5254721Semaste// This file is distributed under the University of Illinois Open Source
6254721Semaste// License. See LICENSE.TXT for details.
7254721Semaste//
8254721Semaste//===----------------------------------------------------------------------===//
9254721Semaste
10254721Semaste#ifndef liblldb_ValueObject_h_
11254721Semaste#define liblldb_ValueObject_h_
12254721Semaste
13254721Semaste// C Includes
14254721Semaste// C++ Includes
15254721Semaste#include <map>
16254721Semaste#include <vector>
17254721Semaste// Other libraries and framework includes
18254721Semaste// Project includes
19254721Semaste
20254721Semaste#include "lldb/lldb-private.h"
21254721Semaste#include "lldb/Core/DataExtractor.h"
22254721Semaste#include "lldb/Core/Error.h"
23254721Semaste#include "lldb/Core/Flags.h"
24254721Semaste#include "lldb/Core/ConstString.h"
25254721Semaste#include "lldb/Core/UserID.h"
26254721Semaste#include "lldb/Core/Value.h"
27254721Semaste#include "lldb/Target/ExecutionContext.h"
28254721Semaste#include "lldb/Target/ExecutionContextScope.h"
29254721Semaste#include "lldb/Target/Process.h"
30254721Semaste#include "lldb/Target/StackID.h"
31254721Semaste#include "lldb/Utility/SharedCluster.h"
32254721Semaste
33254721Semastenamespace lldb_private {
34254721Semaste
35254721Semaste/// ValueObject:
36254721Semaste///
37254721Semaste/// This abstract class provides an interface to a particular value, be it a register, a local or global variable,
38254721Semaste/// that is evaluated in some particular scope.  The ValueObject also has the capibility of being the "child" of
39254721Semaste/// some other variable object, and in turn of having children.
40254721Semaste/// If a ValueObject is a root variable object - having no parent - then it must be constructed with respect to some
41254721Semaste/// particular ExecutionContextScope.  If it is a child, it inherits the ExecutionContextScope from its parent.
42254721Semaste/// The ValueObject will update itself if necessary before fetching its value, summary, object description, etc.
43254721Semaste/// But it will always update itself in the ExecutionContextScope with which it was originally created.
44254721Semaste
45254721Semaste/// A brief note on life cycle management for ValueObjects.  This is a little tricky because a ValueObject can contain
46254721Semaste/// various other ValueObjects - the Dynamic Value, its children, the dereference value, etc.  Any one of these can be
47254721Semaste/// handed out as a shared pointer, but for that contained value object to be valid, the root object and potentially other
48254721Semaste/// of the value objects need to stay around.
49254721Semaste/// We solve this problem by handing out shared pointers to the Value Object and any of its dependents using a shared
50254721Semaste/// ClusterManager.  This treats each shared pointer handed out for the entire cluster as a reference to the whole
51254721Semaste/// cluster.  The whole cluster will stay around until the last reference is released.
52254721Semaste///
53254721Semaste/// The ValueObject mostly handle this automatically, if a value object is made with a Parent ValueObject, then it adds
54254721Semaste/// itself to the ClusterManager of the parent.
55254721Semaste
56254721Semaste/// It does mean that external to the ValueObjects we should only ever make available ValueObjectSP's, never ValueObjects
57254721Semaste/// or pointers to them.  So all the "Root level" ValueObject derived constructors should be private, and
58254721Semaste/// should implement a Create function that new's up object and returns a Shared Pointer that it gets from the GetSP() method.
59254721Semaste///
60254721Semaste/// However, if you are making an derived ValueObject that will be contained in a parent value object, you should just
61254721Semaste/// hold onto a pointer to it internally, and by virtue of passing the parent ValueObject into its constructor, it will
62254721Semaste/// be added to the ClusterManager for the parent.  Then if you ever hand out a Shared Pointer to the contained ValueObject,
63254721Semaste/// just do so by calling GetSP() on the contained object.
64254721Semaste
65254721Semasteclass ValueObject : public UserID
66254721Semaste{
67254721Semastepublic:
68254721Semaste
69254721Semaste    enum GetExpressionPathFormat
70254721Semaste    {
71254721Semaste        eGetExpressionPathFormatDereferencePointers = 1,
72254721Semaste        eGetExpressionPathFormatHonorPointers
73254721Semaste    };
74254721Semaste
75254721Semaste    enum ValueObjectRepresentationStyle
76254721Semaste    {
77254721Semaste        eValueObjectRepresentationStyleValue = 1,
78254721Semaste        eValueObjectRepresentationStyleSummary,
79254721Semaste        eValueObjectRepresentationStyleLanguageSpecific,
80254721Semaste        eValueObjectRepresentationStyleLocation,
81254721Semaste        eValueObjectRepresentationStyleChildrenCount,
82254721Semaste        eValueObjectRepresentationStyleType,
83254721Semaste        eValueObjectRepresentationStyleName,
84254721Semaste        eValueObjectRepresentationStyleExpressionPath
85254721Semaste    };
86254721Semaste
87254721Semaste    enum ExpressionPathScanEndReason
88254721Semaste    {
89254721Semaste        eExpressionPathScanEndReasonEndOfString = 1,           // out of data to parse
90254721Semaste        eExpressionPathScanEndReasonNoSuchChild,               // child element not found
91254721Semaste        eExpressionPathScanEndReasonEmptyRangeNotAllowed,      // [] only allowed for arrays
92254721Semaste        eExpressionPathScanEndReasonDotInsteadOfArrow,         // . used when -> should be used
93254721Semaste        eExpressionPathScanEndReasonArrowInsteadOfDot,         // -> used when . should be used
94254721Semaste        eExpressionPathScanEndReasonFragileIVarNotAllowed,     // ObjC ivar expansion not allowed
95254721Semaste        eExpressionPathScanEndReasonRangeOperatorNotAllowed,   // [] not allowed by options
96254721Semaste        eExpressionPathScanEndReasonRangeOperatorInvalid,      // [] not valid on objects other than scalars, pointers or arrays
97254721Semaste        eExpressionPathScanEndReasonArrayRangeOperatorMet,     // [] is good for arrays, but I cannot parse it
98254721Semaste        eExpressionPathScanEndReasonBitfieldRangeOperatorMet,  // [] is good for bitfields, but I cannot parse after it
99254721Semaste        eExpressionPathScanEndReasonUnexpectedSymbol,          // something is malformed in the expression
100254721Semaste        eExpressionPathScanEndReasonTakingAddressFailed,       // impossible to apply & operator
101254721Semaste        eExpressionPathScanEndReasonDereferencingFailed,       // impossible to apply * operator
102254721Semaste        eExpressionPathScanEndReasonRangeOperatorExpanded,     // [] was expanded into a VOList
103254721Semaste        eExpressionPathScanEndReasonSyntheticValueMissing,     // getting the synthetic children failed
104254721Semaste        eExpressionPathScanEndReasonUnknown = 0xFFFF
105254721Semaste    };
106254721Semaste
107254721Semaste    enum ExpressionPathEndResultType
108254721Semaste    {
109254721Semaste        eExpressionPathEndResultTypePlain = 1,                 // anything but...
110254721Semaste        eExpressionPathEndResultTypeBitfield,                  // a bitfield
111254721Semaste        eExpressionPathEndResultTypeBoundedRange,              // a range [low-high]
112254721Semaste        eExpressionPathEndResultTypeUnboundedRange,            // a range []
113254721Semaste        eExpressionPathEndResultTypeValueObjectList,           // several items in a VOList
114254721Semaste        eExpressionPathEndResultTypeInvalid = 0xFFFF
115254721Semaste    };
116254721Semaste
117254721Semaste    enum ExpressionPathAftermath
118254721Semaste    {
119254721Semaste        eExpressionPathAftermathNothing = 1,               // just return it
120254721Semaste        eExpressionPathAftermathDereference,               // dereference the target
121254721Semaste        eExpressionPathAftermathTakeAddress                // take target's address
122254721Semaste    };
123254721Semaste
124254721Semaste    enum ClearUserVisibleDataItems
125254721Semaste    {
126254721Semaste        eClearUserVisibleDataItemsNothing = 1u << 0,
127254721Semaste        eClearUserVisibleDataItemsValue = 1u << 1,
128254721Semaste        eClearUserVisibleDataItemsSummary = 1u << 2,
129254721Semaste        eClearUserVisibleDataItemsLocation = 1u << 3,
130254721Semaste        eClearUserVisibleDataItemsDescription = 1u << 4,
131254721Semaste        eClearUserVisibleDataItemsSyntheticChildren = 1u << 5,
132254721Semaste        eClearUserVisibleDataItemsAllStrings = eClearUserVisibleDataItemsValue | eClearUserVisibleDataItemsSummary | eClearUserVisibleDataItemsLocation | eClearUserVisibleDataItemsDescription,
133254721Semaste        eClearUserVisibleDataItemsAll = 0xFFFF
134254721Semaste    };
135254721Semaste
136254721Semaste    struct GetValueForExpressionPathOptions
137254721Semaste    {
138254721Semaste        bool m_check_dot_vs_arrow_syntax;
139254721Semaste        bool m_no_fragile_ivar;
140254721Semaste        bool m_allow_bitfields_syntax;
141254721Semaste        bool m_no_synthetic_children;
142254721Semaste
143254721Semaste        GetValueForExpressionPathOptions(bool dot = false,
144254721Semaste                                         bool no_ivar = false,
145254721Semaste                                         bool bitfield = true,
146254721Semaste                                         bool no_synth = false) :
147254721Semaste            m_check_dot_vs_arrow_syntax(dot),
148254721Semaste            m_no_fragile_ivar(no_ivar),
149254721Semaste            m_allow_bitfields_syntax(bitfield),
150254721Semaste            m_no_synthetic_children(no_synth)
151254721Semaste        {
152254721Semaste        }
153254721Semaste
154254721Semaste        GetValueForExpressionPathOptions&
155254721Semaste        DoCheckDotVsArrowSyntax()
156254721Semaste        {
157254721Semaste            m_check_dot_vs_arrow_syntax = true;
158254721Semaste            return *this;
159254721Semaste        }
160254721Semaste
161254721Semaste        GetValueForExpressionPathOptions&
162254721Semaste        DontCheckDotVsArrowSyntax()
163254721Semaste        {
164254721Semaste            m_check_dot_vs_arrow_syntax = false;
165254721Semaste            return *this;
166254721Semaste        }
167254721Semaste
168254721Semaste        GetValueForExpressionPathOptions&
169254721Semaste        DoAllowFragileIVar()
170254721Semaste        {
171254721Semaste            m_no_fragile_ivar = false;
172254721Semaste            return *this;
173254721Semaste        }
174254721Semaste
175254721Semaste        GetValueForExpressionPathOptions&
176254721Semaste        DontAllowFragileIVar()
177254721Semaste        {
178254721Semaste            m_no_fragile_ivar = true;
179254721Semaste            return *this;
180254721Semaste        }
181254721Semaste
182254721Semaste        GetValueForExpressionPathOptions&
183254721Semaste        DoAllowBitfieldSyntax()
184254721Semaste        {
185254721Semaste            m_allow_bitfields_syntax = true;
186254721Semaste            return *this;
187254721Semaste        }
188254721Semaste
189254721Semaste        GetValueForExpressionPathOptions&
190254721Semaste        DontAllowBitfieldSyntax()
191254721Semaste        {
192254721Semaste            m_allow_bitfields_syntax = false;
193254721Semaste            return *this;
194254721Semaste        }
195254721Semaste
196254721Semaste        GetValueForExpressionPathOptions&
197254721Semaste        DoAllowSyntheticChildren()
198254721Semaste        {
199254721Semaste            m_no_synthetic_children = false;
200254721Semaste            return *this;
201254721Semaste        }
202254721Semaste
203254721Semaste        GetValueForExpressionPathOptions&
204254721Semaste        DontAllowSyntheticChildren()
205254721Semaste        {
206254721Semaste            m_no_synthetic_children = true;
207254721Semaste            return *this;
208254721Semaste        }
209254721Semaste
210254721Semaste        static const GetValueForExpressionPathOptions
211254721Semaste        DefaultOptions()
212254721Semaste        {
213254721Semaste            static GetValueForExpressionPathOptions g_default_options;
214254721Semaste
215254721Semaste            return g_default_options;
216254721Semaste        }
217254721Semaste
218254721Semaste    };
219254721Semaste
220254721Semaste    class EvaluationPoint
221254721Semaste    {
222254721Semaste    public:
223254721Semaste
224254721Semaste        EvaluationPoint ();
225254721Semaste
226254721Semaste        EvaluationPoint (ExecutionContextScope *exe_scope, bool use_selected = false);
227254721Semaste
228254721Semaste        EvaluationPoint (const EvaluationPoint &rhs);
229254721Semaste
230254721Semaste        ~EvaluationPoint ();
231254721Semaste
232254721Semaste        const ExecutionContextRef &
233254721Semaste        GetExecutionContextRef() const
234254721Semaste        {
235254721Semaste            return m_exe_ctx_ref;
236254721Semaste        }
237254721Semaste
238254721Semaste        // Set the EvaluationPoint to the values in exe_scope,
239254721Semaste        // Return true if the Evaluation Point changed.
240254721Semaste        // Since the ExecutionContextScope is always going to be valid currently,
241254721Semaste        // the Updated Context will also always be valid.
242254721Semaste
243254721Semaste//        bool
244254721Semaste//        SetContext (ExecutionContextScope *exe_scope);
245254721Semaste
246254721Semaste        void
247254721Semaste        SetIsConstant ()
248254721Semaste        {
249254721Semaste            SetUpdated();
250254721Semaste            m_mod_id.SetInvalid();
251254721Semaste        }
252254721Semaste
253254721Semaste        bool
254254721Semaste        IsConstant () const
255254721Semaste        {
256254721Semaste            return !m_mod_id.IsValid();
257254721Semaste        }
258254721Semaste
259254721Semaste        ProcessModID
260254721Semaste        GetModID () const
261254721Semaste        {
262254721Semaste            return m_mod_id;
263254721Semaste        }
264254721Semaste
265254721Semaste        void
266254721Semaste        SetUpdateID (ProcessModID new_id)
267254721Semaste        {
268254721Semaste            m_mod_id = new_id;
269254721Semaste        }
270254721Semaste
271254721Semaste        bool
272254721Semaste        IsFirstEvaluation () const
273254721Semaste        {
274254721Semaste            return m_first_update;
275254721Semaste        }
276254721Semaste
277254721Semaste        void
278254721Semaste        SetNeedsUpdate ()
279254721Semaste        {
280254721Semaste            m_needs_update = true;
281254721Semaste        }
282254721Semaste
283254721Semaste        void
284254721Semaste        SetUpdated ();
285254721Semaste
286254721Semaste        bool
287254721Semaste        NeedsUpdating()
288254721Semaste        {
289254721Semaste            SyncWithProcessState();
290254721Semaste            return m_needs_update;
291254721Semaste        }
292254721Semaste
293254721Semaste        bool
294254721Semaste        IsValid ()
295254721Semaste        {
296254721Semaste            if (!m_mod_id.IsValid())
297254721Semaste                return false;
298254721Semaste            else if (SyncWithProcessState ())
299254721Semaste            {
300254721Semaste                if (!m_mod_id.IsValid())
301254721Semaste                    return false;
302254721Semaste            }
303254721Semaste            return true;
304254721Semaste        }
305254721Semaste
306254721Semaste        void
307254721Semaste        SetInvalid ()
308254721Semaste        {
309254721Semaste            // Use the stop id to mark us as invalid, leave the thread id and the stack id around for logging and
310254721Semaste            // history purposes.
311254721Semaste            m_mod_id.SetInvalid();
312254721Semaste
313254721Semaste            // Can't update an invalid state.
314254721Semaste            m_needs_update = false;
315254721Semaste
316254721Semaste        }
317254721Semaste
318254721Semaste    private:
319254721Semaste        bool
320254721Semaste        SyncWithProcessState ();
321254721Semaste
322254721Semaste        ProcessModID m_mod_id; // This is the stop id when this ValueObject was last evaluated.
323254721Semaste        ExecutionContextRef m_exe_ctx_ref;
324254721Semaste        bool m_needs_update;
325254721Semaste        bool m_first_update;
326254721Semaste    };
327254721Semaste
328254721Semaste    const EvaluationPoint &
329254721Semaste    GetUpdatePoint () const
330254721Semaste    {
331254721Semaste        return m_update_point;
332254721Semaste    }
333254721Semaste
334254721Semaste    EvaluationPoint &
335254721Semaste    GetUpdatePoint ()
336254721Semaste    {
337254721Semaste        return m_update_point;
338254721Semaste    }
339254721Semaste
340254721Semaste    const ExecutionContextRef &
341254721Semaste    GetExecutionContextRef() const
342254721Semaste    {
343254721Semaste        return m_update_point.GetExecutionContextRef();
344254721Semaste    }
345254721Semaste
346254721Semaste    lldb::TargetSP
347254721Semaste    GetTargetSP() const
348254721Semaste    {
349254721Semaste        return m_update_point.GetExecutionContextRef().GetTargetSP();
350254721Semaste    }
351254721Semaste
352254721Semaste    lldb::ProcessSP
353254721Semaste    GetProcessSP() const
354254721Semaste    {
355254721Semaste        return m_update_point.GetExecutionContextRef().GetProcessSP();
356254721Semaste    }
357254721Semaste
358254721Semaste    lldb::ThreadSP
359254721Semaste    GetThreadSP() const
360254721Semaste    {
361254721Semaste        return m_update_point.GetExecutionContextRef().GetThreadSP();
362254721Semaste    }
363254721Semaste
364254721Semaste    lldb::StackFrameSP
365254721Semaste    GetFrameSP() const
366254721Semaste    {
367254721Semaste        return m_update_point.GetExecutionContextRef().GetFrameSP();
368254721Semaste    }
369254721Semaste
370254721Semaste    void
371254721Semaste    SetNeedsUpdate ();
372254721Semaste
373254721Semaste    virtual ~ValueObject();
374254721Semaste
375254721Semaste    ClangASTType
376254721Semaste    GetClangType ();
377263363Semaste
378263363Semaste    // this vends a TypeImpl that is useful at the SB API layer
379263363Semaste    virtual TypeImpl
380263363Semaste    GetTypeImpl ();
381254721Semaste
382254721Semaste    //------------------------------------------------------------------
383254721Semaste    // Sublasses must implement the functions below.
384254721Semaste    //------------------------------------------------------------------
385254721Semaste    virtual uint64_t
386254721Semaste    GetByteSize() = 0;
387254721Semaste
388254721Semaste    virtual lldb::ValueType
389254721Semaste    GetValueType() const = 0;
390254721Semaste
391254721Semaste    //------------------------------------------------------------------
392254721Semaste    // Sublasses can implement the functions below.
393254721Semaste    //------------------------------------------------------------------
394254721Semaste    virtual ConstString
395254721Semaste    GetTypeName();
396254721Semaste
397254721Semaste    virtual ConstString
398254721Semaste    GetQualifiedTypeName();
399254721Semaste
400254721Semaste    virtual lldb::LanguageType
401254721Semaste    GetObjectRuntimeLanguage();
402254721Semaste
403254721Semaste    virtual uint32_t
404254721Semaste    GetTypeInfo (ClangASTType *pointee_or_element_clang_type = NULL);
405254721Semaste
406254721Semaste    virtual bool
407254721Semaste    IsPointerType ();
408254721Semaste
409254721Semaste    virtual bool
410254721Semaste    IsArrayType ();
411254721Semaste
412254721Semaste    virtual bool
413254721Semaste    IsScalarType ();
414254721Semaste
415254721Semaste    virtual bool
416254721Semaste    IsPointerOrReferenceType ();
417254721Semaste
418254721Semaste    virtual bool
419254721Semaste    IsPossibleDynamicType ();
420254721Semaste
421254721Semaste    virtual bool
422254721Semaste    IsObjCNil ();
423254721Semaste
424254721Semaste    virtual bool
425254721Semaste    IsBaseClass ()
426254721Semaste    {
427254721Semaste        return false;
428254721Semaste    }
429254721Semaste
430254721Semaste    virtual bool
431254721Semaste    IsDereferenceOfParent ()
432254721Semaste    {
433254721Semaste        return false;
434254721Semaste    }
435254721Semaste
436254721Semaste    bool
437254721Semaste    IsIntegerType (bool &is_signed);
438254721Semaste
439254721Semaste    virtual bool
440254721Semaste    GetBaseClassPath (Stream &s);
441254721Semaste
442254721Semaste    virtual void
443254721Semaste    GetExpressionPath (Stream &s, bool qualify_cxx_base_classes, GetExpressionPathFormat = eGetExpressionPathFormatDereferencePointers);
444254721Semaste
445254721Semaste    lldb::ValueObjectSP
446254721Semaste    GetValueForExpressionPath(const char* expression,
447254721Semaste                              const char** first_unparsed = NULL,
448254721Semaste                              ExpressionPathScanEndReason* reason_to_stop = NULL,
449254721Semaste                              ExpressionPathEndResultType* final_value_type = NULL,
450254721Semaste                              const GetValueForExpressionPathOptions& options = GetValueForExpressionPathOptions::DefaultOptions(),
451254721Semaste                              ExpressionPathAftermath* final_task_on_target = NULL);
452254721Semaste
453254721Semaste    int
454254721Semaste    GetValuesForExpressionPath(const char* expression,
455254721Semaste                               lldb::ValueObjectListSP& list,
456254721Semaste                               const char** first_unparsed = NULL,
457254721Semaste                               ExpressionPathScanEndReason* reason_to_stop = NULL,
458254721Semaste                               ExpressionPathEndResultType* final_value_type = NULL,
459254721Semaste                               const GetValueForExpressionPathOptions& options = GetValueForExpressionPathOptions::DefaultOptions(),
460254721Semaste                               ExpressionPathAftermath* final_task_on_target = NULL);
461254721Semaste
462254721Semaste    virtual bool
463254721Semaste    IsInScope ()
464254721Semaste    {
465254721Semaste        return true;
466254721Semaste    }
467254721Semaste
468254721Semaste    virtual off_t
469254721Semaste    GetByteOffset()
470254721Semaste    {
471254721Semaste        return 0;
472254721Semaste    }
473254721Semaste
474254721Semaste    virtual uint32_t
475254721Semaste    GetBitfieldBitSize ()
476254721Semaste    {
477254721Semaste        return 0;
478254721Semaste    }
479254721Semaste
480254721Semaste    virtual uint32_t
481254721Semaste    GetBitfieldBitOffset ()
482254721Semaste    {
483254721Semaste        return 0;
484254721Semaste    }
485254721Semaste
486254721Semaste    bool
487254721Semaste    IsBitfield ()
488254721Semaste    {
489254721Semaste        return (GetBitfieldBitSize() != 0) || (GetBitfieldBitOffset() != 0);
490254721Semaste    }
491254721Semaste
492254721Semaste    virtual bool
493254721Semaste    IsArrayItemForPointer()
494254721Semaste    {
495254721Semaste        return m_is_array_item_for_pointer;
496254721Semaste    }
497254721Semaste
498254721Semaste    virtual const char *
499254721Semaste    GetValueAsCString ();
500254721Semaste
501254721Semaste    virtual bool
502269024Semaste    GetValueAsCString (const lldb_private::TypeFormatImpl& format,
503269024Semaste                       std::string& destination);
504269024Semaste
505269024Semaste    bool
506254721Semaste    GetValueAsCString (lldb::Format format,
507254721Semaste                       std::string& destination);
508254721Semaste
509254721Semaste    virtual uint64_t
510254721Semaste    GetValueAsUnsigned (uint64_t fail_value, bool *success = NULL);
511254721Semaste
512263363Semaste    virtual int64_t
513263363Semaste    GetValueAsSigned (int64_t fail_value, bool *success = NULL);
514263363Semaste
515254721Semaste    virtual bool
516254721Semaste    SetValueFromCString (const char *value_str, Error& error);
517254721Semaste
518254721Semaste    // Return the module associated with this value object in case the
519254721Semaste    // value is from an executable file and might have its data in
520254721Semaste    // sections of the file. This can be used for variables.
521254721Semaste    virtual lldb::ModuleSP
522254721Semaste    GetModule();
523254721Semaste
524254721Semaste    virtual ValueObject*
525254721Semaste    GetRoot ();
526254721Semaste
527254721Semaste    virtual bool
528254721Semaste    GetDeclaration (Declaration &decl);
529254721Semaste
530254721Semaste    //------------------------------------------------------------------
531254721Semaste    // The functions below should NOT be modified by sublasses
532254721Semaste    //------------------------------------------------------------------
533254721Semaste    const Error &
534254721Semaste    GetError();
535254721Semaste
536254721Semaste    const ConstString &
537254721Semaste    GetName() const;
538254721Semaste
539254721Semaste    virtual lldb::ValueObjectSP
540254721Semaste    GetChildAtIndex (size_t idx, bool can_create);
541254721Semaste
542254721Semaste    // this will always create the children if necessary
543254721Semaste    lldb::ValueObjectSP
544254721Semaste    GetChildAtIndexPath (const std::initializer_list<size_t> &idxs,
545254721Semaste                         size_t* index_of_error = NULL);
546254721Semaste
547254721Semaste    lldb::ValueObjectSP
548254721Semaste    GetChildAtIndexPath (const std::vector<size_t> &idxs,
549254721Semaste                         size_t* index_of_error = NULL);
550254721Semaste
551254721Semaste    lldb::ValueObjectSP
552254721Semaste    GetChildAtIndexPath (const std::initializer_list< std::pair<size_t, bool> > &idxs,
553254721Semaste                         size_t* index_of_error = NULL);
554254721Semaste
555254721Semaste    lldb::ValueObjectSP
556254721Semaste    GetChildAtIndexPath (const std::vector< std::pair<size_t, bool> > &idxs,
557254721Semaste                         size_t* index_of_error = NULL);
558263363Semaste
559263363Semaste    // this will always create the children if necessary
560263363Semaste    lldb::ValueObjectSP
561263363Semaste    GetChildAtNamePath (const std::initializer_list<ConstString> &names,
562263363Semaste                        ConstString* name_of_error = NULL);
563254721Semaste
564263363Semaste    lldb::ValueObjectSP
565263363Semaste    GetChildAtNamePath (const std::vector<ConstString> &names,
566263363Semaste                        ConstString* name_of_error = NULL);
567263363Semaste
568263363Semaste    lldb::ValueObjectSP
569263363Semaste    GetChildAtNamePath (const std::initializer_list< std::pair<ConstString, bool> > &names,
570263363Semaste                        ConstString* name_of_error = NULL);
571263363Semaste
572263363Semaste    lldb::ValueObjectSP
573263363Semaste    GetChildAtNamePath (const std::vector< std::pair<ConstString, bool> > &names,
574263363Semaste                        ConstString* name_of_error = NULL);
575263363Semaste
576254721Semaste    virtual lldb::ValueObjectSP
577254721Semaste    GetChildMemberWithName (const ConstString &name, bool can_create);
578254721Semaste
579254721Semaste    virtual size_t
580254721Semaste    GetIndexOfChildWithName (const ConstString &name);
581254721Semaste
582254721Semaste    size_t
583254721Semaste    GetNumChildren ();
584254721Semaste
585254721Semaste    const Value &
586254721Semaste    GetValue() const;
587254721Semaste
588254721Semaste    Value &
589254721Semaste    GetValue();
590254721Semaste
591254721Semaste    virtual bool
592254721Semaste    ResolveValue (Scalar &scalar);
593254721Semaste
594254721Semaste    virtual const char *
595254721Semaste    GetLocationAsCString ();
596254721Semaste
597254721Semaste    const char *
598254721Semaste    GetSummaryAsCString ();
599254721Semaste
600254721Semaste    bool
601254721Semaste    GetSummaryAsCString (TypeSummaryImpl* summary_ptr,
602254721Semaste                         std::string& destination);
603254721Semaste
604254721Semaste    const char *
605254721Semaste    GetObjectDescription ();
606254721Semaste
607254721Semaste    bool
608254721Semaste    HasSpecialPrintableRepresentation (ValueObjectRepresentationStyle val_obj_display,
609254721Semaste                                       lldb::Format custom_format);
610254721Semaste
611254721Semaste    enum PrintableRepresentationSpecialCases
612254721Semaste    {
613254721Semaste        ePrintableRepresentationSpecialCasesDisable = 0,
614254721Semaste        ePrintableRepresentationSpecialCasesAllow = 1,
615254721Semaste        ePrintableRepresentationSpecialCasesOnly = 3
616254721Semaste    };
617254721Semaste
618254721Semaste    bool
619254721Semaste    DumpPrintableRepresentation (Stream& s,
620254721Semaste                                 ValueObjectRepresentationStyle val_obj_display = eValueObjectRepresentationStyleSummary,
621254721Semaste                                 lldb::Format custom_format = lldb::eFormatInvalid,
622269024Semaste                                 PrintableRepresentationSpecialCases special = ePrintableRepresentationSpecialCasesAllow,
623269024Semaste                                 bool do_dump_error = true);
624254721Semaste    bool
625254721Semaste    GetValueIsValid () const;
626254721Semaste
627254721Semaste    bool
628254721Semaste    GetValueDidChange ();
629254721Semaste
630254721Semaste    bool
631254721Semaste    UpdateValueIfNeeded (bool update_format = true);
632254721Semaste
633254721Semaste    bool
634254721Semaste    UpdateFormatsIfNeeded();
635254721Semaste
636254721Semaste    lldb::ValueObjectSP
637254721Semaste    GetSP ()
638254721Semaste    {
639254721Semaste        return m_manager->GetSharedPointer(this);
640254721Semaste    }
641254721Semaste
642254721Semaste    void
643254721Semaste    SetName (const ConstString &name);
644254721Semaste
645254721Semaste    virtual lldb::addr_t
646254721Semaste    GetAddressOf (bool scalar_is_load_address = true,
647254721Semaste                  AddressType *address_type = NULL);
648254721Semaste
649254721Semaste    lldb::addr_t
650254721Semaste    GetPointerValue (AddressType *address_type = NULL);
651254721Semaste
652254721Semaste    lldb::ValueObjectSP
653254721Semaste    GetSyntheticChild (const ConstString &key) const;
654254721Semaste
655254721Semaste    lldb::ValueObjectSP
656254721Semaste    GetSyntheticArrayMember (size_t index, bool can_create);
657254721Semaste
658254721Semaste    lldb::ValueObjectSP
659254721Semaste    GetSyntheticArrayMemberFromPointer (size_t index, bool can_create);
660254721Semaste
661254721Semaste    lldb::ValueObjectSP
662254721Semaste    GetSyntheticArrayMemberFromArray (size_t index, bool can_create);
663254721Semaste
664254721Semaste    lldb::ValueObjectSP
665254721Semaste    GetSyntheticBitFieldChild (uint32_t from, uint32_t to, bool can_create);
666254721Semaste
667254721Semaste    lldb::ValueObjectSP
668254721Semaste    GetSyntheticExpressionPathChild(const char* expression, bool can_create);
669254721Semaste
670254721Semaste    virtual lldb::ValueObjectSP
671254721Semaste    GetSyntheticChildAtOffset(uint32_t offset, const ClangASTType& type, bool can_create);
672254721Semaste
673254721Semaste    virtual lldb::ValueObjectSP
674254721Semaste    GetDynamicValue (lldb::DynamicValueType valueType);
675254721Semaste
676254721Semaste    lldb::DynamicValueType
677254721Semaste    GetDynamicValueType ();
678254721Semaste
679254721Semaste    virtual lldb::ValueObjectSP
680254721Semaste    GetStaticValue ();
681254721Semaste
682254721Semaste    virtual lldb::ValueObjectSP
683254721Semaste    GetNonSyntheticValue ();
684254721Semaste
685254721Semaste    lldb::ValueObjectSP
686254721Semaste    GetSyntheticValue (bool use_synthetic = true);
687254721Semaste
688254721Semaste    virtual bool
689254721Semaste    HasSyntheticValue();
690254721Semaste
691254721Semaste    virtual bool
692254721Semaste    IsSynthetic() { return false; }
693254721Semaste
694254721Semaste    virtual lldb::ValueObjectSP
695254721Semaste    CreateConstantValue (const ConstString &name);
696254721Semaste
697254721Semaste    virtual lldb::ValueObjectSP
698254721Semaste    Dereference (Error &error);
699254721Semaste
700254721Semaste    virtual lldb::ValueObjectSP
701254721Semaste    AddressOf (Error &error);
702254721Semaste
703254721Semaste    virtual lldb::addr_t
704254721Semaste    GetLiveAddress()
705254721Semaste    {
706254721Semaste        return LLDB_INVALID_ADDRESS;
707254721Semaste    }
708254721Semaste
709254721Semaste    virtual void
710254721Semaste    SetLiveAddress(lldb::addr_t addr = LLDB_INVALID_ADDRESS,
711254721Semaste                   AddressType address_type = eAddressTypeLoad)
712254721Semaste    {
713254721Semaste    }
714254721Semaste
715254721Semaste    virtual lldb::ValueObjectSP
716254721Semaste    Cast (const ClangASTType &clang_ast_type);
717254721Semaste
718254721Semaste    virtual lldb::ValueObjectSP
719254721Semaste    CastPointerType (const char *name,
720254721Semaste                     ClangASTType &ast_type);
721254721Semaste
722254721Semaste    virtual lldb::ValueObjectSP
723254721Semaste    CastPointerType (const char *name,
724254721Semaste                     lldb::TypeSP &type_sp);
725254721Semaste
726254721Semaste    // The backing bits of this value object were updated, clear any
727254721Semaste    // descriptive string, so we know we have to refetch them
728254721Semaste    virtual void
729254721Semaste    ValueUpdated ()
730254721Semaste    {
731254721Semaste        ClearUserVisibleData(eClearUserVisibleDataItemsValue |
732254721Semaste                             eClearUserVisibleDataItemsSummary |
733254721Semaste                             eClearUserVisibleDataItemsDescription);
734254721Semaste    }
735254721Semaste
736254721Semaste    virtual bool
737254721Semaste    IsDynamic ()
738254721Semaste    {
739254721Semaste        return false;
740254721Semaste    }
741254721Semaste
742254721Semaste    virtual SymbolContextScope *
743254721Semaste    GetSymbolContextScope();
744254721Semaste
745263363Semaste    void
746263363Semaste    Dump (Stream &s);
747263363Semaste
748263363Semaste    void
749263363Semaste    Dump (Stream &s,
750263363Semaste          const DumpValueObjectOptions& options);
751254721Semaste
752254721Semaste    static lldb::ValueObjectSP
753254721Semaste    CreateValueObjectFromExpression (const char* name,
754254721Semaste                                     const char* expression,
755254721Semaste                                     const ExecutionContext& exe_ctx);
756254721Semaste
757254721Semaste    static lldb::ValueObjectSP
758254721Semaste    CreateValueObjectFromAddress (const char* name,
759254721Semaste                                  uint64_t address,
760254721Semaste                                  const ExecutionContext& exe_ctx,
761254721Semaste                                  ClangASTType type);
762254721Semaste
763254721Semaste    static lldb::ValueObjectSP
764254721Semaste    CreateValueObjectFromData (const char* name,
765254721Semaste                               DataExtractor& data,
766254721Semaste                               const ExecutionContext& exe_ctx,
767254721Semaste                               ClangASTType type);
768254721Semaste
769263363Semaste    void
770263363Semaste    LogValueObject (Log *log);
771254721Semaste
772263363Semaste    void
773254721Semaste    LogValueObject (Log *log,
774254721Semaste                    const DumpValueObjectOptions& options);
775254721Semaste
776254721Semaste
777254721Semaste    // returns true if this is a char* or a char[]
778254721Semaste    // if it is a char* and check_pointer is true,
779254721Semaste    // it also checks that the pointer is valid
780254721Semaste    bool
781254721Semaste    IsCStringContainer (bool check_pointer = false);
782254721Semaste
783254721Semaste    size_t
784254721Semaste    ReadPointedString (Stream& s,
785254721Semaste                       Error& error,
786254721Semaste                       uint32_t max_length = 0,
787254721Semaste                       bool honor_array = true,
788254721Semaste                       lldb::Format item_format = lldb::eFormatCharArray);
789254721Semaste
790254721Semaste    virtual size_t
791254721Semaste    GetPointeeData (DataExtractor& data,
792254721Semaste                    uint32_t item_idx = 0,
793254721Semaste					uint32_t item_count = 1);
794254721Semaste
795254721Semaste    virtual uint64_t
796254721Semaste    GetData (DataExtractor& data);
797254721Semaste
798254721Semaste    virtual bool
799254721Semaste    SetData (DataExtractor &data, Error &error);
800254721Semaste
801254721Semaste    bool
802254721Semaste    GetIsConstant () const
803254721Semaste    {
804254721Semaste        return m_update_point.IsConstant();
805254721Semaste    }
806254721Semaste
807254721Semaste    void
808254721Semaste    SetIsConstant ()
809254721Semaste    {
810254721Semaste        m_update_point.SetIsConstant();
811254721Semaste    }
812254721Semaste
813254721Semaste    lldb::Format
814254721Semaste    GetFormat () const;
815254721Semaste
816254721Semaste    void
817254721Semaste    SetFormat (lldb::Format format)
818254721Semaste    {
819254721Semaste        if (format != m_format)
820254721Semaste            ClearUserVisibleData(eClearUserVisibleDataItemsValue);
821254721Semaste        m_format = format;
822254721Semaste    }
823254721Semaste
824254721Semaste    lldb::TypeSummaryImplSP
825254721Semaste    GetSummaryFormat()
826254721Semaste    {
827254721Semaste        UpdateFormatsIfNeeded();
828254721Semaste        return m_type_summary_sp;
829254721Semaste    }
830254721Semaste
831254721Semaste    void
832254721Semaste    SetSummaryFormat(lldb::TypeSummaryImplSP format)
833254721Semaste    {
834254721Semaste        m_type_summary_sp = format;
835254721Semaste        ClearUserVisibleData(eClearUserVisibleDataItemsSummary);
836254721Semaste    }
837254721Semaste
838254721Semaste    void
839254721Semaste    SetValueFormat(lldb::TypeFormatImplSP format)
840254721Semaste    {
841254721Semaste        m_type_format_sp = format;
842254721Semaste        ClearUserVisibleData(eClearUserVisibleDataItemsValue);
843254721Semaste    }
844254721Semaste
845254721Semaste    lldb::TypeFormatImplSP
846254721Semaste    GetValueFormat()
847254721Semaste    {
848254721Semaste        UpdateFormatsIfNeeded();
849254721Semaste        return m_type_format_sp;
850254721Semaste    }
851254721Semaste
852254721Semaste    void
853254721Semaste    SetSyntheticChildren(const lldb::SyntheticChildrenSP &synth_sp)
854254721Semaste    {
855254721Semaste        if (synth_sp.get() == m_synthetic_children_sp.get())
856254721Semaste            return;
857254721Semaste        ClearUserVisibleData(eClearUserVisibleDataItemsSyntheticChildren);
858254721Semaste        m_synthetic_children_sp = synth_sp;
859254721Semaste    }
860254721Semaste
861254721Semaste    lldb::SyntheticChildrenSP
862254721Semaste    GetSyntheticChildren()
863254721Semaste    {
864254721Semaste        UpdateFormatsIfNeeded();
865254721Semaste        return m_synthetic_children_sp;
866254721Semaste    }
867254721Semaste
868254721Semaste    // Use GetParent for display purposes, but if you want to tell the parent to update itself
869254721Semaste    // then use m_parent.  The ValueObjectDynamicValue's parent is not the correct parent for
870254721Semaste    // displaying, they are really siblings, so for display it needs to route through to its grandparent.
871254721Semaste    virtual ValueObject *
872254721Semaste    GetParent()
873254721Semaste    {
874254721Semaste        return m_parent;
875254721Semaste    }
876254721Semaste
877254721Semaste    virtual const ValueObject *
878254721Semaste    GetParent() const
879254721Semaste    {
880254721Semaste        return m_parent;
881254721Semaste    }
882254721Semaste
883254721Semaste    ValueObject *
884254721Semaste    GetNonBaseClassParent();
885254721Semaste
886254721Semaste    void
887254721Semaste    SetAddressTypeOfChildren(AddressType at)
888254721Semaste    {
889254721Semaste        m_address_type_of_ptr_or_ref_children = at;
890254721Semaste    }
891254721Semaste
892254721Semaste    AddressType
893254721Semaste    GetAddressTypeOfChildren();
894254721Semaste
895254721Semaste    void
896254721Semaste    SetHasCompleteType()
897254721Semaste    {
898254721Semaste        m_did_calculate_complete_objc_class_type = true;
899254721Semaste    }
900254721Semaste
901254721Semaste    //------------------------------------------------------------------
902254721Semaste    /// Find out if a ValueObject might have children.
903254721Semaste    ///
904254721Semaste    /// This call is much more efficient than CalculateNumChildren() as
905254721Semaste    /// it doesn't need to complete the underlying type. This is designed
906254721Semaste    /// to be used in a UI environment in order to detect if the
907254721Semaste    /// disclosure triangle should be displayed or not.
908254721Semaste    ///
909254721Semaste    /// This function returns true for class, union, structure,
910254721Semaste    /// pointers, references, arrays and more. Again, it does so without
911254721Semaste    /// doing any expensive type completion.
912254721Semaste    ///
913254721Semaste    /// @return
914254721Semaste    ///     Returns \b true if the ValueObject might have children, or \b
915254721Semaste    ///     false otherwise.
916254721Semaste    //------------------------------------------------------------------
917254721Semaste    virtual bool
918254721Semaste    MightHaveChildren();
919254721Semaste
920254721Semasteprotected:
921254721Semaste    typedef ClusterManager<ValueObject> ValueObjectManager;
922254721Semaste
923254721Semaste    class ChildrenManager
924254721Semaste    {
925254721Semaste    public:
926254721Semaste        ChildrenManager() :
927254721Semaste            m_mutex(Mutex::eMutexTypeRecursive),
928254721Semaste            m_children(),
929254721Semaste            m_children_count(0)
930254721Semaste        {}
931254721Semaste
932254721Semaste        bool
933254721Semaste        HasChildAtIndex (size_t idx)
934254721Semaste        {
935254721Semaste            Mutex::Locker locker(m_mutex);
936254721Semaste            ChildrenIterator iter = m_children.find(idx);
937254721Semaste            ChildrenIterator end = m_children.end();
938254721Semaste            return (iter != end);
939254721Semaste        }
940254721Semaste
941254721Semaste        ValueObject*
942254721Semaste        GetChildAtIndex (size_t idx)
943254721Semaste        {
944254721Semaste            Mutex::Locker locker(m_mutex);
945254721Semaste            ChildrenIterator iter = m_children.find(idx);
946254721Semaste            ChildrenIterator end = m_children.end();
947254721Semaste            if (iter == end)
948254721Semaste                return NULL;
949254721Semaste            else
950254721Semaste                return iter->second;
951254721Semaste        }
952254721Semaste
953254721Semaste        void
954254721Semaste        SetChildAtIndex (size_t idx, ValueObject* valobj)
955254721Semaste        {
956254721Semaste            ChildrenPair pair(idx,valobj); // we do not need to be mutex-protected to make a pair
957254721Semaste            Mutex::Locker locker(m_mutex);
958254721Semaste            m_children.insert(pair);
959254721Semaste        }
960254721Semaste
961254721Semaste        void
962254721Semaste        SetChildrenCount (size_t count)
963254721Semaste        {
964254721Semaste            m_children_count = count;
965254721Semaste        }
966254721Semaste
967254721Semaste        size_t
968254721Semaste        GetChildrenCount ()
969254721Semaste        {
970254721Semaste            return m_children_count;
971254721Semaste        }
972254721Semaste
973254721Semaste        void
974254721Semaste        Clear()
975254721Semaste        {
976254721Semaste            m_children_count = 0;
977254721Semaste            Mutex::Locker locker(m_mutex);
978254721Semaste            m_children.clear();
979254721Semaste        }
980254721Semaste
981254721Semaste    private:
982254721Semaste        typedef std::map<size_t, ValueObject*> ChildrenMap;
983254721Semaste        typedef ChildrenMap::iterator ChildrenIterator;
984254721Semaste        typedef ChildrenMap::value_type ChildrenPair;
985254721Semaste        Mutex m_mutex;
986254721Semaste        ChildrenMap m_children;
987254721Semaste        size_t m_children_count;
988254721Semaste    };
989254721Semaste
990254721Semaste    //------------------------------------------------------------------
991254721Semaste    // Classes that inherit from ValueObject can see and modify these
992254721Semaste    //------------------------------------------------------------------
993254721Semaste    ValueObject  *      m_parent;       // The parent value object, or NULL if this has no parent
994254721Semaste    ValueObject  *      m_root;         // The root of the hierarchy for this ValueObject (or NULL if never calculated)
995254721Semaste    EvaluationPoint     m_update_point; // Stores both the stop id and the full context at which this value was last
996254721Semaste                                        // updated.  When we are asked to update the value object, we check whether
997254721Semaste                                        // the context & stop id are the same before updating.
998254721Semaste    ConstString         m_name;         // The name of this object
999254721Semaste    DataExtractor       m_data;         // A data extractor that can be used to extract the value.
1000254721Semaste    Value               m_value;
1001254721Semaste    Error               m_error;        // An error object that can describe any errors that occur when updating values.
1002254721Semaste    std::string         m_value_str;    // Cached value string that will get cleared if/when the value is updated.
1003254721Semaste    std::string         m_old_value_str;// Cached old value string from the last time the value was gotten
1004254721Semaste    std::string         m_location_str; // Cached location string that will get cleared if/when the value is updated.
1005254721Semaste    std::string         m_summary_str;  // Cached summary string that will get cleared if/when the value is updated.
1006254721Semaste    std::string         m_object_desc_str; // Cached result of the "object printer".  This differs from the summary
1007254721Semaste                                              // in that the summary is consed up by us, the object_desc_string is builtin.
1008254721Semaste
1009254721Semaste    ClangASTType        m_override_type;// If the type of the value object should be overridden, the type to impose.
1010254721Semaste
1011254721Semaste    ValueObjectManager *m_manager;      // This object is managed by the root object (any ValueObject that gets created
1012254721Semaste                                        // without a parent.)  The manager gets passed through all the generations of
1013254721Semaste                                        // dependent objects, and will keep the whole cluster of objects alive as long
1014254721Semaste                                        // as a shared pointer to any of them has been handed out.  Shared pointers to
1015254721Semaste                                        // value objects must always be made with the GetSP method.
1016254721Semaste
1017254721Semaste    ChildrenManager                      m_children;
1018254721Semaste    std::map<ConstString, ValueObject *> m_synthetic_children;
1019254721Semaste
1020254721Semaste    ValueObject*                         m_dynamic_value;
1021254721Semaste    ValueObject*                         m_synthetic_value;
1022254721Semaste    ValueObject*                         m_deref_valobj;
1023254721Semaste
1024254721Semaste    lldb::ValueObjectSP m_addr_of_valobj_sp; // We have to hold onto a shared pointer to this one because it is created
1025254721Semaste                                             // as an independent ValueObjectConstResult, which isn't managed by us.
1026254721Semaste
1027254721Semaste    lldb::Format                m_format;
1028254721Semaste    lldb::Format                m_last_format;
1029254721Semaste    uint32_t                    m_last_format_mgr_revision;
1030254721Semaste    lldb::TypeSummaryImplSP     m_type_summary_sp;
1031254721Semaste    lldb::TypeFormatImplSP      m_type_format_sp;
1032254721Semaste    lldb::SyntheticChildrenSP   m_synthetic_children_sp;
1033254721Semaste    ProcessModID                m_user_id_of_forced_summary;
1034254721Semaste    AddressType                 m_address_type_of_ptr_or_ref_children;
1035254721Semaste
1036254721Semaste    bool                m_value_is_valid:1,
1037254721Semaste                        m_value_did_change:1,
1038254721Semaste                        m_children_count_valid:1,
1039254721Semaste                        m_old_value_valid:1,
1040254721Semaste                        m_is_deref_of_parent:1,
1041254721Semaste                        m_is_array_item_for_pointer:1,
1042254721Semaste                        m_is_bitfield_for_scalar:1,
1043254721Semaste                        m_is_child_at_offset:1,
1044254721Semaste                        m_is_getting_summary:1,
1045254721Semaste                        m_did_calculate_complete_objc_class_type:1;
1046254721Semaste
1047254721Semaste    friend class ClangExpressionDeclMap;  // For GetValue
1048254721Semaste    friend class ClangExpressionVariable; // For SetName
1049254721Semaste    friend class Target;                  // For SetName
1050254721Semaste    friend class ValueObjectConstResultImpl;
1051254721Semaste
1052254721Semaste    //------------------------------------------------------------------
1053254721Semaste    // Constructors and Destructors
1054254721Semaste    //------------------------------------------------------------------
1055254721Semaste
1056254721Semaste    // Use the no-argument constructor to make a constant variable object (with no ExecutionContextScope.)
1057254721Semaste
1058254721Semaste    ValueObject();
1059254721Semaste
1060254721Semaste    // Use this constructor to create a "root variable object".  The ValueObject will be locked to this context
1061254721Semaste    // through-out its lifespan.
1062254721Semaste
1063254721Semaste    ValueObject (ExecutionContextScope *exe_scope,
1064254721Semaste                 AddressType child_ptr_or_ref_addr_type = eAddressTypeLoad);
1065254721Semaste
1066254721Semaste    // Use this constructor to create a ValueObject owned by another ValueObject.  It will inherit the ExecutionContext
1067254721Semaste    // of its parent.
1068254721Semaste
1069254721Semaste    ValueObject (ValueObject &parent);
1070254721Semaste
1071254721Semaste    ValueObjectManager *
1072254721Semaste    GetManager()
1073254721Semaste    {
1074254721Semaste        return m_manager;
1075254721Semaste    }
1076254721Semaste
1077254721Semaste    virtual bool
1078254721Semaste    UpdateValue () = 0;
1079254721Semaste
1080254721Semaste    virtual void
1081254721Semaste    CalculateDynamicValue (lldb::DynamicValueType use_dynamic);
1082254721Semaste
1083254721Semaste    virtual lldb::DynamicValueType
1084254721Semaste    GetDynamicValueTypeImpl ()
1085254721Semaste    {
1086254721Semaste        return lldb::eNoDynamicValues;
1087254721Semaste    }
1088254721Semaste
1089254721Semaste    virtual bool
1090254721Semaste    HasDynamicValueTypeInfo ()
1091254721Semaste    {
1092254721Semaste        return false;
1093254721Semaste    }
1094254721Semaste
1095254721Semaste    virtual void
1096254721Semaste    CalculateSyntheticValue (bool use_synthetic = true);
1097254721Semaste
1098254721Semaste    // Should only be called by ValueObject::GetChildAtIndex()
1099254721Semaste    // Returns a ValueObject managed by this ValueObject's manager.
1100254721Semaste    virtual ValueObject *
1101254721Semaste    CreateChildAtIndex (size_t idx, bool synthetic_array_member, int32_t synthetic_index);
1102254721Semaste
1103254721Semaste    // Should only be called by ValueObject::GetNumChildren()
1104254721Semaste    virtual size_t
1105254721Semaste    CalculateNumChildren() = 0;
1106254721Semaste
1107254721Semaste    void
1108254721Semaste    SetNumChildren (size_t num_children);
1109254721Semaste
1110254721Semaste    void
1111254721Semaste    SetValueDidChange (bool value_changed);
1112254721Semaste
1113254721Semaste    void
1114254721Semaste    SetValueIsValid (bool valid);
1115254721Semaste
1116254721Semaste    void
1117254721Semaste    ClearUserVisibleData(uint32_t items = ValueObject::eClearUserVisibleDataItemsAllStrings);
1118254721Semaste
1119254721Semaste    void
1120254721Semaste    AddSyntheticChild (const ConstString &key,
1121254721Semaste                       ValueObject *valobj);
1122254721Semaste
1123254721Semaste    DataExtractor &
1124254721Semaste    GetDataExtractor ();
1125254721Semaste
1126254721Semaste    void
1127254721Semaste    ClearDynamicTypeInformation ();
1128254721Semaste
1129254721Semaste    //------------------------------------------------------------------
1130254721Semaste    // Sublasses must implement the functions below.
1131254721Semaste    //------------------------------------------------------------------
1132254721Semaste
1133254721Semaste    virtual ClangASTType
1134254721Semaste    GetClangTypeImpl () = 0;
1135254721Semaste
1136254721Semaste    const char *
1137254721Semaste    GetLocationAsCStringImpl (const Value& value,
1138254721Semaste                              const DataExtractor& data);
1139254721Semaste
1140254721Semasteprivate:
1141254721Semaste    //------------------------------------------------------------------
1142254721Semaste    // For ValueObject only
1143254721Semaste    //------------------------------------------------------------------
1144254721Semaste
1145254721Semaste    virtual ClangASTType
1146254721Semaste    MaybeCalculateCompleteType ();
1147254721Semaste
1148254721Semaste    lldb::ValueObjectSP
1149254721Semaste    GetValueForExpressionPath_Impl(const char* expression_cstr,
1150254721Semaste                                   const char** first_unparsed,
1151254721Semaste                                   ExpressionPathScanEndReason* reason_to_stop,
1152254721Semaste                                   ExpressionPathEndResultType* final_value_type,
1153254721Semaste                                   const GetValueForExpressionPathOptions& options,
1154254721Semaste                                   ExpressionPathAftermath* final_task_on_target);
1155254721Semaste
1156254721Semaste    // this method will ONLY expand [] expressions into a VOList and return
1157254721Semaste    // the number of elements it added to the VOList
1158254721Semaste    // it will NOT loop through expanding the follow-up of the expression_cstr
1159254721Semaste    // for all objects in the list
1160254721Semaste    int
1161254721Semaste    ExpandArraySliceExpression(const char* expression_cstr,
1162254721Semaste                               const char** first_unparsed,
1163254721Semaste                               lldb::ValueObjectSP root,
1164254721Semaste                               lldb::ValueObjectListSP& list,
1165254721Semaste                               ExpressionPathScanEndReason* reason_to_stop,
1166254721Semaste                               ExpressionPathEndResultType* final_value_type,
1167254721Semaste                               const GetValueForExpressionPathOptions& options,
1168254721Semaste                               ExpressionPathAftermath* final_task_on_target);
1169254721Semaste
1170254721Semaste
1171254721Semaste    DISALLOW_COPY_AND_ASSIGN (ValueObject);
1172254721Semaste
1173254721Semaste};
1174254721Semaste
1175254721Semaste} // namespace lldb_private
1176254721Semaste
1177254721Semaste#endif  // liblldb_ValueObject_h_
1178