1 //===-- SBValue.cpp ---------------------------------------------*- C++ -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 #include "lldb/API/SBValue.h"
12 #include "lldb/API/SBDeclaration.h"
13 #include "lldb/API/SBStream.h"
14 #include "lldb/API/SBTypeFilter.h"
15 #include "lldb/API/SBTypeFormat.h"
16 #include "lldb/API/SBTypeSummary.h"
17 #include "lldb/API/SBTypeSynthetic.h"
19 #include "lldb/Breakpoint/Watchpoint.h"
20 #include "lldb/Core/Module.h"
21 #include "lldb/Core/Scalar.h"
22 #include "lldb/Core/Section.h"
23 #include "lldb/Core/StreamFile.h"
24 #include "lldb/Core/Value.h"
25 #include "lldb/Core/ValueObject.h"
26 #include "lldb/Core/ValueObjectConstResult.h"
27 #include "lldb/DataFormatters/DataVisualization.h"
28 #include "lldb/Symbol/Block.h"
29 #include "lldb/Symbol/Declaration.h"
30 #include "lldb/Symbol/ObjectFile.h"
31 #include "lldb/Symbol/Type.h"
32 #include "lldb/Symbol/Variable.h"
33 #include "lldb/Symbol/VariableList.h"
34 #include "lldb/Target/ExecutionContext.h"
35 #include "lldb/Target/Process.h"
36 #include "lldb/Target/StackFrame.h"
37 #include "lldb/Target/Target.h"
38 #include "lldb/Target/Thread.h"
39 #include "lldb/Utility/DataExtractor.h"
40 #include "lldb/Utility/Log.h"
41 #include "lldb/Utility/Stream.h"
43 #include "lldb/API/SBDebugger.h"
44 #include "lldb/API/SBExpressionOptions.h"
45 #include "lldb/API/SBFrame.h"
46 #include "lldb/API/SBProcess.h"
47 #include "lldb/API/SBTarget.h"
48 #include "lldb/API/SBThread.h"
51 using namespace lldb_private;
57 ValueImpl(lldb::ValueObjectSP in_valobj_sp,
58 lldb::DynamicValueType use_dynamic, bool use_synthetic,
59 const char *name = NULL)
60 : m_valobj_sp(), m_use_dynamic(use_dynamic),
61 m_use_synthetic(use_synthetic), m_name(name) {
63 if ((m_valobj_sp = in_valobj_sp->GetQualifiedRepresentationIfAvailable(
64 lldb::eNoDynamicValues, false))) {
65 if (!m_name.IsEmpty())
66 m_valobj_sp->SetName(m_name);
71 ValueImpl(const ValueImpl &rhs)
72 : m_valobj_sp(rhs.m_valobj_sp), m_use_dynamic(rhs.m_use_dynamic),
73 m_use_synthetic(rhs.m_use_synthetic), m_name(rhs.m_name) {}
75 ValueImpl &operator=(const ValueImpl &rhs) {
77 m_valobj_sp = rhs.m_valobj_sp;
78 m_use_dynamic = rhs.m_use_dynamic;
79 m_use_synthetic = rhs.m_use_synthetic;
86 if (m_valobj_sp.get() == NULL)
89 // FIXME: This check is necessary but not sufficient. We for sure don't
90 // want to touch SBValues whose owning
91 // targets have gone away. This check is a little weak in that it
92 // enforces that restriction when you call
93 // IsValid, but since IsValid doesn't lock the target, you have no
94 // guarantee that the SBValue won't go
95 // invalid after you call this...
96 // Also, an SBValue could depend on data from one of the modules in the
97 // target, and those could go away
98 // independently of the target, for instance if a module is unloaded. But
99 // right now, neither SBValues
100 // nor ValueObjects know which modules they depend on. So I have no good
101 // way to make that check without
102 // tracking that in all the ValueObject subclasses.
103 TargetSP target_sp = m_valobj_sp->GetTargetSP();
104 if (target_sp && target_sp->IsValid())
111 lldb::ValueObjectSP GetRootSP() { return m_valobj_sp; }
113 lldb::ValueObjectSP GetSP(Process::StopLocker &stop_locker,
114 std::unique_lock<std::recursive_mutex> &lock,
116 Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_API));
118 error.SetErrorString("invalid value object");
122 lldb::ValueObjectSP value_sp = m_valobj_sp;
124 Target *target = value_sp->GetTargetSP().get();
126 return ValueObjectSP();
128 lock = std::unique_lock<std::recursive_mutex>(target->GetAPIMutex());
130 ProcessSP process_sp(value_sp->GetProcessSP());
131 if (process_sp && !stop_locker.TryLock(&process_sp->GetRunLock())) {
132 // We don't allow people to play around with ValueObject if the process is
134 // If you want to look at values, pause the process, then look.
136 log->Printf("SBValue(%p)::GetSP() => error: process is running",
137 static_cast<void *>(value_sp.get()));
138 error.SetErrorString("process must be stopped.");
139 return ValueObjectSP();
142 if (m_use_dynamic != eNoDynamicValues) {
143 ValueObjectSP dynamic_sp = value_sp->GetDynamicValue(m_use_dynamic);
145 value_sp = dynamic_sp;
148 if (m_use_synthetic) {
149 ValueObjectSP synthetic_sp = value_sp->GetSyntheticValue(m_use_synthetic);
151 value_sp = synthetic_sp;
155 error.SetErrorString("invalid value object");
156 if (!m_name.IsEmpty())
157 value_sp->SetName(m_name);
162 void SetUseDynamic(lldb::DynamicValueType use_dynamic) {
163 m_use_dynamic = use_dynamic;
166 void SetUseSynthetic(bool use_synthetic) { m_use_synthetic = use_synthetic; }
168 lldb::DynamicValueType GetUseDynamic() { return m_use_dynamic; }
170 bool GetUseSynthetic() { return m_use_synthetic; }
172 // All the derived values that we would make from the m_valobj_sp will share
173 // the ExecutionContext with m_valobj_sp, so we don't need to do the
175 // in GetSP to return the Target, Process, Thread or Frame. It is convenient
177 // provide simple accessors for these, which I do here.
178 TargetSP GetTargetSP() {
180 return m_valobj_sp->GetTargetSP();
185 ProcessSP GetProcessSP() {
187 return m_valobj_sp->GetProcessSP();
192 ThreadSP GetThreadSP() {
194 return m_valobj_sp->GetThreadSP();
199 StackFrameSP GetFrameSP() {
201 return m_valobj_sp->GetFrameSP();
203 return StackFrameSP();
207 lldb::ValueObjectSP m_valobj_sp;
208 lldb::DynamicValueType m_use_dynamic;
209 bool m_use_synthetic;
217 ValueObjectSP GetLockedSP(ValueImpl &in_value) {
218 return in_value.GetSP(m_stop_locker, m_lock, m_lock_error);
221 Status &GetError() { return m_lock_error; }
224 Process::StopLocker m_stop_locker;
225 std::unique_lock<std::recursive_mutex> m_lock;
229 SBValue::SBValue() : m_opaque_sp() {}
231 SBValue::SBValue(const lldb::ValueObjectSP &value_sp) { SetSP(value_sp); }
233 SBValue::SBValue(const SBValue &rhs) { SetSP(rhs.m_opaque_sp); }
235 SBValue &SBValue::operator=(const SBValue &rhs) {
237 SetSP(rhs.m_opaque_sp);
242 SBValue::~SBValue() {}
244 bool SBValue::IsValid() {
245 // If this function ever changes to anything that does more than just
246 // check if the opaque shared pointer is non NULL, then we need to update
247 // all "if (m_opaque_sp)" code in this file.
248 return m_opaque_sp.get() != NULL && m_opaque_sp->IsValid() &&
249 m_opaque_sp->GetRootSP().get() != NULL;
252 void SBValue::Clear() { m_opaque_sp.reset(); }
254 SBError SBValue::GetError() {
258 lldb::ValueObjectSP value_sp(GetSP(locker));
260 sb_error.SetError(value_sp->GetError());
262 sb_error.SetErrorStringWithFormat("error: %s",
263 locker.GetError().AsCString());
268 user_id_t SBValue::GetID() {
270 lldb::ValueObjectSP value_sp(GetSP(locker));
272 return value_sp->GetID();
273 return LLDB_INVALID_UID;
276 const char *SBValue::GetName() {
277 const char *name = NULL;
279 lldb::ValueObjectSP value_sp(GetSP(locker));
281 name = value_sp->GetName().GetCString();
283 Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_API));
286 log->Printf("SBValue(%p)::GetName () => \"%s\"",
287 static_cast<void *>(value_sp.get()), name);
289 log->Printf("SBValue(%p)::GetName () => NULL",
290 static_cast<void *>(value_sp.get()));
296 const char *SBValue::GetTypeName() {
297 Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_API));
298 const char *name = NULL;
300 lldb::ValueObjectSP value_sp(GetSP(locker));
302 name = value_sp->GetQualifiedTypeName().GetCString();
307 log->Printf("SBValue(%p)::GetTypeName () => \"%s\"",
308 static_cast<void *>(value_sp.get()), name);
310 log->Printf("SBValue(%p)::GetTypeName () => NULL",
311 static_cast<void *>(value_sp.get()));
317 const char *SBValue::GetDisplayTypeName() {
318 Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_API));
319 const char *name = NULL;
321 lldb::ValueObjectSP value_sp(GetSP(locker));
323 name = value_sp->GetDisplayTypeName().GetCString();
328 log->Printf("SBValue(%p)::GetTypeName () => \"%s\"",
329 static_cast<void *>(value_sp.get()), name);
331 log->Printf("SBValue(%p)::GetTypeName () => NULL",
332 static_cast<void *>(value_sp.get()));
338 size_t SBValue::GetByteSize() {
339 Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_API));
343 lldb::ValueObjectSP value_sp(GetSP(locker));
345 result = value_sp->GetByteSize();
349 log->Printf("SBValue(%p)::GetByteSize () => %" PRIu64,
350 static_cast<void *>(value_sp.get()),
351 static_cast<uint64_t>(result));
356 bool SBValue::IsInScope() {
360 lldb::ValueObjectSP value_sp(GetSP(locker));
362 result = value_sp->IsInScope();
365 Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_API));
367 log->Printf("SBValue(%p)::IsInScope () => %i",
368 static_cast<void *>(value_sp.get()), result);
373 const char *SBValue::GetValue() {
374 Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_API));
376 const char *cstr = NULL;
378 lldb::ValueObjectSP value_sp(GetSP(locker));
380 cstr = value_sp->GetValueAsCString();
384 log->Printf("SBValue(%p)::GetValue() => \"%s\"",
385 static_cast<void *>(value_sp.get()), cstr);
387 log->Printf("SBValue(%p)::GetValue() => NULL",
388 static_cast<void *>(value_sp.get()));
394 ValueType SBValue::GetValueType() {
395 ValueType result = eValueTypeInvalid;
397 lldb::ValueObjectSP value_sp(GetSP(locker));
399 result = value_sp->GetValueType();
401 Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_API));
404 case eValueTypeInvalid:
405 log->Printf("SBValue(%p)::GetValueType () => eValueTypeInvalid",
406 static_cast<void *>(value_sp.get()));
408 case eValueTypeVariableGlobal:
409 log->Printf("SBValue(%p)::GetValueType () => eValueTypeVariableGlobal",
410 static_cast<void *>(value_sp.get()));
412 case eValueTypeVariableStatic:
413 log->Printf("SBValue(%p)::GetValueType () => eValueTypeVariableStatic",
414 static_cast<void *>(value_sp.get()));
416 case eValueTypeVariableArgument:
417 log->Printf("SBValue(%p)::GetValueType () => eValueTypeVariableArgument",
418 static_cast<void *>(value_sp.get()));
420 case eValueTypeVariableLocal:
421 log->Printf("SBValue(%p)::GetValueType () => eValueTypeVariableLocal",
422 static_cast<void *>(value_sp.get()));
424 case eValueTypeRegister:
425 log->Printf("SBValue(%p)::GetValueType () => eValueTypeRegister",
426 static_cast<void *>(value_sp.get()));
428 case eValueTypeRegisterSet:
429 log->Printf("SBValue(%p)::GetValueType () => eValueTypeRegisterSet",
430 static_cast<void *>(value_sp.get()));
432 case eValueTypeConstResult:
433 log->Printf("SBValue(%p)::GetValueType () => eValueTypeConstResult",
434 static_cast<void *>(value_sp.get()));
436 case eValueTypeVariableThreadLocal:
438 "SBValue(%p)::GetValueType () => eValueTypeVariableThreadLocal",
439 static_cast<void *>(value_sp.get()));
446 const char *SBValue::GetObjectDescription() {
447 Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_API));
448 const char *cstr = NULL;
450 lldb::ValueObjectSP value_sp(GetSP(locker));
452 cstr = value_sp->GetObjectDescription();
456 log->Printf("SBValue(%p)::GetObjectDescription() => \"%s\"",
457 static_cast<void *>(value_sp.get()), cstr);
459 log->Printf("SBValue(%p)::GetObjectDescription() => NULL",
460 static_cast<void *>(value_sp.get()));
465 const char *SBValue::GetTypeValidatorResult() {
466 Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_API));
467 const char *cstr = NULL;
469 lldb::ValueObjectSP value_sp(GetSP(locker));
471 const auto &validation(value_sp->GetValidationStatus());
472 if (TypeValidatorResult::Failure == validation.first) {
473 if (validation.second.empty())
474 cstr = "unknown error";
476 cstr = validation.second.c_str();
481 log->Printf("SBValue(%p)::GetTypeValidatorResult() => \"%s\"",
482 static_cast<void *>(value_sp.get()), cstr);
484 log->Printf("SBValue(%p)::GetTypeValidatorResult() => NULL",
485 static_cast<void *>(value_sp.get()));
490 SBType SBValue::GetType() {
491 Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_API));
494 lldb::ValueObjectSP value_sp(GetSP(locker));
497 type_sp.reset(new TypeImpl(value_sp->GetTypeImpl()));
498 sb_type.SetSP(type_sp);
502 log->Printf("SBValue(%p)::GetType => SBType(%p)",
503 static_cast<void *>(value_sp.get()),
504 static_cast<void *>(type_sp.get()));
506 log->Printf("SBValue(%p)::GetType => NULL",
507 static_cast<void *>(value_sp.get()));
512 bool SBValue::GetValueDidChange() {
513 Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_API));
516 lldb::ValueObjectSP value_sp(GetSP(locker));
518 if (value_sp->UpdateValueIfNeeded(false))
519 result = value_sp->GetValueDidChange();
522 log->Printf("SBValue(%p)::GetValueDidChange() => %i",
523 static_cast<void *>(value_sp.get()), result);
528 const char *SBValue::GetSummary() {
529 Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_API));
530 const char *cstr = NULL;
532 lldb::ValueObjectSP value_sp(GetSP(locker));
534 cstr = value_sp->GetSummaryAsCString();
538 log->Printf("SBValue(%p)::GetSummary() => \"%s\"",
539 static_cast<void *>(value_sp.get()), cstr);
541 log->Printf("SBValue(%p)::GetSummary() => NULL",
542 static_cast<void *>(value_sp.get()));
547 const char *SBValue::GetSummary(lldb::SBStream &stream,
548 lldb::SBTypeSummaryOptions &options) {
549 Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_API));
551 lldb::ValueObjectSP value_sp(GetSP(locker));
554 if (value_sp->GetSummaryAsCString(buffer, options.ref()) && !buffer.empty())
555 stream.Printf("%s", buffer.c_str());
557 const char *cstr = stream.GetData();
560 log->Printf("SBValue(%p)::GetSummary() => \"%s\"",
561 static_cast<void *>(value_sp.get()), cstr);
563 log->Printf("SBValue(%p)::GetSummary() => NULL",
564 static_cast<void *>(value_sp.get()));
569 const char *SBValue::GetLocation() {
570 Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_API));
571 const char *cstr = NULL;
573 lldb::ValueObjectSP value_sp(GetSP(locker));
575 cstr = value_sp->GetLocationAsCString();
579 log->Printf("SBValue(%p)::GetLocation() => \"%s\"",
580 static_cast<void *>(value_sp.get()), cstr);
582 log->Printf("SBValue(%p)::GetLocation() => NULL",
583 static_cast<void *>(value_sp.get()));
588 // Deprecated - use the one that takes an lldb::SBError
589 bool SBValue::SetValueFromCString(const char *value_str) {
591 return SetValueFromCString(value_str, dummy);
594 bool SBValue::SetValueFromCString(const char *value_str, lldb::SBError &error) {
595 bool success = false;
597 lldb::ValueObjectSP value_sp(GetSP(locker));
598 Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_API));
600 success = value_sp->SetValueFromCString(value_str, error.ref());
602 error.SetErrorStringWithFormat("Could not get value: %s",
603 locker.GetError().AsCString());
606 log->Printf("SBValue(%p)::SetValueFromCString(\"%s\") => %i",
607 static_cast<void *>(value_sp.get()), value_str, success);
612 lldb::SBTypeFormat SBValue::GetTypeFormat() {
613 lldb::SBTypeFormat format;
615 lldb::ValueObjectSP value_sp(GetSP(locker));
617 if (value_sp->UpdateValueIfNeeded(true)) {
618 lldb::TypeFormatImplSP format_sp = value_sp->GetValueFormat();
620 format.SetSP(format_sp);
626 lldb::SBTypeSummary SBValue::GetTypeSummary() {
627 lldb::SBTypeSummary summary;
629 lldb::ValueObjectSP value_sp(GetSP(locker));
631 if (value_sp->UpdateValueIfNeeded(true)) {
632 lldb::TypeSummaryImplSP summary_sp = value_sp->GetSummaryFormat();
634 summary.SetSP(summary_sp);
640 lldb::SBTypeFilter SBValue::GetTypeFilter() {
641 lldb::SBTypeFilter filter;
643 lldb::ValueObjectSP value_sp(GetSP(locker));
645 if (value_sp->UpdateValueIfNeeded(true)) {
646 lldb::SyntheticChildrenSP synthetic_sp = value_sp->GetSyntheticChildren();
648 if (synthetic_sp && !synthetic_sp->IsScripted()) {
649 TypeFilterImplSP filter_sp =
650 std::static_pointer_cast<TypeFilterImpl>(synthetic_sp);
651 filter.SetSP(filter_sp);
658 #ifndef LLDB_DISABLE_PYTHON
659 lldb::SBTypeSynthetic SBValue::GetTypeSynthetic() {
660 lldb::SBTypeSynthetic synthetic;
662 lldb::ValueObjectSP value_sp(GetSP(locker));
664 if (value_sp->UpdateValueIfNeeded(true)) {
665 lldb::SyntheticChildrenSP children_sp = value_sp->GetSyntheticChildren();
667 if (children_sp && children_sp->IsScripted()) {
668 ScriptedSyntheticChildrenSP synth_sp =
669 std::static_pointer_cast<ScriptedSyntheticChildren>(children_sp);
670 synthetic.SetSP(synth_sp);
678 lldb::SBValue SBValue::CreateChildAtOffset(const char *name, uint32_t offset,
680 lldb::SBValue sb_value;
682 lldb::ValueObjectSP value_sp(GetSP(locker));
683 lldb::ValueObjectSP new_value_sp;
685 TypeImplSP type_sp(type.GetSP());
686 if (type.IsValid()) {
687 sb_value.SetSP(value_sp->GetSyntheticChildAtOffset(
688 offset, type_sp->GetCompilerType(false), true),
689 GetPreferDynamicValue(), GetPreferSyntheticValue(), name);
692 Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_API));
695 log->Printf("SBValue(%p)::CreateChildAtOffset => \"%s\"",
696 static_cast<void *>(value_sp.get()),
697 new_value_sp->GetName().AsCString());
699 log->Printf("SBValue(%p)::CreateChildAtOffset => NULL",
700 static_cast<void *>(value_sp.get()));
705 lldb::SBValue SBValue::Cast(SBType type) {
706 lldb::SBValue sb_value;
708 lldb::ValueObjectSP value_sp(GetSP(locker));
709 TypeImplSP type_sp(type.GetSP());
710 if (value_sp && type_sp)
711 sb_value.SetSP(value_sp->Cast(type_sp->GetCompilerType(false)),
712 GetPreferDynamicValue(), GetPreferSyntheticValue());
716 lldb::SBValue SBValue::CreateValueFromExpression(const char *name,
717 const char *expression) {
718 SBExpressionOptions options;
719 options.ref().SetKeepInMemory(true);
720 return CreateValueFromExpression(name, expression, options);
723 lldb::SBValue SBValue::CreateValueFromExpression(const char *name,
724 const char *expression,
725 SBExpressionOptions &options) {
726 Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_API));
727 lldb::SBValue sb_value;
729 lldb::ValueObjectSP value_sp(GetSP(locker));
730 lldb::ValueObjectSP new_value_sp;
732 ExecutionContext exe_ctx(value_sp->GetExecutionContextRef());
733 new_value_sp = ValueObject::CreateValueObjectFromExpression(
734 name, expression, exe_ctx, options.ref());
736 new_value_sp->SetName(ConstString(name));
738 sb_value.SetSP(new_value_sp);
741 log->Printf("SBValue(%p)::CreateValueFromExpression(name=\"%s\", "
742 "expression=\"%s\") => SBValue (%p)",
743 static_cast<void *>(value_sp.get()), name, expression,
744 static_cast<void *>(new_value_sp.get()));
746 log->Printf("SBValue(%p)::CreateValueFromExpression(name=\"%s\", "
747 "expression=\"%s\") => NULL",
748 static_cast<void *>(value_sp.get()), name, expression);
753 lldb::SBValue SBValue::CreateValueFromAddress(const char *name,
754 lldb::addr_t address,
756 lldb::SBValue sb_value;
758 lldb::ValueObjectSP value_sp(GetSP(locker));
759 lldb::ValueObjectSP new_value_sp;
760 lldb::TypeImplSP type_impl_sp(sb_type.GetSP());
761 if (value_sp && type_impl_sp) {
762 CompilerType ast_type(type_impl_sp->GetCompilerType(true));
763 ExecutionContext exe_ctx(value_sp->GetExecutionContextRef());
764 new_value_sp = ValueObject::CreateValueObjectFromAddress(name, address,
767 sb_value.SetSP(new_value_sp);
768 Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_API));
771 log->Printf("SBValue(%p)::CreateValueFromAddress => \"%s\"",
772 static_cast<void *>(value_sp.get()),
773 new_value_sp->GetName().AsCString());
775 log->Printf("SBValue(%p)::CreateValueFromAddress => NULL",
776 static_cast<void *>(value_sp.get()));
781 lldb::SBValue SBValue::CreateValueFromData(const char *name, SBData data,
783 lldb::SBValue sb_value;
784 lldb::ValueObjectSP new_value_sp;
786 lldb::ValueObjectSP value_sp(GetSP(locker));
787 lldb::TypeImplSP type_impl_sp(sb_type.GetSP());
788 if (value_sp && type_impl_sp) {
789 ExecutionContext exe_ctx(value_sp->GetExecutionContextRef());
790 new_value_sp = ValueObject::CreateValueObjectFromData(
791 name, **data, exe_ctx, type_impl_sp->GetCompilerType(true));
792 new_value_sp->SetAddressTypeOfChildren(eAddressTypeLoad);
794 sb_value.SetSP(new_value_sp);
795 Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_API));
798 log->Printf("SBValue(%p)::CreateValueFromData => \"%s\"",
799 static_cast<void *>(value_sp.get()),
800 new_value_sp->GetName().AsCString());
802 log->Printf("SBValue(%p)::CreateValueFromData => NULL",
803 static_cast<void *>(value_sp.get()));
808 SBValue SBValue::GetChildAtIndex(uint32_t idx) {
809 const bool can_create_synthetic = false;
810 lldb::DynamicValueType use_dynamic = eNoDynamicValues;
813 target_sp = m_opaque_sp->GetTargetSP();
816 use_dynamic = target_sp->GetPreferDynamicValue();
818 return GetChildAtIndex(idx, use_dynamic, can_create_synthetic);
821 SBValue SBValue::GetChildAtIndex(uint32_t idx,
822 lldb::DynamicValueType use_dynamic,
823 bool can_create_synthetic) {
824 lldb::ValueObjectSP child_sp;
825 Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_API));
828 lldb::ValueObjectSP value_sp(GetSP(locker));
830 const bool can_create = true;
831 child_sp = value_sp->GetChildAtIndex(idx, can_create);
832 if (can_create_synthetic && !child_sp) {
833 child_sp = value_sp->GetSyntheticArrayMember(idx, can_create);
838 sb_value.SetSP(child_sp, use_dynamic, GetPreferSyntheticValue());
840 log->Printf("SBValue(%p)::GetChildAtIndex (%u) => SBValue(%p)",
841 static_cast<void *>(value_sp.get()), idx,
842 static_cast<void *>(value_sp.get()));
847 uint32_t SBValue::GetIndexOfChildWithName(const char *name) {
848 uint32_t idx = UINT32_MAX;
850 lldb::ValueObjectSP value_sp(GetSP(locker));
852 idx = value_sp->GetIndexOfChildWithName(ConstString(name));
854 Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_API));
856 if (idx == UINT32_MAX)
858 "SBValue(%p)::GetIndexOfChildWithName (name=\"%s\") => NOT FOUND",
859 static_cast<void *>(value_sp.get()), name);
861 log->Printf("SBValue(%p)::GetIndexOfChildWithName (name=\"%s\") => %u",
862 static_cast<void *>(value_sp.get()), name, idx);
867 SBValue SBValue::GetChildMemberWithName(const char *name) {
868 lldb::DynamicValueType use_dynamic_value = eNoDynamicValues;
871 target_sp = m_opaque_sp->GetTargetSP();
874 use_dynamic_value = target_sp->GetPreferDynamicValue();
875 return GetChildMemberWithName(name, use_dynamic_value);
879 SBValue::GetChildMemberWithName(const char *name,
880 lldb::DynamicValueType use_dynamic_value) {
881 lldb::ValueObjectSP child_sp;
882 const ConstString str_name(name);
884 Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_API));
887 lldb::ValueObjectSP value_sp(GetSP(locker));
889 child_sp = value_sp->GetChildMemberWithName(str_name, true);
893 sb_value.SetSP(child_sp, use_dynamic_value, GetPreferSyntheticValue());
897 "SBValue(%p)::GetChildMemberWithName (name=\"%s\") => SBValue(%p)",
898 static_cast<void *>(value_sp.get()), name,
899 static_cast<void *>(value_sp.get()));
904 lldb::SBValue SBValue::GetDynamicValue(lldb::DynamicValueType use_dynamic) {
907 ValueImplSP proxy_sp(new ValueImpl(m_opaque_sp->GetRootSP(), use_dynamic,
908 m_opaque_sp->GetUseSynthetic()));
909 value_sb.SetSP(proxy_sp);
914 lldb::SBValue SBValue::GetStaticValue() {
917 ValueImplSP proxy_sp(new ValueImpl(m_opaque_sp->GetRootSP(),
919 m_opaque_sp->GetUseSynthetic()));
920 value_sb.SetSP(proxy_sp);
925 lldb::SBValue SBValue::GetNonSyntheticValue() {
928 ValueImplSP proxy_sp(new ValueImpl(m_opaque_sp->GetRootSP(),
929 m_opaque_sp->GetUseDynamic(), false));
930 value_sb.SetSP(proxy_sp);
935 lldb::DynamicValueType SBValue::GetPreferDynamicValue() {
937 return eNoDynamicValues;
938 return m_opaque_sp->GetUseDynamic();
941 void SBValue::SetPreferDynamicValue(lldb::DynamicValueType use_dynamic) {
943 return m_opaque_sp->SetUseDynamic(use_dynamic);
946 bool SBValue::GetPreferSyntheticValue() {
949 return m_opaque_sp->GetUseSynthetic();
952 void SBValue::SetPreferSyntheticValue(bool use_synthetic) {
954 return m_opaque_sp->SetUseSynthetic(use_synthetic);
957 bool SBValue::IsDynamic() {
959 lldb::ValueObjectSP value_sp(GetSP(locker));
961 return value_sp->IsDynamic();
965 bool SBValue::IsSynthetic() {
967 lldb::ValueObjectSP value_sp(GetSP(locker));
969 return value_sp->IsSynthetic();
973 bool SBValue::IsSyntheticChildrenGenerated() {
975 lldb::ValueObjectSP value_sp(GetSP(locker));
977 return value_sp->IsSyntheticChildrenGenerated();
981 void SBValue::SetSyntheticChildrenGenerated(bool is) {
983 lldb::ValueObjectSP value_sp(GetSP(locker));
985 return value_sp->SetSyntheticChildrenGenerated(is);
988 lldb::SBValue SBValue::GetValueForExpressionPath(const char *expr_path) {
989 Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_API));
990 lldb::ValueObjectSP child_sp;
992 lldb::ValueObjectSP value_sp(GetSP(locker));
994 // using default values for all the fancy options, just do it if you can
995 child_sp = value_sp->GetValueForExpressionPath(expr_path);
999 sb_value.SetSP(child_sp, GetPreferDynamicValue(), GetPreferSyntheticValue());
1002 log->Printf("SBValue(%p)::GetValueForExpressionPath (expr_path=\"%s\") => "
1004 static_cast<void *>(value_sp.get()), expr_path,
1005 static_cast<void *>(value_sp.get()));
1010 int64_t SBValue::GetValueAsSigned(SBError &error, int64_t fail_value) {
1013 lldb::ValueObjectSP value_sp(GetSP(locker));
1015 bool success = true;
1016 uint64_t ret_val = fail_value;
1017 ret_val = value_sp->GetValueAsSigned(fail_value, &success);
1019 error.SetErrorString("could not resolve value");
1022 error.SetErrorStringWithFormat("could not get SBValue: %s",
1023 locker.GetError().AsCString());
1028 uint64_t SBValue::GetValueAsUnsigned(SBError &error, uint64_t fail_value) {
1031 lldb::ValueObjectSP value_sp(GetSP(locker));
1033 bool success = true;
1034 uint64_t ret_val = fail_value;
1035 ret_val = value_sp->GetValueAsUnsigned(fail_value, &success);
1037 error.SetErrorString("could not resolve value");
1040 error.SetErrorStringWithFormat("could not get SBValue: %s",
1041 locker.GetError().AsCString());
1046 int64_t SBValue::GetValueAsSigned(int64_t fail_value) {
1048 lldb::ValueObjectSP value_sp(GetSP(locker));
1050 return value_sp->GetValueAsSigned(fail_value);
1055 uint64_t SBValue::GetValueAsUnsigned(uint64_t fail_value) {
1057 lldb::ValueObjectSP value_sp(GetSP(locker));
1059 return value_sp->GetValueAsUnsigned(fail_value);
1064 bool SBValue::MightHaveChildren() {
1065 Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_API));
1066 bool has_children = false;
1068 lldb::ValueObjectSP value_sp(GetSP(locker));
1070 has_children = value_sp->MightHaveChildren();
1073 log->Printf("SBValue(%p)::MightHaveChildren() => %i",
1074 static_cast<void *>(value_sp.get()), has_children);
1075 return has_children;
1078 bool SBValue::IsRuntimeSupportValue() {
1079 Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_API));
1080 bool is_support = false;
1082 lldb::ValueObjectSP value_sp(GetSP(locker));
1084 is_support = value_sp->IsRuntimeSupportValue();
1087 log->Printf("SBValue(%p)::IsRuntimeSupportValue() => %i",
1088 static_cast<void *>(value_sp.get()), is_support);
1092 uint32_t SBValue::GetNumChildren() { return GetNumChildren(UINT32_MAX); }
1094 uint32_t SBValue::GetNumChildren(uint32_t max) {
1095 uint32_t num_children = 0;
1097 Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_API));
1099 lldb::ValueObjectSP value_sp(GetSP(locker));
1101 num_children = value_sp->GetNumChildren(max);
1104 log->Printf("SBValue(%p)::GetNumChildren (%u) => %u",
1105 static_cast<void *>(value_sp.get()), max, num_children);
1107 return num_children;
1110 SBValue SBValue::Dereference() {
1113 lldb::ValueObjectSP value_sp(GetSP(locker));
1116 sb_value = value_sp->Dereference(error);
1118 Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_API));
1120 log->Printf("SBValue(%p)::Dereference () => SBValue(%p)",
1121 static_cast<void *>(value_sp.get()),
1122 static_cast<void *>(value_sp.get()));
1127 // Deprecated - please use GetType().IsPointerType() instead.
1128 bool SBValue::TypeIsPointerType() { return GetType().IsPointerType(); }
1130 void *SBValue::GetOpaqueType() {
1132 lldb::ValueObjectSP value_sp(GetSP(locker));
1134 return value_sp->GetCompilerType().GetOpaqueQualType();
1138 lldb::SBTarget SBValue::GetTarget() {
1142 target_sp = m_opaque_sp->GetTargetSP();
1143 sb_target.SetSP(target_sp);
1145 Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_API));
1147 if (target_sp.get() == NULL)
1148 log->Printf("SBValue(%p)::GetTarget () => NULL",
1149 static_cast<void *>(m_opaque_sp.get()));
1151 log->Printf("SBValue(%p)::GetTarget () => %p",
1152 static_cast<void *>(m_opaque_sp.get()),
1153 static_cast<void *>(target_sp.get()));
1158 lldb::SBProcess SBValue::GetProcess() {
1159 SBProcess sb_process;
1160 ProcessSP process_sp;
1162 process_sp = m_opaque_sp->GetProcessSP();
1163 sb_process.SetSP(process_sp);
1165 Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_API));
1167 if (process_sp.get() == NULL)
1168 log->Printf("SBValue(%p)::GetProcess () => NULL",
1169 static_cast<void *>(m_opaque_sp.get()));
1171 log->Printf("SBValue(%p)::GetProcess () => %p",
1172 static_cast<void *>(m_opaque_sp.get()),
1173 static_cast<void *>(process_sp.get()));
1178 lldb::SBThread SBValue::GetThread() {
1182 thread_sp = m_opaque_sp->GetThreadSP();
1183 sb_thread.SetThread(thread_sp);
1185 Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_API));
1187 if (thread_sp.get() == NULL)
1188 log->Printf("SBValue(%p)::GetThread () => NULL",
1189 static_cast<void *>(m_opaque_sp.get()));
1191 log->Printf("SBValue(%p)::GetThread () => %p",
1192 static_cast<void *>(m_opaque_sp.get()),
1193 static_cast<void *>(thread_sp.get()));
1198 lldb::SBFrame SBValue::GetFrame() {
1200 StackFrameSP frame_sp;
1202 frame_sp = m_opaque_sp->GetFrameSP();
1203 sb_frame.SetFrameSP(frame_sp);
1205 Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_API));
1207 if (frame_sp.get() == NULL)
1208 log->Printf("SBValue(%p)::GetFrame () => NULL",
1209 static_cast<void *>(m_opaque_sp.get()));
1211 log->Printf("SBValue(%p)::GetFrame () => %p",
1212 static_cast<void *>(m_opaque_sp.get()),
1213 static_cast<void *>(frame_sp.get()));
1218 lldb::ValueObjectSP SBValue::GetSP(ValueLocker &locker) const {
1219 if (!m_opaque_sp || !m_opaque_sp->IsValid()) {
1220 locker.GetError().SetErrorString("No value");
1221 return ValueObjectSP();
1223 return locker.GetLockedSP(*m_opaque_sp.get());
1226 lldb::ValueObjectSP SBValue::GetSP() const {
1228 return GetSP(locker);
1231 void SBValue::SetSP(ValueImplSP impl_sp) { m_opaque_sp = impl_sp; }
1233 void SBValue::SetSP(const lldb::ValueObjectSP &sp) {
1235 lldb::TargetSP target_sp(sp->GetTargetSP());
1237 lldb::DynamicValueType use_dynamic = target_sp->GetPreferDynamicValue();
1238 bool use_synthetic =
1239 target_sp->TargetProperties::GetEnableSyntheticValue();
1240 m_opaque_sp = ValueImplSP(new ValueImpl(sp, use_dynamic, use_synthetic));
1242 m_opaque_sp = ValueImplSP(new ValueImpl(sp, eNoDynamicValues, true));
1244 m_opaque_sp = ValueImplSP(new ValueImpl(sp, eNoDynamicValues, false));
1247 void SBValue::SetSP(const lldb::ValueObjectSP &sp,
1248 lldb::DynamicValueType use_dynamic) {
1250 lldb::TargetSP target_sp(sp->GetTargetSP());
1252 bool use_synthetic =
1253 target_sp->TargetProperties::GetEnableSyntheticValue();
1254 SetSP(sp, use_dynamic, use_synthetic);
1256 SetSP(sp, use_dynamic, true);
1258 SetSP(sp, use_dynamic, false);
1261 void SBValue::SetSP(const lldb::ValueObjectSP &sp, bool use_synthetic) {
1263 lldb::TargetSP target_sp(sp->GetTargetSP());
1265 lldb::DynamicValueType use_dynamic = target_sp->GetPreferDynamicValue();
1266 SetSP(sp, use_dynamic, use_synthetic);
1268 SetSP(sp, eNoDynamicValues, use_synthetic);
1270 SetSP(sp, eNoDynamicValues, use_synthetic);
1273 void SBValue::SetSP(const lldb::ValueObjectSP &sp,
1274 lldb::DynamicValueType use_dynamic, bool use_synthetic) {
1275 m_opaque_sp = ValueImplSP(new ValueImpl(sp, use_dynamic, use_synthetic));
1278 void SBValue::SetSP(const lldb::ValueObjectSP &sp,
1279 lldb::DynamicValueType use_dynamic, bool use_synthetic,
1282 ValueImplSP(new ValueImpl(sp, use_dynamic, use_synthetic, name));
1285 bool SBValue::GetExpressionPath(SBStream &description) {
1287 lldb::ValueObjectSP value_sp(GetSP(locker));
1289 value_sp->GetExpressionPath(description.ref(), false);
1295 bool SBValue::GetExpressionPath(SBStream &description,
1296 bool qualify_cxx_base_classes) {
1298 lldb::ValueObjectSP value_sp(GetSP(locker));
1300 value_sp->GetExpressionPath(description.ref(), qualify_cxx_base_classes);
1306 bool SBValue::GetDescription(SBStream &description) {
1307 Stream &strm = description.ref();
1310 lldb::ValueObjectSP value_sp(GetSP(locker));
1312 value_sp->Dump(strm);
1314 strm.PutCString("No value");
1319 lldb::Format SBValue::GetFormat() {
1321 lldb::ValueObjectSP value_sp(GetSP(locker));
1323 return value_sp->GetFormat();
1324 return eFormatDefault;
1327 void SBValue::SetFormat(lldb::Format format) {
1329 lldb::ValueObjectSP value_sp(GetSP(locker));
1331 value_sp->SetFormat(format);
1334 lldb::SBValue SBValue::AddressOf() {
1337 lldb::ValueObjectSP value_sp(GetSP(locker));
1340 sb_value.SetSP(value_sp->AddressOf(error), GetPreferDynamicValue(),
1341 GetPreferSyntheticValue());
1343 Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_API));
1345 log->Printf("SBValue(%p)::AddressOf () => SBValue(%p)",
1346 static_cast<void *>(value_sp.get()),
1347 static_cast<void *>(value_sp.get()));
1352 lldb::addr_t SBValue::GetLoadAddress() {
1353 lldb::addr_t value = LLDB_INVALID_ADDRESS;
1355 lldb::ValueObjectSP value_sp(GetSP(locker));
1357 TargetSP target_sp(value_sp->GetTargetSP());
1359 const bool scalar_is_load_address = true;
1360 AddressType addr_type;
1361 value = value_sp->GetAddressOf(scalar_is_load_address, &addr_type);
1362 if (addr_type == eAddressTypeFile) {
1363 ModuleSP module_sp(value_sp->GetModule());
1365 value = LLDB_INVALID_ADDRESS;
1368 module_sp->ResolveFileAddress(value, addr);
1369 value = addr.GetLoadAddress(target_sp.get());
1371 } else if (addr_type == eAddressTypeHost ||
1372 addr_type == eAddressTypeInvalid)
1373 value = LLDB_INVALID_ADDRESS;
1376 Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_API));
1378 log->Printf("SBValue(%p)::GetLoadAddress () => (%" PRIu64 ")",
1379 static_cast<void *>(value_sp.get()), value);
1384 lldb::SBAddress SBValue::GetAddress() {
1387 lldb::ValueObjectSP value_sp(GetSP(locker));
1389 TargetSP target_sp(value_sp->GetTargetSP());
1391 lldb::addr_t value = LLDB_INVALID_ADDRESS;
1392 const bool scalar_is_load_address = true;
1393 AddressType addr_type;
1394 value = value_sp->GetAddressOf(scalar_is_load_address, &addr_type);
1395 if (addr_type == eAddressTypeFile) {
1396 ModuleSP module_sp(value_sp->GetModule());
1398 module_sp->ResolveFileAddress(value, addr);
1399 } else if (addr_type == eAddressTypeLoad) {
1400 // no need to check the return value on this.. if it can actually do the
1402 // addr will be in the form (section,offset), otherwise it will simply
1405 addr.SetLoadAddress(value, target_sp.get());
1409 Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_API));
1411 log->Printf("SBValue(%p)::GetAddress () => (%s,%" PRIu64 ")",
1412 static_cast<void *>(value_sp.get()),
1413 (addr.GetSection() ? addr.GetSection()->GetName().GetCString()
1416 return SBAddress(new Address(addr));
1419 lldb::SBData SBValue::GetPointeeData(uint32_t item_idx, uint32_t item_count) {
1420 Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_API));
1421 lldb::SBData sb_data;
1423 lldb::ValueObjectSP value_sp(GetSP(locker));
1425 TargetSP target_sp(value_sp->GetTargetSP());
1427 DataExtractorSP data_sp(new DataExtractor());
1428 value_sp->GetPointeeData(*data_sp, item_idx, item_count);
1429 if (data_sp->GetByteSize() > 0)
1434 log->Printf("SBValue(%p)::GetPointeeData (%d, %d) => SBData(%p)",
1435 static_cast<void *>(value_sp.get()), item_idx, item_count,
1436 static_cast<void *>(sb_data.get()));
1441 lldb::SBData SBValue::GetData() {
1442 Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_API));
1443 lldb::SBData sb_data;
1445 lldb::ValueObjectSP value_sp(GetSP(locker));
1447 DataExtractorSP data_sp(new DataExtractor());
1449 value_sp->GetData(*data_sp, error);
1450 if (error.Success())
1454 log->Printf("SBValue(%p)::GetData () => SBData(%p)",
1455 static_cast<void *>(value_sp.get()),
1456 static_cast<void *>(sb_data.get()));
1461 bool SBValue::SetData(lldb::SBData &data, SBError &error) {
1462 Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_API));
1464 lldb::ValueObjectSP value_sp(GetSP(locker));
1468 DataExtractor *data_extractor = data.get();
1470 if (!data_extractor) {
1472 log->Printf("SBValue(%p)::SetData() => error: no data to set",
1473 static_cast<void *>(value_sp.get()));
1475 error.SetErrorString("No data to set");
1480 value_sp->SetData(*data_extractor, set_error);
1482 if (!set_error.Success()) {
1483 error.SetErrorStringWithFormat("Couldn't set data: %s",
1484 set_error.AsCString());
1489 error.SetErrorStringWithFormat(
1490 "Couldn't set data: could not get SBValue: %s",
1491 locker.GetError().AsCString());
1496 log->Printf("SBValue(%p)::SetData (%p) => %s",
1497 static_cast<void *>(value_sp.get()),
1498 static_cast<void *>(data.get()), ret ? "true" : "false");
1502 lldb::SBDeclaration SBValue::GetDeclaration() {
1504 lldb::ValueObjectSP value_sp(GetSP(locker));
1505 SBDeclaration decl_sb;
1508 if (value_sp->GetDeclaration(decl))
1509 decl_sb.SetDeclaration(decl);
1514 lldb::SBWatchpoint SBValue::Watch(bool resolve_location, bool read, bool write,
1516 SBWatchpoint sb_watchpoint;
1518 // If the SBValue is not valid, there's no point in even trying to watch it.
1520 lldb::ValueObjectSP value_sp(GetSP(locker));
1521 TargetSP target_sp(GetTarget().GetSP());
1522 if (value_sp && target_sp) {
1523 // Read and Write cannot both be false.
1524 if (!read && !write)
1525 return sb_watchpoint;
1527 // If the value is not in scope, don't try and watch and invalid value
1529 return sb_watchpoint;
1531 addr_t addr = GetLoadAddress();
1532 if (addr == LLDB_INVALID_ADDRESS)
1533 return sb_watchpoint;
1534 size_t byte_size = GetByteSize();
1536 return sb_watchpoint;
1538 uint32_t watch_type = 0;
1540 watch_type |= LLDB_WATCH_TYPE_READ;
1542 watch_type |= LLDB_WATCH_TYPE_WRITE;
1545 CompilerType type(value_sp->GetCompilerType());
1546 WatchpointSP watchpoint_sp =
1547 target_sp->CreateWatchpoint(addr, byte_size, &type, watch_type, rc);
1550 if (watchpoint_sp) {
1551 sb_watchpoint.SetSP(watchpoint_sp);
1553 if (value_sp->GetDeclaration(decl)) {
1554 if (decl.GetFile()) {
1556 // True to show fullpath for declaration file.
1557 decl.DumpStopContext(&ss, true);
1558 watchpoint_sp->SetDeclInfo(ss.GetString());
1562 } else if (target_sp) {
1563 Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_API));
1565 log->Printf("SBValue(%p)::Watch() => error getting SBValue: %s",
1566 static_cast<void *>(value_sp.get()),
1567 locker.GetError().AsCString());
1569 error.SetErrorStringWithFormat("could not get SBValue: %s",
1570 locker.GetError().AsCString());
1572 Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_API));
1574 log->Printf("SBValue(%p)::Watch() => error getting SBValue: no target",
1575 static_cast<void *>(value_sp.get()));
1576 error.SetErrorString("could not set watchpoint, a target is required");
1579 return sb_watchpoint;
1582 // FIXME: Remove this method impl (as well as the decl in .h) once it is no
1584 // Backward compatibility fix in the interim.
1585 lldb::SBWatchpoint SBValue::Watch(bool resolve_location, bool read,
1588 return Watch(resolve_location, read, write, error);
1591 lldb::SBWatchpoint SBValue::WatchPointee(bool resolve_location, bool read,
1592 bool write, SBError &error) {
1593 SBWatchpoint sb_watchpoint;
1594 if (IsInScope() && GetType().IsPointerType())
1595 sb_watchpoint = Dereference().Watch(resolve_location, read, write, error);
1596 return sb_watchpoint;
1599 lldb::SBValue SBValue::Persist() {
1601 lldb::ValueObjectSP value_sp(GetSP(locker));
1602 SBValue persisted_sb;
1604 persisted_sb.SetSP(value_sp->Persist());
1606 return persisted_sb;