15ffd83dbSDimitry Andric //===-- SBValue.cpp -------------------------------------------------------===//
2*0b57cec5SDimitry Andric //
3*0b57cec5SDimitry Andric // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4*0b57cec5SDimitry Andric // See https://llvm.org/LICENSE.txt for license information.
5*0b57cec5SDimitry Andric // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6*0b57cec5SDimitry Andric //
7*0b57cec5SDimitry Andric //===----------------------------------------------------------------------===//
8*0b57cec5SDimitry Andric 
9*0b57cec5SDimitry Andric #include "lldb/API/SBValue.h"
10*0b57cec5SDimitry Andric #include "SBReproducerPrivate.h"
11*0b57cec5SDimitry Andric 
12*0b57cec5SDimitry Andric #include "lldb/API/SBDeclaration.h"
13*0b57cec5SDimitry Andric #include "lldb/API/SBStream.h"
14*0b57cec5SDimitry Andric #include "lldb/API/SBTypeFilter.h"
15*0b57cec5SDimitry Andric #include "lldb/API/SBTypeFormat.h"
16*0b57cec5SDimitry Andric #include "lldb/API/SBTypeSummary.h"
17*0b57cec5SDimitry Andric #include "lldb/API/SBTypeSynthetic.h"
18*0b57cec5SDimitry Andric 
19*0b57cec5SDimitry Andric #include "lldb/Breakpoint/Watchpoint.h"
20*0b57cec5SDimitry Andric #include "lldb/Core/Module.h"
21*0b57cec5SDimitry Andric #include "lldb/Core/Section.h"
22*0b57cec5SDimitry Andric #include "lldb/Core/StreamFile.h"
23*0b57cec5SDimitry Andric #include "lldb/Core/Value.h"
24*0b57cec5SDimitry Andric #include "lldb/Core/ValueObject.h"
25*0b57cec5SDimitry Andric #include "lldb/Core/ValueObjectConstResult.h"
26*0b57cec5SDimitry Andric #include "lldb/DataFormatters/DataVisualization.h"
27*0b57cec5SDimitry Andric #include "lldb/Symbol/Block.h"
28*0b57cec5SDimitry Andric #include "lldb/Symbol/Declaration.h"
29*0b57cec5SDimitry Andric #include "lldb/Symbol/ObjectFile.h"
30*0b57cec5SDimitry Andric #include "lldb/Symbol/Type.h"
31*0b57cec5SDimitry Andric #include "lldb/Symbol/Variable.h"
32*0b57cec5SDimitry Andric #include "lldb/Symbol/VariableList.h"
33*0b57cec5SDimitry Andric #include "lldb/Target/ExecutionContext.h"
34*0b57cec5SDimitry Andric #include "lldb/Target/Process.h"
35*0b57cec5SDimitry Andric #include "lldb/Target/StackFrame.h"
36*0b57cec5SDimitry Andric #include "lldb/Target/Target.h"
37*0b57cec5SDimitry Andric #include "lldb/Target/Thread.h"
38*0b57cec5SDimitry Andric #include "lldb/Utility/DataExtractor.h"
39*0b57cec5SDimitry Andric #include "lldb/Utility/Scalar.h"
40*0b57cec5SDimitry Andric #include "lldb/Utility/Stream.h"
41*0b57cec5SDimitry Andric 
42*0b57cec5SDimitry Andric #include "lldb/API/SBDebugger.h"
43*0b57cec5SDimitry Andric #include "lldb/API/SBExpressionOptions.h"
44*0b57cec5SDimitry Andric #include "lldb/API/SBFrame.h"
45*0b57cec5SDimitry Andric #include "lldb/API/SBProcess.h"
46*0b57cec5SDimitry Andric #include "lldb/API/SBTarget.h"
47*0b57cec5SDimitry Andric #include "lldb/API/SBThread.h"
48*0b57cec5SDimitry Andric 
49*0b57cec5SDimitry Andric #include <memory>
50*0b57cec5SDimitry Andric 
51*0b57cec5SDimitry Andric using namespace lldb;
52*0b57cec5SDimitry Andric using namespace lldb_private;
53*0b57cec5SDimitry Andric 
54*0b57cec5SDimitry Andric class ValueImpl {
55*0b57cec5SDimitry Andric public:
565ffd83dbSDimitry Andric   ValueImpl() = default;
57*0b57cec5SDimitry Andric 
58*0b57cec5SDimitry Andric   ValueImpl(lldb::ValueObjectSP in_valobj_sp,
59*0b57cec5SDimitry Andric             lldb::DynamicValueType use_dynamic, bool use_synthetic,
60*0b57cec5SDimitry Andric             const char *name = nullptr)
61*0b57cec5SDimitry Andric       : m_valobj_sp(), m_use_dynamic(use_dynamic),
62*0b57cec5SDimitry Andric         m_use_synthetic(use_synthetic), m_name(name) {
63*0b57cec5SDimitry Andric     if (in_valobj_sp) {
64*0b57cec5SDimitry Andric       if ((m_valobj_sp = in_valobj_sp->GetQualifiedRepresentationIfAvailable(
65*0b57cec5SDimitry Andric                lldb::eNoDynamicValues, false))) {
66*0b57cec5SDimitry Andric         if (!m_name.IsEmpty())
67*0b57cec5SDimitry Andric           m_valobj_sp->SetName(m_name);
68*0b57cec5SDimitry Andric       }
69*0b57cec5SDimitry Andric     }
70*0b57cec5SDimitry Andric   }
71*0b57cec5SDimitry Andric 
72*0b57cec5SDimitry Andric   ValueImpl(const ValueImpl &rhs)
73*0b57cec5SDimitry Andric       : m_valobj_sp(rhs.m_valobj_sp), m_use_dynamic(rhs.m_use_dynamic),
74*0b57cec5SDimitry Andric         m_use_synthetic(rhs.m_use_synthetic), m_name(rhs.m_name) {}
75*0b57cec5SDimitry Andric 
76*0b57cec5SDimitry Andric   ValueImpl &operator=(const ValueImpl &rhs) {
77*0b57cec5SDimitry Andric     if (this != &rhs) {
78*0b57cec5SDimitry Andric       m_valobj_sp = rhs.m_valobj_sp;
79*0b57cec5SDimitry Andric       m_use_dynamic = rhs.m_use_dynamic;
80*0b57cec5SDimitry Andric       m_use_synthetic = rhs.m_use_synthetic;
81*0b57cec5SDimitry Andric       m_name = rhs.m_name;
82*0b57cec5SDimitry Andric     }
83*0b57cec5SDimitry Andric     return *this;
84*0b57cec5SDimitry Andric   }
85*0b57cec5SDimitry Andric 
86*0b57cec5SDimitry Andric   bool IsValid() {
87*0b57cec5SDimitry Andric     if (m_valobj_sp.get() == nullptr)
88*0b57cec5SDimitry Andric       return false;
89*0b57cec5SDimitry Andric     else {
90*0b57cec5SDimitry Andric       // FIXME: This check is necessary but not sufficient.  We for sure don't
91*0b57cec5SDimitry Andric       // want to touch SBValues whose owning
92*0b57cec5SDimitry Andric       // targets have gone away.  This check is a little weak in that it
93*0b57cec5SDimitry Andric       // enforces that restriction when you call IsValid, but since IsValid
94*0b57cec5SDimitry Andric       // doesn't lock the target, you have no guarantee that the SBValue won't
95*0b57cec5SDimitry Andric       // go invalid after you call this... Also, an SBValue could depend on
96*0b57cec5SDimitry Andric       // data from one of the modules in the target, and those could go away
97*0b57cec5SDimitry Andric       // independently of the target, for instance if a module is unloaded.
98*0b57cec5SDimitry Andric       // But right now, neither SBValues nor ValueObjects know which modules
99*0b57cec5SDimitry Andric       // they depend on.  So I have no good way to make that check without
100*0b57cec5SDimitry Andric       // tracking that in all the ValueObject subclasses.
101*0b57cec5SDimitry Andric       TargetSP target_sp = m_valobj_sp->GetTargetSP();
102*0b57cec5SDimitry Andric       return target_sp && target_sp->IsValid();
103*0b57cec5SDimitry Andric     }
104*0b57cec5SDimitry Andric   }
105*0b57cec5SDimitry Andric 
106*0b57cec5SDimitry Andric   lldb::ValueObjectSP GetRootSP() { return m_valobj_sp; }
107*0b57cec5SDimitry Andric 
108*0b57cec5SDimitry Andric   lldb::ValueObjectSP GetSP(Process::StopLocker &stop_locker,
109*0b57cec5SDimitry Andric                             std::unique_lock<std::recursive_mutex> &lock,
110*0b57cec5SDimitry Andric                             Status &error) {
111*0b57cec5SDimitry Andric     if (!m_valobj_sp) {
112*0b57cec5SDimitry Andric       error.SetErrorString("invalid value object");
113*0b57cec5SDimitry Andric       return m_valobj_sp;
114*0b57cec5SDimitry Andric     }
115*0b57cec5SDimitry Andric 
116*0b57cec5SDimitry Andric     lldb::ValueObjectSP value_sp = m_valobj_sp;
117*0b57cec5SDimitry Andric 
118*0b57cec5SDimitry Andric     Target *target = value_sp->GetTargetSP().get();
119*0b57cec5SDimitry Andric     if (!target)
120*0b57cec5SDimitry Andric       return ValueObjectSP();
121*0b57cec5SDimitry Andric 
122*0b57cec5SDimitry Andric     lock = std::unique_lock<std::recursive_mutex>(target->GetAPIMutex());
123*0b57cec5SDimitry Andric 
124*0b57cec5SDimitry Andric     ProcessSP process_sp(value_sp->GetProcessSP());
125*0b57cec5SDimitry Andric     if (process_sp && !stop_locker.TryLock(&process_sp->GetRunLock())) {
126*0b57cec5SDimitry Andric       // We don't allow people to play around with ValueObject if the process
127*0b57cec5SDimitry Andric       // is running. If you want to look at values, pause the process, then
128*0b57cec5SDimitry Andric       // look.
129*0b57cec5SDimitry Andric       error.SetErrorString("process must be stopped.");
130*0b57cec5SDimitry Andric       return ValueObjectSP();
131*0b57cec5SDimitry Andric     }
132*0b57cec5SDimitry Andric 
133*0b57cec5SDimitry Andric     if (m_use_dynamic != eNoDynamicValues) {
134*0b57cec5SDimitry Andric       ValueObjectSP dynamic_sp = value_sp->GetDynamicValue(m_use_dynamic);
135*0b57cec5SDimitry Andric       if (dynamic_sp)
136*0b57cec5SDimitry Andric         value_sp = dynamic_sp;
137*0b57cec5SDimitry Andric     }
138*0b57cec5SDimitry Andric 
139*0b57cec5SDimitry Andric     if (m_use_synthetic) {
1405ffd83dbSDimitry Andric       ValueObjectSP synthetic_sp = value_sp->GetSyntheticValue();
141*0b57cec5SDimitry Andric       if (synthetic_sp)
142*0b57cec5SDimitry Andric         value_sp = synthetic_sp;
143*0b57cec5SDimitry Andric     }
144*0b57cec5SDimitry Andric 
145*0b57cec5SDimitry Andric     if (!value_sp)
146*0b57cec5SDimitry Andric       error.SetErrorString("invalid value object");
147*0b57cec5SDimitry Andric     if (!m_name.IsEmpty())
148*0b57cec5SDimitry Andric       value_sp->SetName(m_name);
149*0b57cec5SDimitry Andric 
150*0b57cec5SDimitry Andric     return value_sp;
151*0b57cec5SDimitry Andric   }
152*0b57cec5SDimitry Andric 
153*0b57cec5SDimitry Andric   void SetUseDynamic(lldb::DynamicValueType use_dynamic) {
154*0b57cec5SDimitry Andric     m_use_dynamic = use_dynamic;
155*0b57cec5SDimitry Andric   }
156*0b57cec5SDimitry Andric 
157*0b57cec5SDimitry Andric   void SetUseSynthetic(bool use_synthetic) { m_use_synthetic = use_synthetic; }
158*0b57cec5SDimitry Andric 
159*0b57cec5SDimitry Andric   lldb::DynamicValueType GetUseDynamic() { return m_use_dynamic; }
160*0b57cec5SDimitry Andric 
161*0b57cec5SDimitry Andric   bool GetUseSynthetic() { return m_use_synthetic; }
162*0b57cec5SDimitry Andric 
163*0b57cec5SDimitry Andric   // All the derived values that we would make from the m_valobj_sp will share
164*0b57cec5SDimitry Andric   // the ExecutionContext with m_valobj_sp, so we don't need to do the
165*0b57cec5SDimitry Andric   // calculations in GetSP to return the Target, Process, Thread or Frame.  It
166*0b57cec5SDimitry Andric   // is convenient to provide simple accessors for these, which I do here.
167*0b57cec5SDimitry Andric   TargetSP GetTargetSP() {
168*0b57cec5SDimitry Andric     if (m_valobj_sp)
169*0b57cec5SDimitry Andric       return m_valobj_sp->GetTargetSP();
170*0b57cec5SDimitry Andric     else
171*0b57cec5SDimitry Andric       return TargetSP();
172*0b57cec5SDimitry Andric   }
173*0b57cec5SDimitry Andric 
174*0b57cec5SDimitry Andric   ProcessSP GetProcessSP() {
175*0b57cec5SDimitry Andric     if (m_valobj_sp)
176*0b57cec5SDimitry Andric       return m_valobj_sp->GetProcessSP();
177*0b57cec5SDimitry Andric     else
178*0b57cec5SDimitry Andric       return ProcessSP();
179*0b57cec5SDimitry Andric   }
180*0b57cec5SDimitry Andric 
181*0b57cec5SDimitry Andric   ThreadSP GetThreadSP() {
182*0b57cec5SDimitry Andric     if (m_valobj_sp)
183*0b57cec5SDimitry Andric       return m_valobj_sp->GetThreadSP();
184*0b57cec5SDimitry Andric     else
185*0b57cec5SDimitry Andric       return ThreadSP();
186*0b57cec5SDimitry Andric   }
187*0b57cec5SDimitry Andric 
188*0b57cec5SDimitry Andric   StackFrameSP GetFrameSP() {
189*0b57cec5SDimitry Andric     if (m_valobj_sp)
190*0b57cec5SDimitry Andric       return m_valobj_sp->GetFrameSP();
191*0b57cec5SDimitry Andric     else
192*0b57cec5SDimitry Andric       return StackFrameSP();
193*0b57cec5SDimitry Andric   }
194*0b57cec5SDimitry Andric 
195*0b57cec5SDimitry Andric private:
196*0b57cec5SDimitry Andric   lldb::ValueObjectSP m_valobj_sp;
197*0b57cec5SDimitry Andric   lldb::DynamicValueType m_use_dynamic;
198*0b57cec5SDimitry Andric   bool m_use_synthetic;
199*0b57cec5SDimitry Andric   ConstString m_name;
200*0b57cec5SDimitry Andric };
201*0b57cec5SDimitry Andric 
202*0b57cec5SDimitry Andric class ValueLocker {
203*0b57cec5SDimitry Andric public:
2045ffd83dbSDimitry Andric   ValueLocker() = default;
205*0b57cec5SDimitry Andric 
206*0b57cec5SDimitry Andric   ValueObjectSP GetLockedSP(ValueImpl &in_value) {
207*0b57cec5SDimitry Andric     return in_value.GetSP(m_stop_locker, m_lock, m_lock_error);
208*0b57cec5SDimitry Andric   }
209*0b57cec5SDimitry Andric 
210*0b57cec5SDimitry Andric   Status &GetError() { return m_lock_error; }
211*0b57cec5SDimitry Andric 
212*0b57cec5SDimitry Andric private:
213*0b57cec5SDimitry Andric   Process::StopLocker m_stop_locker;
214*0b57cec5SDimitry Andric   std::unique_lock<std::recursive_mutex> m_lock;
215*0b57cec5SDimitry Andric   Status m_lock_error;
216*0b57cec5SDimitry Andric };
217*0b57cec5SDimitry Andric 
218*0b57cec5SDimitry Andric SBValue::SBValue() : m_opaque_sp() { LLDB_RECORD_CONSTRUCTOR_NO_ARGS(SBValue); }
219*0b57cec5SDimitry Andric 
220*0b57cec5SDimitry Andric SBValue::SBValue(const lldb::ValueObjectSP &value_sp) {
221*0b57cec5SDimitry Andric   LLDB_RECORD_CONSTRUCTOR(SBValue, (const lldb::ValueObjectSP &), value_sp);
222*0b57cec5SDimitry Andric 
223*0b57cec5SDimitry Andric   SetSP(value_sp);
224*0b57cec5SDimitry Andric }
225*0b57cec5SDimitry Andric 
226*0b57cec5SDimitry Andric SBValue::SBValue(const SBValue &rhs) {
227*0b57cec5SDimitry Andric   LLDB_RECORD_CONSTRUCTOR(SBValue, (const lldb::SBValue &), rhs);
228*0b57cec5SDimitry Andric 
229*0b57cec5SDimitry Andric   SetSP(rhs.m_opaque_sp);
230*0b57cec5SDimitry Andric }
231*0b57cec5SDimitry Andric 
232*0b57cec5SDimitry Andric SBValue &SBValue::operator=(const SBValue &rhs) {
233*0b57cec5SDimitry Andric   LLDB_RECORD_METHOD(lldb::SBValue &,
234*0b57cec5SDimitry Andric                      SBValue, operator=,(const lldb::SBValue &), rhs);
235*0b57cec5SDimitry Andric 
236*0b57cec5SDimitry Andric   if (this != &rhs) {
237*0b57cec5SDimitry Andric     SetSP(rhs.m_opaque_sp);
238*0b57cec5SDimitry Andric   }
239*0b57cec5SDimitry Andric   return LLDB_RECORD_RESULT(*this);
240*0b57cec5SDimitry Andric }
241*0b57cec5SDimitry Andric 
2425ffd83dbSDimitry Andric SBValue::~SBValue() = default;
243*0b57cec5SDimitry Andric 
244*0b57cec5SDimitry Andric bool SBValue::IsValid() {
245*0b57cec5SDimitry Andric   LLDB_RECORD_METHOD_NO_ARGS(bool, SBValue, IsValid);
246*0b57cec5SDimitry Andric   return this->operator bool();
247*0b57cec5SDimitry Andric }
248*0b57cec5SDimitry Andric SBValue::operator bool() const {
249*0b57cec5SDimitry Andric   LLDB_RECORD_METHOD_CONST_NO_ARGS(bool, SBValue, operator bool);
250*0b57cec5SDimitry Andric 
251*0b57cec5SDimitry Andric   // If this function ever changes to anything that does more than just check
252*0b57cec5SDimitry Andric   // if the opaque shared pointer is non NULL, then we need to update all "if
253*0b57cec5SDimitry Andric   // (m_opaque_sp)" code in this file.
254*0b57cec5SDimitry Andric   return m_opaque_sp.get() != nullptr && m_opaque_sp->IsValid() &&
255*0b57cec5SDimitry Andric          m_opaque_sp->GetRootSP().get() != nullptr;
256*0b57cec5SDimitry Andric }
257*0b57cec5SDimitry Andric 
258*0b57cec5SDimitry Andric void SBValue::Clear() {
259*0b57cec5SDimitry Andric   LLDB_RECORD_METHOD_NO_ARGS(void, SBValue, Clear);
260*0b57cec5SDimitry Andric 
261*0b57cec5SDimitry Andric   m_opaque_sp.reset();
262*0b57cec5SDimitry Andric }
263*0b57cec5SDimitry Andric 
264*0b57cec5SDimitry Andric SBError SBValue::GetError() {
265*0b57cec5SDimitry Andric   LLDB_RECORD_METHOD_NO_ARGS(lldb::SBError, SBValue, GetError);
266*0b57cec5SDimitry Andric 
267*0b57cec5SDimitry Andric   SBError sb_error;
268*0b57cec5SDimitry Andric 
269*0b57cec5SDimitry Andric   ValueLocker locker;
270*0b57cec5SDimitry Andric   lldb::ValueObjectSP value_sp(GetSP(locker));
271*0b57cec5SDimitry Andric   if (value_sp)
272*0b57cec5SDimitry Andric     sb_error.SetError(value_sp->GetError());
273*0b57cec5SDimitry Andric   else
274*0b57cec5SDimitry Andric     sb_error.SetErrorStringWithFormat("error: %s",
275*0b57cec5SDimitry Andric                                       locker.GetError().AsCString());
276*0b57cec5SDimitry Andric 
277*0b57cec5SDimitry Andric   return LLDB_RECORD_RESULT(sb_error);
278*0b57cec5SDimitry Andric }
279*0b57cec5SDimitry Andric 
280*0b57cec5SDimitry Andric user_id_t SBValue::GetID() {
281*0b57cec5SDimitry Andric   LLDB_RECORD_METHOD_NO_ARGS(lldb::user_id_t, SBValue, GetID);
282*0b57cec5SDimitry Andric 
283*0b57cec5SDimitry Andric   ValueLocker locker;
284*0b57cec5SDimitry Andric   lldb::ValueObjectSP value_sp(GetSP(locker));
285*0b57cec5SDimitry Andric   if (value_sp)
286*0b57cec5SDimitry Andric     return value_sp->GetID();
287*0b57cec5SDimitry Andric   return LLDB_INVALID_UID;
288*0b57cec5SDimitry Andric }
289*0b57cec5SDimitry Andric 
290*0b57cec5SDimitry Andric const char *SBValue::GetName() {
291*0b57cec5SDimitry Andric   LLDB_RECORD_METHOD_NO_ARGS(const char *, SBValue, GetName);
292*0b57cec5SDimitry Andric 
293*0b57cec5SDimitry Andric   const char *name = nullptr;
294*0b57cec5SDimitry Andric   ValueLocker locker;
295*0b57cec5SDimitry Andric   lldb::ValueObjectSP value_sp(GetSP(locker));
296*0b57cec5SDimitry Andric   if (value_sp)
297*0b57cec5SDimitry Andric     name = value_sp->GetName().GetCString();
298*0b57cec5SDimitry Andric 
299*0b57cec5SDimitry Andric   return name;
300*0b57cec5SDimitry Andric }
301*0b57cec5SDimitry Andric 
302*0b57cec5SDimitry Andric const char *SBValue::GetTypeName() {
303*0b57cec5SDimitry Andric   LLDB_RECORD_METHOD_NO_ARGS(const char *, SBValue, GetTypeName);
304*0b57cec5SDimitry Andric 
305*0b57cec5SDimitry Andric   const char *name = nullptr;
306*0b57cec5SDimitry Andric   ValueLocker locker;
307*0b57cec5SDimitry Andric   lldb::ValueObjectSP value_sp(GetSP(locker));
308*0b57cec5SDimitry Andric   if (value_sp) {
309*0b57cec5SDimitry Andric     name = value_sp->GetQualifiedTypeName().GetCString();
310*0b57cec5SDimitry Andric   }
311*0b57cec5SDimitry Andric 
312*0b57cec5SDimitry Andric   return name;
313*0b57cec5SDimitry Andric }
314*0b57cec5SDimitry Andric 
315*0b57cec5SDimitry Andric const char *SBValue::GetDisplayTypeName() {
316*0b57cec5SDimitry Andric   LLDB_RECORD_METHOD_NO_ARGS(const char *, SBValue, GetDisplayTypeName);
317*0b57cec5SDimitry Andric 
318*0b57cec5SDimitry Andric   const char *name = nullptr;
319*0b57cec5SDimitry Andric   ValueLocker locker;
320*0b57cec5SDimitry Andric   lldb::ValueObjectSP value_sp(GetSP(locker));
321*0b57cec5SDimitry Andric   if (value_sp) {
322*0b57cec5SDimitry Andric     name = value_sp->GetDisplayTypeName().GetCString();
323*0b57cec5SDimitry Andric   }
324*0b57cec5SDimitry Andric 
325*0b57cec5SDimitry Andric   return name;
326*0b57cec5SDimitry Andric }
327*0b57cec5SDimitry Andric 
328*0b57cec5SDimitry Andric size_t SBValue::GetByteSize() {
329*0b57cec5SDimitry Andric   LLDB_RECORD_METHOD_NO_ARGS(size_t, SBValue, GetByteSize);
330*0b57cec5SDimitry Andric 
331*0b57cec5SDimitry Andric   size_t result = 0;
332*0b57cec5SDimitry Andric 
333*0b57cec5SDimitry Andric   ValueLocker locker;
334*0b57cec5SDimitry Andric   lldb::ValueObjectSP value_sp(GetSP(locker));
335*0b57cec5SDimitry Andric   if (value_sp) {
336*0b57cec5SDimitry Andric     result = value_sp->GetByteSize();
337*0b57cec5SDimitry Andric   }
338*0b57cec5SDimitry Andric 
339*0b57cec5SDimitry Andric   return result;
340*0b57cec5SDimitry Andric }
341*0b57cec5SDimitry Andric 
342*0b57cec5SDimitry Andric bool SBValue::IsInScope() {
343*0b57cec5SDimitry Andric   LLDB_RECORD_METHOD_NO_ARGS(bool, SBValue, IsInScope);
344*0b57cec5SDimitry Andric 
345*0b57cec5SDimitry Andric   bool result = false;
346*0b57cec5SDimitry Andric 
347*0b57cec5SDimitry Andric   ValueLocker locker;
348*0b57cec5SDimitry Andric   lldb::ValueObjectSP value_sp(GetSP(locker));
349*0b57cec5SDimitry Andric   if (value_sp) {
350*0b57cec5SDimitry Andric     result = value_sp->IsInScope();
351*0b57cec5SDimitry Andric   }
352*0b57cec5SDimitry Andric 
353*0b57cec5SDimitry Andric   return result;
354*0b57cec5SDimitry Andric }
355*0b57cec5SDimitry Andric 
356*0b57cec5SDimitry Andric const char *SBValue::GetValue() {
357*0b57cec5SDimitry Andric   LLDB_RECORD_METHOD_NO_ARGS(const char *, SBValue, GetValue);
358*0b57cec5SDimitry Andric 
359*0b57cec5SDimitry Andric   const char *cstr = nullptr;
360*0b57cec5SDimitry Andric   ValueLocker locker;
361*0b57cec5SDimitry Andric   lldb::ValueObjectSP value_sp(GetSP(locker));
362*0b57cec5SDimitry Andric   if (value_sp) {
363*0b57cec5SDimitry Andric     cstr = value_sp->GetValueAsCString();
364*0b57cec5SDimitry Andric   }
365*0b57cec5SDimitry Andric 
366*0b57cec5SDimitry Andric   return cstr;
367*0b57cec5SDimitry Andric }
368*0b57cec5SDimitry Andric 
369*0b57cec5SDimitry Andric ValueType SBValue::GetValueType() {
370*0b57cec5SDimitry Andric   LLDB_RECORD_METHOD_NO_ARGS(lldb::ValueType, SBValue, GetValueType);
371*0b57cec5SDimitry Andric 
372*0b57cec5SDimitry Andric   ValueType result = eValueTypeInvalid;
373*0b57cec5SDimitry Andric   ValueLocker locker;
374*0b57cec5SDimitry Andric   lldb::ValueObjectSP value_sp(GetSP(locker));
375*0b57cec5SDimitry Andric   if (value_sp)
376*0b57cec5SDimitry Andric     result = value_sp->GetValueType();
377*0b57cec5SDimitry Andric 
378*0b57cec5SDimitry Andric   return result;
379*0b57cec5SDimitry Andric }
380*0b57cec5SDimitry Andric 
381*0b57cec5SDimitry Andric const char *SBValue::GetObjectDescription() {
382*0b57cec5SDimitry Andric   LLDB_RECORD_METHOD_NO_ARGS(const char *, SBValue, GetObjectDescription);
383*0b57cec5SDimitry Andric 
384*0b57cec5SDimitry Andric   const char *cstr = nullptr;
385*0b57cec5SDimitry Andric   ValueLocker locker;
386*0b57cec5SDimitry Andric   lldb::ValueObjectSP value_sp(GetSP(locker));
387*0b57cec5SDimitry Andric   if (value_sp) {
388*0b57cec5SDimitry Andric     cstr = value_sp->GetObjectDescription();
389*0b57cec5SDimitry Andric   }
390*0b57cec5SDimitry Andric 
391*0b57cec5SDimitry Andric   return cstr;
392*0b57cec5SDimitry Andric }
393*0b57cec5SDimitry Andric 
394*0b57cec5SDimitry Andric SBType SBValue::GetType() {
395*0b57cec5SDimitry Andric   LLDB_RECORD_METHOD_NO_ARGS(lldb::SBType, SBValue, GetType);
396*0b57cec5SDimitry Andric 
397*0b57cec5SDimitry Andric   SBType sb_type;
398*0b57cec5SDimitry Andric   ValueLocker locker;
399*0b57cec5SDimitry Andric   lldb::ValueObjectSP value_sp(GetSP(locker));
400*0b57cec5SDimitry Andric   TypeImplSP type_sp;
401*0b57cec5SDimitry Andric   if (value_sp) {
402*0b57cec5SDimitry Andric     type_sp = std::make_shared<TypeImpl>(value_sp->GetTypeImpl());
403*0b57cec5SDimitry Andric     sb_type.SetSP(type_sp);
404*0b57cec5SDimitry Andric   }
405*0b57cec5SDimitry Andric 
406*0b57cec5SDimitry Andric   return LLDB_RECORD_RESULT(sb_type);
407*0b57cec5SDimitry Andric }
408*0b57cec5SDimitry Andric 
409*0b57cec5SDimitry Andric bool SBValue::GetValueDidChange() {
410*0b57cec5SDimitry Andric   LLDB_RECORD_METHOD_NO_ARGS(bool, SBValue, GetValueDidChange);
411*0b57cec5SDimitry Andric 
412*0b57cec5SDimitry Andric   bool result = false;
413*0b57cec5SDimitry Andric   ValueLocker locker;
414*0b57cec5SDimitry Andric   lldb::ValueObjectSP value_sp(GetSP(locker));
415*0b57cec5SDimitry Andric   if (value_sp) {
416*0b57cec5SDimitry Andric     if (value_sp->UpdateValueIfNeeded(false))
417*0b57cec5SDimitry Andric       result = value_sp->GetValueDidChange();
418*0b57cec5SDimitry Andric   }
419*0b57cec5SDimitry Andric 
420*0b57cec5SDimitry Andric   return result;
421*0b57cec5SDimitry Andric }
422*0b57cec5SDimitry Andric 
423*0b57cec5SDimitry Andric const char *SBValue::GetSummary() {
424*0b57cec5SDimitry Andric   LLDB_RECORD_METHOD_NO_ARGS(const char *, SBValue, GetSummary);
425*0b57cec5SDimitry Andric 
426*0b57cec5SDimitry Andric   const char *cstr = nullptr;
427*0b57cec5SDimitry Andric   ValueLocker locker;
428*0b57cec5SDimitry Andric   lldb::ValueObjectSP value_sp(GetSP(locker));
429*0b57cec5SDimitry Andric   if (value_sp) {
430*0b57cec5SDimitry Andric     cstr = value_sp->GetSummaryAsCString();
431*0b57cec5SDimitry Andric   }
432*0b57cec5SDimitry Andric 
433*0b57cec5SDimitry Andric   return cstr;
434*0b57cec5SDimitry Andric }
435*0b57cec5SDimitry Andric 
436*0b57cec5SDimitry Andric const char *SBValue::GetSummary(lldb::SBStream &stream,
437*0b57cec5SDimitry Andric                                 lldb::SBTypeSummaryOptions &options) {
438*0b57cec5SDimitry Andric   LLDB_RECORD_METHOD(const char *, SBValue, GetSummary,
439*0b57cec5SDimitry Andric                      (lldb::SBStream &, lldb::SBTypeSummaryOptions &), stream,
440*0b57cec5SDimitry Andric                      options);
441*0b57cec5SDimitry Andric 
442*0b57cec5SDimitry Andric   ValueLocker locker;
443*0b57cec5SDimitry Andric   lldb::ValueObjectSP value_sp(GetSP(locker));
444*0b57cec5SDimitry Andric   if (value_sp) {
445*0b57cec5SDimitry Andric     std::string buffer;
446*0b57cec5SDimitry Andric     if (value_sp->GetSummaryAsCString(buffer, options.ref()) && !buffer.empty())
447*0b57cec5SDimitry Andric       stream.Printf("%s", buffer.c_str());
448*0b57cec5SDimitry Andric   }
449*0b57cec5SDimitry Andric   const char *cstr = stream.GetData();
450*0b57cec5SDimitry Andric   return cstr;
451*0b57cec5SDimitry Andric }
452*0b57cec5SDimitry Andric 
453*0b57cec5SDimitry Andric const char *SBValue::GetLocation() {
454*0b57cec5SDimitry Andric   LLDB_RECORD_METHOD_NO_ARGS(const char *, SBValue, GetLocation);
455*0b57cec5SDimitry Andric 
456*0b57cec5SDimitry Andric   const char *cstr = nullptr;
457*0b57cec5SDimitry Andric   ValueLocker locker;
458*0b57cec5SDimitry Andric   lldb::ValueObjectSP value_sp(GetSP(locker));
459*0b57cec5SDimitry Andric   if (value_sp) {
460*0b57cec5SDimitry Andric     cstr = value_sp->GetLocationAsCString();
461*0b57cec5SDimitry Andric   }
462*0b57cec5SDimitry Andric   return cstr;
463*0b57cec5SDimitry Andric }
464*0b57cec5SDimitry Andric 
465*0b57cec5SDimitry Andric // Deprecated - use the one that takes an lldb::SBError
466*0b57cec5SDimitry Andric bool SBValue::SetValueFromCString(const char *value_str) {
467*0b57cec5SDimitry Andric   LLDB_RECORD_METHOD(bool, SBValue, SetValueFromCString, (const char *),
468*0b57cec5SDimitry Andric                      value_str);
469*0b57cec5SDimitry Andric 
470*0b57cec5SDimitry Andric   lldb::SBError dummy;
471*0b57cec5SDimitry Andric   return SetValueFromCString(value_str, dummy);
472*0b57cec5SDimitry Andric }
473*0b57cec5SDimitry Andric 
474*0b57cec5SDimitry Andric bool SBValue::SetValueFromCString(const char *value_str, lldb::SBError &error) {
475*0b57cec5SDimitry Andric   LLDB_RECORD_METHOD(bool, SBValue, SetValueFromCString,
476*0b57cec5SDimitry Andric                      (const char *, lldb::SBError &), value_str, error);
477*0b57cec5SDimitry Andric 
478*0b57cec5SDimitry Andric   bool success = false;
479*0b57cec5SDimitry Andric   ValueLocker locker;
480*0b57cec5SDimitry Andric   lldb::ValueObjectSP value_sp(GetSP(locker));
481*0b57cec5SDimitry Andric   if (value_sp) {
482*0b57cec5SDimitry Andric     success = value_sp->SetValueFromCString(value_str, error.ref());
483*0b57cec5SDimitry Andric   } else
484*0b57cec5SDimitry Andric     error.SetErrorStringWithFormat("Could not get value: %s",
485*0b57cec5SDimitry Andric                                    locker.GetError().AsCString());
486*0b57cec5SDimitry Andric 
487*0b57cec5SDimitry Andric   return success;
488*0b57cec5SDimitry Andric }
489*0b57cec5SDimitry Andric 
490*0b57cec5SDimitry Andric lldb::SBTypeFormat SBValue::GetTypeFormat() {
491*0b57cec5SDimitry Andric   LLDB_RECORD_METHOD_NO_ARGS(lldb::SBTypeFormat, SBValue, GetTypeFormat);
492*0b57cec5SDimitry Andric 
493*0b57cec5SDimitry Andric   lldb::SBTypeFormat format;
494*0b57cec5SDimitry Andric   ValueLocker locker;
495*0b57cec5SDimitry Andric   lldb::ValueObjectSP value_sp(GetSP(locker));
496*0b57cec5SDimitry Andric   if (value_sp) {
497*0b57cec5SDimitry Andric     if (value_sp->UpdateValueIfNeeded(true)) {
498*0b57cec5SDimitry Andric       lldb::TypeFormatImplSP format_sp = value_sp->GetValueFormat();
499*0b57cec5SDimitry Andric       if (format_sp)
500*0b57cec5SDimitry Andric         format.SetSP(format_sp);
501*0b57cec5SDimitry Andric     }
502*0b57cec5SDimitry Andric   }
503*0b57cec5SDimitry Andric   return LLDB_RECORD_RESULT(format);
504*0b57cec5SDimitry Andric }
505*0b57cec5SDimitry Andric 
506*0b57cec5SDimitry Andric lldb::SBTypeSummary SBValue::GetTypeSummary() {
507*0b57cec5SDimitry Andric   LLDB_RECORD_METHOD_NO_ARGS(lldb::SBTypeSummary, SBValue, GetTypeSummary);
508*0b57cec5SDimitry Andric 
509*0b57cec5SDimitry Andric   lldb::SBTypeSummary summary;
510*0b57cec5SDimitry Andric   ValueLocker locker;
511*0b57cec5SDimitry Andric   lldb::ValueObjectSP value_sp(GetSP(locker));
512*0b57cec5SDimitry Andric   if (value_sp) {
513*0b57cec5SDimitry Andric     if (value_sp->UpdateValueIfNeeded(true)) {
514*0b57cec5SDimitry Andric       lldb::TypeSummaryImplSP summary_sp = value_sp->GetSummaryFormat();
515*0b57cec5SDimitry Andric       if (summary_sp)
516*0b57cec5SDimitry Andric         summary.SetSP(summary_sp);
517*0b57cec5SDimitry Andric     }
518*0b57cec5SDimitry Andric   }
519*0b57cec5SDimitry Andric   return LLDB_RECORD_RESULT(summary);
520*0b57cec5SDimitry Andric }
521*0b57cec5SDimitry Andric 
522*0b57cec5SDimitry Andric lldb::SBTypeFilter SBValue::GetTypeFilter() {
523*0b57cec5SDimitry Andric   LLDB_RECORD_METHOD_NO_ARGS(lldb::SBTypeFilter, SBValue, GetTypeFilter);
524*0b57cec5SDimitry Andric 
525*0b57cec5SDimitry Andric   lldb::SBTypeFilter filter;
526*0b57cec5SDimitry Andric   ValueLocker locker;
527*0b57cec5SDimitry Andric   lldb::ValueObjectSP value_sp(GetSP(locker));
528*0b57cec5SDimitry Andric   if (value_sp) {
529*0b57cec5SDimitry Andric     if (value_sp->UpdateValueIfNeeded(true)) {
530*0b57cec5SDimitry Andric       lldb::SyntheticChildrenSP synthetic_sp = value_sp->GetSyntheticChildren();
531*0b57cec5SDimitry Andric 
532*0b57cec5SDimitry Andric       if (synthetic_sp && !synthetic_sp->IsScripted()) {
533*0b57cec5SDimitry Andric         TypeFilterImplSP filter_sp =
534*0b57cec5SDimitry Andric             std::static_pointer_cast<TypeFilterImpl>(synthetic_sp);
535*0b57cec5SDimitry Andric         filter.SetSP(filter_sp);
536*0b57cec5SDimitry Andric       }
537*0b57cec5SDimitry Andric     }
538*0b57cec5SDimitry Andric   }
539*0b57cec5SDimitry Andric   return LLDB_RECORD_RESULT(filter);
540*0b57cec5SDimitry Andric }
541*0b57cec5SDimitry Andric 
542*0b57cec5SDimitry Andric lldb::SBTypeSynthetic SBValue::GetTypeSynthetic() {
543*0b57cec5SDimitry Andric   LLDB_RECORD_METHOD_NO_ARGS(lldb::SBTypeSynthetic, SBValue, GetTypeSynthetic);
544*0b57cec5SDimitry Andric 
545*0b57cec5SDimitry Andric   lldb::SBTypeSynthetic synthetic;
546*0b57cec5SDimitry Andric   ValueLocker locker;
547*0b57cec5SDimitry Andric   lldb::ValueObjectSP value_sp(GetSP(locker));
548*0b57cec5SDimitry Andric   if (value_sp) {
549*0b57cec5SDimitry Andric     if (value_sp->UpdateValueIfNeeded(true)) {
550*0b57cec5SDimitry Andric       lldb::SyntheticChildrenSP children_sp = value_sp->GetSyntheticChildren();
551*0b57cec5SDimitry Andric 
552*0b57cec5SDimitry Andric       if (children_sp && children_sp->IsScripted()) {
553*0b57cec5SDimitry Andric         ScriptedSyntheticChildrenSP synth_sp =
554*0b57cec5SDimitry Andric             std::static_pointer_cast<ScriptedSyntheticChildren>(children_sp);
555*0b57cec5SDimitry Andric         synthetic.SetSP(synth_sp);
556*0b57cec5SDimitry Andric       }
557*0b57cec5SDimitry Andric     }
558*0b57cec5SDimitry Andric   }
559*0b57cec5SDimitry Andric   return LLDB_RECORD_RESULT(synthetic);
560*0b57cec5SDimitry Andric }
561*0b57cec5SDimitry Andric 
562*0b57cec5SDimitry Andric lldb::SBValue SBValue::CreateChildAtOffset(const char *name, uint32_t offset,
563*0b57cec5SDimitry Andric                                            SBType type) {
564*0b57cec5SDimitry Andric   LLDB_RECORD_METHOD(lldb::SBValue, SBValue, CreateChildAtOffset,
565*0b57cec5SDimitry Andric                      (const char *, uint32_t, lldb::SBType), name, offset,
566*0b57cec5SDimitry Andric                      type);
567*0b57cec5SDimitry Andric 
568*0b57cec5SDimitry Andric   lldb::SBValue sb_value;
569*0b57cec5SDimitry Andric   ValueLocker locker;
570*0b57cec5SDimitry Andric   lldb::ValueObjectSP value_sp(GetSP(locker));
571*0b57cec5SDimitry Andric   lldb::ValueObjectSP new_value_sp;
572*0b57cec5SDimitry Andric   if (value_sp) {
573*0b57cec5SDimitry Andric     TypeImplSP type_sp(type.GetSP());
574*0b57cec5SDimitry Andric     if (type.IsValid()) {
575*0b57cec5SDimitry Andric       sb_value.SetSP(value_sp->GetSyntheticChildAtOffset(
576*0b57cec5SDimitry Andric                          offset, type_sp->GetCompilerType(false), true),
577*0b57cec5SDimitry Andric                      GetPreferDynamicValue(), GetPreferSyntheticValue(), name);
578*0b57cec5SDimitry Andric     }
579*0b57cec5SDimitry Andric   }
580*0b57cec5SDimitry Andric   return LLDB_RECORD_RESULT(sb_value);
581*0b57cec5SDimitry Andric }
582*0b57cec5SDimitry Andric 
583*0b57cec5SDimitry Andric lldb::SBValue SBValue::Cast(SBType type) {
584*0b57cec5SDimitry Andric   LLDB_RECORD_METHOD(lldb::SBValue, SBValue, Cast, (lldb::SBType), type);
585*0b57cec5SDimitry Andric 
586*0b57cec5SDimitry Andric   lldb::SBValue sb_value;
587*0b57cec5SDimitry Andric   ValueLocker locker;
588*0b57cec5SDimitry Andric   lldb::ValueObjectSP value_sp(GetSP(locker));
589*0b57cec5SDimitry Andric   TypeImplSP type_sp(type.GetSP());
590*0b57cec5SDimitry Andric   if (value_sp && type_sp)
591*0b57cec5SDimitry Andric     sb_value.SetSP(value_sp->Cast(type_sp->GetCompilerType(false)),
592*0b57cec5SDimitry Andric                    GetPreferDynamicValue(), GetPreferSyntheticValue());
593*0b57cec5SDimitry Andric   return LLDB_RECORD_RESULT(sb_value);
594*0b57cec5SDimitry Andric }
595*0b57cec5SDimitry Andric 
596*0b57cec5SDimitry Andric lldb::SBValue SBValue::CreateValueFromExpression(const char *name,
597*0b57cec5SDimitry Andric                                                  const char *expression) {
598*0b57cec5SDimitry Andric   LLDB_RECORD_METHOD(lldb::SBValue, SBValue, CreateValueFromExpression,
599*0b57cec5SDimitry Andric                      (const char *, const char *), name, expression);
600*0b57cec5SDimitry Andric 
601*0b57cec5SDimitry Andric   SBExpressionOptions options;
602*0b57cec5SDimitry Andric   options.ref().SetKeepInMemory(true);
603*0b57cec5SDimitry Andric   return LLDB_RECORD_RESULT(
604*0b57cec5SDimitry Andric       CreateValueFromExpression(name, expression, options));
605*0b57cec5SDimitry Andric }
606*0b57cec5SDimitry Andric 
607*0b57cec5SDimitry Andric lldb::SBValue SBValue::CreateValueFromExpression(const char *name,
608*0b57cec5SDimitry Andric                                                  const char *expression,
609*0b57cec5SDimitry Andric                                                  SBExpressionOptions &options) {
610*0b57cec5SDimitry Andric   LLDB_RECORD_METHOD(lldb::SBValue, SBValue, CreateValueFromExpression,
611*0b57cec5SDimitry Andric                      (const char *, const char *, lldb::SBExpressionOptions &),
612*0b57cec5SDimitry Andric                      name, expression, options);
613*0b57cec5SDimitry Andric 
614*0b57cec5SDimitry Andric   lldb::SBValue sb_value;
615*0b57cec5SDimitry Andric   ValueLocker locker;
616*0b57cec5SDimitry Andric   lldb::ValueObjectSP value_sp(GetSP(locker));
617*0b57cec5SDimitry Andric   lldb::ValueObjectSP new_value_sp;
618*0b57cec5SDimitry Andric   if (value_sp) {
619*0b57cec5SDimitry Andric     ExecutionContext exe_ctx(value_sp->GetExecutionContextRef());
620*0b57cec5SDimitry Andric     new_value_sp = ValueObject::CreateValueObjectFromExpression(
621*0b57cec5SDimitry Andric         name, expression, exe_ctx, options.ref());
622*0b57cec5SDimitry Andric     if (new_value_sp)
623*0b57cec5SDimitry Andric       new_value_sp->SetName(ConstString(name));
624*0b57cec5SDimitry Andric   }
625*0b57cec5SDimitry Andric   sb_value.SetSP(new_value_sp);
626*0b57cec5SDimitry Andric   return LLDB_RECORD_RESULT(sb_value);
627*0b57cec5SDimitry Andric }
628*0b57cec5SDimitry Andric 
629*0b57cec5SDimitry Andric lldb::SBValue SBValue::CreateValueFromAddress(const char *name,
630*0b57cec5SDimitry Andric                                               lldb::addr_t address,
631*0b57cec5SDimitry Andric                                               SBType sb_type) {
632*0b57cec5SDimitry Andric   LLDB_RECORD_METHOD(lldb::SBValue, SBValue, CreateValueFromAddress,
633*0b57cec5SDimitry Andric                      (const char *, lldb::addr_t, lldb::SBType), name, address,
634*0b57cec5SDimitry Andric                      sb_type);
635*0b57cec5SDimitry Andric 
636*0b57cec5SDimitry Andric   lldb::SBValue sb_value;
637*0b57cec5SDimitry Andric   ValueLocker locker;
638*0b57cec5SDimitry Andric   lldb::ValueObjectSP value_sp(GetSP(locker));
639*0b57cec5SDimitry Andric   lldb::ValueObjectSP new_value_sp;
640*0b57cec5SDimitry Andric   lldb::TypeImplSP type_impl_sp(sb_type.GetSP());
641*0b57cec5SDimitry Andric   if (value_sp && type_impl_sp) {
642*0b57cec5SDimitry Andric     CompilerType ast_type(type_impl_sp->GetCompilerType(true));
643*0b57cec5SDimitry Andric     ExecutionContext exe_ctx(value_sp->GetExecutionContextRef());
644*0b57cec5SDimitry Andric     new_value_sp = ValueObject::CreateValueObjectFromAddress(name, address,
645*0b57cec5SDimitry Andric                                                              exe_ctx, ast_type);
646*0b57cec5SDimitry Andric   }
647*0b57cec5SDimitry Andric   sb_value.SetSP(new_value_sp);
648*0b57cec5SDimitry Andric   return LLDB_RECORD_RESULT(sb_value);
649*0b57cec5SDimitry Andric }
650*0b57cec5SDimitry Andric 
651*0b57cec5SDimitry Andric lldb::SBValue SBValue::CreateValueFromData(const char *name, SBData data,
652*0b57cec5SDimitry Andric                                            SBType sb_type) {
653*0b57cec5SDimitry Andric   LLDB_RECORD_METHOD(lldb::SBValue, SBValue, CreateValueFromData,
654*0b57cec5SDimitry Andric                      (const char *, lldb::SBData, lldb::SBType), name, data,
655*0b57cec5SDimitry Andric                      sb_type);
656*0b57cec5SDimitry Andric 
657*0b57cec5SDimitry Andric   lldb::SBValue sb_value;
658*0b57cec5SDimitry Andric   lldb::ValueObjectSP new_value_sp;
659*0b57cec5SDimitry Andric   ValueLocker locker;
660*0b57cec5SDimitry Andric   lldb::ValueObjectSP value_sp(GetSP(locker));
661*0b57cec5SDimitry Andric   lldb::TypeImplSP type_impl_sp(sb_type.GetSP());
662*0b57cec5SDimitry Andric   if (value_sp && type_impl_sp) {
663*0b57cec5SDimitry Andric     ExecutionContext exe_ctx(value_sp->GetExecutionContextRef());
664*0b57cec5SDimitry Andric     new_value_sp = ValueObject::CreateValueObjectFromData(
665*0b57cec5SDimitry Andric         name, **data, exe_ctx, type_impl_sp->GetCompilerType(true));
666*0b57cec5SDimitry Andric     new_value_sp->SetAddressTypeOfChildren(eAddressTypeLoad);
667*0b57cec5SDimitry Andric   }
668*0b57cec5SDimitry Andric   sb_value.SetSP(new_value_sp);
669*0b57cec5SDimitry Andric   return LLDB_RECORD_RESULT(sb_value);
670*0b57cec5SDimitry Andric }
671*0b57cec5SDimitry Andric 
672*0b57cec5SDimitry Andric SBValue SBValue::GetChildAtIndex(uint32_t idx) {
673*0b57cec5SDimitry Andric   LLDB_RECORD_METHOD(lldb::SBValue, SBValue, GetChildAtIndex, (uint32_t), idx);
674*0b57cec5SDimitry Andric 
675*0b57cec5SDimitry Andric   const bool can_create_synthetic = false;
676*0b57cec5SDimitry Andric   lldb::DynamicValueType use_dynamic = eNoDynamicValues;
677*0b57cec5SDimitry Andric   TargetSP target_sp;
678*0b57cec5SDimitry Andric   if (m_opaque_sp)
679*0b57cec5SDimitry Andric     target_sp = m_opaque_sp->GetTargetSP();
680*0b57cec5SDimitry Andric 
681*0b57cec5SDimitry Andric   if (target_sp)
682*0b57cec5SDimitry Andric     use_dynamic = target_sp->GetPreferDynamicValue();
683*0b57cec5SDimitry Andric 
684*0b57cec5SDimitry Andric   return LLDB_RECORD_RESULT(
685*0b57cec5SDimitry Andric       GetChildAtIndex(idx, use_dynamic, can_create_synthetic));
686*0b57cec5SDimitry Andric }
687*0b57cec5SDimitry Andric 
688*0b57cec5SDimitry Andric SBValue SBValue::GetChildAtIndex(uint32_t idx,
689*0b57cec5SDimitry Andric                                  lldb::DynamicValueType use_dynamic,
690*0b57cec5SDimitry Andric                                  bool can_create_synthetic) {
691*0b57cec5SDimitry Andric   LLDB_RECORD_METHOD(lldb::SBValue, SBValue, GetChildAtIndex,
692*0b57cec5SDimitry Andric                      (uint32_t, lldb::DynamicValueType, bool), idx, use_dynamic,
693*0b57cec5SDimitry Andric                      can_create_synthetic);
694*0b57cec5SDimitry Andric 
695*0b57cec5SDimitry Andric   lldb::ValueObjectSP child_sp;
696*0b57cec5SDimitry Andric 
697*0b57cec5SDimitry Andric   ValueLocker locker;
698*0b57cec5SDimitry Andric   lldb::ValueObjectSP value_sp(GetSP(locker));
699*0b57cec5SDimitry Andric   if (value_sp) {
700*0b57cec5SDimitry Andric     const bool can_create = true;
701*0b57cec5SDimitry Andric     child_sp = value_sp->GetChildAtIndex(idx, can_create);
702*0b57cec5SDimitry Andric     if (can_create_synthetic && !child_sp) {
703*0b57cec5SDimitry Andric       child_sp = value_sp->GetSyntheticArrayMember(idx, can_create);
704*0b57cec5SDimitry Andric     }
705*0b57cec5SDimitry Andric   }
706*0b57cec5SDimitry Andric 
707*0b57cec5SDimitry Andric   SBValue sb_value;
708*0b57cec5SDimitry Andric   sb_value.SetSP(child_sp, use_dynamic, GetPreferSyntheticValue());
709*0b57cec5SDimitry Andric 
710*0b57cec5SDimitry Andric   return LLDB_RECORD_RESULT(sb_value);
711*0b57cec5SDimitry Andric }
712*0b57cec5SDimitry Andric 
713*0b57cec5SDimitry Andric uint32_t SBValue::GetIndexOfChildWithName(const char *name) {
714*0b57cec5SDimitry Andric   LLDB_RECORD_METHOD(uint32_t, SBValue, GetIndexOfChildWithName, (const char *),
715*0b57cec5SDimitry Andric                      name);
716*0b57cec5SDimitry Andric 
717*0b57cec5SDimitry Andric   uint32_t idx = UINT32_MAX;
718*0b57cec5SDimitry Andric   ValueLocker locker;
719*0b57cec5SDimitry Andric   lldb::ValueObjectSP value_sp(GetSP(locker));
720*0b57cec5SDimitry Andric   if (value_sp) {
721*0b57cec5SDimitry Andric     idx = value_sp->GetIndexOfChildWithName(ConstString(name));
722*0b57cec5SDimitry Andric   }
723*0b57cec5SDimitry Andric   return idx;
724*0b57cec5SDimitry Andric }
725*0b57cec5SDimitry Andric 
726*0b57cec5SDimitry Andric SBValue SBValue::GetChildMemberWithName(const char *name) {
727*0b57cec5SDimitry Andric   LLDB_RECORD_METHOD(lldb::SBValue, SBValue, GetChildMemberWithName,
728*0b57cec5SDimitry Andric                      (const char *), name);
729*0b57cec5SDimitry Andric 
730*0b57cec5SDimitry Andric   lldb::DynamicValueType use_dynamic_value = eNoDynamicValues;
731*0b57cec5SDimitry Andric   TargetSP target_sp;
732*0b57cec5SDimitry Andric   if (m_opaque_sp)
733*0b57cec5SDimitry Andric     target_sp = m_opaque_sp->GetTargetSP();
734*0b57cec5SDimitry Andric 
735*0b57cec5SDimitry Andric   if (target_sp)
736*0b57cec5SDimitry Andric     use_dynamic_value = target_sp->GetPreferDynamicValue();
737*0b57cec5SDimitry Andric   return LLDB_RECORD_RESULT(GetChildMemberWithName(name, use_dynamic_value));
738*0b57cec5SDimitry Andric }
739*0b57cec5SDimitry Andric 
740*0b57cec5SDimitry Andric SBValue
741*0b57cec5SDimitry Andric SBValue::GetChildMemberWithName(const char *name,
742*0b57cec5SDimitry Andric                                 lldb::DynamicValueType use_dynamic_value) {
743*0b57cec5SDimitry Andric   LLDB_RECORD_METHOD(lldb::SBValue, SBValue, GetChildMemberWithName,
744*0b57cec5SDimitry Andric                      (const char *, lldb::DynamicValueType), name,
745*0b57cec5SDimitry Andric                      use_dynamic_value);
746*0b57cec5SDimitry Andric 
747*0b57cec5SDimitry Andric   lldb::ValueObjectSP child_sp;
748*0b57cec5SDimitry Andric   const ConstString str_name(name);
749*0b57cec5SDimitry Andric 
750*0b57cec5SDimitry Andric   ValueLocker locker;
751*0b57cec5SDimitry Andric   lldb::ValueObjectSP value_sp(GetSP(locker));
752*0b57cec5SDimitry Andric   if (value_sp) {
753*0b57cec5SDimitry Andric     child_sp = value_sp->GetChildMemberWithName(str_name, true);
754*0b57cec5SDimitry Andric   }
755*0b57cec5SDimitry Andric 
756*0b57cec5SDimitry Andric   SBValue sb_value;
757*0b57cec5SDimitry Andric   sb_value.SetSP(child_sp, use_dynamic_value, GetPreferSyntheticValue());
758*0b57cec5SDimitry Andric 
759*0b57cec5SDimitry Andric   return LLDB_RECORD_RESULT(sb_value);
760*0b57cec5SDimitry Andric }
761*0b57cec5SDimitry Andric 
762*0b57cec5SDimitry Andric lldb::SBValue SBValue::GetDynamicValue(lldb::DynamicValueType use_dynamic) {
763*0b57cec5SDimitry Andric   LLDB_RECORD_METHOD(lldb::SBValue, SBValue, GetDynamicValue,
764*0b57cec5SDimitry Andric                      (lldb::DynamicValueType), use_dynamic);
765*0b57cec5SDimitry Andric 
766*0b57cec5SDimitry Andric   SBValue value_sb;
767*0b57cec5SDimitry Andric   if (IsValid()) {
768*0b57cec5SDimitry Andric     ValueImplSP proxy_sp(new ValueImpl(m_opaque_sp->GetRootSP(), use_dynamic,
769*0b57cec5SDimitry Andric                                        m_opaque_sp->GetUseSynthetic()));
770*0b57cec5SDimitry Andric     value_sb.SetSP(proxy_sp);
771*0b57cec5SDimitry Andric   }
772*0b57cec5SDimitry Andric   return LLDB_RECORD_RESULT(value_sb);
773*0b57cec5SDimitry Andric }
774*0b57cec5SDimitry Andric 
775*0b57cec5SDimitry Andric lldb::SBValue SBValue::GetStaticValue() {
776*0b57cec5SDimitry Andric   LLDB_RECORD_METHOD_NO_ARGS(lldb::SBValue, SBValue, GetStaticValue);
777*0b57cec5SDimitry Andric 
778*0b57cec5SDimitry Andric   SBValue value_sb;
779*0b57cec5SDimitry Andric   if (IsValid()) {
780*0b57cec5SDimitry Andric     ValueImplSP proxy_sp(new ValueImpl(m_opaque_sp->GetRootSP(),
781*0b57cec5SDimitry Andric                                        eNoDynamicValues,
782*0b57cec5SDimitry Andric                                        m_opaque_sp->GetUseSynthetic()));
783*0b57cec5SDimitry Andric     value_sb.SetSP(proxy_sp);
784*0b57cec5SDimitry Andric   }
785*0b57cec5SDimitry Andric   return LLDB_RECORD_RESULT(value_sb);
786*0b57cec5SDimitry Andric }
787*0b57cec5SDimitry Andric 
788*0b57cec5SDimitry Andric lldb::SBValue SBValue::GetNonSyntheticValue() {
789*0b57cec5SDimitry Andric   LLDB_RECORD_METHOD_NO_ARGS(lldb::SBValue, SBValue, GetNonSyntheticValue);
790*0b57cec5SDimitry Andric 
791*0b57cec5SDimitry Andric   SBValue value_sb;
792*0b57cec5SDimitry Andric   if (IsValid()) {
793*0b57cec5SDimitry Andric     ValueImplSP proxy_sp(new ValueImpl(m_opaque_sp->GetRootSP(),
794*0b57cec5SDimitry Andric                                        m_opaque_sp->GetUseDynamic(), false));
795*0b57cec5SDimitry Andric     value_sb.SetSP(proxy_sp);
796*0b57cec5SDimitry Andric   }
797*0b57cec5SDimitry Andric   return LLDB_RECORD_RESULT(value_sb);
798*0b57cec5SDimitry Andric }
799*0b57cec5SDimitry Andric 
800*0b57cec5SDimitry Andric lldb::DynamicValueType SBValue::GetPreferDynamicValue() {
801*0b57cec5SDimitry Andric   LLDB_RECORD_METHOD_NO_ARGS(lldb::DynamicValueType, SBValue,
802*0b57cec5SDimitry Andric                              GetPreferDynamicValue);
803*0b57cec5SDimitry Andric 
804*0b57cec5SDimitry Andric   if (!IsValid())
805*0b57cec5SDimitry Andric     return eNoDynamicValues;
806*0b57cec5SDimitry Andric   return m_opaque_sp->GetUseDynamic();
807*0b57cec5SDimitry Andric }
808*0b57cec5SDimitry Andric 
809*0b57cec5SDimitry Andric void SBValue::SetPreferDynamicValue(lldb::DynamicValueType use_dynamic) {
810*0b57cec5SDimitry Andric   LLDB_RECORD_METHOD(void, SBValue, SetPreferDynamicValue,
811*0b57cec5SDimitry Andric                      (lldb::DynamicValueType), use_dynamic);
812*0b57cec5SDimitry Andric 
813*0b57cec5SDimitry Andric   if (IsValid())
814*0b57cec5SDimitry Andric     return m_opaque_sp->SetUseDynamic(use_dynamic);
815*0b57cec5SDimitry Andric }
816*0b57cec5SDimitry Andric 
817*0b57cec5SDimitry Andric bool SBValue::GetPreferSyntheticValue() {
818*0b57cec5SDimitry Andric   LLDB_RECORD_METHOD_NO_ARGS(bool, SBValue, GetPreferSyntheticValue);
819*0b57cec5SDimitry Andric 
820*0b57cec5SDimitry Andric   if (!IsValid())
821*0b57cec5SDimitry Andric     return false;
822*0b57cec5SDimitry Andric   return m_opaque_sp->GetUseSynthetic();
823*0b57cec5SDimitry Andric }
824*0b57cec5SDimitry Andric 
825*0b57cec5SDimitry Andric void SBValue::SetPreferSyntheticValue(bool use_synthetic) {
826*0b57cec5SDimitry Andric   LLDB_RECORD_METHOD(void, SBValue, SetPreferSyntheticValue, (bool),
827*0b57cec5SDimitry Andric                      use_synthetic);
828*0b57cec5SDimitry Andric 
829*0b57cec5SDimitry Andric   if (IsValid())
830*0b57cec5SDimitry Andric     return m_opaque_sp->SetUseSynthetic(use_synthetic);
831*0b57cec5SDimitry Andric }
832*0b57cec5SDimitry Andric 
833*0b57cec5SDimitry Andric bool SBValue::IsDynamic() {
834*0b57cec5SDimitry Andric   LLDB_RECORD_METHOD_NO_ARGS(bool, SBValue, IsDynamic);
835*0b57cec5SDimitry Andric 
836*0b57cec5SDimitry Andric   ValueLocker locker;
837*0b57cec5SDimitry Andric   lldb::ValueObjectSP value_sp(GetSP(locker));
838*0b57cec5SDimitry Andric   if (value_sp)
839*0b57cec5SDimitry Andric     return value_sp->IsDynamic();
840*0b57cec5SDimitry Andric   return false;
841*0b57cec5SDimitry Andric }
842*0b57cec5SDimitry Andric 
843*0b57cec5SDimitry Andric bool SBValue::IsSynthetic() {
844*0b57cec5SDimitry Andric   LLDB_RECORD_METHOD_NO_ARGS(bool, SBValue, IsSynthetic);
845*0b57cec5SDimitry Andric 
846*0b57cec5SDimitry Andric   ValueLocker locker;
847*0b57cec5SDimitry Andric   lldb::ValueObjectSP value_sp(GetSP(locker));
848*0b57cec5SDimitry Andric   if (value_sp)
849*0b57cec5SDimitry Andric     return value_sp->IsSynthetic();
850*0b57cec5SDimitry Andric   return false;
851*0b57cec5SDimitry Andric }
852*0b57cec5SDimitry Andric 
853*0b57cec5SDimitry Andric bool SBValue::IsSyntheticChildrenGenerated() {
854*0b57cec5SDimitry Andric   LLDB_RECORD_METHOD_NO_ARGS(bool, SBValue, IsSyntheticChildrenGenerated);
855*0b57cec5SDimitry Andric 
856*0b57cec5SDimitry Andric   ValueLocker locker;
857*0b57cec5SDimitry Andric   lldb::ValueObjectSP value_sp(GetSP(locker));
858*0b57cec5SDimitry Andric   if (value_sp)
859*0b57cec5SDimitry Andric     return value_sp->IsSyntheticChildrenGenerated();
860*0b57cec5SDimitry Andric   return false;
861*0b57cec5SDimitry Andric }
862*0b57cec5SDimitry Andric 
863*0b57cec5SDimitry Andric void SBValue::SetSyntheticChildrenGenerated(bool is) {
864*0b57cec5SDimitry Andric   LLDB_RECORD_METHOD(void, SBValue, SetSyntheticChildrenGenerated, (bool), is);
865*0b57cec5SDimitry Andric 
866*0b57cec5SDimitry Andric   ValueLocker locker;
867*0b57cec5SDimitry Andric   lldb::ValueObjectSP value_sp(GetSP(locker));
868*0b57cec5SDimitry Andric   if (value_sp)
869*0b57cec5SDimitry Andric     return value_sp->SetSyntheticChildrenGenerated(is);
870*0b57cec5SDimitry Andric }
871*0b57cec5SDimitry Andric 
872*0b57cec5SDimitry Andric lldb::SBValue SBValue::GetValueForExpressionPath(const char *expr_path) {
873*0b57cec5SDimitry Andric   LLDB_RECORD_METHOD(lldb::SBValue, SBValue, GetValueForExpressionPath,
874*0b57cec5SDimitry Andric                      (const char *), expr_path);
875*0b57cec5SDimitry Andric 
876*0b57cec5SDimitry Andric   lldb::ValueObjectSP child_sp;
877*0b57cec5SDimitry Andric   ValueLocker locker;
878*0b57cec5SDimitry Andric   lldb::ValueObjectSP value_sp(GetSP(locker));
879*0b57cec5SDimitry Andric   if (value_sp) {
880*0b57cec5SDimitry Andric     // using default values for all the fancy options, just do it if you can
881*0b57cec5SDimitry Andric     child_sp = value_sp->GetValueForExpressionPath(expr_path);
882*0b57cec5SDimitry Andric   }
883*0b57cec5SDimitry Andric 
884*0b57cec5SDimitry Andric   SBValue sb_value;
885*0b57cec5SDimitry Andric   sb_value.SetSP(child_sp, GetPreferDynamicValue(), GetPreferSyntheticValue());
886*0b57cec5SDimitry Andric 
887*0b57cec5SDimitry Andric   return LLDB_RECORD_RESULT(sb_value);
888*0b57cec5SDimitry Andric }
889*0b57cec5SDimitry Andric 
890*0b57cec5SDimitry Andric int64_t SBValue::GetValueAsSigned(SBError &error, int64_t fail_value) {
891*0b57cec5SDimitry Andric   LLDB_RECORD_METHOD(int64_t, SBValue, GetValueAsSigned,
892*0b57cec5SDimitry Andric                      (lldb::SBError &, int64_t), error, fail_value);
893*0b57cec5SDimitry Andric 
894*0b57cec5SDimitry Andric   error.Clear();
895*0b57cec5SDimitry Andric   ValueLocker locker;
896*0b57cec5SDimitry Andric   lldb::ValueObjectSP value_sp(GetSP(locker));
897*0b57cec5SDimitry Andric   if (value_sp) {
898*0b57cec5SDimitry Andric     bool success = true;
899*0b57cec5SDimitry Andric     uint64_t ret_val = fail_value;
900*0b57cec5SDimitry Andric     ret_val = value_sp->GetValueAsSigned(fail_value, &success);
901*0b57cec5SDimitry Andric     if (!success)
902*0b57cec5SDimitry Andric       error.SetErrorString("could not resolve value");
903*0b57cec5SDimitry Andric     return ret_val;
904*0b57cec5SDimitry Andric   } else
905*0b57cec5SDimitry Andric     error.SetErrorStringWithFormat("could not get SBValue: %s",
906*0b57cec5SDimitry Andric                                    locker.GetError().AsCString());
907*0b57cec5SDimitry Andric 
908*0b57cec5SDimitry Andric   return fail_value;
909*0b57cec5SDimitry Andric }
910*0b57cec5SDimitry Andric 
911*0b57cec5SDimitry Andric uint64_t SBValue::GetValueAsUnsigned(SBError &error, uint64_t fail_value) {
912*0b57cec5SDimitry Andric   LLDB_RECORD_METHOD(uint64_t, SBValue, GetValueAsUnsigned,
913*0b57cec5SDimitry Andric                      (lldb::SBError &, uint64_t), error, fail_value);
914*0b57cec5SDimitry Andric 
915*0b57cec5SDimitry Andric   error.Clear();
916*0b57cec5SDimitry Andric   ValueLocker locker;
917*0b57cec5SDimitry Andric   lldb::ValueObjectSP value_sp(GetSP(locker));
918*0b57cec5SDimitry Andric   if (value_sp) {
919*0b57cec5SDimitry Andric     bool success = true;
920*0b57cec5SDimitry Andric     uint64_t ret_val = fail_value;
921*0b57cec5SDimitry Andric     ret_val = value_sp->GetValueAsUnsigned(fail_value, &success);
922*0b57cec5SDimitry Andric     if (!success)
923*0b57cec5SDimitry Andric       error.SetErrorString("could not resolve value");
924*0b57cec5SDimitry Andric     return ret_val;
925*0b57cec5SDimitry Andric   } else
926*0b57cec5SDimitry Andric     error.SetErrorStringWithFormat("could not get SBValue: %s",
927*0b57cec5SDimitry Andric                                    locker.GetError().AsCString());
928*0b57cec5SDimitry Andric 
929*0b57cec5SDimitry Andric   return fail_value;
930*0b57cec5SDimitry Andric }
931*0b57cec5SDimitry Andric 
932*0b57cec5SDimitry Andric int64_t SBValue::GetValueAsSigned(int64_t fail_value) {
933*0b57cec5SDimitry Andric   LLDB_RECORD_METHOD(int64_t, SBValue, GetValueAsSigned, (int64_t), fail_value);
934*0b57cec5SDimitry Andric 
935*0b57cec5SDimitry Andric   ValueLocker locker;
936*0b57cec5SDimitry Andric   lldb::ValueObjectSP value_sp(GetSP(locker));
937*0b57cec5SDimitry Andric   if (value_sp) {
938*0b57cec5SDimitry Andric     return value_sp->GetValueAsSigned(fail_value);
939*0b57cec5SDimitry Andric   }
940*0b57cec5SDimitry Andric   return fail_value;
941*0b57cec5SDimitry Andric }
942*0b57cec5SDimitry Andric 
943*0b57cec5SDimitry Andric uint64_t SBValue::GetValueAsUnsigned(uint64_t fail_value) {
944*0b57cec5SDimitry Andric   LLDB_RECORD_METHOD(uint64_t, SBValue, GetValueAsUnsigned, (uint64_t),
945*0b57cec5SDimitry Andric                      fail_value);
946*0b57cec5SDimitry Andric 
947*0b57cec5SDimitry Andric   ValueLocker locker;
948*0b57cec5SDimitry Andric   lldb::ValueObjectSP value_sp(GetSP(locker));
949*0b57cec5SDimitry Andric   if (value_sp) {
950*0b57cec5SDimitry Andric     return value_sp->GetValueAsUnsigned(fail_value);
951*0b57cec5SDimitry Andric   }
952*0b57cec5SDimitry Andric   return fail_value;
953*0b57cec5SDimitry Andric }
954*0b57cec5SDimitry Andric 
955*0b57cec5SDimitry Andric bool SBValue::MightHaveChildren() {
956*0b57cec5SDimitry Andric   LLDB_RECORD_METHOD_NO_ARGS(bool, SBValue, MightHaveChildren);
957*0b57cec5SDimitry Andric 
958*0b57cec5SDimitry Andric   bool has_children = false;
959*0b57cec5SDimitry Andric   ValueLocker locker;
960*0b57cec5SDimitry Andric   lldb::ValueObjectSP value_sp(GetSP(locker));
961*0b57cec5SDimitry Andric   if (value_sp)
962*0b57cec5SDimitry Andric     has_children = value_sp->MightHaveChildren();
963*0b57cec5SDimitry Andric 
964*0b57cec5SDimitry Andric   return has_children;
965*0b57cec5SDimitry Andric }
966*0b57cec5SDimitry Andric 
967*0b57cec5SDimitry Andric bool SBValue::IsRuntimeSupportValue() {
968*0b57cec5SDimitry Andric   LLDB_RECORD_METHOD_NO_ARGS(bool, SBValue, IsRuntimeSupportValue);
969*0b57cec5SDimitry Andric 
970*0b57cec5SDimitry Andric   bool is_support = false;
971*0b57cec5SDimitry Andric   ValueLocker locker;
972*0b57cec5SDimitry Andric   lldb::ValueObjectSP value_sp(GetSP(locker));
973*0b57cec5SDimitry Andric   if (value_sp)
974*0b57cec5SDimitry Andric     is_support = value_sp->IsRuntimeSupportValue();
975*0b57cec5SDimitry Andric 
976*0b57cec5SDimitry Andric   return is_support;
977*0b57cec5SDimitry Andric }
978*0b57cec5SDimitry Andric 
979*0b57cec5SDimitry Andric uint32_t SBValue::GetNumChildren() {
980*0b57cec5SDimitry Andric   LLDB_RECORD_METHOD_NO_ARGS(uint32_t, SBValue, GetNumChildren);
981*0b57cec5SDimitry Andric 
982*0b57cec5SDimitry Andric   return GetNumChildren(UINT32_MAX);
983*0b57cec5SDimitry Andric }
984*0b57cec5SDimitry Andric 
985*0b57cec5SDimitry Andric uint32_t SBValue::GetNumChildren(uint32_t max) {
986*0b57cec5SDimitry Andric   LLDB_RECORD_METHOD(uint32_t, SBValue, GetNumChildren, (uint32_t), max);
987*0b57cec5SDimitry Andric 
988*0b57cec5SDimitry Andric   uint32_t num_children = 0;
989*0b57cec5SDimitry Andric 
990*0b57cec5SDimitry Andric   ValueLocker locker;
991*0b57cec5SDimitry Andric   lldb::ValueObjectSP value_sp(GetSP(locker));
992*0b57cec5SDimitry Andric   if (value_sp)
993*0b57cec5SDimitry Andric     num_children = value_sp->GetNumChildren(max);
994*0b57cec5SDimitry Andric 
995*0b57cec5SDimitry Andric   return num_children;
996*0b57cec5SDimitry Andric }
997*0b57cec5SDimitry Andric 
998*0b57cec5SDimitry Andric SBValue SBValue::Dereference() {
999*0b57cec5SDimitry Andric   LLDB_RECORD_METHOD_NO_ARGS(lldb::SBValue, SBValue, Dereference);
1000*0b57cec5SDimitry Andric 
1001*0b57cec5SDimitry Andric   SBValue sb_value;
1002*0b57cec5SDimitry Andric   ValueLocker locker;
1003*0b57cec5SDimitry Andric   lldb::ValueObjectSP value_sp(GetSP(locker));
1004*0b57cec5SDimitry Andric   if (value_sp) {
1005*0b57cec5SDimitry Andric     Status error;
1006*0b57cec5SDimitry Andric     sb_value = value_sp->Dereference(error);
1007*0b57cec5SDimitry Andric   }
1008*0b57cec5SDimitry Andric 
1009*0b57cec5SDimitry Andric   return LLDB_RECORD_RESULT(sb_value);
1010*0b57cec5SDimitry Andric }
1011*0b57cec5SDimitry Andric 
1012*0b57cec5SDimitry Andric // Deprecated - please use GetType().IsPointerType() instead.
1013*0b57cec5SDimitry Andric bool SBValue::TypeIsPointerType() {
1014*0b57cec5SDimitry Andric   LLDB_RECORD_METHOD_NO_ARGS(bool, SBValue, TypeIsPointerType);
1015*0b57cec5SDimitry Andric 
1016*0b57cec5SDimitry Andric   return GetType().IsPointerType();
1017*0b57cec5SDimitry Andric }
1018*0b57cec5SDimitry Andric 
1019*0b57cec5SDimitry Andric void *SBValue::GetOpaqueType() {
1020*0b57cec5SDimitry Andric   LLDB_RECORD_METHOD_NO_ARGS(void *, SBValue, GetOpaqueType);
1021*0b57cec5SDimitry Andric 
1022*0b57cec5SDimitry Andric   ValueLocker locker;
1023*0b57cec5SDimitry Andric   lldb::ValueObjectSP value_sp(GetSP(locker));
1024*0b57cec5SDimitry Andric   if (value_sp)
1025*0b57cec5SDimitry Andric     return value_sp->GetCompilerType().GetOpaqueQualType();
1026*0b57cec5SDimitry Andric   return nullptr;
1027*0b57cec5SDimitry Andric }
1028*0b57cec5SDimitry Andric 
1029*0b57cec5SDimitry Andric lldb::SBTarget SBValue::GetTarget() {
1030*0b57cec5SDimitry Andric   LLDB_RECORD_METHOD_NO_ARGS(lldb::SBTarget, SBValue, GetTarget);
1031*0b57cec5SDimitry Andric 
1032*0b57cec5SDimitry Andric   SBTarget sb_target;
1033*0b57cec5SDimitry Andric   TargetSP target_sp;
1034*0b57cec5SDimitry Andric   if (m_opaque_sp) {
1035*0b57cec5SDimitry Andric     target_sp = m_opaque_sp->GetTargetSP();
1036*0b57cec5SDimitry Andric     sb_target.SetSP(target_sp);
1037*0b57cec5SDimitry Andric   }
1038*0b57cec5SDimitry Andric 
1039*0b57cec5SDimitry Andric   return LLDB_RECORD_RESULT(sb_target);
1040*0b57cec5SDimitry Andric }
1041*0b57cec5SDimitry Andric 
1042*0b57cec5SDimitry Andric lldb::SBProcess SBValue::GetProcess() {
1043*0b57cec5SDimitry Andric   LLDB_RECORD_METHOD_NO_ARGS(lldb::SBProcess, SBValue, GetProcess);
1044*0b57cec5SDimitry Andric 
1045*0b57cec5SDimitry Andric   SBProcess sb_process;
1046*0b57cec5SDimitry Andric   ProcessSP process_sp;
1047*0b57cec5SDimitry Andric   if (m_opaque_sp) {
1048*0b57cec5SDimitry Andric     process_sp = m_opaque_sp->GetProcessSP();
1049*0b57cec5SDimitry Andric     sb_process.SetSP(process_sp);
1050*0b57cec5SDimitry Andric   }
1051*0b57cec5SDimitry Andric 
1052*0b57cec5SDimitry Andric   return LLDB_RECORD_RESULT(sb_process);
1053*0b57cec5SDimitry Andric }
1054*0b57cec5SDimitry Andric 
1055*0b57cec5SDimitry Andric lldb::SBThread SBValue::GetThread() {
1056*0b57cec5SDimitry Andric   LLDB_RECORD_METHOD_NO_ARGS(lldb::SBThread, SBValue, GetThread);
1057*0b57cec5SDimitry Andric 
1058*0b57cec5SDimitry Andric   SBThread sb_thread;
1059*0b57cec5SDimitry Andric   ThreadSP thread_sp;
1060*0b57cec5SDimitry Andric   if (m_opaque_sp) {
1061*0b57cec5SDimitry Andric     thread_sp = m_opaque_sp->GetThreadSP();
1062*0b57cec5SDimitry Andric     sb_thread.SetThread(thread_sp);
1063*0b57cec5SDimitry Andric   }
1064*0b57cec5SDimitry Andric 
1065*0b57cec5SDimitry Andric   return LLDB_RECORD_RESULT(sb_thread);
1066*0b57cec5SDimitry Andric }
1067*0b57cec5SDimitry Andric 
1068*0b57cec5SDimitry Andric lldb::SBFrame SBValue::GetFrame() {
1069*0b57cec5SDimitry Andric   LLDB_RECORD_METHOD_NO_ARGS(lldb::SBFrame, SBValue, GetFrame);
1070*0b57cec5SDimitry Andric 
1071*0b57cec5SDimitry Andric   SBFrame sb_frame;
1072*0b57cec5SDimitry Andric   StackFrameSP frame_sp;
1073*0b57cec5SDimitry Andric   if (m_opaque_sp) {
1074*0b57cec5SDimitry Andric     frame_sp = m_opaque_sp->GetFrameSP();
1075*0b57cec5SDimitry Andric     sb_frame.SetFrameSP(frame_sp);
1076*0b57cec5SDimitry Andric   }
1077*0b57cec5SDimitry Andric 
1078*0b57cec5SDimitry Andric   return LLDB_RECORD_RESULT(sb_frame);
1079*0b57cec5SDimitry Andric }
1080*0b57cec5SDimitry Andric 
1081*0b57cec5SDimitry Andric lldb::ValueObjectSP SBValue::GetSP(ValueLocker &locker) const {
1082*0b57cec5SDimitry Andric   if (!m_opaque_sp || !m_opaque_sp->IsValid()) {
1083*0b57cec5SDimitry Andric     locker.GetError().SetErrorString("No value");
1084*0b57cec5SDimitry Andric     return ValueObjectSP();
1085*0b57cec5SDimitry Andric   }
1086*0b57cec5SDimitry Andric   return locker.GetLockedSP(*m_opaque_sp.get());
1087*0b57cec5SDimitry Andric }
1088*0b57cec5SDimitry Andric 
1089*0b57cec5SDimitry Andric lldb::ValueObjectSP SBValue::GetSP() const {
1090*0b57cec5SDimitry Andric   LLDB_RECORD_METHOD_CONST_NO_ARGS(lldb::ValueObjectSP, SBValue, GetSP);
1091*0b57cec5SDimitry Andric 
1092*0b57cec5SDimitry Andric   ValueLocker locker;
1093*0b57cec5SDimitry Andric   return LLDB_RECORD_RESULT(GetSP(locker));
1094*0b57cec5SDimitry Andric }
1095*0b57cec5SDimitry Andric 
1096*0b57cec5SDimitry Andric void SBValue::SetSP(ValueImplSP impl_sp) { m_opaque_sp = impl_sp; }
1097*0b57cec5SDimitry Andric 
1098*0b57cec5SDimitry Andric void SBValue::SetSP(const lldb::ValueObjectSP &sp) {
1099*0b57cec5SDimitry Andric   if (sp) {
1100*0b57cec5SDimitry Andric     lldb::TargetSP target_sp(sp->GetTargetSP());
1101*0b57cec5SDimitry Andric     if (target_sp) {
1102*0b57cec5SDimitry Andric       lldb::DynamicValueType use_dynamic = target_sp->GetPreferDynamicValue();
1103*0b57cec5SDimitry Andric       bool use_synthetic =
1104*0b57cec5SDimitry Andric           target_sp->TargetProperties::GetEnableSyntheticValue();
1105*0b57cec5SDimitry Andric       m_opaque_sp = ValueImplSP(new ValueImpl(sp, use_dynamic, use_synthetic));
1106*0b57cec5SDimitry Andric     } else
1107*0b57cec5SDimitry Andric       m_opaque_sp = ValueImplSP(new ValueImpl(sp, eNoDynamicValues, true));
1108*0b57cec5SDimitry Andric   } else
1109*0b57cec5SDimitry Andric     m_opaque_sp = ValueImplSP(new ValueImpl(sp, eNoDynamicValues, false));
1110*0b57cec5SDimitry Andric }
1111*0b57cec5SDimitry Andric 
1112*0b57cec5SDimitry Andric void SBValue::SetSP(const lldb::ValueObjectSP &sp,
1113*0b57cec5SDimitry Andric                     lldb::DynamicValueType use_dynamic) {
1114*0b57cec5SDimitry Andric   if (sp) {
1115*0b57cec5SDimitry Andric     lldb::TargetSP target_sp(sp->GetTargetSP());
1116*0b57cec5SDimitry Andric     if (target_sp) {
1117*0b57cec5SDimitry Andric       bool use_synthetic =
1118*0b57cec5SDimitry Andric           target_sp->TargetProperties::GetEnableSyntheticValue();
1119*0b57cec5SDimitry Andric       SetSP(sp, use_dynamic, use_synthetic);
1120*0b57cec5SDimitry Andric     } else
1121*0b57cec5SDimitry Andric       SetSP(sp, use_dynamic, true);
1122*0b57cec5SDimitry Andric   } else
1123*0b57cec5SDimitry Andric     SetSP(sp, use_dynamic, false);
1124*0b57cec5SDimitry Andric }
1125*0b57cec5SDimitry Andric 
1126*0b57cec5SDimitry Andric void SBValue::SetSP(const lldb::ValueObjectSP &sp, bool use_synthetic) {
1127*0b57cec5SDimitry Andric   if (sp) {
1128*0b57cec5SDimitry Andric     lldb::TargetSP target_sp(sp->GetTargetSP());
1129*0b57cec5SDimitry Andric     if (target_sp) {
1130*0b57cec5SDimitry Andric       lldb::DynamicValueType use_dynamic = target_sp->GetPreferDynamicValue();
1131*0b57cec5SDimitry Andric       SetSP(sp, use_dynamic, use_synthetic);
1132*0b57cec5SDimitry Andric     } else
1133*0b57cec5SDimitry Andric       SetSP(sp, eNoDynamicValues, use_synthetic);
1134*0b57cec5SDimitry Andric   } else
1135*0b57cec5SDimitry Andric     SetSP(sp, eNoDynamicValues, use_synthetic);
1136*0b57cec5SDimitry Andric }
1137*0b57cec5SDimitry Andric 
1138*0b57cec5SDimitry Andric void SBValue::SetSP(const lldb::ValueObjectSP &sp,
1139*0b57cec5SDimitry Andric                     lldb::DynamicValueType use_dynamic, bool use_synthetic) {
1140*0b57cec5SDimitry Andric   m_opaque_sp = ValueImplSP(new ValueImpl(sp, use_dynamic, use_synthetic));
1141*0b57cec5SDimitry Andric }
1142*0b57cec5SDimitry Andric 
1143*0b57cec5SDimitry Andric void SBValue::SetSP(const lldb::ValueObjectSP &sp,
1144*0b57cec5SDimitry Andric                     lldb::DynamicValueType use_dynamic, bool use_synthetic,
1145*0b57cec5SDimitry Andric                     const char *name) {
1146*0b57cec5SDimitry Andric   m_opaque_sp =
1147*0b57cec5SDimitry Andric       ValueImplSP(new ValueImpl(sp, use_dynamic, use_synthetic, name));
1148*0b57cec5SDimitry Andric }
1149*0b57cec5SDimitry Andric 
1150*0b57cec5SDimitry Andric bool SBValue::GetExpressionPath(SBStream &description) {
1151*0b57cec5SDimitry Andric   LLDB_RECORD_METHOD(bool, SBValue, GetExpressionPath, (lldb::SBStream &),
1152*0b57cec5SDimitry Andric                      description);
1153*0b57cec5SDimitry Andric 
1154*0b57cec5SDimitry Andric   ValueLocker locker;
1155*0b57cec5SDimitry Andric   lldb::ValueObjectSP value_sp(GetSP(locker));
1156*0b57cec5SDimitry Andric   if (value_sp) {
11575ffd83dbSDimitry Andric     value_sp->GetExpressionPath(description.ref());
1158*0b57cec5SDimitry Andric     return true;
1159*0b57cec5SDimitry Andric   }
1160*0b57cec5SDimitry Andric   return false;
1161*0b57cec5SDimitry Andric }
1162*0b57cec5SDimitry Andric 
1163*0b57cec5SDimitry Andric bool SBValue::GetExpressionPath(SBStream &description,
1164*0b57cec5SDimitry Andric                                 bool qualify_cxx_base_classes) {
1165*0b57cec5SDimitry Andric   LLDB_RECORD_METHOD(bool, SBValue, GetExpressionPath, (lldb::SBStream &, bool),
1166*0b57cec5SDimitry Andric                      description, qualify_cxx_base_classes);
1167*0b57cec5SDimitry Andric 
1168*0b57cec5SDimitry Andric   ValueLocker locker;
1169*0b57cec5SDimitry Andric   lldb::ValueObjectSP value_sp(GetSP(locker));
1170*0b57cec5SDimitry Andric   if (value_sp) {
11715ffd83dbSDimitry Andric     value_sp->GetExpressionPath(description.ref());
1172*0b57cec5SDimitry Andric     return true;
1173*0b57cec5SDimitry Andric   }
1174*0b57cec5SDimitry Andric   return false;
1175*0b57cec5SDimitry Andric }
1176*0b57cec5SDimitry Andric 
1177*0b57cec5SDimitry Andric lldb::SBValue SBValue::EvaluateExpression(const char *expr) const {
1178*0b57cec5SDimitry Andric   LLDB_RECORD_METHOD_CONST(lldb::SBValue, SBValue, EvaluateExpression,
1179*0b57cec5SDimitry Andric                            (const char *), expr);
1180*0b57cec5SDimitry Andric 
1181*0b57cec5SDimitry Andric   ValueLocker locker;
1182*0b57cec5SDimitry Andric   lldb::ValueObjectSP value_sp(GetSP(locker));
1183*0b57cec5SDimitry Andric   if (!value_sp)
1184*0b57cec5SDimitry Andric     return LLDB_RECORD_RESULT(SBValue());
1185*0b57cec5SDimitry Andric 
1186*0b57cec5SDimitry Andric   lldb::TargetSP target_sp = value_sp->GetTargetSP();
1187*0b57cec5SDimitry Andric   if (!target_sp)
1188*0b57cec5SDimitry Andric     return LLDB_RECORD_RESULT(SBValue());
1189*0b57cec5SDimitry Andric 
1190*0b57cec5SDimitry Andric   lldb::SBExpressionOptions options;
1191*0b57cec5SDimitry Andric   options.SetFetchDynamicValue(target_sp->GetPreferDynamicValue());
1192*0b57cec5SDimitry Andric   options.SetUnwindOnError(true);
1193*0b57cec5SDimitry Andric   options.SetIgnoreBreakpoints(true);
1194*0b57cec5SDimitry Andric 
1195*0b57cec5SDimitry Andric   return LLDB_RECORD_RESULT(EvaluateExpression(expr, options, nullptr));
1196*0b57cec5SDimitry Andric }
1197*0b57cec5SDimitry Andric 
1198*0b57cec5SDimitry Andric lldb::SBValue
1199*0b57cec5SDimitry Andric SBValue::EvaluateExpression(const char *expr,
1200*0b57cec5SDimitry Andric                             const SBExpressionOptions &options) const {
1201*0b57cec5SDimitry Andric   LLDB_RECORD_METHOD_CONST(lldb::SBValue, SBValue, EvaluateExpression,
1202*0b57cec5SDimitry Andric                            (const char *, const lldb::SBExpressionOptions &),
1203*0b57cec5SDimitry Andric                            expr, options);
1204*0b57cec5SDimitry Andric 
1205*0b57cec5SDimitry Andric   return LLDB_RECORD_RESULT(EvaluateExpression(expr, options, nullptr));
1206*0b57cec5SDimitry Andric }
1207*0b57cec5SDimitry Andric 
1208*0b57cec5SDimitry Andric lldb::SBValue SBValue::EvaluateExpression(const char *expr,
1209*0b57cec5SDimitry Andric                                           const SBExpressionOptions &options,
1210*0b57cec5SDimitry Andric                                           const char *name) const {
1211*0b57cec5SDimitry Andric   LLDB_RECORD_METHOD_CONST(
1212*0b57cec5SDimitry Andric       lldb::SBValue, SBValue, EvaluateExpression,
1213*0b57cec5SDimitry Andric       (const char *, const lldb::SBExpressionOptions &, const char *), expr,
1214*0b57cec5SDimitry Andric       options, name);
1215*0b57cec5SDimitry Andric 
1216*0b57cec5SDimitry Andric 
1217*0b57cec5SDimitry Andric   if (!expr || expr[0] == '\0') {
1218*0b57cec5SDimitry Andric     return LLDB_RECORD_RESULT(SBValue());
1219*0b57cec5SDimitry Andric   }
1220*0b57cec5SDimitry Andric 
1221*0b57cec5SDimitry Andric 
1222*0b57cec5SDimitry Andric   ValueLocker locker;
1223*0b57cec5SDimitry Andric   lldb::ValueObjectSP value_sp(GetSP(locker));
1224*0b57cec5SDimitry Andric   if (!value_sp) {
1225*0b57cec5SDimitry Andric     return LLDB_RECORD_RESULT(SBValue());
1226*0b57cec5SDimitry Andric   }
1227*0b57cec5SDimitry Andric 
1228*0b57cec5SDimitry Andric   lldb::TargetSP target_sp = value_sp->GetTargetSP();
1229*0b57cec5SDimitry Andric   if (!target_sp) {
1230*0b57cec5SDimitry Andric     return LLDB_RECORD_RESULT(SBValue());
1231*0b57cec5SDimitry Andric   }
1232*0b57cec5SDimitry Andric 
1233*0b57cec5SDimitry Andric   std::lock_guard<std::recursive_mutex> guard(target_sp->GetAPIMutex());
1234*0b57cec5SDimitry Andric   ExecutionContext exe_ctx(target_sp.get());
1235*0b57cec5SDimitry Andric 
1236*0b57cec5SDimitry Andric   StackFrame *frame = exe_ctx.GetFramePtr();
1237*0b57cec5SDimitry Andric   if (!frame) {
1238*0b57cec5SDimitry Andric     return LLDB_RECORD_RESULT(SBValue());
1239*0b57cec5SDimitry Andric   }
1240*0b57cec5SDimitry Andric 
1241*0b57cec5SDimitry Andric   ValueObjectSP res_val_sp;
1242*0b57cec5SDimitry Andric   target_sp->EvaluateExpression(expr, frame, res_val_sp, options.ref(), nullptr,
1243*0b57cec5SDimitry Andric                                 value_sp.get());
1244*0b57cec5SDimitry Andric 
1245*0b57cec5SDimitry Andric   if (name)
1246*0b57cec5SDimitry Andric     res_val_sp->SetName(ConstString(name));
1247*0b57cec5SDimitry Andric 
1248*0b57cec5SDimitry Andric   SBValue result;
1249*0b57cec5SDimitry Andric   result.SetSP(res_val_sp, options.GetFetchDynamicValue());
1250*0b57cec5SDimitry Andric   return LLDB_RECORD_RESULT(result);
1251*0b57cec5SDimitry Andric }
1252*0b57cec5SDimitry Andric 
1253*0b57cec5SDimitry Andric bool SBValue::GetDescription(SBStream &description) {
1254*0b57cec5SDimitry Andric   LLDB_RECORD_METHOD(bool, SBValue, GetDescription, (lldb::SBStream &),
1255*0b57cec5SDimitry Andric                      description);
1256*0b57cec5SDimitry Andric 
1257*0b57cec5SDimitry Andric   Stream &strm = description.ref();
1258*0b57cec5SDimitry Andric 
1259*0b57cec5SDimitry Andric   ValueLocker locker;
1260*0b57cec5SDimitry Andric   lldb::ValueObjectSP value_sp(GetSP(locker));
1261*0b57cec5SDimitry Andric   if (value_sp)
1262*0b57cec5SDimitry Andric     value_sp->Dump(strm);
1263*0b57cec5SDimitry Andric   else
1264*0b57cec5SDimitry Andric     strm.PutCString("No value");
1265*0b57cec5SDimitry Andric 
1266*0b57cec5SDimitry Andric   return true;
1267*0b57cec5SDimitry Andric }
1268*0b57cec5SDimitry Andric 
1269*0b57cec5SDimitry Andric lldb::Format SBValue::GetFormat() {
1270*0b57cec5SDimitry Andric   LLDB_RECORD_METHOD_NO_ARGS(lldb::Format, SBValue, GetFormat);
1271*0b57cec5SDimitry Andric 
1272*0b57cec5SDimitry Andric   ValueLocker locker;
1273*0b57cec5SDimitry Andric   lldb::ValueObjectSP value_sp(GetSP(locker));
1274*0b57cec5SDimitry Andric   if (value_sp)
1275*0b57cec5SDimitry Andric     return value_sp->GetFormat();
1276*0b57cec5SDimitry Andric   return eFormatDefault;
1277*0b57cec5SDimitry Andric }
1278*0b57cec5SDimitry Andric 
1279*0b57cec5SDimitry Andric void SBValue::SetFormat(lldb::Format format) {
1280*0b57cec5SDimitry Andric   LLDB_RECORD_METHOD(void, SBValue, SetFormat, (lldb::Format), format);
1281*0b57cec5SDimitry Andric 
1282*0b57cec5SDimitry Andric   ValueLocker locker;
1283*0b57cec5SDimitry Andric   lldb::ValueObjectSP value_sp(GetSP(locker));
1284*0b57cec5SDimitry Andric   if (value_sp)
1285*0b57cec5SDimitry Andric     value_sp->SetFormat(format);
1286*0b57cec5SDimitry Andric }
1287*0b57cec5SDimitry Andric 
1288*0b57cec5SDimitry Andric lldb::SBValue SBValue::AddressOf() {
1289*0b57cec5SDimitry Andric   LLDB_RECORD_METHOD_NO_ARGS(lldb::SBValue, SBValue, AddressOf);
1290*0b57cec5SDimitry Andric 
1291*0b57cec5SDimitry Andric   SBValue sb_value;
1292*0b57cec5SDimitry Andric   ValueLocker locker;
1293*0b57cec5SDimitry Andric   lldb::ValueObjectSP value_sp(GetSP(locker));
1294*0b57cec5SDimitry Andric   if (value_sp) {
1295*0b57cec5SDimitry Andric     Status error;
1296*0b57cec5SDimitry Andric     sb_value.SetSP(value_sp->AddressOf(error), GetPreferDynamicValue(),
1297*0b57cec5SDimitry Andric                    GetPreferSyntheticValue());
1298*0b57cec5SDimitry Andric   }
1299*0b57cec5SDimitry Andric 
1300*0b57cec5SDimitry Andric   return LLDB_RECORD_RESULT(sb_value);
1301*0b57cec5SDimitry Andric }
1302*0b57cec5SDimitry Andric 
1303*0b57cec5SDimitry Andric lldb::addr_t SBValue::GetLoadAddress() {
1304*0b57cec5SDimitry Andric   LLDB_RECORD_METHOD_NO_ARGS(lldb::addr_t, SBValue, GetLoadAddress);
1305*0b57cec5SDimitry Andric 
1306*0b57cec5SDimitry Andric   lldb::addr_t value = LLDB_INVALID_ADDRESS;
1307*0b57cec5SDimitry Andric   ValueLocker locker;
1308*0b57cec5SDimitry Andric   lldb::ValueObjectSP value_sp(GetSP(locker));
1309*0b57cec5SDimitry Andric   if (value_sp) {
1310*0b57cec5SDimitry Andric     TargetSP target_sp(value_sp->GetTargetSP());
1311*0b57cec5SDimitry Andric     if (target_sp) {
1312*0b57cec5SDimitry Andric       const bool scalar_is_load_address = true;
1313*0b57cec5SDimitry Andric       AddressType addr_type;
1314*0b57cec5SDimitry Andric       value = value_sp->GetAddressOf(scalar_is_load_address, &addr_type);
1315*0b57cec5SDimitry Andric       if (addr_type == eAddressTypeFile) {
1316*0b57cec5SDimitry Andric         ModuleSP module_sp(value_sp->GetModule());
1317*0b57cec5SDimitry Andric         if (!module_sp)
1318*0b57cec5SDimitry Andric           value = LLDB_INVALID_ADDRESS;
1319*0b57cec5SDimitry Andric         else {
1320*0b57cec5SDimitry Andric           Address addr;
1321*0b57cec5SDimitry Andric           module_sp->ResolveFileAddress(value, addr);
1322*0b57cec5SDimitry Andric           value = addr.GetLoadAddress(target_sp.get());
1323*0b57cec5SDimitry Andric         }
1324*0b57cec5SDimitry Andric       } else if (addr_type == eAddressTypeHost ||
1325*0b57cec5SDimitry Andric                  addr_type == eAddressTypeInvalid)
1326*0b57cec5SDimitry Andric         value = LLDB_INVALID_ADDRESS;
1327*0b57cec5SDimitry Andric     }
1328*0b57cec5SDimitry Andric   }
1329*0b57cec5SDimitry Andric 
1330*0b57cec5SDimitry Andric   return value;
1331*0b57cec5SDimitry Andric }
1332*0b57cec5SDimitry Andric 
1333*0b57cec5SDimitry Andric lldb::SBAddress SBValue::GetAddress() {
1334*0b57cec5SDimitry Andric   LLDB_RECORD_METHOD_NO_ARGS(lldb::SBAddress, SBValue, GetAddress);
1335*0b57cec5SDimitry Andric 
1336*0b57cec5SDimitry Andric   Address addr;
1337*0b57cec5SDimitry Andric   ValueLocker locker;
1338*0b57cec5SDimitry Andric   lldb::ValueObjectSP value_sp(GetSP(locker));
1339*0b57cec5SDimitry Andric   if (value_sp) {
1340*0b57cec5SDimitry Andric     TargetSP target_sp(value_sp->GetTargetSP());
1341*0b57cec5SDimitry Andric     if (target_sp) {
1342*0b57cec5SDimitry Andric       lldb::addr_t value = LLDB_INVALID_ADDRESS;
1343*0b57cec5SDimitry Andric       const bool scalar_is_load_address = true;
1344*0b57cec5SDimitry Andric       AddressType addr_type;
1345*0b57cec5SDimitry Andric       value = value_sp->GetAddressOf(scalar_is_load_address, &addr_type);
1346*0b57cec5SDimitry Andric       if (addr_type == eAddressTypeFile) {
1347*0b57cec5SDimitry Andric         ModuleSP module_sp(value_sp->GetModule());
1348*0b57cec5SDimitry Andric         if (module_sp)
1349*0b57cec5SDimitry Andric           module_sp->ResolveFileAddress(value, addr);
1350*0b57cec5SDimitry Andric       } else if (addr_type == eAddressTypeLoad) {
1351*0b57cec5SDimitry Andric         // no need to check the return value on this.. if it can actually do
1352*0b57cec5SDimitry Andric         // the resolve addr will be in the form (section,offset), otherwise it
1353*0b57cec5SDimitry Andric         // will simply be returned as (NULL, value)
1354*0b57cec5SDimitry Andric         addr.SetLoadAddress(value, target_sp.get());
1355*0b57cec5SDimitry Andric       }
1356*0b57cec5SDimitry Andric     }
1357*0b57cec5SDimitry Andric   }
1358*0b57cec5SDimitry Andric 
1359*0b57cec5SDimitry Andric   return LLDB_RECORD_RESULT(SBAddress(new Address(addr)));
1360*0b57cec5SDimitry Andric }
1361*0b57cec5SDimitry Andric 
1362*0b57cec5SDimitry Andric lldb::SBData SBValue::GetPointeeData(uint32_t item_idx, uint32_t item_count) {
1363*0b57cec5SDimitry Andric   LLDB_RECORD_METHOD(lldb::SBData, SBValue, GetPointeeData,
1364*0b57cec5SDimitry Andric                      (uint32_t, uint32_t), item_idx, item_count);
1365*0b57cec5SDimitry Andric 
1366*0b57cec5SDimitry Andric   lldb::SBData sb_data;
1367*0b57cec5SDimitry Andric   ValueLocker locker;
1368*0b57cec5SDimitry Andric   lldb::ValueObjectSP value_sp(GetSP(locker));
1369*0b57cec5SDimitry Andric   if (value_sp) {
1370*0b57cec5SDimitry Andric     TargetSP target_sp(value_sp->GetTargetSP());
1371*0b57cec5SDimitry Andric     if (target_sp) {
1372*0b57cec5SDimitry Andric       DataExtractorSP data_sp(new DataExtractor());
1373*0b57cec5SDimitry Andric       value_sp->GetPointeeData(*data_sp, item_idx, item_count);
1374*0b57cec5SDimitry Andric       if (data_sp->GetByteSize() > 0)
1375*0b57cec5SDimitry Andric         *sb_data = data_sp;
1376*0b57cec5SDimitry Andric     }
1377*0b57cec5SDimitry Andric   }
1378*0b57cec5SDimitry Andric 
1379*0b57cec5SDimitry Andric   return LLDB_RECORD_RESULT(sb_data);
1380*0b57cec5SDimitry Andric }
1381*0b57cec5SDimitry Andric 
1382*0b57cec5SDimitry Andric lldb::SBData SBValue::GetData() {
1383*0b57cec5SDimitry Andric   LLDB_RECORD_METHOD_NO_ARGS(lldb::SBData, SBValue, GetData);
1384*0b57cec5SDimitry Andric 
1385*0b57cec5SDimitry Andric   lldb::SBData sb_data;
1386*0b57cec5SDimitry Andric   ValueLocker locker;
1387*0b57cec5SDimitry Andric   lldb::ValueObjectSP value_sp(GetSP(locker));
1388*0b57cec5SDimitry Andric   if (value_sp) {
1389*0b57cec5SDimitry Andric     DataExtractorSP data_sp(new DataExtractor());
1390*0b57cec5SDimitry Andric     Status error;
1391*0b57cec5SDimitry Andric     value_sp->GetData(*data_sp, error);
1392*0b57cec5SDimitry Andric     if (error.Success())
1393*0b57cec5SDimitry Andric       *sb_data = data_sp;
1394*0b57cec5SDimitry Andric   }
1395*0b57cec5SDimitry Andric 
1396*0b57cec5SDimitry Andric   return LLDB_RECORD_RESULT(sb_data);
1397*0b57cec5SDimitry Andric }
1398*0b57cec5SDimitry Andric 
1399*0b57cec5SDimitry Andric bool SBValue::SetData(lldb::SBData &data, SBError &error) {
1400*0b57cec5SDimitry Andric   LLDB_RECORD_METHOD(bool, SBValue, SetData, (lldb::SBData &, lldb::SBError &),
1401*0b57cec5SDimitry Andric                      data, error);
1402*0b57cec5SDimitry Andric 
1403*0b57cec5SDimitry Andric   ValueLocker locker;
1404*0b57cec5SDimitry Andric   lldb::ValueObjectSP value_sp(GetSP(locker));
1405*0b57cec5SDimitry Andric   bool ret = true;
1406*0b57cec5SDimitry Andric 
1407*0b57cec5SDimitry Andric   if (value_sp) {
1408*0b57cec5SDimitry Andric     DataExtractor *data_extractor = data.get();
1409*0b57cec5SDimitry Andric 
1410*0b57cec5SDimitry Andric     if (!data_extractor) {
1411*0b57cec5SDimitry Andric       error.SetErrorString("No data to set");
1412*0b57cec5SDimitry Andric       ret = false;
1413*0b57cec5SDimitry Andric     } else {
1414*0b57cec5SDimitry Andric       Status set_error;
1415*0b57cec5SDimitry Andric 
1416*0b57cec5SDimitry Andric       value_sp->SetData(*data_extractor, set_error);
1417*0b57cec5SDimitry Andric 
1418*0b57cec5SDimitry Andric       if (!set_error.Success()) {
1419*0b57cec5SDimitry Andric         error.SetErrorStringWithFormat("Couldn't set data: %s",
1420*0b57cec5SDimitry Andric                                        set_error.AsCString());
1421*0b57cec5SDimitry Andric         ret = false;
1422*0b57cec5SDimitry Andric       }
1423*0b57cec5SDimitry Andric     }
1424*0b57cec5SDimitry Andric   } else {
1425*0b57cec5SDimitry Andric     error.SetErrorStringWithFormat(
1426*0b57cec5SDimitry Andric         "Couldn't set data: could not get SBValue: %s",
1427*0b57cec5SDimitry Andric         locker.GetError().AsCString());
1428*0b57cec5SDimitry Andric     ret = false;
1429*0b57cec5SDimitry Andric   }
1430*0b57cec5SDimitry Andric 
1431*0b57cec5SDimitry Andric   return ret;
1432*0b57cec5SDimitry Andric }
1433*0b57cec5SDimitry Andric 
1434*0b57cec5SDimitry Andric lldb::SBDeclaration SBValue::GetDeclaration() {
1435*0b57cec5SDimitry Andric   LLDB_RECORD_METHOD_NO_ARGS(lldb::SBDeclaration, SBValue, GetDeclaration);
1436*0b57cec5SDimitry Andric 
1437*0b57cec5SDimitry Andric   ValueLocker locker;
1438*0b57cec5SDimitry Andric   lldb::ValueObjectSP value_sp(GetSP(locker));
1439*0b57cec5SDimitry Andric   SBDeclaration decl_sb;
1440*0b57cec5SDimitry Andric   if (value_sp) {
1441*0b57cec5SDimitry Andric     Declaration decl;
1442*0b57cec5SDimitry Andric     if (value_sp->GetDeclaration(decl))
1443*0b57cec5SDimitry Andric       decl_sb.SetDeclaration(decl);
1444*0b57cec5SDimitry Andric   }
1445*0b57cec5SDimitry Andric   return LLDB_RECORD_RESULT(decl_sb);
1446*0b57cec5SDimitry Andric }
1447*0b57cec5SDimitry Andric 
1448*0b57cec5SDimitry Andric lldb::SBWatchpoint SBValue::Watch(bool resolve_location, bool read, bool write,
1449*0b57cec5SDimitry Andric                                   SBError &error) {
1450*0b57cec5SDimitry Andric   LLDB_RECORD_METHOD(lldb::SBWatchpoint, SBValue, Watch,
1451*0b57cec5SDimitry Andric                      (bool, bool, bool, lldb::SBError &), resolve_location,
1452*0b57cec5SDimitry Andric                      read, write, error);
1453*0b57cec5SDimitry Andric 
1454*0b57cec5SDimitry Andric   SBWatchpoint sb_watchpoint;
1455*0b57cec5SDimitry Andric 
1456*0b57cec5SDimitry Andric   // If the SBValue is not valid, there's no point in even trying to watch it.
1457*0b57cec5SDimitry Andric   ValueLocker locker;
1458*0b57cec5SDimitry Andric   lldb::ValueObjectSP value_sp(GetSP(locker));
1459*0b57cec5SDimitry Andric   TargetSP target_sp(GetTarget().GetSP());
1460*0b57cec5SDimitry Andric   if (value_sp && target_sp) {
1461*0b57cec5SDimitry Andric     // Read and Write cannot both be false.
1462*0b57cec5SDimitry Andric     if (!read && !write)
1463*0b57cec5SDimitry Andric       return LLDB_RECORD_RESULT(sb_watchpoint);
1464*0b57cec5SDimitry Andric 
1465*0b57cec5SDimitry Andric     // If the value is not in scope, don't try and watch and invalid value
1466*0b57cec5SDimitry Andric     if (!IsInScope())
1467*0b57cec5SDimitry Andric       return LLDB_RECORD_RESULT(sb_watchpoint);
1468*0b57cec5SDimitry Andric 
1469*0b57cec5SDimitry Andric     addr_t addr = GetLoadAddress();
1470*0b57cec5SDimitry Andric     if (addr == LLDB_INVALID_ADDRESS)
1471*0b57cec5SDimitry Andric       return LLDB_RECORD_RESULT(sb_watchpoint);
1472*0b57cec5SDimitry Andric     size_t byte_size = GetByteSize();
1473*0b57cec5SDimitry Andric     if (byte_size == 0)
1474*0b57cec5SDimitry Andric       return LLDB_RECORD_RESULT(sb_watchpoint);
1475*0b57cec5SDimitry Andric 
1476*0b57cec5SDimitry Andric     uint32_t watch_type = 0;
1477*0b57cec5SDimitry Andric     if (read)
1478*0b57cec5SDimitry Andric       watch_type |= LLDB_WATCH_TYPE_READ;
1479*0b57cec5SDimitry Andric     if (write)
1480*0b57cec5SDimitry Andric       watch_type |= LLDB_WATCH_TYPE_WRITE;
1481*0b57cec5SDimitry Andric 
1482*0b57cec5SDimitry Andric     Status rc;
1483*0b57cec5SDimitry Andric     CompilerType type(value_sp->GetCompilerType());
1484*0b57cec5SDimitry Andric     WatchpointSP watchpoint_sp =
1485*0b57cec5SDimitry Andric         target_sp->CreateWatchpoint(addr, byte_size, &type, watch_type, rc);
1486*0b57cec5SDimitry Andric     error.SetError(rc);
1487*0b57cec5SDimitry Andric 
1488*0b57cec5SDimitry Andric     if (watchpoint_sp) {
1489*0b57cec5SDimitry Andric       sb_watchpoint.SetSP(watchpoint_sp);
1490*0b57cec5SDimitry Andric       Declaration decl;
1491*0b57cec5SDimitry Andric       if (value_sp->GetDeclaration(decl)) {
1492*0b57cec5SDimitry Andric         if (decl.GetFile()) {
1493*0b57cec5SDimitry Andric           StreamString ss;
1494*0b57cec5SDimitry Andric           // True to show fullpath for declaration file.
1495*0b57cec5SDimitry Andric           decl.DumpStopContext(&ss, true);
14965ffd83dbSDimitry Andric           watchpoint_sp->SetDeclInfo(std::string(ss.GetString()));
1497*0b57cec5SDimitry Andric         }
1498*0b57cec5SDimitry Andric       }
1499*0b57cec5SDimitry Andric     }
1500*0b57cec5SDimitry Andric   } else if (target_sp) {
1501*0b57cec5SDimitry Andric     error.SetErrorStringWithFormat("could not get SBValue: %s",
1502*0b57cec5SDimitry Andric                                    locker.GetError().AsCString());
1503*0b57cec5SDimitry Andric   } else {
1504*0b57cec5SDimitry Andric     error.SetErrorString("could not set watchpoint, a target is required");
1505*0b57cec5SDimitry Andric   }
1506*0b57cec5SDimitry Andric 
1507*0b57cec5SDimitry Andric   return LLDB_RECORD_RESULT(sb_watchpoint);
1508*0b57cec5SDimitry Andric }
1509*0b57cec5SDimitry Andric 
1510*0b57cec5SDimitry Andric // FIXME: Remove this method impl (as well as the decl in .h) once it is no
1511*0b57cec5SDimitry Andric // longer needed.
1512*0b57cec5SDimitry Andric // Backward compatibility fix in the interim.
1513*0b57cec5SDimitry Andric lldb::SBWatchpoint SBValue::Watch(bool resolve_location, bool read,
1514*0b57cec5SDimitry Andric                                   bool write) {
1515*0b57cec5SDimitry Andric   LLDB_RECORD_METHOD(lldb::SBWatchpoint, SBValue, Watch, (bool, bool, bool),
1516*0b57cec5SDimitry Andric                      resolve_location, read, write);
1517*0b57cec5SDimitry Andric 
1518*0b57cec5SDimitry Andric   SBError error;
1519*0b57cec5SDimitry Andric   return LLDB_RECORD_RESULT(Watch(resolve_location, read, write, error));
1520*0b57cec5SDimitry Andric }
1521*0b57cec5SDimitry Andric 
1522*0b57cec5SDimitry Andric lldb::SBWatchpoint SBValue::WatchPointee(bool resolve_location, bool read,
1523*0b57cec5SDimitry Andric                                          bool write, SBError &error) {
1524*0b57cec5SDimitry Andric   LLDB_RECORD_METHOD(lldb::SBWatchpoint, SBValue, WatchPointee,
1525*0b57cec5SDimitry Andric                      (bool, bool, bool, lldb::SBError &), resolve_location,
1526*0b57cec5SDimitry Andric                      read, write, error);
1527*0b57cec5SDimitry Andric 
1528*0b57cec5SDimitry Andric   SBWatchpoint sb_watchpoint;
1529*0b57cec5SDimitry Andric   if (IsInScope() && GetType().IsPointerType())
1530*0b57cec5SDimitry Andric     sb_watchpoint = Dereference().Watch(resolve_location, read, write, error);
1531*0b57cec5SDimitry Andric   return LLDB_RECORD_RESULT(sb_watchpoint);
1532*0b57cec5SDimitry Andric }
1533*0b57cec5SDimitry Andric 
1534*0b57cec5SDimitry Andric lldb::SBValue SBValue::Persist() {
1535*0b57cec5SDimitry Andric   LLDB_RECORD_METHOD_NO_ARGS(lldb::SBValue, SBValue, Persist);
1536*0b57cec5SDimitry Andric 
1537*0b57cec5SDimitry Andric   ValueLocker locker;
1538*0b57cec5SDimitry Andric   lldb::ValueObjectSP value_sp(GetSP(locker));
1539*0b57cec5SDimitry Andric   SBValue persisted_sb;
1540*0b57cec5SDimitry Andric   if (value_sp) {
1541*0b57cec5SDimitry Andric     persisted_sb.SetSP(value_sp->Persist());
1542*0b57cec5SDimitry Andric   }
1543*0b57cec5SDimitry Andric   return LLDB_RECORD_RESULT(persisted_sb);
1544*0b57cec5SDimitry Andric }
1545*0b57cec5SDimitry Andric 
1546*0b57cec5SDimitry Andric namespace lldb_private {
1547*0b57cec5SDimitry Andric namespace repro {
1548*0b57cec5SDimitry Andric 
1549*0b57cec5SDimitry Andric template <>
1550*0b57cec5SDimitry Andric void RegisterMethods<SBValue>(Registry &R) {
1551*0b57cec5SDimitry Andric   LLDB_REGISTER_CONSTRUCTOR(SBValue, ());
1552*0b57cec5SDimitry Andric   LLDB_REGISTER_CONSTRUCTOR(SBValue, (const lldb::ValueObjectSP &));
1553*0b57cec5SDimitry Andric   LLDB_REGISTER_CONSTRUCTOR(SBValue, (const lldb::SBValue &));
1554*0b57cec5SDimitry Andric   LLDB_REGISTER_METHOD(lldb::SBValue &,
1555*0b57cec5SDimitry Andric                        SBValue, operator=,(const lldb::SBValue &));
1556*0b57cec5SDimitry Andric   LLDB_REGISTER_METHOD(bool, SBValue, IsValid, ());
1557*0b57cec5SDimitry Andric   LLDB_REGISTER_METHOD_CONST(bool, SBValue, operator bool, ());
1558*0b57cec5SDimitry Andric   LLDB_REGISTER_METHOD(void, SBValue, Clear, ());
1559*0b57cec5SDimitry Andric   LLDB_REGISTER_METHOD(lldb::SBError, SBValue, GetError, ());
1560*0b57cec5SDimitry Andric   LLDB_REGISTER_METHOD(lldb::user_id_t, SBValue, GetID, ());
1561*0b57cec5SDimitry Andric   LLDB_REGISTER_METHOD(const char *, SBValue, GetName, ());
1562*0b57cec5SDimitry Andric   LLDB_REGISTER_METHOD(const char *, SBValue, GetTypeName, ());
1563*0b57cec5SDimitry Andric   LLDB_REGISTER_METHOD(const char *, SBValue, GetDisplayTypeName, ());
1564*0b57cec5SDimitry Andric   LLDB_REGISTER_METHOD(size_t, SBValue, GetByteSize, ());
1565*0b57cec5SDimitry Andric   LLDB_REGISTER_METHOD(bool, SBValue, IsInScope, ());
1566*0b57cec5SDimitry Andric   LLDB_REGISTER_METHOD(const char *, SBValue, GetValue, ());
1567*0b57cec5SDimitry Andric   LLDB_REGISTER_METHOD(lldb::ValueType, SBValue, GetValueType, ());
1568*0b57cec5SDimitry Andric   LLDB_REGISTER_METHOD(const char *, SBValue, GetObjectDescription, ());
1569*0b57cec5SDimitry Andric   LLDB_REGISTER_METHOD(lldb::SBType, SBValue, GetType, ());
1570*0b57cec5SDimitry Andric   LLDB_REGISTER_METHOD(bool, SBValue, GetValueDidChange, ());
1571*0b57cec5SDimitry Andric   LLDB_REGISTER_METHOD(const char *, SBValue, GetSummary, ());
1572*0b57cec5SDimitry Andric   LLDB_REGISTER_METHOD(const char *, SBValue, GetSummary,
1573*0b57cec5SDimitry Andric                        (lldb::SBStream &, lldb::SBTypeSummaryOptions &));
1574*0b57cec5SDimitry Andric   LLDB_REGISTER_METHOD(const char *, SBValue, GetLocation, ());
1575*0b57cec5SDimitry Andric   LLDB_REGISTER_METHOD(bool, SBValue, SetValueFromCString, (const char *));
1576*0b57cec5SDimitry Andric   LLDB_REGISTER_METHOD(bool, SBValue, SetValueFromCString,
1577*0b57cec5SDimitry Andric                        (const char *, lldb::SBError &));
1578*0b57cec5SDimitry Andric   LLDB_REGISTER_METHOD(lldb::SBTypeFormat, SBValue, GetTypeFormat, ());
1579*0b57cec5SDimitry Andric   LLDB_REGISTER_METHOD(lldb::SBTypeSummary, SBValue, GetTypeSummary, ());
1580*0b57cec5SDimitry Andric   LLDB_REGISTER_METHOD(lldb::SBTypeFilter, SBValue, GetTypeFilter, ());
1581*0b57cec5SDimitry Andric   LLDB_REGISTER_METHOD(lldb::SBTypeSynthetic, SBValue, GetTypeSynthetic, ());
1582*0b57cec5SDimitry Andric   LLDB_REGISTER_METHOD(lldb::SBValue, SBValue, CreateChildAtOffset,
1583*0b57cec5SDimitry Andric                        (const char *, uint32_t, lldb::SBType));
1584*0b57cec5SDimitry Andric   LLDB_REGISTER_METHOD(lldb::SBValue, SBValue, Cast, (lldb::SBType));
1585*0b57cec5SDimitry Andric   LLDB_REGISTER_METHOD(lldb::SBValue, SBValue, CreateValueFromExpression,
1586*0b57cec5SDimitry Andric                        (const char *, const char *));
1587*0b57cec5SDimitry Andric   LLDB_REGISTER_METHOD(
1588*0b57cec5SDimitry Andric       lldb::SBValue, SBValue, CreateValueFromExpression,
1589*0b57cec5SDimitry Andric       (const char *, const char *, lldb::SBExpressionOptions &));
1590*0b57cec5SDimitry Andric   LLDB_REGISTER_METHOD(lldb::SBValue, SBValue, CreateValueFromAddress,
1591*0b57cec5SDimitry Andric                        (const char *, lldb::addr_t, lldb::SBType));
1592*0b57cec5SDimitry Andric   LLDB_REGISTER_METHOD(lldb::SBValue, SBValue, CreateValueFromData,
1593*0b57cec5SDimitry Andric                        (const char *, lldb::SBData, lldb::SBType));
1594*0b57cec5SDimitry Andric   LLDB_REGISTER_METHOD(lldb::SBValue, SBValue, GetChildAtIndex, (uint32_t));
1595*0b57cec5SDimitry Andric   LLDB_REGISTER_METHOD(lldb::SBValue, SBValue, GetChildAtIndex,
1596*0b57cec5SDimitry Andric                        (uint32_t, lldb::DynamicValueType, bool));
1597*0b57cec5SDimitry Andric   LLDB_REGISTER_METHOD(uint32_t, SBValue, GetIndexOfChildWithName,
1598*0b57cec5SDimitry Andric                        (const char *));
1599*0b57cec5SDimitry Andric   LLDB_REGISTER_METHOD(lldb::SBValue, SBValue, GetChildMemberWithName,
1600*0b57cec5SDimitry Andric                        (const char *));
1601*0b57cec5SDimitry Andric   LLDB_REGISTER_METHOD(lldb::SBValue, SBValue, GetChildMemberWithName,
1602*0b57cec5SDimitry Andric                        (const char *, lldb::DynamicValueType));
1603*0b57cec5SDimitry Andric   LLDB_REGISTER_METHOD(lldb::SBValue, SBValue, GetDynamicValue,
1604*0b57cec5SDimitry Andric                        (lldb::DynamicValueType));
1605*0b57cec5SDimitry Andric   LLDB_REGISTER_METHOD(lldb::SBValue, SBValue, GetStaticValue, ());
1606*0b57cec5SDimitry Andric   LLDB_REGISTER_METHOD(lldb::SBValue, SBValue, GetNonSyntheticValue, ());
1607*0b57cec5SDimitry Andric   LLDB_REGISTER_METHOD(lldb::DynamicValueType, SBValue, GetPreferDynamicValue,
1608*0b57cec5SDimitry Andric                        ());
1609*0b57cec5SDimitry Andric   LLDB_REGISTER_METHOD(void, SBValue, SetPreferDynamicValue,
1610*0b57cec5SDimitry Andric                        (lldb::DynamicValueType));
1611*0b57cec5SDimitry Andric   LLDB_REGISTER_METHOD(bool, SBValue, GetPreferSyntheticValue, ());
1612*0b57cec5SDimitry Andric   LLDB_REGISTER_METHOD(void, SBValue, SetPreferSyntheticValue, (bool));
1613*0b57cec5SDimitry Andric   LLDB_REGISTER_METHOD(bool, SBValue, IsDynamic, ());
1614*0b57cec5SDimitry Andric   LLDB_REGISTER_METHOD(bool, SBValue, IsSynthetic, ());
1615*0b57cec5SDimitry Andric   LLDB_REGISTER_METHOD(bool, SBValue, IsSyntheticChildrenGenerated, ());
1616*0b57cec5SDimitry Andric   LLDB_REGISTER_METHOD(void, SBValue, SetSyntheticChildrenGenerated, (bool));
1617*0b57cec5SDimitry Andric   LLDB_REGISTER_METHOD(lldb::SBValue, SBValue, GetValueForExpressionPath,
1618*0b57cec5SDimitry Andric                        (const char *));
1619*0b57cec5SDimitry Andric   LLDB_REGISTER_METHOD(int64_t, SBValue, GetValueAsSigned,
1620*0b57cec5SDimitry Andric                        (lldb::SBError &, int64_t));
1621*0b57cec5SDimitry Andric   LLDB_REGISTER_METHOD(uint64_t, SBValue, GetValueAsUnsigned,
1622*0b57cec5SDimitry Andric                        (lldb::SBError &, uint64_t));
1623*0b57cec5SDimitry Andric   LLDB_REGISTER_METHOD(int64_t, SBValue, GetValueAsSigned, (int64_t));
1624*0b57cec5SDimitry Andric   LLDB_REGISTER_METHOD(uint64_t, SBValue, GetValueAsUnsigned, (uint64_t));
1625*0b57cec5SDimitry Andric   LLDB_REGISTER_METHOD(bool, SBValue, MightHaveChildren, ());
1626*0b57cec5SDimitry Andric   LLDB_REGISTER_METHOD(bool, SBValue, IsRuntimeSupportValue, ());
1627*0b57cec5SDimitry Andric   LLDB_REGISTER_METHOD(uint32_t, SBValue, GetNumChildren, ());
1628*0b57cec5SDimitry Andric   LLDB_REGISTER_METHOD(uint32_t, SBValue, GetNumChildren, (uint32_t));
1629*0b57cec5SDimitry Andric   LLDB_REGISTER_METHOD(lldb::SBValue, SBValue, Dereference, ());
1630*0b57cec5SDimitry Andric   LLDB_REGISTER_METHOD(bool, SBValue, TypeIsPointerType, ());
1631*0b57cec5SDimitry Andric   LLDB_REGISTER_METHOD(void *, SBValue, GetOpaqueType, ());
1632*0b57cec5SDimitry Andric   LLDB_REGISTER_METHOD(lldb::SBTarget, SBValue, GetTarget, ());
1633*0b57cec5SDimitry Andric   LLDB_REGISTER_METHOD(lldb::SBProcess, SBValue, GetProcess, ());
1634*0b57cec5SDimitry Andric   LLDB_REGISTER_METHOD(lldb::SBThread, SBValue, GetThread, ());
1635*0b57cec5SDimitry Andric   LLDB_REGISTER_METHOD(lldb::SBFrame, SBValue, GetFrame, ());
1636*0b57cec5SDimitry Andric   LLDB_REGISTER_METHOD_CONST(lldb::ValueObjectSP, SBValue, GetSP, ());
1637*0b57cec5SDimitry Andric   LLDB_REGISTER_METHOD(bool, SBValue, GetExpressionPath, (lldb::SBStream &));
1638*0b57cec5SDimitry Andric   LLDB_REGISTER_METHOD(bool, SBValue, GetExpressionPath,
1639*0b57cec5SDimitry Andric                        (lldb::SBStream &, bool));
1640*0b57cec5SDimitry Andric   LLDB_REGISTER_METHOD_CONST(lldb::SBValue, SBValue, EvaluateExpression,
1641*0b57cec5SDimitry Andric                              (const char *));
1642*0b57cec5SDimitry Andric   LLDB_REGISTER_METHOD_CONST(
1643*0b57cec5SDimitry Andric       lldb::SBValue, SBValue, EvaluateExpression,
1644*0b57cec5SDimitry Andric       (const char *, const lldb::SBExpressionOptions &));
1645*0b57cec5SDimitry Andric   LLDB_REGISTER_METHOD_CONST(
1646*0b57cec5SDimitry Andric       lldb::SBValue, SBValue, EvaluateExpression,
1647*0b57cec5SDimitry Andric       (const char *, const lldb::SBExpressionOptions &, const char *));
1648*0b57cec5SDimitry Andric   LLDB_REGISTER_METHOD(bool, SBValue, GetDescription, (lldb::SBStream &));
1649*0b57cec5SDimitry Andric   LLDB_REGISTER_METHOD(lldb::Format, SBValue, GetFormat, ());
1650*0b57cec5SDimitry Andric   LLDB_REGISTER_METHOD(void, SBValue, SetFormat, (lldb::Format));
1651*0b57cec5SDimitry Andric   LLDB_REGISTER_METHOD(lldb::SBValue, SBValue, AddressOf, ());
1652*0b57cec5SDimitry Andric   LLDB_REGISTER_METHOD(lldb::addr_t, SBValue, GetLoadAddress, ());
1653*0b57cec5SDimitry Andric   LLDB_REGISTER_METHOD(lldb::SBAddress, SBValue, GetAddress, ());
1654*0b57cec5SDimitry Andric   LLDB_REGISTER_METHOD(lldb::SBData, SBValue, GetPointeeData,
1655*0b57cec5SDimitry Andric                        (uint32_t, uint32_t));
1656*0b57cec5SDimitry Andric   LLDB_REGISTER_METHOD(lldb::SBData, SBValue, GetData, ());
1657*0b57cec5SDimitry Andric   LLDB_REGISTER_METHOD(bool, SBValue, SetData,
1658*0b57cec5SDimitry Andric                        (lldb::SBData &, lldb::SBError &));
1659*0b57cec5SDimitry Andric   LLDB_REGISTER_METHOD(lldb::SBDeclaration, SBValue, GetDeclaration, ());
1660*0b57cec5SDimitry Andric   LLDB_REGISTER_METHOD(lldb::SBWatchpoint, SBValue, Watch,
1661*0b57cec5SDimitry Andric                        (bool, bool, bool, lldb::SBError &));
1662*0b57cec5SDimitry Andric   LLDB_REGISTER_METHOD(lldb::SBWatchpoint, SBValue, Watch,
1663*0b57cec5SDimitry Andric                        (bool, bool, bool));
1664*0b57cec5SDimitry Andric   LLDB_REGISTER_METHOD(lldb::SBWatchpoint, SBValue, WatchPointee,
1665*0b57cec5SDimitry Andric                        (bool, bool, bool, lldb::SBError &));
1666*0b57cec5SDimitry Andric   LLDB_REGISTER_METHOD(lldb::SBValue, SBValue, Persist, ());
1667*0b57cec5SDimitry Andric }
1668*0b57cec5SDimitry Andric 
1669*0b57cec5SDimitry Andric }
1670*0b57cec5SDimitry Andric }
1671