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