15ffd83dbSDimitry Andric //===-- SBValue.cpp -------------------------------------------------------===//
20b57cec5SDimitry Andric //
30b57cec5SDimitry Andric // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
40b57cec5SDimitry Andric // See https://llvm.org/LICENSE.txt for license information.
50b57cec5SDimitry Andric // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
60b57cec5SDimitry Andric //
70b57cec5SDimitry Andric //===----------------------------------------------------------------------===//
80b57cec5SDimitry Andric 
90b57cec5SDimitry Andric #include "lldb/API/SBValue.h"
100b57cec5SDimitry Andric #include "SBReproducerPrivate.h"
110b57cec5SDimitry Andric 
120b57cec5SDimitry Andric #include "lldb/API/SBDeclaration.h"
130b57cec5SDimitry Andric #include "lldb/API/SBStream.h"
140b57cec5SDimitry Andric #include "lldb/API/SBTypeFilter.h"
150b57cec5SDimitry Andric #include "lldb/API/SBTypeFormat.h"
160b57cec5SDimitry Andric #include "lldb/API/SBTypeSummary.h"
170b57cec5SDimitry Andric #include "lldb/API/SBTypeSynthetic.h"
180b57cec5SDimitry Andric 
190b57cec5SDimitry Andric #include "lldb/Breakpoint/Watchpoint.h"
20*5f7ddb14SDimitry Andric #include "lldb/Core/Declaration.h"
210b57cec5SDimitry Andric #include "lldb/Core/Module.h"
220b57cec5SDimitry Andric #include "lldb/Core/Section.h"
230b57cec5SDimitry Andric #include "lldb/Core/StreamFile.h"
240b57cec5SDimitry Andric #include "lldb/Core/Value.h"
250b57cec5SDimitry Andric #include "lldb/Core/ValueObject.h"
260b57cec5SDimitry Andric #include "lldb/Core/ValueObjectConstResult.h"
270b57cec5SDimitry Andric #include "lldb/DataFormatters/DataVisualization.h"
280b57cec5SDimitry Andric #include "lldb/Symbol/Block.h"
290b57cec5SDimitry Andric #include "lldb/Symbol/ObjectFile.h"
300b57cec5SDimitry Andric #include "lldb/Symbol/Type.h"
310b57cec5SDimitry Andric #include "lldb/Symbol/Variable.h"
320b57cec5SDimitry Andric #include "lldb/Symbol/VariableList.h"
330b57cec5SDimitry Andric #include "lldb/Target/ExecutionContext.h"
340b57cec5SDimitry Andric #include "lldb/Target/Process.h"
350b57cec5SDimitry Andric #include "lldb/Target/StackFrame.h"
360b57cec5SDimitry Andric #include "lldb/Target/Target.h"
370b57cec5SDimitry Andric #include "lldb/Target/Thread.h"
380b57cec5SDimitry Andric #include "lldb/Utility/DataExtractor.h"
390b57cec5SDimitry Andric #include "lldb/Utility/Scalar.h"
400b57cec5SDimitry Andric #include "lldb/Utility/Stream.h"
410b57cec5SDimitry Andric 
420b57cec5SDimitry Andric #include "lldb/API/SBDebugger.h"
430b57cec5SDimitry Andric #include "lldb/API/SBExpressionOptions.h"
440b57cec5SDimitry Andric #include "lldb/API/SBFrame.h"
450b57cec5SDimitry Andric #include "lldb/API/SBProcess.h"
460b57cec5SDimitry Andric #include "lldb/API/SBTarget.h"
470b57cec5SDimitry Andric #include "lldb/API/SBThread.h"
480b57cec5SDimitry Andric 
490b57cec5SDimitry Andric #include <memory>
500b57cec5SDimitry Andric 
510b57cec5SDimitry Andric using namespace lldb;
520b57cec5SDimitry Andric using namespace lldb_private;
530b57cec5SDimitry Andric 
540b57cec5SDimitry Andric class ValueImpl {
550b57cec5SDimitry Andric public:
565ffd83dbSDimitry Andric   ValueImpl() = default;
570b57cec5SDimitry Andric 
ValueImpl(lldb::ValueObjectSP in_valobj_sp,lldb::DynamicValueType use_dynamic,bool use_synthetic,const char * name=nullptr)580b57cec5SDimitry Andric   ValueImpl(lldb::ValueObjectSP in_valobj_sp,
590b57cec5SDimitry Andric             lldb::DynamicValueType use_dynamic, bool use_synthetic,
600b57cec5SDimitry Andric             const char *name = nullptr)
610b57cec5SDimitry Andric       : m_valobj_sp(), m_use_dynamic(use_dynamic),
620b57cec5SDimitry Andric         m_use_synthetic(use_synthetic), m_name(name) {
630b57cec5SDimitry Andric     if (in_valobj_sp) {
640b57cec5SDimitry Andric       if ((m_valobj_sp = in_valobj_sp->GetQualifiedRepresentationIfAvailable(
650b57cec5SDimitry Andric                lldb::eNoDynamicValues, false))) {
660b57cec5SDimitry Andric         if (!m_name.IsEmpty())
670b57cec5SDimitry Andric           m_valobj_sp->SetName(m_name);
680b57cec5SDimitry Andric       }
690b57cec5SDimitry Andric     }
700b57cec5SDimitry Andric   }
710b57cec5SDimitry Andric 
ValueImpl(const ValueImpl & rhs)720b57cec5SDimitry Andric   ValueImpl(const ValueImpl &rhs)
730b57cec5SDimitry Andric       : m_valobj_sp(rhs.m_valobj_sp), m_use_dynamic(rhs.m_use_dynamic),
740b57cec5SDimitry Andric         m_use_synthetic(rhs.m_use_synthetic), m_name(rhs.m_name) {}
750b57cec5SDimitry Andric 
operator =(const ValueImpl & rhs)760b57cec5SDimitry Andric   ValueImpl &operator=(const ValueImpl &rhs) {
770b57cec5SDimitry Andric     if (this != &rhs) {
780b57cec5SDimitry Andric       m_valobj_sp = rhs.m_valobj_sp;
790b57cec5SDimitry Andric       m_use_dynamic = rhs.m_use_dynamic;
800b57cec5SDimitry Andric       m_use_synthetic = rhs.m_use_synthetic;
810b57cec5SDimitry Andric       m_name = rhs.m_name;
820b57cec5SDimitry Andric     }
830b57cec5SDimitry Andric     return *this;
840b57cec5SDimitry Andric   }
850b57cec5SDimitry Andric 
IsValid()860b57cec5SDimitry Andric   bool IsValid() {
870b57cec5SDimitry Andric     if (m_valobj_sp.get() == nullptr)
880b57cec5SDimitry Andric       return false;
890b57cec5SDimitry Andric     else {
900b57cec5SDimitry Andric       // FIXME: This check is necessary but not sufficient.  We for sure don't
910b57cec5SDimitry Andric       // want to touch SBValues whose owning
920b57cec5SDimitry Andric       // targets have gone away.  This check is a little weak in that it
930b57cec5SDimitry Andric       // enforces that restriction when you call IsValid, but since IsValid
940b57cec5SDimitry Andric       // doesn't lock the target, you have no guarantee that the SBValue won't
950b57cec5SDimitry Andric       // go invalid after you call this... Also, an SBValue could depend on
960b57cec5SDimitry Andric       // data from one of the modules in the target, and those could go away
970b57cec5SDimitry Andric       // independently of the target, for instance if a module is unloaded.
980b57cec5SDimitry Andric       // But right now, neither SBValues nor ValueObjects know which modules
990b57cec5SDimitry Andric       // they depend on.  So I have no good way to make that check without
1000b57cec5SDimitry Andric       // tracking that in all the ValueObject subclasses.
1010b57cec5SDimitry Andric       TargetSP target_sp = m_valobj_sp->GetTargetSP();
1020b57cec5SDimitry Andric       return target_sp && target_sp->IsValid();
1030b57cec5SDimitry Andric     }
1040b57cec5SDimitry Andric   }
1050b57cec5SDimitry Andric 
GetRootSP()1060b57cec5SDimitry Andric   lldb::ValueObjectSP GetRootSP() { return m_valobj_sp; }
1070b57cec5SDimitry Andric 
GetSP(Process::StopLocker & stop_locker,std::unique_lock<std::recursive_mutex> & lock,Status & error)1080b57cec5SDimitry Andric   lldb::ValueObjectSP GetSP(Process::StopLocker &stop_locker,
1090b57cec5SDimitry Andric                             std::unique_lock<std::recursive_mutex> &lock,
1100b57cec5SDimitry Andric                             Status &error) {
1110b57cec5SDimitry Andric     if (!m_valobj_sp) {
1120b57cec5SDimitry Andric       error.SetErrorString("invalid value object");
1130b57cec5SDimitry Andric       return m_valobj_sp;
1140b57cec5SDimitry Andric     }
1150b57cec5SDimitry Andric 
1160b57cec5SDimitry Andric     lldb::ValueObjectSP value_sp = m_valobj_sp;
1170b57cec5SDimitry Andric 
1180b57cec5SDimitry Andric     Target *target = value_sp->GetTargetSP().get();
1190b57cec5SDimitry Andric     if (!target)
1200b57cec5SDimitry Andric       return ValueObjectSP();
1210b57cec5SDimitry Andric 
1220b57cec5SDimitry Andric     lock = std::unique_lock<std::recursive_mutex>(target->GetAPIMutex());
1230b57cec5SDimitry Andric 
1240b57cec5SDimitry Andric     ProcessSP process_sp(value_sp->GetProcessSP());
1250b57cec5SDimitry Andric     if (process_sp && !stop_locker.TryLock(&process_sp->GetRunLock())) {
1260b57cec5SDimitry Andric       // We don't allow people to play around with ValueObject if the process
1270b57cec5SDimitry Andric       // is running. If you want to look at values, pause the process, then
1280b57cec5SDimitry Andric       // look.
1290b57cec5SDimitry Andric       error.SetErrorString("process must be stopped.");
1300b57cec5SDimitry Andric       return ValueObjectSP();
1310b57cec5SDimitry Andric     }
1320b57cec5SDimitry Andric 
1330b57cec5SDimitry Andric     if (m_use_dynamic != eNoDynamicValues) {
1340b57cec5SDimitry Andric       ValueObjectSP dynamic_sp = value_sp->GetDynamicValue(m_use_dynamic);
1350b57cec5SDimitry Andric       if (dynamic_sp)
1360b57cec5SDimitry Andric         value_sp = dynamic_sp;
1370b57cec5SDimitry Andric     }
1380b57cec5SDimitry Andric 
1390b57cec5SDimitry Andric     if (m_use_synthetic) {
1405ffd83dbSDimitry Andric       ValueObjectSP synthetic_sp = value_sp->GetSyntheticValue();
1410b57cec5SDimitry Andric       if (synthetic_sp)
1420b57cec5SDimitry Andric         value_sp = synthetic_sp;
1430b57cec5SDimitry Andric     }
1440b57cec5SDimitry Andric 
1450b57cec5SDimitry Andric     if (!value_sp)
1460b57cec5SDimitry Andric       error.SetErrorString("invalid value object");
1470b57cec5SDimitry Andric     if (!m_name.IsEmpty())
1480b57cec5SDimitry Andric       value_sp->SetName(m_name);
1490b57cec5SDimitry Andric 
1500b57cec5SDimitry Andric     return value_sp;
1510b57cec5SDimitry Andric   }
1520b57cec5SDimitry Andric 
SetUseDynamic(lldb::DynamicValueType use_dynamic)1530b57cec5SDimitry Andric   void SetUseDynamic(lldb::DynamicValueType use_dynamic) {
1540b57cec5SDimitry Andric     m_use_dynamic = use_dynamic;
1550b57cec5SDimitry Andric   }
1560b57cec5SDimitry Andric 
SetUseSynthetic(bool use_synthetic)1570b57cec5SDimitry Andric   void SetUseSynthetic(bool use_synthetic) { m_use_synthetic = use_synthetic; }
1580b57cec5SDimitry Andric 
GetUseDynamic()1590b57cec5SDimitry Andric   lldb::DynamicValueType GetUseDynamic() { return m_use_dynamic; }
1600b57cec5SDimitry Andric 
GetUseSynthetic()1610b57cec5SDimitry Andric   bool GetUseSynthetic() { return m_use_synthetic; }
1620b57cec5SDimitry Andric 
1630b57cec5SDimitry Andric   // All the derived values that we would make from the m_valobj_sp will share
1640b57cec5SDimitry Andric   // the ExecutionContext with m_valobj_sp, so we don't need to do the
1650b57cec5SDimitry Andric   // calculations in GetSP to return the Target, Process, Thread or Frame.  It
1660b57cec5SDimitry Andric   // is convenient to provide simple accessors for these, which I do here.
GetTargetSP()1670b57cec5SDimitry Andric   TargetSP GetTargetSP() {
1680b57cec5SDimitry Andric     if (m_valobj_sp)
1690b57cec5SDimitry Andric       return m_valobj_sp->GetTargetSP();
1700b57cec5SDimitry Andric     else
1710b57cec5SDimitry Andric       return TargetSP();
1720b57cec5SDimitry Andric   }
1730b57cec5SDimitry Andric 
GetProcessSP()1740b57cec5SDimitry Andric   ProcessSP GetProcessSP() {
1750b57cec5SDimitry Andric     if (m_valobj_sp)
1760b57cec5SDimitry Andric       return m_valobj_sp->GetProcessSP();
1770b57cec5SDimitry Andric     else
1780b57cec5SDimitry Andric       return ProcessSP();
1790b57cec5SDimitry Andric   }
1800b57cec5SDimitry Andric 
GetThreadSP()1810b57cec5SDimitry Andric   ThreadSP GetThreadSP() {
1820b57cec5SDimitry Andric     if (m_valobj_sp)
1830b57cec5SDimitry Andric       return m_valobj_sp->GetThreadSP();
1840b57cec5SDimitry Andric     else
1850b57cec5SDimitry Andric       return ThreadSP();
1860b57cec5SDimitry Andric   }
1870b57cec5SDimitry Andric 
GetFrameSP()1880b57cec5SDimitry Andric   StackFrameSP GetFrameSP() {
1890b57cec5SDimitry Andric     if (m_valobj_sp)
1900b57cec5SDimitry Andric       return m_valobj_sp->GetFrameSP();
1910b57cec5SDimitry Andric     else
1920b57cec5SDimitry Andric       return StackFrameSP();
1930b57cec5SDimitry Andric   }
1940b57cec5SDimitry Andric 
1950b57cec5SDimitry Andric private:
1960b57cec5SDimitry Andric   lldb::ValueObjectSP m_valobj_sp;
1970b57cec5SDimitry Andric   lldb::DynamicValueType m_use_dynamic;
1980b57cec5SDimitry Andric   bool m_use_synthetic;
1990b57cec5SDimitry Andric   ConstString m_name;
2000b57cec5SDimitry Andric };
2010b57cec5SDimitry Andric 
2020b57cec5SDimitry Andric class ValueLocker {
2030b57cec5SDimitry Andric public:
2045ffd83dbSDimitry Andric   ValueLocker() = default;
2050b57cec5SDimitry Andric 
GetLockedSP(ValueImpl & in_value)2060b57cec5SDimitry Andric   ValueObjectSP GetLockedSP(ValueImpl &in_value) {
2070b57cec5SDimitry Andric     return in_value.GetSP(m_stop_locker, m_lock, m_lock_error);
2080b57cec5SDimitry Andric   }
2090b57cec5SDimitry Andric 
GetError()2100b57cec5SDimitry Andric   Status &GetError() { return m_lock_error; }
2110b57cec5SDimitry Andric 
2120b57cec5SDimitry Andric private:
2130b57cec5SDimitry Andric   Process::StopLocker m_stop_locker;
2140b57cec5SDimitry Andric   std::unique_lock<std::recursive_mutex> m_lock;
2150b57cec5SDimitry Andric   Status m_lock_error;
2160b57cec5SDimitry Andric };
2170b57cec5SDimitry Andric 
SBValue()2180b57cec5SDimitry Andric SBValue::SBValue() : m_opaque_sp() { LLDB_RECORD_CONSTRUCTOR_NO_ARGS(SBValue); }
2190b57cec5SDimitry Andric 
SBValue(const lldb::ValueObjectSP & value_sp)2200b57cec5SDimitry Andric SBValue::SBValue(const lldb::ValueObjectSP &value_sp) {
2210b57cec5SDimitry Andric   LLDB_RECORD_CONSTRUCTOR(SBValue, (const lldb::ValueObjectSP &), value_sp);
2220b57cec5SDimitry Andric 
2230b57cec5SDimitry Andric   SetSP(value_sp);
2240b57cec5SDimitry Andric }
2250b57cec5SDimitry Andric 
SBValue(const SBValue & rhs)2260b57cec5SDimitry Andric SBValue::SBValue(const SBValue &rhs) {
2270b57cec5SDimitry Andric   LLDB_RECORD_CONSTRUCTOR(SBValue, (const lldb::SBValue &), rhs);
2280b57cec5SDimitry Andric 
2290b57cec5SDimitry Andric   SetSP(rhs.m_opaque_sp);
2300b57cec5SDimitry Andric }
2310b57cec5SDimitry Andric 
operator =(const SBValue & rhs)2320b57cec5SDimitry Andric SBValue &SBValue::operator=(const SBValue &rhs) {
2330b57cec5SDimitry Andric   LLDB_RECORD_METHOD(lldb::SBValue &,
2340b57cec5SDimitry Andric                      SBValue, operator=,(const lldb::SBValue &), rhs);
2350b57cec5SDimitry Andric 
2360b57cec5SDimitry Andric   if (this != &rhs) {
2370b57cec5SDimitry Andric     SetSP(rhs.m_opaque_sp);
2380b57cec5SDimitry Andric   }
2390b57cec5SDimitry Andric   return LLDB_RECORD_RESULT(*this);
2400b57cec5SDimitry Andric }
2410b57cec5SDimitry Andric 
2425ffd83dbSDimitry Andric SBValue::~SBValue() = default;
2430b57cec5SDimitry Andric 
IsValid()2440b57cec5SDimitry Andric bool SBValue::IsValid() {
2450b57cec5SDimitry Andric   LLDB_RECORD_METHOD_NO_ARGS(bool, SBValue, IsValid);
2460b57cec5SDimitry Andric   return this->operator bool();
2470b57cec5SDimitry Andric }
operator bool() const2480b57cec5SDimitry Andric SBValue::operator bool() const {
2490b57cec5SDimitry Andric   LLDB_RECORD_METHOD_CONST_NO_ARGS(bool, SBValue, operator bool);
2500b57cec5SDimitry Andric 
2510b57cec5SDimitry Andric   // If this function ever changes to anything that does more than just check
2520b57cec5SDimitry Andric   // if the opaque shared pointer is non NULL, then we need to update all "if
2530b57cec5SDimitry Andric   // (m_opaque_sp)" code in this file.
2540b57cec5SDimitry Andric   return m_opaque_sp.get() != nullptr && m_opaque_sp->IsValid() &&
2550b57cec5SDimitry Andric          m_opaque_sp->GetRootSP().get() != nullptr;
2560b57cec5SDimitry Andric }
2570b57cec5SDimitry Andric 
Clear()2580b57cec5SDimitry Andric void SBValue::Clear() {
2590b57cec5SDimitry Andric   LLDB_RECORD_METHOD_NO_ARGS(void, SBValue, Clear);
2600b57cec5SDimitry Andric 
2610b57cec5SDimitry Andric   m_opaque_sp.reset();
2620b57cec5SDimitry Andric }
2630b57cec5SDimitry Andric 
GetError()2640b57cec5SDimitry Andric SBError SBValue::GetError() {
2650b57cec5SDimitry Andric   LLDB_RECORD_METHOD_NO_ARGS(lldb::SBError, SBValue, GetError);
2660b57cec5SDimitry Andric 
2670b57cec5SDimitry Andric   SBError sb_error;
2680b57cec5SDimitry Andric 
2690b57cec5SDimitry Andric   ValueLocker locker;
2700b57cec5SDimitry Andric   lldb::ValueObjectSP value_sp(GetSP(locker));
2710b57cec5SDimitry Andric   if (value_sp)
2720b57cec5SDimitry Andric     sb_error.SetError(value_sp->GetError());
2730b57cec5SDimitry Andric   else
2740b57cec5SDimitry Andric     sb_error.SetErrorStringWithFormat("error: %s",
2750b57cec5SDimitry Andric                                       locker.GetError().AsCString());
2760b57cec5SDimitry Andric 
2770b57cec5SDimitry Andric   return LLDB_RECORD_RESULT(sb_error);
2780b57cec5SDimitry Andric }
2790b57cec5SDimitry Andric 
GetID()2800b57cec5SDimitry Andric user_id_t SBValue::GetID() {
2810b57cec5SDimitry Andric   LLDB_RECORD_METHOD_NO_ARGS(lldb::user_id_t, SBValue, GetID);
2820b57cec5SDimitry Andric 
2830b57cec5SDimitry Andric   ValueLocker locker;
2840b57cec5SDimitry Andric   lldb::ValueObjectSP value_sp(GetSP(locker));
2850b57cec5SDimitry Andric   if (value_sp)
2860b57cec5SDimitry Andric     return value_sp->GetID();
2870b57cec5SDimitry Andric   return LLDB_INVALID_UID;
2880b57cec5SDimitry Andric }
2890b57cec5SDimitry Andric 
GetName()2900b57cec5SDimitry Andric const char *SBValue::GetName() {
2910b57cec5SDimitry Andric   LLDB_RECORD_METHOD_NO_ARGS(const char *, SBValue, GetName);
2920b57cec5SDimitry Andric 
2930b57cec5SDimitry Andric   const char *name = nullptr;
2940b57cec5SDimitry Andric   ValueLocker locker;
2950b57cec5SDimitry Andric   lldb::ValueObjectSP value_sp(GetSP(locker));
2960b57cec5SDimitry Andric   if (value_sp)
2970b57cec5SDimitry Andric     name = value_sp->GetName().GetCString();
2980b57cec5SDimitry Andric 
2990b57cec5SDimitry Andric   return name;
3000b57cec5SDimitry Andric }
3010b57cec5SDimitry Andric 
GetTypeName()3020b57cec5SDimitry Andric const char *SBValue::GetTypeName() {
3030b57cec5SDimitry Andric   LLDB_RECORD_METHOD_NO_ARGS(const char *, SBValue, GetTypeName);
3040b57cec5SDimitry Andric 
3050b57cec5SDimitry Andric   const char *name = nullptr;
3060b57cec5SDimitry Andric   ValueLocker locker;
3070b57cec5SDimitry Andric   lldb::ValueObjectSP value_sp(GetSP(locker));
3080b57cec5SDimitry Andric   if (value_sp) {
3090b57cec5SDimitry Andric     name = value_sp->GetQualifiedTypeName().GetCString();
3100b57cec5SDimitry Andric   }
3110b57cec5SDimitry Andric 
3120b57cec5SDimitry Andric   return name;
3130b57cec5SDimitry Andric }
3140b57cec5SDimitry Andric 
GetDisplayTypeName()3150b57cec5SDimitry Andric const char *SBValue::GetDisplayTypeName() {
3160b57cec5SDimitry Andric   LLDB_RECORD_METHOD_NO_ARGS(const char *, SBValue, GetDisplayTypeName);
3170b57cec5SDimitry Andric 
3180b57cec5SDimitry Andric   const char *name = nullptr;
3190b57cec5SDimitry Andric   ValueLocker locker;
3200b57cec5SDimitry Andric   lldb::ValueObjectSP value_sp(GetSP(locker));
3210b57cec5SDimitry Andric   if (value_sp) {
3220b57cec5SDimitry Andric     name = value_sp->GetDisplayTypeName().GetCString();
3230b57cec5SDimitry Andric   }
3240b57cec5SDimitry Andric 
3250b57cec5SDimitry Andric   return name;
3260b57cec5SDimitry Andric }
3270b57cec5SDimitry Andric 
GetByteSize()3280b57cec5SDimitry Andric size_t SBValue::GetByteSize() {
3290b57cec5SDimitry Andric   LLDB_RECORD_METHOD_NO_ARGS(size_t, SBValue, GetByteSize);
3300b57cec5SDimitry Andric 
3310b57cec5SDimitry Andric   size_t result = 0;
3320b57cec5SDimitry Andric 
3330b57cec5SDimitry Andric   ValueLocker locker;
3340b57cec5SDimitry Andric   lldb::ValueObjectSP value_sp(GetSP(locker));
3350b57cec5SDimitry Andric   if (value_sp) {
336af732203SDimitry Andric     result = value_sp->GetByteSize().getValueOr(0);
3370b57cec5SDimitry Andric   }
3380b57cec5SDimitry Andric 
3390b57cec5SDimitry Andric   return result;
3400b57cec5SDimitry Andric }
3410b57cec5SDimitry Andric 
IsInScope()3420b57cec5SDimitry Andric bool SBValue::IsInScope() {
3430b57cec5SDimitry Andric   LLDB_RECORD_METHOD_NO_ARGS(bool, SBValue, IsInScope);
3440b57cec5SDimitry Andric 
3450b57cec5SDimitry Andric   bool result = false;
3460b57cec5SDimitry Andric 
3470b57cec5SDimitry Andric   ValueLocker locker;
3480b57cec5SDimitry Andric   lldb::ValueObjectSP value_sp(GetSP(locker));
3490b57cec5SDimitry Andric   if (value_sp) {
3500b57cec5SDimitry Andric     result = value_sp->IsInScope();
3510b57cec5SDimitry Andric   }
3520b57cec5SDimitry Andric 
3530b57cec5SDimitry Andric   return result;
3540b57cec5SDimitry Andric }
3550b57cec5SDimitry Andric 
GetValue()3560b57cec5SDimitry Andric const char *SBValue::GetValue() {
3570b57cec5SDimitry Andric   LLDB_RECORD_METHOD_NO_ARGS(const char *, SBValue, GetValue);
3580b57cec5SDimitry Andric 
3590b57cec5SDimitry Andric   const char *cstr = nullptr;
3600b57cec5SDimitry Andric   ValueLocker locker;
3610b57cec5SDimitry Andric   lldb::ValueObjectSP value_sp(GetSP(locker));
3620b57cec5SDimitry Andric   if (value_sp) {
3630b57cec5SDimitry Andric     cstr = value_sp->GetValueAsCString();
3640b57cec5SDimitry Andric   }
3650b57cec5SDimitry Andric 
3660b57cec5SDimitry Andric   return cstr;
3670b57cec5SDimitry Andric }
3680b57cec5SDimitry Andric 
GetValueType()3690b57cec5SDimitry Andric ValueType SBValue::GetValueType() {
3700b57cec5SDimitry Andric   LLDB_RECORD_METHOD_NO_ARGS(lldb::ValueType, SBValue, GetValueType);
3710b57cec5SDimitry Andric 
3720b57cec5SDimitry Andric   ValueType result = eValueTypeInvalid;
3730b57cec5SDimitry Andric   ValueLocker locker;
3740b57cec5SDimitry Andric   lldb::ValueObjectSP value_sp(GetSP(locker));
3750b57cec5SDimitry Andric   if (value_sp)
3760b57cec5SDimitry Andric     result = value_sp->GetValueType();
3770b57cec5SDimitry Andric 
3780b57cec5SDimitry Andric   return result;
3790b57cec5SDimitry Andric }
3800b57cec5SDimitry Andric 
GetObjectDescription()3810b57cec5SDimitry Andric const char *SBValue::GetObjectDescription() {
3820b57cec5SDimitry Andric   LLDB_RECORD_METHOD_NO_ARGS(const char *, SBValue, GetObjectDescription);
3830b57cec5SDimitry Andric 
3840b57cec5SDimitry Andric   const char *cstr = nullptr;
3850b57cec5SDimitry Andric   ValueLocker locker;
3860b57cec5SDimitry Andric   lldb::ValueObjectSP value_sp(GetSP(locker));
3870b57cec5SDimitry Andric   if (value_sp) {
3880b57cec5SDimitry Andric     cstr = value_sp->GetObjectDescription();
3890b57cec5SDimitry Andric   }
3900b57cec5SDimitry Andric 
3910b57cec5SDimitry Andric   return cstr;
3920b57cec5SDimitry Andric }
3930b57cec5SDimitry Andric 
GetType()3940b57cec5SDimitry Andric SBType SBValue::GetType() {
3950b57cec5SDimitry Andric   LLDB_RECORD_METHOD_NO_ARGS(lldb::SBType, SBValue, GetType);
3960b57cec5SDimitry Andric 
3970b57cec5SDimitry Andric   SBType sb_type;
3980b57cec5SDimitry Andric   ValueLocker locker;
3990b57cec5SDimitry Andric   lldb::ValueObjectSP value_sp(GetSP(locker));
4000b57cec5SDimitry Andric   TypeImplSP type_sp;
4010b57cec5SDimitry Andric   if (value_sp) {
4020b57cec5SDimitry Andric     type_sp = std::make_shared<TypeImpl>(value_sp->GetTypeImpl());
4030b57cec5SDimitry Andric     sb_type.SetSP(type_sp);
4040b57cec5SDimitry Andric   }
4050b57cec5SDimitry Andric 
4060b57cec5SDimitry Andric   return LLDB_RECORD_RESULT(sb_type);
4070b57cec5SDimitry Andric }
4080b57cec5SDimitry Andric 
GetValueDidChange()4090b57cec5SDimitry Andric bool SBValue::GetValueDidChange() {
4100b57cec5SDimitry Andric   LLDB_RECORD_METHOD_NO_ARGS(bool, SBValue, GetValueDidChange);
4110b57cec5SDimitry Andric 
4120b57cec5SDimitry Andric   bool result = false;
4130b57cec5SDimitry Andric   ValueLocker locker;
4140b57cec5SDimitry Andric   lldb::ValueObjectSP value_sp(GetSP(locker));
4150b57cec5SDimitry Andric   if (value_sp) {
4160b57cec5SDimitry Andric     if (value_sp->UpdateValueIfNeeded(false))
4170b57cec5SDimitry Andric       result = value_sp->GetValueDidChange();
4180b57cec5SDimitry Andric   }
4190b57cec5SDimitry Andric 
4200b57cec5SDimitry Andric   return result;
4210b57cec5SDimitry Andric }
4220b57cec5SDimitry Andric 
GetSummary()4230b57cec5SDimitry Andric const char *SBValue::GetSummary() {
4240b57cec5SDimitry Andric   LLDB_RECORD_METHOD_NO_ARGS(const char *, SBValue, GetSummary);
4250b57cec5SDimitry Andric 
4260b57cec5SDimitry Andric   const char *cstr = nullptr;
4270b57cec5SDimitry Andric   ValueLocker locker;
4280b57cec5SDimitry Andric   lldb::ValueObjectSP value_sp(GetSP(locker));
4290b57cec5SDimitry Andric   if (value_sp) {
4300b57cec5SDimitry Andric     cstr = value_sp->GetSummaryAsCString();
4310b57cec5SDimitry Andric   }
4320b57cec5SDimitry Andric 
4330b57cec5SDimitry Andric   return cstr;
4340b57cec5SDimitry Andric }
4350b57cec5SDimitry Andric 
GetSummary(lldb::SBStream & stream,lldb::SBTypeSummaryOptions & options)4360b57cec5SDimitry Andric const char *SBValue::GetSummary(lldb::SBStream &stream,
4370b57cec5SDimitry Andric                                 lldb::SBTypeSummaryOptions &options) {
4380b57cec5SDimitry Andric   LLDB_RECORD_METHOD(const char *, SBValue, GetSummary,
4390b57cec5SDimitry Andric                      (lldb::SBStream &, lldb::SBTypeSummaryOptions &), stream,
4400b57cec5SDimitry Andric                      options);
4410b57cec5SDimitry Andric 
4420b57cec5SDimitry Andric   ValueLocker locker;
4430b57cec5SDimitry Andric   lldb::ValueObjectSP value_sp(GetSP(locker));
4440b57cec5SDimitry Andric   if (value_sp) {
4450b57cec5SDimitry Andric     std::string buffer;
4460b57cec5SDimitry Andric     if (value_sp->GetSummaryAsCString(buffer, options.ref()) && !buffer.empty())
4470b57cec5SDimitry Andric       stream.Printf("%s", buffer.c_str());
4480b57cec5SDimitry Andric   }
4490b57cec5SDimitry Andric   const char *cstr = stream.GetData();
4500b57cec5SDimitry Andric   return cstr;
4510b57cec5SDimitry Andric }
4520b57cec5SDimitry Andric 
GetLocation()4530b57cec5SDimitry Andric const char *SBValue::GetLocation() {
4540b57cec5SDimitry Andric   LLDB_RECORD_METHOD_NO_ARGS(const char *, SBValue, GetLocation);
4550b57cec5SDimitry Andric 
4560b57cec5SDimitry Andric   const char *cstr = nullptr;
4570b57cec5SDimitry Andric   ValueLocker locker;
4580b57cec5SDimitry Andric   lldb::ValueObjectSP value_sp(GetSP(locker));
4590b57cec5SDimitry Andric   if (value_sp) {
4600b57cec5SDimitry Andric     cstr = value_sp->GetLocationAsCString();
4610b57cec5SDimitry Andric   }
4620b57cec5SDimitry Andric   return cstr;
4630b57cec5SDimitry Andric }
4640b57cec5SDimitry Andric 
4650b57cec5SDimitry Andric // Deprecated - use the one that takes an lldb::SBError
SetValueFromCString(const char * value_str)4660b57cec5SDimitry Andric bool SBValue::SetValueFromCString(const char *value_str) {
4670b57cec5SDimitry Andric   LLDB_RECORD_METHOD(bool, SBValue, SetValueFromCString, (const char *),
4680b57cec5SDimitry Andric                      value_str);
4690b57cec5SDimitry Andric 
4700b57cec5SDimitry Andric   lldb::SBError dummy;
4710b57cec5SDimitry Andric   return SetValueFromCString(value_str, dummy);
4720b57cec5SDimitry Andric }
4730b57cec5SDimitry Andric 
SetValueFromCString(const char * value_str,lldb::SBError & error)4740b57cec5SDimitry Andric bool SBValue::SetValueFromCString(const char *value_str, lldb::SBError &error) {
4750b57cec5SDimitry Andric   LLDB_RECORD_METHOD(bool, SBValue, SetValueFromCString,
4760b57cec5SDimitry Andric                      (const char *, lldb::SBError &), value_str, error);
4770b57cec5SDimitry Andric 
4780b57cec5SDimitry Andric   bool success = false;
4790b57cec5SDimitry Andric   ValueLocker locker;
4800b57cec5SDimitry Andric   lldb::ValueObjectSP value_sp(GetSP(locker));
4810b57cec5SDimitry Andric   if (value_sp) {
4820b57cec5SDimitry Andric     success = value_sp->SetValueFromCString(value_str, error.ref());
4830b57cec5SDimitry Andric   } else
4840b57cec5SDimitry Andric     error.SetErrorStringWithFormat("Could not get value: %s",
4850b57cec5SDimitry Andric                                    locker.GetError().AsCString());
4860b57cec5SDimitry Andric 
4870b57cec5SDimitry Andric   return success;
4880b57cec5SDimitry Andric }
4890b57cec5SDimitry Andric 
GetTypeFormat()4900b57cec5SDimitry Andric lldb::SBTypeFormat SBValue::GetTypeFormat() {
4910b57cec5SDimitry Andric   LLDB_RECORD_METHOD_NO_ARGS(lldb::SBTypeFormat, SBValue, GetTypeFormat);
4920b57cec5SDimitry Andric 
4930b57cec5SDimitry Andric   lldb::SBTypeFormat format;
4940b57cec5SDimitry Andric   ValueLocker locker;
4950b57cec5SDimitry Andric   lldb::ValueObjectSP value_sp(GetSP(locker));
4960b57cec5SDimitry Andric   if (value_sp) {
4970b57cec5SDimitry Andric     if (value_sp->UpdateValueIfNeeded(true)) {
4980b57cec5SDimitry Andric       lldb::TypeFormatImplSP format_sp = value_sp->GetValueFormat();
4990b57cec5SDimitry Andric       if (format_sp)
5000b57cec5SDimitry Andric         format.SetSP(format_sp);
5010b57cec5SDimitry Andric     }
5020b57cec5SDimitry Andric   }
5030b57cec5SDimitry Andric   return LLDB_RECORD_RESULT(format);
5040b57cec5SDimitry Andric }
5050b57cec5SDimitry Andric 
GetTypeSummary()5060b57cec5SDimitry Andric lldb::SBTypeSummary SBValue::GetTypeSummary() {
5070b57cec5SDimitry Andric   LLDB_RECORD_METHOD_NO_ARGS(lldb::SBTypeSummary, SBValue, GetTypeSummary);
5080b57cec5SDimitry Andric 
5090b57cec5SDimitry Andric   lldb::SBTypeSummary summary;
5100b57cec5SDimitry Andric   ValueLocker locker;
5110b57cec5SDimitry Andric   lldb::ValueObjectSP value_sp(GetSP(locker));
5120b57cec5SDimitry Andric   if (value_sp) {
5130b57cec5SDimitry Andric     if (value_sp->UpdateValueIfNeeded(true)) {
5140b57cec5SDimitry Andric       lldb::TypeSummaryImplSP summary_sp = value_sp->GetSummaryFormat();
5150b57cec5SDimitry Andric       if (summary_sp)
5160b57cec5SDimitry Andric         summary.SetSP(summary_sp);
5170b57cec5SDimitry Andric     }
5180b57cec5SDimitry Andric   }
5190b57cec5SDimitry Andric   return LLDB_RECORD_RESULT(summary);
5200b57cec5SDimitry Andric }
5210b57cec5SDimitry Andric 
GetTypeFilter()5220b57cec5SDimitry Andric lldb::SBTypeFilter SBValue::GetTypeFilter() {
5230b57cec5SDimitry Andric   LLDB_RECORD_METHOD_NO_ARGS(lldb::SBTypeFilter, SBValue, GetTypeFilter);
5240b57cec5SDimitry Andric 
5250b57cec5SDimitry Andric   lldb::SBTypeFilter filter;
5260b57cec5SDimitry Andric   ValueLocker locker;
5270b57cec5SDimitry Andric   lldb::ValueObjectSP value_sp(GetSP(locker));
5280b57cec5SDimitry Andric   if (value_sp) {
5290b57cec5SDimitry Andric     if (value_sp->UpdateValueIfNeeded(true)) {
5300b57cec5SDimitry Andric       lldb::SyntheticChildrenSP synthetic_sp = value_sp->GetSyntheticChildren();
5310b57cec5SDimitry Andric 
5320b57cec5SDimitry Andric       if (synthetic_sp && !synthetic_sp->IsScripted()) {
5330b57cec5SDimitry Andric         TypeFilterImplSP filter_sp =
5340b57cec5SDimitry Andric             std::static_pointer_cast<TypeFilterImpl>(synthetic_sp);
5350b57cec5SDimitry Andric         filter.SetSP(filter_sp);
5360b57cec5SDimitry Andric       }
5370b57cec5SDimitry Andric     }
5380b57cec5SDimitry Andric   }
5390b57cec5SDimitry Andric   return LLDB_RECORD_RESULT(filter);
5400b57cec5SDimitry Andric }
5410b57cec5SDimitry Andric 
GetTypeSynthetic()5420b57cec5SDimitry Andric lldb::SBTypeSynthetic SBValue::GetTypeSynthetic() {
5430b57cec5SDimitry Andric   LLDB_RECORD_METHOD_NO_ARGS(lldb::SBTypeSynthetic, SBValue, GetTypeSynthetic);
5440b57cec5SDimitry Andric 
5450b57cec5SDimitry Andric   lldb::SBTypeSynthetic synthetic;
5460b57cec5SDimitry Andric   ValueLocker locker;
5470b57cec5SDimitry Andric   lldb::ValueObjectSP value_sp(GetSP(locker));
5480b57cec5SDimitry Andric   if (value_sp) {
5490b57cec5SDimitry Andric     if (value_sp->UpdateValueIfNeeded(true)) {
5500b57cec5SDimitry Andric       lldb::SyntheticChildrenSP children_sp = value_sp->GetSyntheticChildren();
5510b57cec5SDimitry Andric 
5520b57cec5SDimitry Andric       if (children_sp && children_sp->IsScripted()) {
5530b57cec5SDimitry Andric         ScriptedSyntheticChildrenSP synth_sp =
5540b57cec5SDimitry Andric             std::static_pointer_cast<ScriptedSyntheticChildren>(children_sp);
5550b57cec5SDimitry Andric         synthetic.SetSP(synth_sp);
5560b57cec5SDimitry Andric       }
5570b57cec5SDimitry Andric     }
5580b57cec5SDimitry Andric   }
5590b57cec5SDimitry Andric   return LLDB_RECORD_RESULT(synthetic);
5600b57cec5SDimitry Andric }
5610b57cec5SDimitry Andric 
CreateChildAtOffset(const char * name,uint32_t offset,SBType type)5620b57cec5SDimitry Andric lldb::SBValue SBValue::CreateChildAtOffset(const char *name, uint32_t offset,
5630b57cec5SDimitry Andric                                            SBType type) {
5640b57cec5SDimitry Andric   LLDB_RECORD_METHOD(lldb::SBValue, SBValue, CreateChildAtOffset,
5650b57cec5SDimitry Andric                      (const char *, uint32_t, lldb::SBType), name, offset,
5660b57cec5SDimitry Andric                      type);
5670b57cec5SDimitry Andric 
5680b57cec5SDimitry Andric   lldb::SBValue sb_value;
5690b57cec5SDimitry Andric   ValueLocker locker;
5700b57cec5SDimitry Andric   lldb::ValueObjectSP value_sp(GetSP(locker));
5710b57cec5SDimitry Andric   lldb::ValueObjectSP new_value_sp;
5720b57cec5SDimitry Andric   if (value_sp) {
5730b57cec5SDimitry Andric     TypeImplSP type_sp(type.GetSP());
5740b57cec5SDimitry Andric     if (type.IsValid()) {
5750b57cec5SDimitry Andric       sb_value.SetSP(value_sp->GetSyntheticChildAtOffset(
5760b57cec5SDimitry Andric                          offset, type_sp->GetCompilerType(false), true),
5770b57cec5SDimitry Andric                      GetPreferDynamicValue(), GetPreferSyntheticValue(), name);
5780b57cec5SDimitry Andric     }
5790b57cec5SDimitry Andric   }
5800b57cec5SDimitry Andric   return LLDB_RECORD_RESULT(sb_value);
5810b57cec5SDimitry Andric }
5820b57cec5SDimitry Andric 
Cast(SBType type)5830b57cec5SDimitry Andric lldb::SBValue SBValue::Cast(SBType type) {
5840b57cec5SDimitry Andric   LLDB_RECORD_METHOD(lldb::SBValue, SBValue, Cast, (lldb::SBType), type);
5850b57cec5SDimitry Andric 
5860b57cec5SDimitry Andric   lldb::SBValue sb_value;
5870b57cec5SDimitry Andric   ValueLocker locker;
5880b57cec5SDimitry Andric   lldb::ValueObjectSP value_sp(GetSP(locker));
5890b57cec5SDimitry Andric   TypeImplSP type_sp(type.GetSP());
5900b57cec5SDimitry Andric   if (value_sp && type_sp)
5910b57cec5SDimitry Andric     sb_value.SetSP(value_sp->Cast(type_sp->GetCompilerType(false)),
5920b57cec5SDimitry Andric                    GetPreferDynamicValue(), GetPreferSyntheticValue());
5930b57cec5SDimitry Andric   return LLDB_RECORD_RESULT(sb_value);
5940b57cec5SDimitry Andric }
5950b57cec5SDimitry Andric 
CreateValueFromExpression(const char * name,const char * expression)5960b57cec5SDimitry Andric lldb::SBValue SBValue::CreateValueFromExpression(const char *name,
5970b57cec5SDimitry Andric                                                  const char *expression) {
5980b57cec5SDimitry Andric   LLDB_RECORD_METHOD(lldb::SBValue, SBValue, CreateValueFromExpression,
5990b57cec5SDimitry Andric                      (const char *, const char *), name, expression);
6000b57cec5SDimitry Andric 
6010b57cec5SDimitry Andric   SBExpressionOptions options;
6020b57cec5SDimitry Andric   options.ref().SetKeepInMemory(true);
6030b57cec5SDimitry Andric   return LLDB_RECORD_RESULT(
6040b57cec5SDimitry Andric       CreateValueFromExpression(name, expression, options));
6050b57cec5SDimitry Andric }
6060b57cec5SDimitry Andric 
CreateValueFromExpression(const char * name,const char * expression,SBExpressionOptions & options)6070b57cec5SDimitry Andric lldb::SBValue SBValue::CreateValueFromExpression(const char *name,
6080b57cec5SDimitry Andric                                                  const char *expression,
6090b57cec5SDimitry Andric                                                  SBExpressionOptions &options) {
6100b57cec5SDimitry Andric   LLDB_RECORD_METHOD(lldb::SBValue, SBValue, CreateValueFromExpression,
6110b57cec5SDimitry Andric                      (const char *, const char *, lldb::SBExpressionOptions &),
6120b57cec5SDimitry Andric                      name, expression, options);
6130b57cec5SDimitry Andric 
6140b57cec5SDimitry Andric   lldb::SBValue sb_value;
6150b57cec5SDimitry Andric   ValueLocker locker;
6160b57cec5SDimitry Andric   lldb::ValueObjectSP value_sp(GetSP(locker));
6170b57cec5SDimitry Andric   lldb::ValueObjectSP new_value_sp;
6180b57cec5SDimitry Andric   if (value_sp) {
6190b57cec5SDimitry Andric     ExecutionContext exe_ctx(value_sp->GetExecutionContextRef());
6200b57cec5SDimitry Andric     new_value_sp = ValueObject::CreateValueObjectFromExpression(
6210b57cec5SDimitry Andric         name, expression, exe_ctx, options.ref());
6220b57cec5SDimitry Andric     if (new_value_sp)
6230b57cec5SDimitry Andric       new_value_sp->SetName(ConstString(name));
6240b57cec5SDimitry Andric   }
6250b57cec5SDimitry Andric   sb_value.SetSP(new_value_sp);
6260b57cec5SDimitry Andric   return LLDB_RECORD_RESULT(sb_value);
6270b57cec5SDimitry Andric }
6280b57cec5SDimitry Andric 
CreateValueFromAddress(const char * name,lldb::addr_t address,SBType sb_type)6290b57cec5SDimitry Andric lldb::SBValue SBValue::CreateValueFromAddress(const char *name,
6300b57cec5SDimitry Andric                                               lldb::addr_t address,
6310b57cec5SDimitry Andric                                               SBType sb_type) {
6320b57cec5SDimitry Andric   LLDB_RECORD_METHOD(lldb::SBValue, SBValue, CreateValueFromAddress,
6330b57cec5SDimitry Andric                      (const char *, lldb::addr_t, lldb::SBType), name, address,
6340b57cec5SDimitry Andric                      sb_type);
6350b57cec5SDimitry Andric 
6360b57cec5SDimitry Andric   lldb::SBValue sb_value;
6370b57cec5SDimitry Andric   ValueLocker locker;
6380b57cec5SDimitry Andric   lldb::ValueObjectSP value_sp(GetSP(locker));
6390b57cec5SDimitry Andric   lldb::ValueObjectSP new_value_sp;
6400b57cec5SDimitry Andric   lldb::TypeImplSP type_impl_sp(sb_type.GetSP());
6410b57cec5SDimitry Andric   if (value_sp && type_impl_sp) {
6420b57cec5SDimitry Andric     CompilerType ast_type(type_impl_sp->GetCompilerType(true));
6430b57cec5SDimitry Andric     ExecutionContext exe_ctx(value_sp->GetExecutionContextRef());
6440b57cec5SDimitry Andric     new_value_sp = ValueObject::CreateValueObjectFromAddress(name, address,
6450b57cec5SDimitry Andric                                                              exe_ctx, ast_type);
6460b57cec5SDimitry Andric   }
6470b57cec5SDimitry Andric   sb_value.SetSP(new_value_sp);
6480b57cec5SDimitry Andric   return LLDB_RECORD_RESULT(sb_value);
6490b57cec5SDimitry Andric }
6500b57cec5SDimitry Andric 
CreateValueFromData(const char * name,SBData data,SBType sb_type)6510b57cec5SDimitry Andric lldb::SBValue SBValue::CreateValueFromData(const char *name, SBData data,
6520b57cec5SDimitry Andric                                            SBType sb_type) {
6530b57cec5SDimitry Andric   LLDB_RECORD_METHOD(lldb::SBValue, SBValue, CreateValueFromData,
6540b57cec5SDimitry Andric                      (const char *, lldb::SBData, lldb::SBType), name, data,
6550b57cec5SDimitry Andric                      sb_type);
6560b57cec5SDimitry Andric 
6570b57cec5SDimitry Andric   lldb::SBValue sb_value;
6580b57cec5SDimitry Andric   lldb::ValueObjectSP new_value_sp;
6590b57cec5SDimitry Andric   ValueLocker locker;
6600b57cec5SDimitry Andric   lldb::ValueObjectSP value_sp(GetSP(locker));
6610b57cec5SDimitry Andric   lldb::TypeImplSP type_impl_sp(sb_type.GetSP());
6620b57cec5SDimitry Andric   if (value_sp && type_impl_sp) {
6630b57cec5SDimitry Andric     ExecutionContext exe_ctx(value_sp->GetExecutionContextRef());
6640b57cec5SDimitry Andric     new_value_sp = ValueObject::CreateValueObjectFromData(
6650b57cec5SDimitry Andric         name, **data, exe_ctx, type_impl_sp->GetCompilerType(true));
6660b57cec5SDimitry Andric     new_value_sp->SetAddressTypeOfChildren(eAddressTypeLoad);
6670b57cec5SDimitry Andric   }
6680b57cec5SDimitry Andric   sb_value.SetSP(new_value_sp);
6690b57cec5SDimitry Andric   return LLDB_RECORD_RESULT(sb_value);
6700b57cec5SDimitry Andric }
6710b57cec5SDimitry Andric 
GetChildAtIndex(uint32_t idx)6720b57cec5SDimitry Andric SBValue SBValue::GetChildAtIndex(uint32_t idx) {
6730b57cec5SDimitry Andric   LLDB_RECORD_METHOD(lldb::SBValue, SBValue, GetChildAtIndex, (uint32_t), idx);
6740b57cec5SDimitry Andric 
6750b57cec5SDimitry Andric   const bool can_create_synthetic = false;
6760b57cec5SDimitry Andric   lldb::DynamicValueType use_dynamic = eNoDynamicValues;
6770b57cec5SDimitry Andric   TargetSP target_sp;
6780b57cec5SDimitry Andric   if (m_opaque_sp)
6790b57cec5SDimitry Andric     target_sp = m_opaque_sp->GetTargetSP();
6800b57cec5SDimitry Andric 
6810b57cec5SDimitry Andric   if (target_sp)
6820b57cec5SDimitry Andric     use_dynamic = target_sp->GetPreferDynamicValue();
6830b57cec5SDimitry Andric 
6840b57cec5SDimitry Andric   return LLDB_RECORD_RESULT(
6850b57cec5SDimitry Andric       GetChildAtIndex(idx, use_dynamic, can_create_synthetic));
6860b57cec5SDimitry Andric }
6870b57cec5SDimitry Andric 
GetChildAtIndex(uint32_t idx,lldb::DynamicValueType use_dynamic,bool can_create_synthetic)6880b57cec5SDimitry Andric SBValue SBValue::GetChildAtIndex(uint32_t idx,
6890b57cec5SDimitry Andric                                  lldb::DynamicValueType use_dynamic,
6900b57cec5SDimitry Andric                                  bool can_create_synthetic) {
6910b57cec5SDimitry Andric   LLDB_RECORD_METHOD(lldb::SBValue, SBValue, GetChildAtIndex,
6920b57cec5SDimitry Andric                      (uint32_t, lldb::DynamicValueType, bool), idx, use_dynamic,
6930b57cec5SDimitry Andric                      can_create_synthetic);
6940b57cec5SDimitry Andric 
6950b57cec5SDimitry Andric   lldb::ValueObjectSP child_sp;
6960b57cec5SDimitry Andric 
6970b57cec5SDimitry Andric   ValueLocker locker;
6980b57cec5SDimitry Andric   lldb::ValueObjectSP value_sp(GetSP(locker));
6990b57cec5SDimitry Andric   if (value_sp) {
7000b57cec5SDimitry Andric     const bool can_create = true;
7010b57cec5SDimitry Andric     child_sp = value_sp->GetChildAtIndex(idx, can_create);
7020b57cec5SDimitry Andric     if (can_create_synthetic && !child_sp) {
7030b57cec5SDimitry Andric       child_sp = value_sp->GetSyntheticArrayMember(idx, can_create);
7040b57cec5SDimitry Andric     }
7050b57cec5SDimitry Andric   }
7060b57cec5SDimitry Andric 
7070b57cec5SDimitry Andric   SBValue sb_value;
7080b57cec5SDimitry Andric   sb_value.SetSP(child_sp, use_dynamic, GetPreferSyntheticValue());
7090b57cec5SDimitry Andric 
7100b57cec5SDimitry Andric   return LLDB_RECORD_RESULT(sb_value);
7110b57cec5SDimitry Andric }
7120b57cec5SDimitry Andric 
GetIndexOfChildWithName(const char * name)7130b57cec5SDimitry Andric uint32_t SBValue::GetIndexOfChildWithName(const char *name) {
7140b57cec5SDimitry Andric   LLDB_RECORD_METHOD(uint32_t, SBValue, GetIndexOfChildWithName, (const char *),
7150b57cec5SDimitry Andric                      name);
7160b57cec5SDimitry Andric 
7170b57cec5SDimitry Andric   uint32_t idx = UINT32_MAX;
7180b57cec5SDimitry Andric   ValueLocker locker;
7190b57cec5SDimitry Andric   lldb::ValueObjectSP value_sp(GetSP(locker));
7200b57cec5SDimitry Andric   if (value_sp) {
7210b57cec5SDimitry Andric     idx = value_sp->GetIndexOfChildWithName(ConstString(name));
7220b57cec5SDimitry Andric   }
7230b57cec5SDimitry Andric   return idx;
7240b57cec5SDimitry Andric }
7250b57cec5SDimitry Andric 
GetChildMemberWithName(const char * name)7260b57cec5SDimitry Andric SBValue SBValue::GetChildMemberWithName(const char *name) {
7270b57cec5SDimitry Andric   LLDB_RECORD_METHOD(lldb::SBValue, SBValue, GetChildMemberWithName,
7280b57cec5SDimitry Andric                      (const char *), name);
7290b57cec5SDimitry Andric 
7300b57cec5SDimitry Andric   lldb::DynamicValueType use_dynamic_value = eNoDynamicValues;
7310b57cec5SDimitry Andric   TargetSP target_sp;
7320b57cec5SDimitry Andric   if (m_opaque_sp)
7330b57cec5SDimitry Andric     target_sp = m_opaque_sp->GetTargetSP();
7340b57cec5SDimitry Andric 
7350b57cec5SDimitry Andric   if (target_sp)
7360b57cec5SDimitry Andric     use_dynamic_value = target_sp->GetPreferDynamicValue();
7370b57cec5SDimitry Andric   return LLDB_RECORD_RESULT(GetChildMemberWithName(name, use_dynamic_value));
7380b57cec5SDimitry Andric }
7390b57cec5SDimitry Andric 
7400b57cec5SDimitry Andric SBValue
GetChildMemberWithName(const char * name,lldb::DynamicValueType use_dynamic_value)7410b57cec5SDimitry Andric SBValue::GetChildMemberWithName(const char *name,
7420b57cec5SDimitry Andric                                 lldb::DynamicValueType use_dynamic_value) {
7430b57cec5SDimitry Andric   LLDB_RECORD_METHOD(lldb::SBValue, SBValue, GetChildMemberWithName,
7440b57cec5SDimitry Andric                      (const char *, lldb::DynamicValueType), name,
7450b57cec5SDimitry Andric                      use_dynamic_value);
7460b57cec5SDimitry Andric 
7470b57cec5SDimitry Andric   lldb::ValueObjectSP child_sp;
7480b57cec5SDimitry Andric   const ConstString str_name(name);
7490b57cec5SDimitry Andric 
7500b57cec5SDimitry Andric   ValueLocker locker;
7510b57cec5SDimitry Andric   lldb::ValueObjectSP value_sp(GetSP(locker));
7520b57cec5SDimitry Andric   if (value_sp) {
7530b57cec5SDimitry Andric     child_sp = value_sp->GetChildMemberWithName(str_name, true);
7540b57cec5SDimitry Andric   }
7550b57cec5SDimitry Andric 
7560b57cec5SDimitry Andric   SBValue sb_value;
7570b57cec5SDimitry Andric   sb_value.SetSP(child_sp, use_dynamic_value, GetPreferSyntheticValue());
7580b57cec5SDimitry Andric 
7590b57cec5SDimitry Andric   return LLDB_RECORD_RESULT(sb_value);
7600b57cec5SDimitry Andric }
7610b57cec5SDimitry Andric 
GetDynamicValue(lldb::DynamicValueType use_dynamic)7620b57cec5SDimitry Andric lldb::SBValue SBValue::GetDynamicValue(lldb::DynamicValueType use_dynamic) {
7630b57cec5SDimitry Andric   LLDB_RECORD_METHOD(lldb::SBValue, SBValue, GetDynamicValue,
7640b57cec5SDimitry Andric                      (lldb::DynamicValueType), use_dynamic);
7650b57cec5SDimitry Andric 
7660b57cec5SDimitry Andric   SBValue value_sb;
7670b57cec5SDimitry Andric   if (IsValid()) {
7680b57cec5SDimitry Andric     ValueImplSP proxy_sp(new ValueImpl(m_opaque_sp->GetRootSP(), use_dynamic,
7690b57cec5SDimitry Andric                                        m_opaque_sp->GetUseSynthetic()));
7700b57cec5SDimitry Andric     value_sb.SetSP(proxy_sp);
7710b57cec5SDimitry Andric   }
7720b57cec5SDimitry Andric   return LLDB_RECORD_RESULT(value_sb);
7730b57cec5SDimitry Andric }
7740b57cec5SDimitry Andric 
GetStaticValue()7750b57cec5SDimitry Andric lldb::SBValue SBValue::GetStaticValue() {
7760b57cec5SDimitry Andric   LLDB_RECORD_METHOD_NO_ARGS(lldb::SBValue, SBValue, GetStaticValue);
7770b57cec5SDimitry Andric 
7780b57cec5SDimitry Andric   SBValue value_sb;
7790b57cec5SDimitry Andric   if (IsValid()) {
7800b57cec5SDimitry Andric     ValueImplSP proxy_sp(new ValueImpl(m_opaque_sp->GetRootSP(),
7810b57cec5SDimitry Andric                                        eNoDynamicValues,
7820b57cec5SDimitry Andric                                        m_opaque_sp->GetUseSynthetic()));
7830b57cec5SDimitry Andric     value_sb.SetSP(proxy_sp);
7840b57cec5SDimitry Andric   }
7850b57cec5SDimitry Andric   return LLDB_RECORD_RESULT(value_sb);
7860b57cec5SDimitry Andric }
7870b57cec5SDimitry Andric 
GetNonSyntheticValue()7880b57cec5SDimitry Andric lldb::SBValue SBValue::GetNonSyntheticValue() {
7890b57cec5SDimitry Andric   LLDB_RECORD_METHOD_NO_ARGS(lldb::SBValue, SBValue, GetNonSyntheticValue);
7900b57cec5SDimitry Andric 
7910b57cec5SDimitry Andric   SBValue value_sb;
7920b57cec5SDimitry Andric   if (IsValid()) {
7930b57cec5SDimitry Andric     ValueImplSP proxy_sp(new ValueImpl(m_opaque_sp->GetRootSP(),
7940b57cec5SDimitry Andric                                        m_opaque_sp->GetUseDynamic(), false));
7950b57cec5SDimitry Andric     value_sb.SetSP(proxy_sp);
7960b57cec5SDimitry Andric   }
7970b57cec5SDimitry Andric   return LLDB_RECORD_RESULT(value_sb);
7980b57cec5SDimitry Andric }
7990b57cec5SDimitry Andric 
GetPreferDynamicValue()8000b57cec5SDimitry Andric lldb::DynamicValueType SBValue::GetPreferDynamicValue() {
8010b57cec5SDimitry Andric   LLDB_RECORD_METHOD_NO_ARGS(lldb::DynamicValueType, SBValue,
8020b57cec5SDimitry Andric                              GetPreferDynamicValue);
8030b57cec5SDimitry Andric 
8040b57cec5SDimitry Andric   if (!IsValid())
8050b57cec5SDimitry Andric     return eNoDynamicValues;
8060b57cec5SDimitry Andric   return m_opaque_sp->GetUseDynamic();
8070b57cec5SDimitry Andric }
8080b57cec5SDimitry Andric 
SetPreferDynamicValue(lldb::DynamicValueType use_dynamic)8090b57cec5SDimitry Andric void SBValue::SetPreferDynamicValue(lldb::DynamicValueType use_dynamic) {
8100b57cec5SDimitry Andric   LLDB_RECORD_METHOD(void, SBValue, SetPreferDynamicValue,
8110b57cec5SDimitry Andric                      (lldb::DynamicValueType), use_dynamic);
8120b57cec5SDimitry Andric 
8130b57cec5SDimitry Andric   if (IsValid())
8140b57cec5SDimitry Andric     return m_opaque_sp->SetUseDynamic(use_dynamic);
8150b57cec5SDimitry Andric }
8160b57cec5SDimitry Andric 
GetPreferSyntheticValue()8170b57cec5SDimitry Andric bool SBValue::GetPreferSyntheticValue() {
8180b57cec5SDimitry Andric   LLDB_RECORD_METHOD_NO_ARGS(bool, SBValue, GetPreferSyntheticValue);
8190b57cec5SDimitry Andric 
8200b57cec5SDimitry Andric   if (!IsValid())
8210b57cec5SDimitry Andric     return false;
8220b57cec5SDimitry Andric   return m_opaque_sp->GetUseSynthetic();
8230b57cec5SDimitry Andric }
8240b57cec5SDimitry Andric 
SetPreferSyntheticValue(bool use_synthetic)8250b57cec5SDimitry Andric void SBValue::SetPreferSyntheticValue(bool use_synthetic) {
8260b57cec5SDimitry Andric   LLDB_RECORD_METHOD(void, SBValue, SetPreferSyntheticValue, (bool),
8270b57cec5SDimitry Andric                      use_synthetic);
8280b57cec5SDimitry Andric 
8290b57cec5SDimitry Andric   if (IsValid())
8300b57cec5SDimitry Andric     return m_opaque_sp->SetUseSynthetic(use_synthetic);
8310b57cec5SDimitry Andric }
8320b57cec5SDimitry Andric 
IsDynamic()8330b57cec5SDimitry Andric bool SBValue::IsDynamic() {
8340b57cec5SDimitry Andric   LLDB_RECORD_METHOD_NO_ARGS(bool, SBValue, IsDynamic);
8350b57cec5SDimitry Andric 
8360b57cec5SDimitry Andric   ValueLocker locker;
8370b57cec5SDimitry Andric   lldb::ValueObjectSP value_sp(GetSP(locker));
8380b57cec5SDimitry Andric   if (value_sp)
8390b57cec5SDimitry Andric     return value_sp->IsDynamic();
8400b57cec5SDimitry Andric   return false;
8410b57cec5SDimitry Andric }
8420b57cec5SDimitry Andric 
IsSynthetic()8430b57cec5SDimitry Andric bool SBValue::IsSynthetic() {
8440b57cec5SDimitry Andric   LLDB_RECORD_METHOD_NO_ARGS(bool, SBValue, IsSynthetic);
8450b57cec5SDimitry Andric 
8460b57cec5SDimitry Andric   ValueLocker locker;
8470b57cec5SDimitry Andric   lldb::ValueObjectSP value_sp(GetSP(locker));
8480b57cec5SDimitry Andric   if (value_sp)
8490b57cec5SDimitry Andric     return value_sp->IsSynthetic();
8500b57cec5SDimitry Andric   return false;
8510b57cec5SDimitry Andric }
8520b57cec5SDimitry Andric 
IsSyntheticChildrenGenerated()8530b57cec5SDimitry Andric bool SBValue::IsSyntheticChildrenGenerated() {
8540b57cec5SDimitry Andric   LLDB_RECORD_METHOD_NO_ARGS(bool, SBValue, IsSyntheticChildrenGenerated);
8550b57cec5SDimitry Andric 
8560b57cec5SDimitry Andric   ValueLocker locker;
8570b57cec5SDimitry Andric   lldb::ValueObjectSP value_sp(GetSP(locker));
8580b57cec5SDimitry Andric   if (value_sp)
8590b57cec5SDimitry Andric     return value_sp->IsSyntheticChildrenGenerated();
8600b57cec5SDimitry Andric   return false;
8610b57cec5SDimitry Andric }
8620b57cec5SDimitry Andric 
SetSyntheticChildrenGenerated(bool is)8630b57cec5SDimitry Andric void SBValue::SetSyntheticChildrenGenerated(bool is) {
8640b57cec5SDimitry Andric   LLDB_RECORD_METHOD(void, SBValue, SetSyntheticChildrenGenerated, (bool), is);
8650b57cec5SDimitry Andric 
8660b57cec5SDimitry Andric   ValueLocker locker;
8670b57cec5SDimitry Andric   lldb::ValueObjectSP value_sp(GetSP(locker));
8680b57cec5SDimitry Andric   if (value_sp)
8690b57cec5SDimitry Andric     return value_sp->SetSyntheticChildrenGenerated(is);
8700b57cec5SDimitry Andric }
8710b57cec5SDimitry Andric 
GetValueForExpressionPath(const char * expr_path)8720b57cec5SDimitry Andric lldb::SBValue SBValue::GetValueForExpressionPath(const char *expr_path) {
8730b57cec5SDimitry Andric   LLDB_RECORD_METHOD(lldb::SBValue, SBValue, GetValueForExpressionPath,
8740b57cec5SDimitry Andric                      (const char *), expr_path);
8750b57cec5SDimitry Andric 
8760b57cec5SDimitry Andric   lldb::ValueObjectSP child_sp;
8770b57cec5SDimitry Andric   ValueLocker locker;
8780b57cec5SDimitry Andric   lldb::ValueObjectSP value_sp(GetSP(locker));
8790b57cec5SDimitry Andric   if (value_sp) {
8800b57cec5SDimitry Andric     // using default values for all the fancy options, just do it if you can
8810b57cec5SDimitry Andric     child_sp = value_sp->GetValueForExpressionPath(expr_path);
8820b57cec5SDimitry Andric   }
8830b57cec5SDimitry Andric 
8840b57cec5SDimitry Andric   SBValue sb_value;
8850b57cec5SDimitry Andric   sb_value.SetSP(child_sp, GetPreferDynamicValue(), GetPreferSyntheticValue());
8860b57cec5SDimitry Andric 
8870b57cec5SDimitry Andric   return LLDB_RECORD_RESULT(sb_value);
8880b57cec5SDimitry Andric }
8890b57cec5SDimitry Andric 
GetValueAsSigned(SBError & error,int64_t fail_value)8900b57cec5SDimitry Andric int64_t SBValue::GetValueAsSigned(SBError &error, int64_t fail_value) {
8910b57cec5SDimitry Andric   LLDB_RECORD_METHOD(int64_t, SBValue, GetValueAsSigned,
8920b57cec5SDimitry Andric                      (lldb::SBError &, int64_t), error, fail_value);
8930b57cec5SDimitry Andric 
8940b57cec5SDimitry Andric   error.Clear();
8950b57cec5SDimitry Andric   ValueLocker locker;
8960b57cec5SDimitry Andric   lldb::ValueObjectSP value_sp(GetSP(locker));
8970b57cec5SDimitry Andric   if (value_sp) {
8980b57cec5SDimitry Andric     bool success = true;
8990b57cec5SDimitry Andric     uint64_t ret_val = fail_value;
9000b57cec5SDimitry Andric     ret_val = value_sp->GetValueAsSigned(fail_value, &success);
9010b57cec5SDimitry Andric     if (!success)
9020b57cec5SDimitry Andric       error.SetErrorString("could not resolve value");
9030b57cec5SDimitry Andric     return ret_val;
9040b57cec5SDimitry Andric   } else
9050b57cec5SDimitry Andric     error.SetErrorStringWithFormat("could not get SBValue: %s",
9060b57cec5SDimitry Andric                                    locker.GetError().AsCString());
9070b57cec5SDimitry Andric 
9080b57cec5SDimitry Andric   return fail_value;
9090b57cec5SDimitry Andric }
9100b57cec5SDimitry Andric 
GetValueAsUnsigned(SBError & error,uint64_t fail_value)9110b57cec5SDimitry Andric uint64_t SBValue::GetValueAsUnsigned(SBError &error, uint64_t fail_value) {
9120b57cec5SDimitry Andric   LLDB_RECORD_METHOD(uint64_t, SBValue, GetValueAsUnsigned,
9130b57cec5SDimitry Andric                      (lldb::SBError &, uint64_t), error, fail_value);
9140b57cec5SDimitry Andric 
9150b57cec5SDimitry Andric   error.Clear();
9160b57cec5SDimitry Andric   ValueLocker locker;
9170b57cec5SDimitry Andric   lldb::ValueObjectSP value_sp(GetSP(locker));
9180b57cec5SDimitry Andric   if (value_sp) {
9190b57cec5SDimitry Andric     bool success = true;
9200b57cec5SDimitry Andric     uint64_t ret_val = fail_value;
9210b57cec5SDimitry Andric     ret_val = value_sp->GetValueAsUnsigned(fail_value, &success);
9220b57cec5SDimitry Andric     if (!success)
9230b57cec5SDimitry Andric       error.SetErrorString("could not resolve value");
9240b57cec5SDimitry Andric     return ret_val;
9250b57cec5SDimitry Andric   } else
9260b57cec5SDimitry Andric     error.SetErrorStringWithFormat("could not get SBValue: %s",
9270b57cec5SDimitry Andric                                    locker.GetError().AsCString());
9280b57cec5SDimitry Andric 
9290b57cec5SDimitry Andric   return fail_value;
9300b57cec5SDimitry Andric }
9310b57cec5SDimitry Andric 
GetValueAsSigned(int64_t fail_value)9320b57cec5SDimitry Andric int64_t SBValue::GetValueAsSigned(int64_t fail_value) {
9330b57cec5SDimitry Andric   LLDB_RECORD_METHOD(int64_t, SBValue, GetValueAsSigned, (int64_t), fail_value);
9340b57cec5SDimitry Andric 
9350b57cec5SDimitry Andric   ValueLocker locker;
9360b57cec5SDimitry Andric   lldb::ValueObjectSP value_sp(GetSP(locker));
9370b57cec5SDimitry Andric   if (value_sp) {
9380b57cec5SDimitry Andric     return value_sp->GetValueAsSigned(fail_value);
9390b57cec5SDimitry Andric   }
9400b57cec5SDimitry Andric   return fail_value;
9410b57cec5SDimitry Andric }
9420b57cec5SDimitry Andric 
GetValueAsUnsigned(uint64_t fail_value)9430b57cec5SDimitry Andric uint64_t SBValue::GetValueAsUnsigned(uint64_t fail_value) {
9440b57cec5SDimitry Andric   LLDB_RECORD_METHOD(uint64_t, SBValue, GetValueAsUnsigned, (uint64_t),
9450b57cec5SDimitry Andric                      fail_value);
9460b57cec5SDimitry Andric 
9470b57cec5SDimitry Andric   ValueLocker locker;
9480b57cec5SDimitry Andric   lldb::ValueObjectSP value_sp(GetSP(locker));
9490b57cec5SDimitry Andric   if (value_sp) {
9500b57cec5SDimitry Andric     return value_sp->GetValueAsUnsigned(fail_value);
9510b57cec5SDimitry Andric   }
9520b57cec5SDimitry Andric   return fail_value;
9530b57cec5SDimitry Andric }
9540b57cec5SDimitry Andric 
MightHaveChildren()9550b57cec5SDimitry Andric bool SBValue::MightHaveChildren() {
9560b57cec5SDimitry Andric   LLDB_RECORD_METHOD_NO_ARGS(bool, SBValue, MightHaveChildren);
9570b57cec5SDimitry Andric 
9580b57cec5SDimitry Andric   bool has_children = false;
9590b57cec5SDimitry Andric   ValueLocker locker;
9600b57cec5SDimitry Andric   lldb::ValueObjectSP value_sp(GetSP(locker));
9610b57cec5SDimitry Andric   if (value_sp)
9620b57cec5SDimitry Andric     has_children = value_sp->MightHaveChildren();
9630b57cec5SDimitry Andric 
9640b57cec5SDimitry Andric   return has_children;
9650b57cec5SDimitry Andric }
9660b57cec5SDimitry Andric 
IsRuntimeSupportValue()9670b57cec5SDimitry Andric bool SBValue::IsRuntimeSupportValue() {
9680b57cec5SDimitry Andric   LLDB_RECORD_METHOD_NO_ARGS(bool, SBValue, IsRuntimeSupportValue);
9690b57cec5SDimitry Andric 
9700b57cec5SDimitry Andric   bool is_support = false;
9710b57cec5SDimitry Andric   ValueLocker locker;
9720b57cec5SDimitry Andric   lldb::ValueObjectSP value_sp(GetSP(locker));
9730b57cec5SDimitry Andric   if (value_sp)
9740b57cec5SDimitry Andric     is_support = value_sp->IsRuntimeSupportValue();
9750b57cec5SDimitry Andric 
9760b57cec5SDimitry Andric   return is_support;
9770b57cec5SDimitry Andric }
9780b57cec5SDimitry Andric 
GetNumChildren()9790b57cec5SDimitry Andric uint32_t SBValue::GetNumChildren() {
9800b57cec5SDimitry Andric   LLDB_RECORD_METHOD_NO_ARGS(uint32_t, SBValue, GetNumChildren);
9810b57cec5SDimitry Andric 
9820b57cec5SDimitry Andric   return GetNumChildren(UINT32_MAX);
9830b57cec5SDimitry Andric }
9840b57cec5SDimitry Andric 
GetNumChildren(uint32_t max)9850b57cec5SDimitry Andric uint32_t SBValue::GetNumChildren(uint32_t max) {
9860b57cec5SDimitry Andric   LLDB_RECORD_METHOD(uint32_t, SBValue, GetNumChildren, (uint32_t), max);
9870b57cec5SDimitry Andric 
9880b57cec5SDimitry Andric   uint32_t num_children = 0;
9890b57cec5SDimitry Andric 
9900b57cec5SDimitry Andric   ValueLocker locker;
9910b57cec5SDimitry Andric   lldb::ValueObjectSP value_sp(GetSP(locker));
9920b57cec5SDimitry Andric   if (value_sp)
9930b57cec5SDimitry Andric     num_children = value_sp->GetNumChildren(max);
9940b57cec5SDimitry Andric 
9950b57cec5SDimitry Andric   return num_children;
9960b57cec5SDimitry Andric }
9970b57cec5SDimitry Andric 
Dereference()9980b57cec5SDimitry Andric SBValue SBValue::Dereference() {
9990b57cec5SDimitry Andric   LLDB_RECORD_METHOD_NO_ARGS(lldb::SBValue, SBValue, Dereference);
10000b57cec5SDimitry Andric 
10010b57cec5SDimitry Andric   SBValue sb_value;
10020b57cec5SDimitry Andric   ValueLocker locker;
10030b57cec5SDimitry Andric   lldb::ValueObjectSP value_sp(GetSP(locker));
10040b57cec5SDimitry Andric   if (value_sp) {
10050b57cec5SDimitry Andric     Status error;
10060b57cec5SDimitry Andric     sb_value = value_sp->Dereference(error);
10070b57cec5SDimitry Andric   }
10080b57cec5SDimitry Andric 
10090b57cec5SDimitry Andric   return LLDB_RECORD_RESULT(sb_value);
10100b57cec5SDimitry Andric }
10110b57cec5SDimitry Andric 
10120b57cec5SDimitry Andric // Deprecated - please use GetType().IsPointerType() instead.
TypeIsPointerType()10130b57cec5SDimitry Andric bool SBValue::TypeIsPointerType() {
10140b57cec5SDimitry Andric   LLDB_RECORD_METHOD_NO_ARGS(bool, SBValue, TypeIsPointerType);
10150b57cec5SDimitry Andric 
10160b57cec5SDimitry Andric   return GetType().IsPointerType();
10170b57cec5SDimitry Andric }
10180b57cec5SDimitry Andric 
GetOpaqueType()10190b57cec5SDimitry Andric void *SBValue::GetOpaqueType() {
10200b57cec5SDimitry Andric   LLDB_RECORD_METHOD_NO_ARGS(void *, SBValue, GetOpaqueType);
10210b57cec5SDimitry Andric 
10220b57cec5SDimitry Andric   ValueLocker locker;
10230b57cec5SDimitry Andric   lldb::ValueObjectSP value_sp(GetSP(locker));
10240b57cec5SDimitry Andric   if (value_sp)
10250b57cec5SDimitry Andric     return value_sp->GetCompilerType().GetOpaqueQualType();
10260b57cec5SDimitry Andric   return nullptr;
10270b57cec5SDimitry Andric }
10280b57cec5SDimitry Andric 
GetTarget()10290b57cec5SDimitry Andric lldb::SBTarget SBValue::GetTarget() {
10300b57cec5SDimitry Andric   LLDB_RECORD_METHOD_NO_ARGS(lldb::SBTarget, SBValue, GetTarget);
10310b57cec5SDimitry Andric 
10320b57cec5SDimitry Andric   SBTarget sb_target;
10330b57cec5SDimitry Andric   TargetSP target_sp;
10340b57cec5SDimitry Andric   if (m_opaque_sp) {
10350b57cec5SDimitry Andric     target_sp = m_opaque_sp->GetTargetSP();
10360b57cec5SDimitry Andric     sb_target.SetSP(target_sp);
10370b57cec5SDimitry Andric   }
10380b57cec5SDimitry Andric 
10390b57cec5SDimitry Andric   return LLDB_RECORD_RESULT(sb_target);
10400b57cec5SDimitry Andric }
10410b57cec5SDimitry Andric 
GetProcess()10420b57cec5SDimitry Andric lldb::SBProcess SBValue::GetProcess() {
10430b57cec5SDimitry Andric   LLDB_RECORD_METHOD_NO_ARGS(lldb::SBProcess, SBValue, GetProcess);
10440b57cec5SDimitry Andric 
10450b57cec5SDimitry Andric   SBProcess sb_process;
10460b57cec5SDimitry Andric   ProcessSP process_sp;
10470b57cec5SDimitry Andric   if (m_opaque_sp) {
10480b57cec5SDimitry Andric     process_sp = m_opaque_sp->GetProcessSP();
10490b57cec5SDimitry Andric     sb_process.SetSP(process_sp);
10500b57cec5SDimitry Andric   }
10510b57cec5SDimitry Andric 
10520b57cec5SDimitry Andric   return LLDB_RECORD_RESULT(sb_process);
10530b57cec5SDimitry Andric }
10540b57cec5SDimitry Andric 
GetThread()10550b57cec5SDimitry Andric lldb::SBThread SBValue::GetThread() {
10560b57cec5SDimitry Andric   LLDB_RECORD_METHOD_NO_ARGS(lldb::SBThread, SBValue, GetThread);
10570b57cec5SDimitry Andric 
10580b57cec5SDimitry Andric   SBThread sb_thread;
10590b57cec5SDimitry Andric   ThreadSP thread_sp;
10600b57cec5SDimitry Andric   if (m_opaque_sp) {
10610b57cec5SDimitry Andric     thread_sp = m_opaque_sp->GetThreadSP();
10620b57cec5SDimitry Andric     sb_thread.SetThread(thread_sp);
10630b57cec5SDimitry Andric   }
10640b57cec5SDimitry Andric 
10650b57cec5SDimitry Andric   return LLDB_RECORD_RESULT(sb_thread);
10660b57cec5SDimitry Andric }
10670b57cec5SDimitry Andric 
GetFrame()10680b57cec5SDimitry Andric lldb::SBFrame SBValue::GetFrame() {
10690b57cec5SDimitry Andric   LLDB_RECORD_METHOD_NO_ARGS(lldb::SBFrame, SBValue, GetFrame);
10700b57cec5SDimitry Andric 
10710b57cec5SDimitry Andric   SBFrame sb_frame;
10720b57cec5SDimitry Andric   StackFrameSP frame_sp;
10730b57cec5SDimitry Andric   if (m_opaque_sp) {
10740b57cec5SDimitry Andric     frame_sp = m_opaque_sp->GetFrameSP();
10750b57cec5SDimitry Andric     sb_frame.SetFrameSP(frame_sp);
10760b57cec5SDimitry Andric   }
10770b57cec5SDimitry Andric 
10780b57cec5SDimitry Andric   return LLDB_RECORD_RESULT(sb_frame);
10790b57cec5SDimitry Andric }
10800b57cec5SDimitry Andric 
GetSP(ValueLocker & locker) const10810b57cec5SDimitry Andric lldb::ValueObjectSP SBValue::GetSP(ValueLocker &locker) const {
10820b57cec5SDimitry Andric   if (!m_opaque_sp || !m_opaque_sp->IsValid()) {
10830b57cec5SDimitry Andric     locker.GetError().SetErrorString("No value");
10840b57cec5SDimitry Andric     return ValueObjectSP();
10850b57cec5SDimitry Andric   }
10860b57cec5SDimitry Andric   return locker.GetLockedSP(*m_opaque_sp.get());
10870b57cec5SDimitry Andric }
10880b57cec5SDimitry Andric 
GetSP() const10890b57cec5SDimitry Andric lldb::ValueObjectSP SBValue::GetSP() const {
10900b57cec5SDimitry Andric   LLDB_RECORD_METHOD_CONST_NO_ARGS(lldb::ValueObjectSP, SBValue, GetSP);
10910b57cec5SDimitry Andric 
10920b57cec5SDimitry Andric   ValueLocker locker;
10930b57cec5SDimitry Andric   return LLDB_RECORD_RESULT(GetSP(locker));
10940b57cec5SDimitry Andric }
10950b57cec5SDimitry Andric 
SetSP(ValueImplSP impl_sp)10960b57cec5SDimitry Andric void SBValue::SetSP(ValueImplSP impl_sp) { m_opaque_sp = impl_sp; }
10970b57cec5SDimitry Andric 
SetSP(const lldb::ValueObjectSP & sp)10980b57cec5SDimitry Andric void SBValue::SetSP(const lldb::ValueObjectSP &sp) {
10990b57cec5SDimitry Andric   if (sp) {
11000b57cec5SDimitry Andric     lldb::TargetSP target_sp(sp->GetTargetSP());
11010b57cec5SDimitry Andric     if (target_sp) {
11020b57cec5SDimitry Andric       lldb::DynamicValueType use_dynamic = target_sp->GetPreferDynamicValue();
11030b57cec5SDimitry Andric       bool use_synthetic =
11040b57cec5SDimitry Andric           target_sp->TargetProperties::GetEnableSyntheticValue();
11050b57cec5SDimitry Andric       m_opaque_sp = ValueImplSP(new ValueImpl(sp, use_dynamic, use_synthetic));
11060b57cec5SDimitry Andric     } else
11070b57cec5SDimitry Andric       m_opaque_sp = ValueImplSP(new ValueImpl(sp, eNoDynamicValues, true));
11080b57cec5SDimitry Andric   } else
11090b57cec5SDimitry Andric     m_opaque_sp = ValueImplSP(new ValueImpl(sp, eNoDynamicValues, false));
11100b57cec5SDimitry Andric }
11110b57cec5SDimitry Andric 
SetSP(const lldb::ValueObjectSP & sp,lldb::DynamicValueType use_dynamic)11120b57cec5SDimitry Andric void SBValue::SetSP(const lldb::ValueObjectSP &sp,
11130b57cec5SDimitry Andric                     lldb::DynamicValueType use_dynamic) {
11140b57cec5SDimitry Andric   if (sp) {
11150b57cec5SDimitry Andric     lldb::TargetSP target_sp(sp->GetTargetSP());
11160b57cec5SDimitry Andric     if (target_sp) {
11170b57cec5SDimitry Andric       bool use_synthetic =
11180b57cec5SDimitry Andric           target_sp->TargetProperties::GetEnableSyntheticValue();
11190b57cec5SDimitry Andric       SetSP(sp, use_dynamic, use_synthetic);
11200b57cec5SDimitry Andric     } else
11210b57cec5SDimitry Andric       SetSP(sp, use_dynamic, true);
11220b57cec5SDimitry Andric   } else
11230b57cec5SDimitry Andric     SetSP(sp, use_dynamic, false);
11240b57cec5SDimitry Andric }
11250b57cec5SDimitry Andric 
SetSP(const lldb::ValueObjectSP & sp,bool use_synthetic)11260b57cec5SDimitry Andric void SBValue::SetSP(const lldb::ValueObjectSP &sp, bool use_synthetic) {
11270b57cec5SDimitry Andric   if (sp) {
11280b57cec5SDimitry Andric     lldb::TargetSP target_sp(sp->GetTargetSP());
11290b57cec5SDimitry Andric     if (target_sp) {
11300b57cec5SDimitry Andric       lldb::DynamicValueType use_dynamic = target_sp->GetPreferDynamicValue();
11310b57cec5SDimitry Andric       SetSP(sp, use_dynamic, use_synthetic);
11320b57cec5SDimitry Andric     } else
11330b57cec5SDimitry Andric       SetSP(sp, eNoDynamicValues, use_synthetic);
11340b57cec5SDimitry Andric   } else
11350b57cec5SDimitry Andric     SetSP(sp, eNoDynamicValues, use_synthetic);
11360b57cec5SDimitry Andric }
11370b57cec5SDimitry Andric 
SetSP(const lldb::ValueObjectSP & sp,lldb::DynamicValueType use_dynamic,bool use_synthetic)11380b57cec5SDimitry Andric void SBValue::SetSP(const lldb::ValueObjectSP &sp,
11390b57cec5SDimitry Andric                     lldb::DynamicValueType use_dynamic, bool use_synthetic) {
11400b57cec5SDimitry Andric   m_opaque_sp = ValueImplSP(new ValueImpl(sp, use_dynamic, use_synthetic));
11410b57cec5SDimitry Andric }
11420b57cec5SDimitry Andric 
SetSP(const lldb::ValueObjectSP & sp,lldb::DynamicValueType use_dynamic,bool use_synthetic,const char * name)11430b57cec5SDimitry Andric void SBValue::SetSP(const lldb::ValueObjectSP &sp,
11440b57cec5SDimitry Andric                     lldb::DynamicValueType use_dynamic, bool use_synthetic,
11450b57cec5SDimitry Andric                     const char *name) {
11460b57cec5SDimitry Andric   m_opaque_sp =
11470b57cec5SDimitry Andric       ValueImplSP(new ValueImpl(sp, use_dynamic, use_synthetic, name));
11480b57cec5SDimitry Andric }
11490b57cec5SDimitry Andric 
GetExpressionPath(SBStream & description)11500b57cec5SDimitry Andric bool SBValue::GetExpressionPath(SBStream &description) {
11510b57cec5SDimitry Andric   LLDB_RECORD_METHOD(bool, SBValue, GetExpressionPath, (lldb::SBStream &),
11520b57cec5SDimitry Andric                      description);
11530b57cec5SDimitry Andric 
11540b57cec5SDimitry Andric   ValueLocker locker;
11550b57cec5SDimitry Andric   lldb::ValueObjectSP value_sp(GetSP(locker));
11560b57cec5SDimitry Andric   if (value_sp) {
11575ffd83dbSDimitry Andric     value_sp->GetExpressionPath(description.ref());
11580b57cec5SDimitry Andric     return true;
11590b57cec5SDimitry Andric   }
11600b57cec5SDimitry Andric   return false;
11610b57cec5SDimitry Andric }
11620b57cec5SDimitry Andric 
GetExpressionPath(SBStream & description,bool qualify_cxx_base_classes)11630b57cec5SDimitry Andric bool SBValue::GetExpressionPath(SBStream &description,
11640b57cec5SDimitry Andric                                 bool qualify_cxx_base_classes) {
11650b57cec5SDimitry Andric   LLDB_RECORD_METHOD(bool, SBValue, GetExpressionPath, (lldb::SBStream &, bool),
11660b57cec5SDimitry Andric                      description, qualify_cxx_base_classes);
11670b57cec5SDimitry Andric 
11680b57cec5SDimitry Andric   ValueLocker locker;
11690b57cec5SDimitry Andric   lldb::ValueObjectSP value_sp(GetSP(locker));
11700b57cec5SDimitry Andric   if (value_sp) {
11715ffd83dbSDimitry Andric     value_sp->GetExpressionPath(description.ref());
11720b57cec5SDimitry Andric     return true;
11730b57cec5SDimitry Andric   }
11740b57cec5SDimitry Andric   return false;
11750b57cec5SDimitry Andric }
11760b57cec5SDimitry Andric 
EvaluateExpression(const char * expr) const11770b57cec5SDimitry Andric lldb::SBValue SBValue::EvaluateExpression(const char *expr) const {
11780b57cec5SDimitry Andric   LLDB_RECORD_METHOD_CONST(lldb::SBValue, SBValue, EvaluateExpression,
11790b57cec5SDimitry Andric                            (const char *), expr);
11800b57cec5SDimitry Andric 
11810b57cec5SDimitry Andric   ValueLocker locker;
11820b57cec5SDimitry Andric   lldb::ValueObjectSP value_sp(GetSP(locker));
11830b57cec5SDimitry Andric   if (!value_sp)
11840b57cec5SDimitry Andric     return LLDB_RECORD_RESULT(SBValue());
11850b57cec5SDimitry Andric 
11860b57cec5SDimitry Andric   lldb::TargetSP target_sp = value_sp->GetTargetSP();
11870b57cec5SDimitry Andric   if (!target_sp)
11880b57cec5SDimitry Andric     return LLDB_RECORD_RESULT(SBValue());
11890b57cec5SDimitry Andric 
11900b57cec5SDimitry Andric   lldb::SBExpressionOptions options;
11910b57cec5SDimitry Andric   options.SetFetchDynamicValue(target_sp->GetPreferDynamicValue());
11920b57cec5SDimitry Andric   options.SetUnwindOnError(true);
11930b57cec5SDimitry Andric   options.SetIgnoreBreakpoints(true);
11940b57cec5SDimitry Andric 
11950b57cec5SDimitry Andric   return LLDB_RECORD_RESULT(EvaluateExpression(expr, options, nullptr));
11960b57cec5SDimitry Andric }
11970b57cec5SDimitry Andric 
11980b57cec5SDimitry Andric lldb::SBValue
EvaluateExpression(const char * expr,const SBExpressionOptions & options) const11990b57cec5SDimitry Andric SBValue::EvaluateExpression(const char *expr,
12000b57cec5SDimitry Andric                             const SBExpressionOptions &options) const {
12010b57cec5SDimitry Andric   LLDB_RECORD_METHOD_CONST(lldb::SBValue, SBValue, EvaluateExpression,
12020b57cec5SDimitry Andric                            (const char *, const lldb::SBExpressionOptions &),
12030b57cec5SDimitry Andric                            expr, options);
12040b57cec5SDimitry Andric 
12050b57cec5SDimitry Andric   return LLDB_RECORD_RESULT(EvaluateExpression(expr, options, nullptr));
12060b57cec5SDimitry Andric }
12070b57cec5SDimitry Andric 
EvaluateExpression(const char * expr,const SBExpressionOptions & options,const char * name) const12080b57cec5SDimitry Andric lldb::SBValue SBValue::EvaluateExpression(const char *expr,
12090b57cec5SDimitry Andric                                           const SBExpressionOptions &options,
12100b57cec5SDimitry Andric                                           const char *name) const {
12110b57cec5SDimitry Andric   LLDB_RECORD_METHOD_CONST(
12120b57cec5SDimitry Andric       lldb::SBValue, SBValue, EvaluateExpression,
12130b57cec5SDimitry Andric       (const char *, const lldb::SBExpressionOptions &, const char *), expr,
12140b57cec5SDimitry Andric       options, name);
12150b57cec5SDimitry Andric 
12160b57cec5SDimitry Andric 
12170b57cec5SDimitry Andric   if (!expr || expr[0] == '\0') {
12180b57cec5SDimitry Andric     return LLDB_RECORD_RESULT(SBValue());
12190b57cec5SDimitry Andric   }
12200b57cec5SDimitry Andric 
12210b57cec5SDimitry Andric 
12220b57cec5SDimitry Andric   ValueLocker locker;
12230b57cec5SDimitry Andric   lldb::ValueObjectSP value_sp(GetSP(locker));
12240b57cec5SDimitry Andric   if (!value_sp) {
12250b57cec5SDimitry Andric     return LLDB_RECORD_RESULT(SBValue());
12260b57cec5SDimitry Andric   }
12270b57cec5SDimitry Andric 
12280b57cec5SDimitry Andric   lldb::TargetSP target_sp = value_sp->GetTargetSP();
12290b57cec5SDimitry Andric   if (!target_sp) {
12300b57cec5SDimitry Andric     return LLDB_RECORD_RESULT(SBValue());
12310b57cec5SDimitry Andric   }
12320b57cec5SDimitry Andric 
12330b57cec5SDimitry Andric   std::lock_guard<std::recursive_mutex> guard(target_sp->GetAPIMutex());
12340b57cec5SDimitry Andric   ExecutionContext exe_ctx(target_sp.get());
12350b57cec5SDimitry Andric 
12360b57cec5SDimitry Andric   StackFrame *frame = exe_ctx.GetFramePtr();
12370b57cec5SDimitry Andric   if (!frame) {
12380b57cec5SDimitry Andric     return LLDB_RECORD_RESULT(SBValue());
12390b57cec5SDimitry Andric   }
12400b57cec5SDimitry Andric 
12410b57cec5SDimitry Andric   ValueObjectSP res_val_sp;
12420b57cec5SDimitry Andric   target_sp->EvaluateExpression(expr, frame, res_val_sp, options.ref(), nullptr,
12430b57cec5SDimitry Andric                                 value_sp.get());
12440b57cec5SDimitry Andric 
12450b57cec5SDimitry Andric   if (name)
12460b57cec5SDimitry Andric     res_val_sp->SetName(ConstString(name));
12470b57cec5SDimitry Andric 
12480b57cec5SDimitry Andric   SBValue result;
12490b57cec5SDimitry Andric   result.SetSP(res_val_sp, options.GetFetchDynamicValue());
12500b57cec5SDimitry Andric   return LLDB_RECORD_RESULT(result);
12510b57cec5SDimitry Andric }
12520b57cec5SDimitry Andric 
GetDescription(SBStream & description)12530b57cec5SDimitry Andric bool SBValue::GetDescription(SBStream &description) {
12540b57cec5SDimitry Andric   LLDB_RECORD_METHOD(bool, SBValue, GetDescription, (lldb::SBStream &),
12550b57cec5SDimitry Andric                      description);
12560b57cec5SDimitry Andric 
12570b57cec5SDimitry Andric   Stream &strm = description.ref();
12580b57cec5SDimitry Andric 
12590b57cec5SDimitry Andric   ValueLocker locker;
12600b57cec5SDimitry Andric   lldb::ValueObjectSP value_sp(GetSP(locker));
12610b57cec5SDimitry Andric   if (value_sp)
12620b57cec5SDimitry Andric     value_sp->Dump(strm);
12630b57cec5SDimitry Andric   else
12640b57cec5SDimitry Andric     strm.PutCString("No value");
12650b57cec5SDimitry Andric 
12660b57cec5SDimitry Andric   return true;
12670b57cec5SDimitry Andric }
12680b57cec5SDimitry Andric 
GetFormat()12690b57cec5SDimitry Andric lldb::Format SBValue::GetFormat() {
12700b57cec5SDimitry Andric   LLDB_RECORD_METHOD_NO_ARGS(lldb::Format, SBValue, GetFormat);
12710b57cec5SDimitry Andric 
12720b57cec5SDimitry Andric   ValueLocker locker;
12730b57cec5SDimitry Andric   lldb::ValueObjectSP value_sp(GetSP(locker));
12740b57cec5SDimitry Andric   if (value_sp)
12750b57cec5SDimitry Andric     return value_sp->GetFormat();
12760b57cec5SDimitry Andric   return eFormatDefault;
12770b57cec5SDimitry Andric }
12780b57cec5SDimitry Andric 
SetFormat(lldb::Format format)12790b57cec5SDimitry Andric void SBValue::SetFormat(lldb::Format format) {
12800b57cec5SDimitry Andric   LLDB_RECORD_METHOD(void, SBValue, SetFormat, (lldb::Format), format);
12810b57cec5SDimitry Andric 
12820b57cec5SDimitry Andric   ValueLocker locker;
12830b57cec5SDimitry Andric   lldb::ValueObjectSP value_sp(GetSP(locker));
12840b57cec5SDimitry Andric   if (value_sp)
12850b57cec5SDimitry Andric     value_sp->SetFormat(format);
12860b57cec5SDimitry Andric }
12870b57cec5SDimitry Andric 
AddressOf()12880b57cec5SDimitry Andric lldb::SBValue SBValue::AddressOf() {
12890b57cec5SDimitry Andric   LLDB_RECORD_METHOD_NO_ARGS(lldb::SBValue, SBValue, AddressOf);
12900b57cec5SDimitry Andric 
12910b57cec5SDimitry Andric   SBValue sb_value;
12920b57cec5SDimitry Andric   ValueLocker locker;
12930b57cec5SDimitry Andric   lldb::ValueObjectSP value_sp(GetSP(locker));
12940b57cec5SDimitry Andric   if (value_sp) {
12950b57cec5SDimitry Andric     Status error;
12960b57cec5SDimitry Andric     sb_value.SetSP(value_sp->AddressOf(error), GetPreferDynamicValue(),
12970b57cec5SDimitry Andric                    GetPreferSyntheticValue());
12980b57cec5SDimitry Andric   }
12990b57cec5SDimitry Andric 
13000b57cec5SDimitry Andric   return LLDB_RECORD_RESULT(sb_value);
13010b57cec5SDimitry Andric }
13020b57cec5SDimitry Andric 
GetLoadAddress()13030b57cec5SDimitry Andric lldb::addr_t SBValue::GetLoadAddress() {
13040b57cec5SDimitry Andric   LLDB_RECORD_METHOD_NO_ARGS(lldb::addr_t, SBValue, GetLoadAddress);
13050b57cec5SDimitry Andric 
13060b57cec5SDimitry Andric   lldb::addr_t value = LLDB_INVALID_ADDRESS;
13070b57cec5SDimitry Andric   ValueLocker locker;
13080b57cec5SDimitry Andric   lldb::ValueObjectSP value_sp(GetSP(locker));
13090b57cec5SDimitry Andric   if (value_sp) {
13100b57cec5SDimitry Andric     TargetSP target_sp(value_sp->GetTargetSP());
13110b57cec5SDimitry Andric     if (target_sp) {
13120b57cec5SDimitry Andric       const bool scalar_is_load_address = true;
13130b57cec5SDimitry Andric       AddressType addr_type;
13140b57cec5SDimitry Andric       value = value_sp->GetAddressOf(scalar_is_load_address, &addr_type);
13150b57cec5SDimitry Andric       if (addr_type == eAddressTypeFile) {
13160b57cec5SDimitry Andric         ModuleSP module_sp(value_sp->GetModule());
13170b57cec5SDimitry Andric         if (!module_sp)
13180b57cec5SDimitry Andric           value = LLDB_INVALID_ADDRESS;
13190b57cec5SDimitry Andric         else {
13200b57cec5SDimitry Andric           Address addr;
13210b57cec5SDimitry Andric           module_sp->ResolveFileAddress(value, addr);
13220b57cec5SDimitry Andric           value = addr.GetLoadAddress(target_sp.get());
13230b57cec5SDimitry Andric         }
13240b57cec5SDimitry Andric       } else if (addr_type == eAddressTypeHost ||
13250b57cec5SDimitry Andric                  addr_type == eAddressTypeInvalid)
13260b57cec5SDimitry Andric         value = LLDB_INVALID_ADDRESS;
13270b57cec5SDimitry Andric     }
13280b57cec5SDimitry Andric   }
13290b57cec5SDimitry Andric 
13300b57cec5SDimitry Andric   return value;
13310b57cec5SDimitry Andric }
13320b57cec5SDimitry Andric 
GetAddress()13330b57cec5SDimitry Andric lldb::SBAddress SBValue::GetAddress() {
13340b57cec5SDimitry Andric   LLDB_RECORD_METHOD_NO_ARGS(lldb::SBAddress, SBValue, GetAddress);
13350b57cec5SDimitry Andric 
13360b57cec5SDimitry Andric   Address addr;
13370b57cec5SDimitry Andric   ValueLocker locker;
13380b57cec5SDimitry Andric   lldb::ValueObjectSP value_sp(GetSP(locker));
13390b57cec5SDimitry Andric   if (value_sp) {
13400b57cec5SDimitry Andric     TargetSP target_sp(value_sp->GetTargetSP());
13410b57cec5SDimitry Andric     if (target_sp) {
13420b57cec5SDimitry Andric       lldb::addr_t value = LLDB_INVALID_ADDRESS;
13430b57cec5SDimitry Andric       const bool scalar_is_load_address = true;
13440b57cec5SDimitry Andric       AddressType addr_type;
13450b57cec5SDimitry Andric       value = value_sp->GetAddressOf(scalar_is_load_address, &addr_type);
13460b57cec5SDimitry Andric       if (addr_type == eAddressTypeFile) {
13470b57cec5SDimitry Andric         ModuleSP module_sp(value_sp->GetModule());
13480b57cec5SDimitry Andric         if (module_sp)
13490b57cec5SDimitry Andric           module_sp->ResolveFileAddress(value, addr);
13500b57cec5SDimitry Andric       } else if (addr_type == eAddressTypeLoad) {
13510b57cec5SDimitry Andric         // no need to check the return value on this.. if it can actually do
13520b57cec5SDimitry Andric         // the resolve addr will be in the form (section,offset), otherwise it
13530b57cec5SDimitry Andric         // will simply be returned as (NULL, value)
13540b57cec5SDimitry Andric         addr.SetLoadAddress(value, target_sp.get());
13550b57cec5SDimitry Andric       }
13560b57cec5SDimitry Andric     }
13570b57cec5SDimitry Andric   }
13580b57cec5SDimitry Andric 
1359af732203SDimitry Andric   return LLDB_RECORD_RESULT(SBAddress(addr));
13600b57cec5SDimitry Andric }
13610b57cec5SDimitry Andric 
GetPointeeData(uint32_t item_idx,uint32_t item_count)13620b57cec5SDimitry Andric lldb::SBData SBValue::GetPointeeData(uint32_t item_idx, uint32_t item_count) {
13630b57cec5SDimitry Andric   LLDB_RECORD_METHOD(lldb::SBData, SBValue, GetPointeeData,
13640b57cec5SDimitry Andric                      (uint32_t, uint32_t), item_idx, item_count);
13650b57cec5SDimitry Andric 
13660b57cec5SDimitry Andric   lldb::SBData sb_data;
13670b57cec5SDimitry Andric   ValueLocker locker;
13680b57cec5SDimitry Andric   lldb::ValueObjectSP value_sp(GetSP(locker));
13690b57cec5SDimitry Andric   if (value_sp) {
13700b57cec5SDimitry Andric     TargetSP target_sp(value_sp->GetTargetSP());
13710b57cec5SDimitry Andric     if (target_sp) {
13720b57cec5SDimitry Andric       DataExtractorSP data_sp(new DataExtractor());
13730b57cec5SDimitry Andric       value_sp->GetPointeeData(*data_sp, item_idx, item_count);
13740b57cec5SDimitry Andric       if (data_sp->GetByteSize() > 0)
13750b57cec5SDimitry Andric         *sb_data = data_sp;
13760b57cec5SDimitry Andric     }
13770b57cec5SDimitry Andric   }
13780b57cec5SDimitry Andric 
13790b57cec5SDimitry Andric   return LLDB_RECORD_RESULT(sb_data);
13800b57cec5SDimitry Andric }
13810b57cec5SDimitry Andric 
GetData()13820b57cec5SDimitry Andric lldb::SBData SBValue::GetData() {
13830b57cec5SDimitry Andric   LLDB_RECORD_METHOD_NO_ARGS(lldb::SBData, SBValue, GetData);
13840b57cec5SDimitry Andric 
13850b57cec5SDimitry Andric   lldb::SBData sb_data;
13860b57cec5SDimitry Andric   ValueLocker locker;
13870b57cec5SDimitry Andric   lldb::ValueObjectSP value_sp(GetSP(locker));
13880b57cec5SDimitry Andric   if (value_sp) {
13890b57cec5SDimitry Andric     DataExtractorSP data_sp(new DataExtractor());
13900b57cec5SDimitry Andric     Status error;
13910b57cec5SDimitry Andric     value_sp->GetData(*data_sp, error);
13920b57cec5SDimitry Andric     if (error.Success())
13930b57cec5SDimitry Andric       *sb_data = data_sp;
13940b57cec5SDimitry Andric   }
13950b57cec5SDimitry Andric 
13960b57cec5SDimitry Andric   return LLDB_RECORD_RESULT(sb_data);
13970b57cec5SDimitry Andric }
13980b57cec5SDimitry Andric 
SetData(lldb::SBData & data,SBError & error)13990b57cec5SDimitry Andric bool SBValue::SetData(lldb::SBData &data, SBError &error) {
14000b57cec5SDimitry Andric   LLDB_RECORD_METHOD(bool, SBValue, SetData, (lldb::SBData &, lldb::SBError &),
14010b57cec5SDimitry Andric                      data, error);
14020b57cec5SDimitry Andric 
14030b57cec5SDimitry Andric   ValueLocker locker;
14040b57cec5SDimitry Andric   lldb::ValueObjectSP value_sp(GetSP(locker));
14050b57cec5SDimitry Andric   bool ret = true;
14060b57cec5SDimitry Andric 
14070b57cec5SDimitry Andric   if (value_sp) {
14080b57cec5SDimitry Andric     DataExtractor *data_extractor = data.get();
14090b57cec5SDimitry Andric 
14100b57cec5SDimitry Andric     if (!data_extractor) {
14110b57cec5SDimitry Andric       error.SetErrorString("No data to set");
14120b57cec5SDimitry Andric       ret = false;
14130b57cec5SDimitry Andric     } else {
14140b57cec5SDimitry Andric       Status set_error;
14150b57cec5SDimitry Andric 
14160b57cec5SDimitry Andric       value_sp->SetData(*data_extractor, set_error);
14170b57cec5SDimitry Andric 
14180b57cec5SDimitry Andric       if (!set_error.Success()) {
14190b57cec5SDimitry Andric         error.SetErrorStringWithFormat("Couldn't set data: %s",
14200b57cec5SDimitry Andric                                        set_error.AsCString());
14210b57cec5SDimitry Andric         ret = false;
14220b57cec5SDimitry Andric       }
14230b57cec5SDimitry Andric     }
14240b57cec5SDimitry Andric   } else {
14250b57cec5SDimitry Andric     error.SetErrorStringWithFormat(
14260b57cec5SDimitry Andric         "Couldn't set data: could not get SBValue: %s",
14270b57cec5SDimitry Andric         locker.GetError().AsCString());
14280b57cec5SDimitry Andric     ret = false;
14290b57cec5SDimitry Andric   }
14300b57cec5SDimitry Andric 
14310b57cec5SDimitry Andric   return ret;
14320b57cec5SDimitry Andric }
14330b57cec5SDimitry Andric 
GetDeclaration()14340b57cec5SDimitry Andric lldb::SBDeclaration SBValue::GetDeclaration() {
14350b57cec5SDimitry Andric   LLDB_RECORD_METHOD_NO_ARGS(lldb::SBDeclaration, SBValue, GetDeclaration);
14360b57cec5SDimitry Andric 
14370b57cec5SDimitry Andric   ValueLocker locker;
14380b57cec5SDimitry Andric   lldb::ValueObjectSP value_sp(GetSP(locker));
14390b57cec5SDimitry Andric   SBDeclaration decl_sb;
14400b57cec5SDimitry Andric   if (value_sp) {
14410b57cec5SDimitry Andric     Declaration decl;
14420b57cec5SDimitry Andric     if (value_sp->GetDeclaration(decl))
14430b57cec5SDimitry Andric       decl_sb.SetDeclaration(decl);
14440b57cec5SDimitry Andric   }
14450b57cec5SDimitry Andric   return LLDB_RECORD_RESULT(decl_sb);
14460b57cec5SDimitry Andric }
14470b57cec5SDimitry Andric 
Watch(bool resolve_location,bool read,bool write,SBError & error)14480b57cec5SDimitry Andric lldb::SBWatchpoint SBValue::Watch(bool resolve_location, bool read, bool write,
14490b57cec5SDimitry Andric                                   SBError &error) {
14500b57cec5SDimitry Andric   LLDB_RECORD_METHOD(lldb::SBWatchpoint, SBValue, Watch,
14510b57cec5SDimitry Andric                      (bool, bool, bool, lldb::SBError &), resolve_location,
14520b57cec5SDimitry Andric                      read, write, error);
14530b57cec5SDimitry Andric 
14540b57cec5SDimitry Andric   SBWatchpoint sb_watchpoint;
14550b57cec5SDimitry Andric 
14560b57cec5SDimitry Andric   // If the SBValue is not valid, there's no point in even trying to watch it.
14570b57cec5SDimitry Andric   ValueLocker locker;
14580b57cec5SDimitry Andric   lldb::ValueObjectSP value_sp(GetSP(locker));
14590b57cec5SDimitry Andric   TargetSP target_sp(GetTarget().GetSP());
14600b57cec5SDimitry Andric   if (value_sp && target_sp) {
14610b57cec5SDimitry Andric     // Read and Write cannot both be false.
14620b57cec5SDimitry Andric     if (!read && !write)
14630b57cec5SDimitry Andric       return LLDB_RECORD_RESULT(sb_watchpoint);
14640b57cec5SDimitry Andric 
14650b57cec5SDimitry Andric     // If the value is not in scope, don't try and watch and invalid value
14660b57cec5SDimitry Andric     if (!IsInScope())
14670b57cec5SDimitry Andric       return LLDB_RECORD_RESULT(sb_watchpoint);
14680b57cec5SDimitry Andric 
14690b57cec5SDimitry Andric     addr_t addr = GetLoadAddress();
14700b57cec5SDimitry Andric     if (addr == LLDB_INVALID_ADDRESS)
14710b57cec5SDimitry Andric       return LLDB_RECORD_RESULT(sb_watchpoint);
14720b57cec5SDimitry Andric     size_t byte_size = GetByteSize();
14730b57cec5SDimitry Andric     if (byte_size == 0)
14740b57cec5SDimitry Andric       return LLDB_RECORD_RESULT(sb_watchpoint);
14750b57cec5SDimitry Andric 
14760b57cec5SDimitry Andric     uint32_t watch_type = 0;
14770b57cec5SDimitry Andric     if (read)
14780b57cec5SDimitry Andric       watch_type |= LLDB_WATCH_TYPE_READ;
14790b57cec5SDimitry Andric     if (write)
14800b57cec5SDimitry Andric       watch_type |= LLDB_WATCH_TYPE_WRITE;
14810b57cec5SDimitry Andric 
14820b57cec5SDimitry Andric     Status rc;
14830b57cec5SDimitry Andric     CompilerType type(value_sp->GetCompilerType());
14840b57cec5SDimitry Andric     WatchpointSP watchpoint_sp =
14850b57cec5SDimitry Andric         target_sp->CreateWatchpoint(addr, byte_size, &type, watch_type, rc);
14860b57cec5SDimitry Andric     error.SetError(rc);
14870b57cec5SDimitry Andric 
14880b57cec5SDimitry Andric     if (watchpoint_sp) {
14890b57cec5SDimitry Andric       sb_watchpoint.SetSP(watchpoint_sp);
14900b57cec5SDimitry Andric       Declaration decl;
14910b57cec5SDimitry Andric       if (value_sp->GetDeclaration(decl)) {
14920b57cec5SDimitry Andric         if (decl.GetFile()) {
14930b57cec5SDimitry Andric           StreamString ss;
14940b57cec5SDimitry Andric           // True to show fullpath for declaration file.
14950b57cec5SDimitry Andric           decl.DumpStopContext(&ss, true);
14965ffd83dbSDimitry Andric           watchpoint_sp->SetDeclInfo(std::string(ss.GetString()));
14970b57cec5SDimitry Andric         }
14980b57cec5SDimitry Andric       }
14990b57cec5SDimitry Andric     }
15000b57cec5SDimitry Andric   } else if (target_sp) {
15010b57cec5SDimitry Andric     error.SetErrorStringWithFormat("could not get SBValue: %s",
15020b57cec5SDimitry Andric                                    locker.GetError().AsCString());
15030b57cec5SDimitry Andric   } else {
15040b57cec5SDimitry Andric     error.SetErrorString("could not set watchpoint, a target is required");
15050b57cec5SDimitry Andric   }
15060b57cec5SDimitry Andric 
15070b57cec5SDimitry Andric   return LLDB_RECORD_RESULT(sb_watchpoint);
15080b57cec5SDimitry Andric }
15090b57cec5SDimitry Andric 
15100b57cec5SDimitry Andric // FIXME: Remove this method impl (as well as the decl in .h) once it is no
15110b57cec5SDimitry Andric // longer needed.
15120b57cec5SDimitry Andric // Backward compatibility fix in the interim.
Watch(bool resolve_location,bool read,bool write)15130b57cec5SDimitry Andric lldb::SBWatchpoint SBValue::Watch(bool resolve_location, bool read,
15140b57cec5SDimitry Andric                                   bool write) {
15150b57cec5SDimitry Andric   LLDB_RECORD_METHOD(lldb::SBWatchpoint, SBValue, Watch, (bool, bool, bool),
15160b57cec5SDimitry Andric                      resolve_location, read, write);
15170b57cec5SDimitry Andric 
15180b57cec5SDimitry Andric   SBError error;
15190b57cec5SDimitry Andric   return LLDB_RECORD_RESULT(Watch(resolve_location, read, write, error));
15200b57cec5SDimitry Andric }
15210b57cec5SDimitry Andric 
WatchPointee(bool resolve_location,bool read,bool write,SBError & error)15220b57cec5SDimitry Andric lldb::SBWatchpoint SBValue::WatchPointee(bool resolve_location, bool read,
15230b57cec5SDimitry Andric                                          bool write, SBError &error) {
15240b57cec5SDimitry Andric   LLDB_RECORD_METHOD(lldb::SBWatchpoint, SBValue, WatchPointee,
15250b57cec5SDimitry Andric                      (bool, bool, bool, lldb::SBError &), resolve_location,
15260b57cec5SDimitry Andric                      read, write, error);
15270b57cec5SDimitry Andric 
15280b57cec5SDimitry Andric   SBWatchpoint sb_watchpoint;
15290b57cec5SDimitry Andric   if (IsInScope() && GetType().IsPointerType())
15300b57cec5SDimitry Andric     sb_watchpoint = Dereference().Watch(resolve_location, read, write, error);
15310b57cec5SDimitry Andric   return LLDB_RECORD_RESULT(sb_watchpoint);
15320b57cec5SDimitry Andric }
15330b57cec5SDimitry Andric 
Persist()15340b57cec5SDimitry Andric lldb::SBValue SBValue::Persist() {
15350b57cec5SDimitry Andric   LLDB_RECORD_METHOD_NO_ARGS(lldb::SBValue, SBValue, Persist);
15360b57cec5SDimitry Andric 
15370b57cec5SDimitry Andric   ValueLocker locker;
15380b57cec5SDimitry Andric   lldb::ValueObjectSP value_sp(GetSP(locker));
15390b57cec5SDimitry Andric   SBValue persisted_sb;
15400b57cec5SDimitry Andric   if (value_sp) {
15410b57cec5SDimitry Andric     persisted_sb.SetSP(value_sp->Persist());
15420b57cec5SDimitry Andric   }
15430b57cec5SDimitry Andric   return LLDB_RECORD_RESULT(persisted_sb);
15440b57cec5SDimitry Andric }
15450b57cec5SDimitry Andric 
15460b57cec5SDimitry Andric namespace lldb_private {
15470b57cec5SDimitry Andric namespace repro {
15480b57cec5SDimitry Andric 
15490b57cec5SDimitry Andric template <>
RegisterMethods(Registry & R)15500b57cec5SDimitry Andric void RegisterMethods<SBValue>(Registry &R) {
15510b57cec5SDimitry Andric   LLDB_REGISTER_CONSTRUCTOR(SBValue, ());
15520b57cec5SDimitry Andric   LLDB_REGISTER_CONSTRUCTOR(SBValue, (const lldb::ValueObjectSP &));
15530b57cec5SDimitry Andric   LLDB_REGISTER_CONSTRUCTOR(SBValue, (const lldb::SBValue &));
15540b57cec5SDimitry Andric   LLDB_REGISTER_METHOD(lldb::SBValue &,
15550b57cec5SDimitry Andric                        SBValue, operator=,(const lldb::SBValue &));
15560b57cec5SDimitry Andric   LLDB_REGISTER_METHOD(bool, SBValue, IsValid, ());
15570b57cec5SDimitry Andric   LLDB_REGISTER_METHOD_CONST(bool, SBValue, operator bool, ());
15580b57cec5SDimitry Andric   LLDB_REGISTER_METHOD(void, SBValue, Clear, ());
15590b57cec5SDimitry Andric   LLDB_REGISTER_METHOD(lldb::SBError, SBValue, GetError, ());
15600b57cec5SDimitry Andric   LLDB_REGISTER_METHOD(lldb::user_id_t, SBValue, GetID, ());
15610b57cec5SDimitry Andric   LLDB_REGISTER_METHOD(const char *, SBValue, GetName, ());
15620b57cec5SDimitry Andric   LLDB_REGISTER_METHOD(const char *, SBValue, GetTypeName, ());
15630b57cec5SDimitry Andric   LLDB_REGISTER_METHOD(const char *, SBValue, GetDisplayTypeName, ());
15640b57cec5SDimitry Andric   LLDB_REGISTER_METHOD(size_t, SBValue, GetByteSize, ());
15650b57cec5SDimitry Andric   LLDB_REGISTER_METHOD(bool, SBValue, IsInScope, ());
15660b57cec5SDimitry Andric   LLDB_REGISTER_METHOD(const char *, SBValue, GetValue, ());
15670b57cec5SDimitry Andric   LLDB_REGISTER_METHOD(lldb::ValueType, SBValue, GetValueType, ());
15680b57cec5SDimitry Andric   LLDB_REGISTER_METHOD(const char *, SBValue, GetObjectDescription, ());
15690b57cec5SDimitry Andric   LLDB_REGISTER_METHOD(lldb::SBType, SBValue, GetType, ());
15700b57cec5SDimitry Andric   LLDB_REGISTER_METHOD(bool, SBValue, GetValueDidChange, ());
15710b57cec5SDimitry Andric   LLDB_REGISTER_METHOD(const char *, SBValue, GetSummary, ());
15720b57cec5SDimitry Andric   LLDB_REGISTER_METHOD(const char *, SBValue, GetSummary,
15730b57cec5SDimitry Andric                        (lldb::SBStream &, lldb::SBTypeSummaryOptions &));
15740b57cec5SDimitry Andric   LLDB_REGISTER_METHOD(const char *, SBValue, GetLocation, ());
15750b57cec5SDimitry Andric   LLDB_REGISTER_METHOD(bool, SBValue, SetValueFromCString, (const char *));
15760b57cec5SDimitry Andric   LLDB_REGISTER_METHOD(bool, SBValue, SetValueFromCString,
15770b57cec5SDimitry Andric                        (const char *, lldb::SBError &));
15780b57cec5SDimitry Andric   LLDB_REGISTER_METHOD(lldb::SBTypeFormat, SBValue, GetTypeFormat, ());
15790b57cec5SDimitry Andric   LLDB_REGISTER_METHOD(lldb::SBTypeSummary, SBValue, GetTypeSummary, ());
15800b57cec5SDimitry Andric   LLDB_REGISTER_METHOD(lldb::SBTypeFilter, SBValue, GetTypeFilter, ());
15810b57cec5SDimitry Andric   LLDB_REGISTER_METHOD(lldb::SBTypeSynthetic, SBValue, GetTypeSynthetic, ());
15820b57cec5SDimitry Andric   LLDB_REGISTER_METHOD(lldb::SBValue, SBValue, CreateChildAtOffset,
15830b57cec5SDimitry Andric                        (const char *, uint32_t, lldb::SBType));
15840b57cec5SDimitry Andric   LLDB_REGISTER_METHOD(lldb::SBValue, SBValue, Cast, (lldb::SBType));
15850b57cec5SDimitry Andric   LLDB_REGISTER_METHOD(lldb::SBValue, SBValue, CreateValueFromExpression,
15860b57cec5SDimitry Andric                        (const char *, const char *));
15870b57cec5SDimitry Andric   LLDB_REGISTER_METHOD(
15880b57cec5SDimitry Andric       lldb::SBValue, SBValue, CreateValueFromExpression,
15890b57cec5SDimitry Andric       (const char *, const char *, lldb::SBExpressionOptions &));
15900b57cec5SDimitry Andric   LLDB_REGISTER_METHOD(lldb::SBValue, SBValue, CreateValueFromAddress,
15910b57cec5SDimitry Andric                        (const char *, lldb::addr_t, lldb::SBType));
15920b57cec5SDimitry Andric   LLDB_REGISTER_METHOD(lldb::SBValue, SBValue, CreateValueFromData,
15930b57cec5SDimitry Andric                        (const char *, lldb::SBData, lldb::SBType));
15940b57cec5SDimitry Andric   LLDB_REGISTER_METHOD(lldb::SBValue, SBValue, GetChildAtIndex, (uint32_t));
15950b57cec5SDimitry Andric   LLDB_REGISTER_METHOD(lldb::SBValue, SBValue, GetChildAtIndex,
15960b57cec5SDimitry Andric                        (uint32_t, lldb::DynamicValueType, bool));
15970b57cec5SDimitry Andric   LLDB_REGISTER_METHOD(uint32_t, SBValue, GetIndexOfChildWithName,
15980b57cec5SDimitry Andric                        (const char *));
15990b57cec5SDimitry Andric   LLDB_REGISTER_METHOD(lldb::SBValue, SBValue, GetChildMemberWithName,
16000b57cec5SDimitry Andric                        (const char *));
16010b57cec5SDimitry Andric   LLDB_REGISTER_METHOD(lldb::SBValue, SBValue, GetChildMemberWithName,
16020b57cec5SDimitry Andric                        (const char *, lldb::DynamicValueType));
16030b57cec5SDimitry Andric   LLDB_REGISTER_METHOD(lldb::SBValue, SBValue, GetDynamicValue,
16040b57cec5SDimitry Andric                        (lldb::DynamicValueType));
16050b57cec5SDimitry Andric   LLDB_REGISTER_METHOD(lldb::SBValue, SBValue, GetStaticValue, ());
16060b57cec5SDimitry Andric   LLDB_REGISTER_METHOD(lldb::SBValue, SBValue, GetNonSyntheticValue, ());
16070b57cec5SDimitry Andric   LLDB_REGISTER_METHOD(lldb::DynamicValueType, SBValue, GetPreferDynamicValue,
16080b57cec5SDimitry Andric                        ());
16090b57cec5SDimitry Andric   LLDB_REGISTER_METHOD(void, SBValue, SetPreferDynamicValue,
16100b57cec5SDimitry Andric                        (lldb::DynamicValueType));
16110b57cec5SDimitry Andric   LLDB_REGISTER_METHOD(bool, SBValue, GetPreferSyntheticValue, ());
16120b57cec5SDimitry Andric   LLDB_REGISTER_METHOD(void, SBValue, SetPreferSyntheticValue, (bool));
16130b57cec5SDimitry Andric   LLDB_REGISTER_METHOD(bool, SBValue, IsDynamic, ());
16140b57cec5SDimitry Andric   LLDB_REGISTER_METHOD(bool, SBValue, IsSynthetic, ());
16150b57cec5SDimitry Andric   LLDB_REGISTER_METHOD(bool, SBValue, IsSyntheticChildrenGenerated, ());
16160b57cec5SDimitry Andric   LLDB_REGISTER_METHOD(void, SBValue, SetSyntheticChildrenGenerated, (bool));
16170b57cec5SDimitry Andric   LLDB_REGISTER_METHOD(lldb::SBValue, SBValue, GetValueForExpressionPath,
16180b57cec5SDimitry Andric                        (const char *));
16190b57cec5SDimitry Andric   LLDB_REGISTER_METHOD(int64_t, SBValue, GetValueAsSigned,
16200b57cec5SDimitry Andric                        (lldb::SBError &, int64_t));
16210b57cec5SDimitry Andric   LLDB_REGISTER_METHOD(uint64_t, SBValue, GetValueAsUnsigned,
16220b57cec5SDimitry Andric                        (lldb::SBError &, uint64_t));
16230b57cec5SDimitry Andric   LLDB_REGISTER_METHOD(int64_t, SBValue, GetValueAsSigned, (int64_t));
16240b57cec5SDimitry Andric   LLDB_REGISTER_METHOD(uint64_t, SBValue, GetValueAsUnsigned, (uint64_t));
16250b57cec5SDimitry Andric   LLDB_REGISTER_METHOD(bool, SBValue, MightHaveChildren, ());
16260b57cec5SDimitry Andric   LLDB_REGISTER_METHOD(bool, SBValue, IsRuntimeSupportValue, ());
16270b57cec5SDimitry Andric   LLDB_REGISTER_METHOD(uint32_t, SBValue, GetNumChildren, ());
16280b57cec5SDimitry Andric   LLDB_REGISTER_METHOD(uint32_t, SBValue, GetNumChildren, (uint32_t));
16290b57cec5SDimitry Andric   LLDB_REGISTER_METHOD(lldb::SBValue, SBValue, Dereference, ());
16300b57cec5SDimitry Andric   LLDB_REGISTER_METHOD(bool, SBValue, TypeIsPointerType, ());
16310b57cec5SDimitry Andric   LLDB_REGISTER_METHOD(void *, SBValue, GetOpaqueType, ());
16320b57cec5SDimitry Andric   LLDB_REGISTER_METHOD(lldb::SBTarget, SBValue, GetTarget, ());
16330b57cec5SDimitry Andric   LLDB_REGISTER_METHOD(lldb::SBProcess, SBValue, GetProcess, ());
16340b57cec5SDimitry Andric   LLDB_REGISTER_METHOD(lldb::SBThread, SBValue, GetThread, ());
16350b57cec5SDimitry Andric   LLDB_REGISTER_METHOD(lldb::SBFrame, SBValue, GetFrame, ());
16360b57cec5SDimitry Andric   LLDB_REGISTER_METHOD_CONST(lldb::ValueObjectSP, SBValue, GetSP, ());
16370b57cec5SDimitry Andric   LLDB_REGISTER_METHOD(bool, SBValue, GetExpressionPath, (lldb::SBStream &));
16380b57cec5SDimitry Andric   LLDB_REGISTER_METHOD(bool, SBValue, GetExpressionPath,
16390b57cec5SDimitry Andric                        (lldb::SBStream &, bool));
16400b57cec5SDimitry Andric   LLDB_REGISTER_METHOD_CONST(lldb::SBValue, SBValue, EvaluateExpression,
16410b57cec5SDimitry Andric                              (const char *));
16420b57cec5SDimitry Andric   LLDB_REGISTER_METHOD_CONST(
16430b57cec5SDimitry Andric       lldb::SBValue, SBValue, EvaluateExpression,
16440b57cec5SDimitry Andric       (const char *, const lldb::SBExpressionOptions &));
16450b57cec5SDimitry Andric   LLDB_REGISTER_METHOD_CONST(
16460b57cec5SDimitry Andric       lldb::SBValue, SBValue, EvaluateExpression,
16470b57cec5SDimitry Andric       (const char *, const lldb::SBExpressionOptions &, const char *));
16480b57cec5SDimitry Andric   LLDB_REGISTER_METHOD(bool, SBValue, GetDescription, (lldb::SBStream &));
16490b57cec5SDimitry Andric   LLDB_REGISTER_METHOD(lldb::Format, SBValue, GetFormat, ());
16500b57cec5SDimitry Andric   LLDB_REGISTER_METHOD(void, SBValue, SetFormat, (lldb::Format));
16510b57cec5SDimitry Andric   LLDB_REGISTER_METHOD(lldb::SBValue, SBValue, AddressOf, ());
16520b57cec5SDimitry Andric   LLDB_REGISTER_METHOD(lldb::addr_t, SBValue, GetLoadAddress, ());
16530b57cec5SDimitry Andric   LLDB_REGISTER_METHOD(lldb::SBAddress, SBValue, GetAddress, ());
16540b57cec5SDimitry Andric   LLDB_REGISTER_METHOD(lldb::SBData, SBValue, GetPointeeData,
16550b57cec5SDimitry Andric                        (uint32_t, uint32_t));
16560b57cec5SDimitry Andric   LLDB_REGISTER_METHOD(lldb::SBData, SBValue, GetData, ());
16570b57cec5SDimitry Andric   LLDB_REGISTER_METHOD(bool, SBValue, SetData,
16580b57cec5SDimitry Andric                        (lldb::SBData &, lldb::SBError &));
16590b57cec5SDimitry Andric   LLDB_REGISTER_METHOD(lldb::SBDeclaration, SBValue, GetDeclaration, ());
16600b57cec5SDimitry Andric   LLDB_REGISTER_METHOD(lldb::SBWatchpoint, SBValue, Watch,
16610b57cec5SDimitry Andric                        (bool, bool, bool, lldb::SBError &));
16620b57cec5SDimitry Andric   LLDB_REGISTER_METHOD(lldb::SBWatchpoint, SBValue, Watch,
16630b57cec5SDimitry Andric                        (bool, bool, bool));
16640b57cec5SDimitry Andric   LLDB_REGISTER_METHOD(lldb::SBWatchpoint, SBValue, WatchPointee,
16650b57cec5SDimitry Andric                        (bool, bool, bool, lldb::SBError &));
16660b57cec5SDimitry Andric   LLDB_REGISTER_METHOD(lldb::SBValue, SBValue, Persist, ());
16670b57cec5SDimitry Andric }
16680b57cec5SDimitry Andric 
16690b57cec5SDimitry Andric }
16700b57cec5SDimitry Andric }
1671