LLDB mainline
SBValue.cpp
Go to the documentation of this file.
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"
11
13#include "lldb/API/SBStream.h"
18
21#include "lldb/Core/Module.h"
22#include "lldb/Core/Section.h"
23#include "lldb/Core/Value.h"
26#include "lldb/Symbol/Block.h"
28#include "lldb/Symbol/Type.h"
32#include "lldb/Target/Process.h"
34#include "lldb/Target/Target.h"
35#include "lldb/Target/Thread.h"
37#include "lldb/Utility/Scalar.h"
38#include "lldb/Utility/Stream.h"
41
42#include "lldb/API/SBDebugger.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"
49
50#include <memory>
51
52using namespace lldb;
53using namespace lldb_private;
54
56
58 LLDB_INSTRUMENT_VA(this, value_sp);
59
60 SetSP(value_sp);
61}
62
64 LLDB_INSTRUMENT_VA(this, rhs);
65
66 SetSP(rhs.m_opaque_sp);
67}
68
70 LLDB_INSTRUMENT_VA(this, rhs);
71
72 if (this != &rhs) {
73 SetSP(rhs.m_opaque_sp);
74 }
75 return *this;
76}
77
78SBValue::~SBValue() = default;
79
82 return this->operator bool();
83}
84SBValue::operator bool() const {
86
87 // If this function ever changes to anything that does more than just check
88 // if the opaque shared pointer is non NULL, then we need to update all "if
89 // (m_opaque_sp)" code in this file.
90 return m_opaque_sp.get() != nullptr && m_opaque_sp->IsValid() &&
91 m_opaque_sp->GetRootSP().get() != nullptr;
92}
93
96
97 m_opaque_sp.reset();
98}
99
101 LLDB_INSTRUMENT_VA(this);
102
103 SBError sb_error;
104
105 ValueLocker locker;
106 lldb::ValueObjectSP value_sp(GetSP(locker));
107 if (value_sp)
108 sb_error.SetError(value_sp->GetError().Clone());
109 else
110 sb_error = Status::FromErrorStringWithFormat("error: %s",
111 locker.GetError().AsCString());
112
113 return sb_error;
114}
115
117 LLDB_INSTRUMENT_VA(this);
118
119 ValueLocker locker;
120 lldb::ValueObjectSP value_sp(GetSP(locker));
121 if (value_sp)
122 return value_sp->GetID();
123 return LLDB_INVALID_UID;
124}
125
126const char *SBValue::GetName() {
127 LLDB_INSTRUMENT_VA(this);
128
129 ValueLocker locker;
130 lldb::ValueObjectSP value_sp(GetSP(locker));
131 if (!value_sp)
132 return nullptr;
133
134 return value_sp->GetName().GetCString();
135}
136
137const char *SBValue::GetTypeName() {
138 LLDB_INSTRUMENT_VA(this);
139
140 ValueLocker locker;
141 lldb::ValueObjectSP value_sp(GetSP(locker));
142 if (!value_sp)
143 return nullptr;
144
145 return value_sp->GetQualifiedTypeName().GetCString();
146}
147
149 LLDB_INSTRUMENT_VA(this);
150
151 ValueLocker locker;
152 lldb::ValueObjectSP value_sp(GetSP(locker));
153 if (!value_sp)
154 return nullptr;
155
156 return value_sp->GetDisplayTypeName().GetCString();
157}
158
160 LLDB_INSTRUMENT_VA(this);
161
162 size_t result = 0;
163
164 ValueLocker locker;
165 lldb::ValueObjectSP value_sp(GetSP(locker));
166 if (value_sp) {
167 result = llvm::expectedToOptional(value_sp->GetByteSize()).value_or(0);
168 }
169
170 return result;
171}
172
174 LLDB_INSTRUMENT_VA(this);
175
176 bool result = false;
177
178 ValueLocker locker;
179 lldb::ValueObjectSP value_sp(GetSP(locker));
180 if (value_sp) {
181 result = value_sp->IsInScope();
182 }
183
184 return result;
185}
186
187const char *SBValue::GetValue() {
188 LLDB_INSTRUMENT_VA(this);
189
190 ValueLocker locker;
191 lldb::ValueObjectSP value_sp(GetSP(locker));
192 if (!value_sp)
193 return nullptr;
194 return ConstString(value_sp->GetValueAsCString()).GetCString();
195}
196
198 LLDB_INSTRUMENT_VA(this);
199
201 ValueLocker locker;
202 lldb::ValueObjectSP value_sp(GetSP(locker));
203 if (value_sp)
204 result = value_sp->GetValueType();
205
206 return result;
207}
208
210 LLDB_INSTRUMENT_VA(this);
211
212 ValueLocker locker;
213 lldb::ValueObjectSP value_sp(GetSP(locker));
214 if (!value_sp)
215 return nullptr;
216
217 llvm::Expected<std::string> str = value_sp->GetObjectDescription();
218 if (!str) {
219 llvm::consumeError(str.takeError());
220 return nullptr;
221 }
222 return ConstString(*str).AsCString();
223}
224
226 LLDB_INSTRUMENT_VA(this);
227
228 SBType sb_type;
229 ValueLocker locker;
230 lldb::ValueObjectSP value_sp(GetSP(locker));
231 TypeImplSP type_sp;
232 if (value_sp) {
233 type_sp = std::make_shared<TypeImpl>(value_sp->GetTypeImpl());
234 sb_type.SetSP(type_sp);
235 }
236
237 return sb_type;
238}
239
241 LLDB_INSTRUMENT_VA(this);
242
243 bool result = false;
244 ValueLocker locker;
245 lldb::ValueObjectSP value_sp(GetSP(locker));
246 if (value_sp) {
247 if (value_sp->UpdateValueIfNeeded(false))
248 result = value_sp->GetValueDidChange();
249 }
250
251 return result;
252}
253
254const char *SBValue::GetSummary() {
255 LLDB_INSTRUMENT_VA(this);
256
257 ValueLocker locker;
258 lldb::ValueObjectSP value_sp(GetSP(locker));
259 if (!value_sp)
260 return nullptr;
261
262 return ConstString(value_sp->GetSummaryAsCString()).GetCString();
263}
264
267 LLDB_INSTRUMENT_VA(this, stream, options);
268
269 ValueLocker locker;
270 lldb::ValueObjectSP value_sp(GetSP(locker));
271 if (value_sp) {
272 std::string buffer;
273 if (value_sp->GetSummaryAsCString(buffer, options.ref()) && !buffer.empty())
274 stream.Printf("%s", buffer.c_str());
275 }
276 return ConstString(stream.GetData()).GetCString();
277}
278
279const char *SBValue::GetLocation() {
280 LLDB_INSTRUMENT_VA(this);
281
282 ValueLocker locker;
283 lldb::ValueObjectSP value_sp(GetSP(locker));
284 if (!value_sp)
285 return nullptr;
286
287 return ConstString(value_sp->GetLocationAsCString()).GetCString();
288}
289
290// Deprecated - use the one that takes an lldb::SBError
291bool SBValue::SetValueFromCString(const char *value_str) {
292 LLDB_INSTRUMENT_VA(this, value_str);
293
294 lldb::SBError dummy;
295 return SetValueFromCString(value_str, dummy);
296}
297
298bool SBValue::SetValueFromCString(const char *value_str, lldb::SBError &error) {
299 LLDB_INSTRUMENT_VA(this, value_str, error);
300
301 bool success = false;
302 ValueLocker locker;
303 lldb::ValueObjectSP value_sp(GetSP(locker));
304 if (value_sp) {
305 success = value_sp->SetValueFromCString(value_str, error.ref());
306 } else
307 error = Status::FromErrorStringWithFormat("Could not get value: %s",
308 locker.GetError().AsCString());
309
310 return success;
311}
312
314 LLDB_INSTRUMENT_VA(this);
315
316 lldb::SBTypeFormat format;
317 ValueLocker locker;
318 lldb::ValueObjectSP value_sp(GetSP(locker));
319 if (value_sp) {
320 if (value_sp->UpdateValueIfNeeded(true)) {
321 lldb::TypeFormatImplSP format_sp = value_sp->GetValueFormat();
322 if (format_sp)
323 format.SetSP(format_sp);
324 }
325 }
326 return format;
327}
328
330 LLDB_INSTRUMENT_VA(this);
331
332 lldb::SBTypeSummary summary;
333 ValueLocker locker;
334 lldb::ValueObjectSP value_sp(GetSP(locker));
335 if (value_sp) {
336 if (value_sp->UpdateValueIfNeeded(true)) {
337 lldb::TypeSummaryImplSP summary_sp = value_sp->GetSummaryFormat();
338 if (summary_sp)
339 summary.SetSP(summary_sp);
340 }
341 }
342 return summary;
343}
344
346 LLDB_INSTRUMENT_VA(this);
347
348 lldb::SBTypeFilter filter;
349 ValueLocker locker;
350 lldb::ValueObjectSP value_sp(GetSP(locker));
351 if (value_sp) {
352 if (value_sp->UpdateValueIfNeeded(true)) {
353 lldb::SyntheticChildrenSP synthetic_sp = value_sp->GetSyntheticChildren();
354
355 if (synthetic_sp && !synthetic_sp->IsScripted()) {
356 TypeFilterImplSP filter_sp =
357 std::static_pointer_cast<TypeFilterImpl>(synthetic_sp);
358 filter.SetSP(filter_sp);
359 }
360 }
361 }
362 return filter;
363}
364
366 LLDB_INSTRUMENT_VA(this);
367
368 lldb::SBTypeSynthetic synthetic;
369 ValueLocker locker;
370 lldb::ValueObjectSP value_sp(GetSP(locker));
371 if (value_sp) {
372 if (value_sp->UpdateValueIfNeeded(true)) {
373 lldb::SyntheticChildrenSP children_sp = value_sp->GetSyntheticChildren();
374
375 if (children_sp && children_sp->IsScripted()) {
377 std::static_pointer_cast<ScriptedSyntheticChildren>(children_sp);
378 synthetic.SetSP(synth_sp);
379 }
380 }
381 }
382 return synthetic;
383}
384
385lldb::SBValue SBValue::CreateChildAtOffset(const char *name, uint32_t offset,
386 SBType type) {
387 LLDB_INSTRUMENT_VA(this, name, offset, type);
388
389 lldb::SBValue sb_value;
390 ValueLocker locker;
391 lldb::ValueObjectSP value_sp(GetSP(locker));
392 lldb::ValueObjectSP new_value_sp;
393 if (value_sp) {
394 TypeImplSP type_sp(type.GetSP());
395 if (type.IsValid()) {
396 sb_value.SetSP(value_sp->GetSyntheticChildAtOffset(
397 offset, type_sp->GetCompilerType(false), true),
399 }
400 }
401 return sb_value;
402}
403
405 LLDB_INSTRUMENT_VA(this, type);
406
407 lldb::SBValue sb_value;
408 ValueLocker locker;
409 lldb::ValueObjectSP value_sp(GetSP(locker));
410 TypeImplSP type_sp(type.GetSP());
411 if (value_sp && type_sp)
412 sb_value.SetSP(value_sp->Cast(type_sp->GetCompilerType(false)),
414 return sb_value;
415}
416
418 const char *expression) {
419 LLDB_INSTRUMENT_VA(this, name, expression);
420
421 SBExpressionOptions options;
422 options.ref().SetKeepInMemory(true);
423 return CreateValueFromExpression(name, expression, options);
424}
425
427 const char *expression,
428 SBExpressionOptions &options) {
429 LLDB_INSTRUMENT_VA(this, name, expression, options);
430
431 lldb::SBValue sb_value;
432 ValueLocker locker;
433 lldb::ValueObjectSP value_sp(GetSP(locker));
434 lldb::ValueObjectSP new_value_sp;
435 if (value_sp) {
436 ExecutionContext exe_ctx(value_sp->GetExecutionContextRef());
438 name, expression, exe_ctx, options.ref());
439 if (new_value_sp)
440 new_value_sp->SetName(ConstString(name));
441 }
442 sb_value.SetSP(new_value_sp);
443 return sb_value;
444}
445
447 lldb::addr_t address,
448 SBType sb_type) {
449 LLDB_INSTRUMENT_VA(this, name, address, sb_type);
450
451 lldb::SBValue sb_value;
452 ValueLocker locker;
453 lldb::ValueObjectSP value_sp(GetSP(locker));
454 lldb::ValueObjectSP new_value_sp;
455 lldb::TypeImplSP type_impl_sp(sb_type.GetSP());
456 if (value_sp && type_impl_sp) {
457 CompilerType ast_type(type_impl_sp->GetCompilerType(true));
458 ExecutionContext exe_ctx(value_sp->GetExecutionContextRef());
459 new_value_sp = ValueObject::CreateValueObjectFromAddress(name, address,
460 exe_ctx, ast_type);
461 }
462 sb_value.SetSP(new_value_sp);
463 return sb_value;
464}
465
467 SBType sb_type) {
468 LLDB_INSTRUMENT_VA(this, name, data, sb_type);
469
470 lldb::SBValue sb_value;
471 lldb::ValueObjectSP new_value_sp;
472 ValueLocker locker;
473 lldb::ValueObjectSP value_sp(GetSP(locker));
474 lldb::TypeImplSP type_impl_sp(sb_type.GetSP());
475 if (value_sp && type_impl_sp) {
476 ExecutionContext exe_ctx(value_sp->GetExecutionContextRef());
478 name, **data, exe_ctx, type_impl_sp->GetCompilerType(true));
479 new_value_sp->SetAddressTypeOfChildren(eAddressTypeLoad);
480 }
481 sb_value.SetSP(new_value_sp);
482 return sb_value;
483}
484
485lldb::SBValue SBValue::CreateBoolValue(const char *name, bool value) {
486 LLDB_INSTRUMENT_VA(this, name);
487
488 lldb::SBValue sb_value;
489 lldb::ValueObjectSP new_value_sp;
490 ValueLocker locker;
491 lldb::ValueObjectSP value_sp(GetSP(locker));
492 lldb::TargetSP target_sp = m_opaque_sp->GetTargetSP();
493 if (value_sp && target_sp) {
494 new_value_sp =
495 ValueObject::CreateValueObjectFromBool(target_sp, value, name);
496 }
497 sb_value.SetSP(new_value_sp);
498 return sb_value;
499}
500
502 LLDB_INSTRUMENT_VA(this, idx);
503
505 TargetSP target_sp;
506 if (m_opaque_sp)
507 target_sp = m_opaque_sp->GetTargetSP();
508
509 if (target_sp)
510 use_dynamic = target_sp->GetPreferDynamicValue();
511
512 return GetChildAtIndex(idx, use_dynamic, /*treat_as_array=*/false);
513}
514
516 lldb::DynamicValueType use_dynamic,
517 bool treat_as_array) {
518 LLDB_INSTRUMENT_VA(this, idx, use_dynamic, treat_as_array);
519 ValueLocker locker;
520 lldb::ValueObjectSP value_sp(GetSP(locker));
521
522 lldb::ValueObjectSP child_sp;
523 if (value_sp) {
524 const bool can_create = true;
525 if (treat_as_array &&
526 (value_sp->IsPointerType() || value_sp->IsArrayType()))
527 child_sp = value_sp->GetSyntheticArrayMember(idx, can_create);
528 else
529 child_sp = value_sp->GetChildAtIndex(idx);
530 }
531
532 SBValue sb_value;
533 sb_value.SetSP(child_sp, use_dynamic, GetPreferSyntheticValue());
534
535 return sb_value;
536}
537
538uint32_t SBValue::GetIndexOfChildWithName(const char *name) {
539 LLDB_INSTRUMENT_VA(this, name);
540
541 ValueLocker locker;
542 lldb::ValueObjectSP value_sp(GetSP(locker));
543 if (value_sp) {
544 if (auto idx_or_err = value_sp->GetIndexOfChildWithName(name))
545 return *idx_or_err;
546 else
547 llvm::consumeError(idx_or_err.takeError());
548 }
549 return UINT32_MAX;
550}
551
553 LLDB_INSTRUMENT_VA(this, name);
554
555 lldb::DynamicValueType use_dynamic_value = eNoDynamicValues;
556 TargetSP target_sp;
557 if (m_opaque_sp)
558 target_sp = m_opaque_sp->GetTargetSP();
559
560 if (target_sp)
561 use_dynamic_value = target_sp->GetPreferDynamicValue();
562 return GetChildMemberWithName(name, use_dynamic_value);
563}
564
567 lldb::DynamicValueType use_dynamic_value) {
568 LLDB_INSTRUMENT_VA(this, name, use_dynamic_value);
569
570 lldb::ValueObjectSP child_sp;
571
572 ValueLocker locker;
573 lldb::ValueObjectSP value_sp(GetSP(locker));
574 if (value_sp) {
575 child_sp = value_sp->GetChildMemberWithName(name);
576 }
577
578 SBValue sb_value;
579 sb_value.SetSP(child_sp, use_dynamic_value, GetPreferSyntheticValue());
580
581 return sb_value;
582}
583
585 LLDB_INSTRUMENT_VA(this, use_dynamic);
586
587 SBValue value_sb;
588 if (IsValid()) {
589 ValueImplSP proxy_sp(new ValueImpl(m_opaque_sp->GetRootSP(), use_dynamic,
590 m_opaque_sp->GetUseSynthetic()));
591 value_sb.SetSP(proxy_sp);
592 }
593 return value_sb;
594}
595
597 LLDB_INSTRUMENT_VA(this);
598
599 SBValue value_sb;
600 if (IsValid()) {
601 ValueImplSP proxy_sp(new ValueImpl(m_opaque_sp->GetRootSP(),
603 m_opaque_sp->GetUseSynthetic()));
604 value_sb.SetSP(proxy_sp);
605 }
606 return value_sb;
607}
608
610 LLDB_INSTRUMENT_VA(this);
611
612 SBValue value_sb;
613 if (IsValid()) {
614 ValueImplSP proxy_sp(new ValueImpl(m_opaque_sp->GetRootSP(),
615 m_opaque_sp->GetUseDynamic(), false));
616 value_sb.SetSP(proxy_sp);
617 }
618 return value_sb;
619}
620
622 LLDB_INSTRUMENT_VA(this);
623
624 SBValue value_sb;
625 if (IsValid()) {
626 ValueImplSP proxy_sp(new ValueImpl(m_opaque_sp->GetRootSP(),
627 m_opaque_sp->GetUseDynamic(), true));
628 value_sb.SetSP(proxy_sp);
629 if (!value_sb.IsSynthetic()) {
630 return {};
631 }
632 }
633 return value_sb;
634}
635
637 LLDB_INSTRUMENT_VA(this);
638
639 if (!IsValid())
640 return eNoDynamicValues;
641 return m_opaque_sp->GetUseDynamic();
642}
643
645 LLDB_INSTRUMENT_VA(this, use_dynamic);
646
647 if (IsValid())
648 return m_opaque_sp->SetUseDynamic(use_dynamic);
649}
650
652 LLDB_INSTRUMENT_VA(this);
653
654 if (!IsValid())
655 return false;
656 return m_opaque_sp->GetUseSynthetic();
657}
658
659void SBValue::SetPreferSyntheticValue(bool use_synthetic) {
660 LLDB_INSTRUMENT_VA(this, use_synthetic);
661
662 if (IsValid())
663 return m_opaque_sp->SetUseSynthetic(use_synthetic);
664}
665
667 LLDB_INSTRUMENT_VA(this);
668
669 ValueLocker locker;
670 lldb::ValueObjectSP value_sp(GetSP(locker));
671 if (value_sp)
672 return value_sp->IsDynamic();
673 return false;
674}
675
677 LLDB_INSTRUMENT_VA(this);
678
679 ValueLocker locker;
680 lldb::ValueObjectSP value_sp(GetSP(locker));
681 if (value_sp)
682 return value_sp->IsSynthetic();
683 return false;
684}
685
687 LLDB_INSTRUMENT_VA(this);
688
689 ValueLocker locker;
690 lldb::ValueObjectSP value_sp(GetSP(locker));
691 if (value_sp)
692 return value_sp->IsSyntheticChildrenGenerated();
693 return false;
694}
695
697 LLDB_INSTRUMENT_VA(this, is);
698
699 ValueLocker locker;
700 lldb::ValueObjectSP value_sp(GetSP(locker));
701 if (value_sp)
702 return value_sp->SetSyntheticChildrenGenerated(is);
703}
704
706 LLDB_INSTRUMENT_VA(this, expr_path);
707
708 lldb::ValueObjectSP child_sp;
709 ValueLocker locker;
710 lldb::ValueObjectSP value_sp(GetSP(locker));
711 if (value_sp) {
712 // using default values for all the fancy options, just do it if you can
713 child_sp = value_sp->GetValueForExpressionPath(expr_path);
714 }
715
716 SBValue sb_value;
717 sb_value.SetSP(child_sp, GetPreferDynamicValue(), GetPreferSyntheticValue());
718
719 return sb_value;
720}
721
722int64_t SBValue::GetValueAsSigned(SBError &error, int64_t fail_value) {
723 LLDB_INSTRUMENT_VA(this, error, fail_value);
724
725 error.Clear();
726 ValueLocker locker;
727 lldb::ValueObjectSP value_sp(GetSP(locker));
728 if (value_sp) {
729 bool success = true;
730 uint64_t ret_val = fail_value;
731 ret_val = value_sp->GetValueAsSigned(fail_value, &success);
732 if (!success)
733 error = Status::FromErrorString("could not resolve value");
734 return ret_val;
735 } else
736 error = Status::FromErrorStringWithFormat("could not get SBValue: %s",
737 locker.GetError().AsCString());
738
739 return fail_value;
740}
741
742uint64_t SBValue::GetValueAsUnsigned(SBError &error, uint64_t fail_value) {
743 LLDB_INSTRUMENT_VA(this, error, fail_value);
744
745 error.Clear();
746 ValueLocker locker;
747 lldb::ValueObjectSP value_sp(GetSP(locker));
748 if (value_sp) {
749 bool success = true;
750 uint64_t ret_val = fail_value;
751 ret_val = value_sp->GetValueAsUnsigned(fail_value, &success);
752 if (!success)
753 error = Status::FromErrorString("could not resolve value");
754 return ret_val;
755 } else
756 error = Status::FromErrorStringWithFormat("could not get SBValue: %s",
757 locker.GetError().AsCString());
758
759 return fail_value;
760}
761
762int64_t SBValue::GetValueAsSigned(int64_t fail_value) {
763 LLDB_INSTRUMENT_VA(this, fail_value);
764
765 ValueLocker locker;
766 lldb::ValueObjectSP value_sp(GetSP(locker));
767 if (value_sp) {
768 return value_sp->GetValueAsSigned(fail_value);
769 }
770 return fail_value;
771}
772
773uint64_t SBValue::GetValueAsUnsigned(uint64_t fail_value) {
774 LLDB_INSTRUMENT_VA(this, fail_value);
775
776 ValueLocker locker;
777 lldb::ValueObjectSP value_sp(GetSP(locker));
778 if (value_sp) {
779 return value_sp->GetValueAsUnsigned(fail_value);
780 }
781 return fail_value;
782}
783
785 addr_t fail_value = LLDB_INVALID_ADDRESS;
786 ValueLocker locker;
787 lldb::ValueObjectSP value_sp(GetSP(locker));
788 if (value_sp) {
789 bool success = true;
790 uint64_t ret_val = fail_value;
791 ret_val = value_sp->GetValueAsUnsigned(fail_value, &success);
792 if (!success)
793 return fail_value;
794 ProcessSP process_sp = m_opaque_sp->GetProcessSP();
795 if (!process_sp)
796 return ret_val;
797 return process_sp->FixDataAddress(ret_val);
798 }
799
800 return fail_value;
801}
802
804 LLDB_INSTRUMENT_VA(this);
805
806 bool has_children = false;
807 ValueLocker locker;
808 lldb::ValueObjectSP value_sp(GetSP(locker));
809 if (value_sp)
810 has_children = value_sp->MightHaveChildren();
811
812 return has_children;
813}
814
816 LLDB_INSTRUMENT_VA(this);
817
818 bool is_support = false;
819 ValueLocker locker;
820 lldb::ValueObjectSP value_sp(GetSP(locker));
821 if (value_sp)
822 is_support = value_sp->IsRuntimeSupportValue();
823
824 return is_support;
825}
826
828 LLDB_INSTRUMENT_VA(this);
829
831}
832
833uint32_t SBValue::GetNumChildren(uint32_t max) {
834 LLDB_INSTRUMENT_VA(this, max);
835
836 uint32_t num_children = 0;
837
838 ValueLocker locker;
839 lldb::ValueObjectSP value_sp(GetSP(locker));
840 if (value_sp)
841 num_children = value_sp->GetNumChildrenIgnoringErrors(max);
842
843 return num_children;
844}
845
847 LLDB_INSTRUMENT_VA(this);
848
849 SBValue sb_value;
850 ValueLocker locker;
851 lldb::ValueObjectSP value_sp(GetSP(locker));
852 if (value_sp) {
854 sb_value = value_sp->Dereference(error);
855 }
856
857 return sb_value;
858}
859
860// Deprecated - please use GetType().IsPointerType() instead.
861bool SBValue::TypeIsPointerType() {
862 LLDB_INSTRUMENT_VA(this);
863
864 return GetType().IsPointerType();
865}
866
868 LLDB_INSTRUMENT_VA(this);
869
870 ValueLocker locker;
871 lldb::ValueObjectSP value_sp(GetSP(locker));
872 if (value_sp)
873 return value_sp->GetCompilerType().GetOpaqueQualType();
874 return nullptr;
875}
876
878 LLDB_INSTRUMENT_VA(this);
879
880 SBTarget sb_target;
881 TargetSP target_sp;
882 if (m_opaque_sp) {
883 target_sp = m_opaque_sp->GetTargetSP();
884 sb_target.SetSP(target_sp);
885 }
886
887 return sb_target;
888}
889
891 LLDB_INSTRUMENT_VA(this);
892
893 SBProcess sb_process;
894 ProcessSP process_sp;
895 if (m_opaque_sp) {
896 process_sp = m_opaque_sp->GetProcessSP();
897 sb_process.SetSP(process_sp);
898 }
899
900 return sb_process;
901}
902
904 LLDB_INSTRUMENT_VA(this);
905
906 SBThread sb_thread;
907 ThreadSP thread_sp;
908 if (m_opaque_sp) {
909 thread_sp = m_opaque_sp->GetThreadSP();
910 sb_thread.SetThread(thread_sp);
911 }
912
913 return sb_thread;
914}
915
917 LLDB_INSTRUMENT_VA(this);
918
919 SBFrame sb_frame;
920 StackFrameSP frame_sp;
921 if (m_opaque_sp) {
922 frame_sp = m_opaque_sp->GetFrameSP();
923 sb_frame.SetFrameSP(frame_sp);
924 }
925
926 return sb_frame;
927}
928
930 // IsValid means that the SBValue has a value in it. But that's not the
931 // only time that ValueObjects are useful. We also want to return the value
932 // if there's an error state in it.
933 if (!m_opaque_sp || (!m_opaque_sp->IsValid()
934 && (m_opaque_sp->GetRootSP()
935 && !m_opaque_sp->GetRootSP()->GetError().Fail()))) {
936 locker.GetError() = Status::FromErrorString("No value");
937 return ValueObjectSP();
938 }
939 return locker.GetLockedSP(*m_opaque_sp.get());
940}
941
943 LLDB_INSTRUMENT_VA(this);
944
945 ValueLocker locker;
946 return GetSP(locker);
947}
948
949void SBValue::SetSP(ValueImplSP impl_sp) { m_opaque_sp = impl_sp; }
950
952 if (sp) {
953 lldb::TargetSP target_sp(sp->GetTargetSP());
954 if (target_sp) {
955 lldb::DynamicValueType use_dynamic = target_sp->GetPreferDynamicValue();
956 bool use_synthetic =
957 target_sp->TargetProperties::GetEnableSyntheticValue();
958 m_opaque_sp = std::make_shared<ValueImpl>(sp, use_dynamic, use_synthetic);
959 } else
960 m_opaque_sp = std::make_shared<ValueImpl>(sp, eNoDynamicValues, true);
961 } else
962 m_opaque_sp = std::make_shared<ValueImpl>(sp, eNoDynamicValues, false);
963}
964
966 lldb::DynamicValueType use_dynamic) {
967 if (sp) {
968 lldb::TargetSP target_sp(sp->GetTargetSP());
969 if (target_sp) {
970 bool use_synthetic =
971 target_sp->TargetProperties::GetEnableSyntheticValue();
972 SetSP(sp, use_dynamic, use_synthetic);
973 } else
974 SetSP(sp, use_dynamic, true);
975 } else
976 SetSP(sp, use_dynamic, false);
977}
978
979void SBValue::SetSP(const lldb::ValueObjectSP &sp, bool use_synthetic) {
980 if (sp) {
981 lldb::TargetSP target_sp(sp->GetTargetSP());
982 if (target_sp) {
983 lldb::DynamicValueType use_dynamic = target_sp->GetPreferDynamicValue();
984 SetSP(sp, use_dynamic, use_synthetic);
985 } else
986 SetSP(sp, eNoDynamicValues, use_synthetic);
987 } else
988 SetSP(sp, eNoDynamicValues, use_synthetic);
989}
990
992 lldb::DynamicValueType use_dynamic, bool use_synthetic) {
993 m_opaque_sp = std::make_shared<ValueImpl>(sp, use_dynamic, use_synthetic);
994}
995
997 lldb::DynamicValueType use_dynamic, bool use_synthetic,
998 const char *name) {
1000 std::make_shared<ValueImpl>(sp, use_dynamic, use_synthetic, name);
1001}
1002
1004 LLDB_INSTRUMENT_VA(this, description);
1005
1006 ValueLocker locker;
1007 lldb::ValueObjectSP value_sp(GetSP(locker));
1008 if (value_sp) {
1009 value_sp->GetExpressionPath(description.ref());
1010 return true;
1011 }
1012 return false;
1013}
1014
1016 bool qualify_cxx_base_classes) {
1017 LLDB_INSTRUMENT_VA(this, description, qualify_cxx_base_classes);
1018
1019 ValueLocker locker;
1020 lldb::ValueObjectSP value_sp(GetSP(locker));
1021 if (value_sp) {
1022 value_sp->GetExpressionPath(description.ref());
1023 return true;
1024 }
1025 return false;
1026}
1027
1029 LLDB_INSTRUMENT_VA(this, expr);
1030
1031 ValueLocker locker;
1032 lldb::ValueObjectSP value_sp(GetSP(locker));
1033 if (!value_sp)
1034 return SBValue();
1035
1036 lldb::TargetSP target_sp = value_sp->GetTargetSP();
1037 if (!target_sp)
1038 return SBValue();
1039
1041 options.SetFetchDynamicValue(target_sp->GetPreferDynamicValue());
1042 options.SetUnwindOnError(true);
1043 options.SetIgnoreBreakpoints(true);
1044
1045 return EvaluateExpression(expr, options, nullptr);
1046}
1047
1050 const SBExpressionOptions &options) const {
1051 LLDB_INSTRUMENT_VA(this, expr, options);
1052
1053 return EvaluateExpression(expr, options, nullptr);
1054}
1055
1057 const SBExpressionOptions &options,
1058 const char *name) const {
1059 LLDB_INSTRUMENT_VA(this, expr, options, name);
1060
1061 if (!expr || expr[0] == '\0') {
1062 return SBValue();
1063 }
1064
1065
1066 ValueLocker locker;
1067 lldb::ValueObjectSP value_sp(GetSP(locker));
1068 if (!value_sp) {
1069 return SBValue();
1070 }
1071
1072 lldb::TargetSP target_sp = value_sp->GetTargetSP();
1073 if (!target_sp) {
1074 return SBValue();
1075 }
1076
1077 std::lock_guard<std::recursive_mutex> guard(target_sp->GetAPIMutex());
1078 ExecutionContext exe_ctx(target_sp.get());
1079
1080 StackFrame *frame = exe_ctx.GetFramePtr();
1081 if (!frame) {
1082 return SBValue();
1083 }
1084
1085 ValueObjectSP res_val_sp;
1086 target_sp->EvaluateExpression(expr, frame, res_val_sp, options.ref(), nullptr,
1087 value_sp.get());
1088
1089 if (name)
1090 res_val_sp->SetName(ConstString(name));
1091
1092 SBValue result;
1093 result.SetSP(res_val_sp, options.GetFetchDynamicValue());
1094 return result;
1095}
1096
1098 LLDB_INSTRUMENT_VA(this, description);
1099
1100 return GetDescription(description, eDescriptionLevelFull);
1101}
1102
1105 lldb::DynamicValueType dyn, bool use_synthetic) {
1106 DumpValueObjectOptions options;
1107 switch (description_level) {
1109 return options;
1111 options.SetAllowOnelinerMode(true);
1112 options.SetHideRootName(true);
1113 options.SetHideRootType(true);
1114 break;
1116 options.SetShowTypes(true);
1117 options.SetShowLocation(true);
1118 break;
1119 default:
1120 break;
1121 }
1122 options.SetUseDynamicType(dyn);
1123 options.SetUseSyntheticValue(use_synthetic);
1124 return options;
1125}
1126
1128 lldb::DescriptionLevel description_level) {
1129 LLDB_INSTRUMENT_VA(this, description, description_level);
1130
1131 Stream &strm = description.ref();
1132
1133 ValueLocker locker;
1134 lldb::ValueObjectSP value_sp(GetSP(locker));
1135 if (value_sp) {
1136 const DumpValueObjectOptions options =
1137 GetDumpOptions(description_level, m_opaque_sp->GetUseDynamic(),
1138 m_opaque_sp->GetUseSynthetic());
1139 if (llvm::Error error = value_sp->Dump(strm, options)) {
1140 strm << "error: " << toString(std::move(error));
1141 return false;
1142 }
1143 } else {
1144 strm.PutCString("No value");
1145 }
1146
1147 return true;
1148}
1149
1151 LLDB_INSTRUMENT_VA(this);
1152
1153 ValueLocker locker;
1154 lldb::ValueObjectSP value_sp(GetSP(locker));
1155 if (value_sp)
1156 return value_sp->GetFormat();
1157 return eFormatDefault;
1158}
1159
1161 LLDB_INSTRUMENT_VA(this, format);
1162
1163 ValueLocker locker;
1164 lldb::ValueObjectSP value_sp(GetSP(locker));
1165 if (value_sp)
1166 value_sp->SetFormat(format);
1167}
1168
1170 LLDB_INSTRUMENT_VA(this);
1171
1172 SBValue sb_value;
1173 ValueLocker locker;
1174 lldb::ValueObjectSP value_sp(GetSP(locker));
1175 if (value_sp) {
1176 Status error;
1177 sb_value.SetSP(value_sp->AddressOf(error), GetPreferDynamicValue(),
1179 }
1180
1181 return sb_value;
1182}
1183
1185 LLDB_INSTRUMENT_VA(this);
1186
1188 ValueLocker locker;
1189 lldb::ValueObjectSP value_sp(GetSP(locker));
1190 if (value_sp)
1191 return value_sp->GetLoadAddress();
1192
1193 return value;
1194}
1195
1197 LLDB_INSTRUMENT_VA(this);
1198
1199 Address addr;
1200 ValueLocker locker;
1201 lldb::ValueObjectSP value_sp(GetSP(locker));
1202 if (value_sp) {
1203 TargetSP target_sp(value_sp->GetTargetSP());
1204 if (target_sp) {
1205 auto [value, addr_type] =
1206 value_sp->GetAddressOf(/*scalar_is_load_address=*/true);
1207 if (addr_type == eAddressTypeFile) {
1208 ModuleSP module_sp(value_sp->GetModule());
1209 if (module_sp)
1210 module_sp->ResolveFileAddress(value, addr);
1211 } else if (addr_type == eAddressTypeLoad) {
1212 // no need to check the return value on this.. if it can actually do
1213 // the resolve addr will be in the form (section,offset), otherwise it
1214 // will simply be returned as (NULL, value)
1215 addr.SetLoadAddress(value, target_sp.get());
1216 }
1217 }
1218 }
1219
1220 return SBAddress(addr);
1221}
1222
1223lldb::SBData SBValue::GetPointeeData(uint32_t item_idx, uint32_t item_count) {
1224 LLDB_INSTRUMENT_VA(this, item_idx, item_count);
1225
1226 lldb::SBData sb_data;
1227 ValueLocker locker;
1228 lldb::ValueObjectSP value_sp(GetSP(locker));
1229 if (value_sp) {
1230 TargetSP target_sp(value_sp->GetTargetSP());
1231 if (target_sp) {
1232 DataExtractorSP data_sp(new DataExtractor());
1233 value_sp->GetPointeeData(*data_sp, item_idx, item_count);
1234 if (data_sp->GetByteSize() > 0)
1235 *sb_data = data_sp;
1236 }
1237 }
1238
1239 return sb_data;
1240}
1241
1243 LLDB_INSTRUMENT_VA(this);
1244
1245 lldb::SBData sb_data;
1246 ValueLocker locker;
1247 lldb::ValueObjectSP value_sp(GetSP(locker));
1248 if (value_sp) {
1249 DataExtractorSP data_sp(new DataExtractor());
1250 Status error;
1251 value_sp->GetData(*data_sp, error);
1252 if (error.Success())
1253 *sb_data = data_sp;
1254 }
1255
1256 return sb_data;
1257}
1258
1260 LLDB_INSTRUMENT_VA(this, data, error);
1261
1262 ValueLocker locker;
1263 lldb::ValueObjectSP value_sp(GetSP(locker));
1264 bool ret = true;
1265
1266 if (value_sp) {
1267 DataExtractor *data_extractor = data.get();
1268
1269 if (!data_extractor) {
1270 error = Status::FromErrorString("No data to set");
1271 ret = false;
1272 } else {
1273 Status set_error;
1274
1275 value_sp->SetData(*data_extractor, set_error);
1276
1277 if (!set_error.Success()) {
1278 error = Status::FromErrorStringWithFormat("Couldn't set data: %s",
1279 set_error.AsCString());
1280 ret = false;
1281 }
1282 }
1283 } else {
1285 "Couldn't set data: could not get SBValue: %s",
1286 locker.GetError().AsCString());
1287 ret = false;
1288 }
1289
1290 return ret;
1291}
1292
1293lldb::SBValue SBValue::Clone(const char *new_name) {
1294 LLDB_INSTRUMENT_VA(this, new_name);
1295
1296 ValueLocker locker;
1297 lldb::ValueObjectSP value_sp(GetSP(locker));
1298
1299 if (value_sp)
1300 return lldb::SBValue(value_sp->Clone(ConstString(new_name)));
1301 else
1302 return lldb::SBValue();
1303}
1304
1306 LLDB_INSTRUMENT_VA(this);
1307
1308 ValueLocker locker;
1309 lldb::ValueObjectSP value_sp(GetSP(locker));
1310 SBDeclaration decl_sb;
1311 if (value_sp) {
1312 Declaration decl;
1313 if (value_sp->GetDeclaration(decl))
1314 decl_sb.SetDeclaration(decl);
1315 }
1316 return decl_sb;
1317}
1318
1319lldb::SBWatchpoint SBValue::Watch(bool resolve_location, bool read, bool write,
1320 SBError &error) {
1321 LLDB_INSTRUMENT_VA(this, resolve_location, read, write, error);
1322
1323 SBWatchpoint sb_watchpoint;
1324
1325 // If the SBValue is not valid, there's no point in even trying to watch it.
1326 ValueLocker locker;
1327 lldb::ValueObjectSP value_sp(GetSP(locker));
1328 TargetSP target_sp(GetTarget().GetSP());
1329 if (value_sp && target_sp) {
1330 // Read and Write cannot both be false.
1331 if (!read && !write)
1332 return sb_watchpoint;
1333
1334 // If the value is not in scope, don't try and watch and invalid value
1335 if (!IsInScope())
1336 return sb_watchpoint;
1337
1338 addr_t addr = GetLoadAddress();
1339 if (addr == LLDB_INVALID_ADDRESS)
1340 return sb_watchpoint;
1341 size_t byte_size = GetByteSize();
1342 if (byte_size == 0)
1343 return sb_watchpoint;
1344
1345 uint32_t watch_type = 0;
1346 if (read) {
1347 watch_type |= LLDB_WATCH_TYPE_READ;
1348 // read + write, the most likely intention
1349 // is to catch all writes to this, not just
1350 // value modifications.
1351 if (write)
1352 watch_type |= LLDB_WATCH_TYPE_WRITE;
1353 } else {
1354 if (write)
1355 watch_type |= LLDB_WATCH_TYPE_MODIFY;
1356 }
1357
1358 Status rc;
1359 CompilerType type(value_sp->GetCompilerType());
1360 WatchpointSP watchpoint_sp =
1361 target_sp->CreateWatchpoint(addr, byte_size, &type, watch_type, rc);
1362 error.SetError(std::move(rc));
1363
1364 if (watchpoint_sp) {
1365 sb_watchpoint.SetSP(watchpoint_sp);
1366 Declaration decl;
1367 if (value_sp->GetDeclaration(decl)) {
1368 if (decl.GetFile()) {
1369 StreamString ss;
1370 // True to show fullpath for declaration file.
1371 decl.DumpStopContext(&ss, true);
1372 watchpoint_sp->SetDeclInfo(std::string(ss.GetString()));
1373 }
1374 }
1375 }
1376 } else if (target_sp) {
1377 error = Status::FromErrorStringWithFormat("could not get SBValue: %s",
1378 locker.GetError().AsCString());
1379 } else {
1381 "could not set watchpoint, a target is required");
1382 }
1383
1384 return sb_watchpoint;
1385}
1386
1387// FIXME: Remove this method impl (as well as the decl in .h) once it is no
1388// longer needed.
1389// Backward compatibility fix in the interim.
1390lldb::SBWatchpoint SBValue::Watch(bool resolve_location, bool read,
1391 bool write) {
1392 LLDB_INSTRUMENT_VA(this, resolve_location, read, write);
1393
1394 SBError error;
1395 return Watch(resolve_location, read, write, error);
1396}
1397
1398lldb::SBWatchpoint SBValue::WatchPointee(bool resolve_location, bool read,
1399 bool write, SBError &error) {
1400 LLDB_INSTRUMENT_VA(this, resolve_location, read, write, error);
1401
1402 SBWatchpoint sb_watchpoint;
1403 if (IsInScope() && GetType().IsPointerType())
1404 sb_watchpoint = Dereference().Watch(resolve_location, read, write, error);
1405 return sb_watchpoint;
1406}
1407
1409 LLDB_INSTRUMENT_VA(this);
1410
1411 ValueLocker locker;
1412 lldb::ValueObjectSP value_sp(GetSP(locker));
1413 SBValue persisted_sb;
1414 if (value_sp) {
1415 persisted_sb.SetSP(value_sp->Persist());
1416 }
1417 return persisted_sb;
1418}
1419
1421 SBValue vtable_sb;
1422 ValueLocker locker;
1423 lldb::ValueObjectSP value_sp(GetSP(locker));
1424 if (!value_sp)
1425 return vtable_sb;
1426
1427 vtable_sb.SetSP(value_sp->GetVTable());
1428 return vtable_sb;
1429}
static llvm::raw_ostream & error(Stream &strm)
#define LLDB_INSTRUMENT_VA(...)
static DumpValueObjectOptions GetDumpOptions(lldb::DescriptionLevel description_level, lldb::DynamicValueType dyn, bool use_synthetic)
Definition SBValue.cpp:1104
lldb_private::DataExtractor * get() const
Definition SBData.cpp:49
void SetDeclaration(const lldb_private::Declaration &lldb_object_ref)
void SetError(uint32_t err, lldb::ErrorType type)
Definition SBError.cpp:124
void SetFetchDynamicValue(lldb::DynamicValueType dynamic=lldb::eDynamicCanRunTarget)
lldb_private::EvaluateExpressionOptions & ref() const
void SetIgnoreBreakpoints(bool ignore=true)
void SetUnwindOnError(bool unwind=true)
lldb::DynamicValueType GetFetchDynamicValue() const
void SetFrameSP(const lldb::StackFrameSP &lldb_object_sp)
Definition SBFrame.cpp:90
void SetSP(const lldb::ProcessSP &process_sp)
lldb_private::Stream & ref()
Definition SBStream.cpp:178
const char * GetData()
Definition SBStream.cpp:44
void SetSP(const lldb::TargetSP &target_sp)
Definition SBTarget.cpp:591
void SetThread(const lldb::ThreadSP &lldb_object_sp)
Definition SBThread.cpp:315
void SetSP(const lldb::TypeFilterImplSP &typefilter_impl_sp)
void SetSP(const lldb::TypeFormatImplSP &typeformat_impl_sp)
lldb_private::TypeSummaryOptions & ref()
void SetSP(const lldb::TypeSummaryImplSP &typefilter_impl_sp)
void SetSP(const lldb::ScriptedSyntheticChildrenSP &typefilter_impl_sp)
lldb::TypeImplSP GetSP()
Definition SBType.cpp:82
bool IsPointerType()
Definition SBType.cpp:148
void SetSP(const lldb::TypeImplSP &type_impl_sp)
Definition SBType.cpp:84
bool IsValid() const
Definition SBType.cpp:113
lldb::addr_t GetValueAsAddress()
Definition SBValue.cpp:784
bool IsInScope()
Definition SBValue.cpp:173
bool SetData(lldb::SBData &data, lldb::SBError &error)
Definition SBValue.cpp:1259
bool GetDescription(lldb::SBStream &description)
Definition SBValue.cpp:1097
bool GetValueDidChange()
Definition SBValue.cpp:240
lldb::SBValue EvaluateExpression(const char *expr) const
Definition SBValue.cpp:1028
lldb::SBValue GetChildAtIndex(uint32_t idx)
Definition SBValue.cpp:501
lldb::SBTypeFilter GetTypeFilter()
Definition SBValue.cpp:345
lldb::SBAddress GetAddress()
Definition SBValue.cpp:1196
lldb::SBData GetPointeeData(uint32_t item_idx=0, uint32_t item_count=1)
Get an SBData wrapping what this SBValue points to.
Definition SBValue.cpp:1223
const char * GetTypeName()
Definition SBValue.cpp:137
bool GetExpressionPath(lldb::SBStream &description)
Definition SBValue.cpp:1003
SBError GetError()
Definition SBValue.cpp:100
lldb::SBValue CreateValueFromData(const char *name, lldb::SBData data, lldb::SBType type)
Definition SBValue.cpp:466
lldb::SBValue Persist()
Definition SBValue.cpp:1408
void SetSP(const lldb::ValueObjectSP &sp)
Definition SBValue.cpp:951
lldb::SBValue CreateValueFromAddress(const char *name, lldb::addr_t address, lldb::SBType type)
Definition SBValue.cpp:446
const char * GetDisplayTypeName()
Definition SBValue.cpp:148
lldb::SBValue CreateValueFromExpression(const char *name, const char *expression)
Definition SBValue.cpp:417
lldb::SBData GetData()
Get an SBData wrapping the contents of this SBValue.
Definition SBValue.cpp:1242
lldb::SBValue Clone(const char *new_name)
Creates a copy of the SBValue with a new name and setting the current SBValue as its parent.
Definition SBValue.cpp:1293
void SetSyntheticChildrenGenerated(bool)
Definition SBValue.cpp:696
void Clear()
Definition SBValue.cpp:94
lldb::SBProcess GetProcess()
Definition SBValue.cpp:890
const char * GetLocation()
Definition SBValue.cpp:279
lldb::SBValue CreateBoolValue(const char *name, bool value)
Definition SBValue.cpp:485
bool IsSynthetic()
Definition SBValue.cpp:676
friend class SBTarget
Definition SBValue.h:445
size_t GetByteSize()
Definition SBValue.cpp:159
lldb::SBValue & operator=(const lldb::SBValue &rhs)
Definition SBValue.cpp:69
int64_t GetValueAsSigned(lldb::SBError &error, int64_t fail_value=0)
Definition SBValue.cpp:722
lldb::SBWatchpoint WatchPointee(bool resolve_location, bool read, bool write, SBError &error)
Watch this value that this value points to in memory.
Definition SBValue.cpp:1398
lldb::SBWatchpoint Watch(bool resolve_location, bool read, bool write, SBError &error)
Watch this value if it resides in memory.
Definition SBValue.cpp:1319
lldb::SBTypeFormat GetTypeFormat()
Definition SBValue.cpp:313
lldb::user_id_t GetID()
Definition SBValue.cpp:116
lldb::SBFrame GetFrame()
Definition SBValue.cpp:916
const char * GetValue()
Definition SBValue.cpp:187
bool MightHaveChildren()
Find out if a SBValue might have children.
Definition SBValue.cpp:803
lldb::SBTypeSummary GetTypeSummary()
Definition SBValue.cpp:329
lldb::SBValue GetDynamicValue(lldb::DynamicValueType use_dynamic)
Definition SBValue.cpp:584
bool IsDynamic()
Definition SBValue.cpp:666
bool IsSyntheticChildrenGenerated()
Definition SBValue.cpp:686
const char * GetName()
Definition SBValue.cpp:126
lldb::SBValue GetSyntheticValue()
Definition SBValue.cpp:621
lldb::SBValue CreateChildAtOffset(const char *name, uint32_t offset, lldb::SBType type)
Definition SBValue.cpp:385
lldb::SBValue Dereference()
Definition SBValue.cpp:846
lldb::SBValue GetStaticValue()
Definition SBValue.cpp:596
lldb::SBValue Cast(lldb::SBType type)
Definition SBValue.cpp:404
friend class SBThread
Definition SBValue.h:446
lldb::SBValue GetNonSyntheticValue()
Definition SBValue.cpp:609
bool GetPreferSyntheticValue()
Definition SBValue.cpp:651
uint32_t GetIndexOfChildWithName(const char *name)
Definition SBValue.cpp:538
lldb::SBValue GetVTable()
If this value represents a C++ class that has a vtable, return an value that represents the virtual f...
Definition SBValue.cpp:1420
const char * GetObjectDescription()
Definition SBValue.cpp:209
const char * GetSummary()
Definition SBValue.cpp:254
lldb::ValueObjectSP GetSP() const
Same as the protected version of GetSP that takes a locker, except that we make the locker locally in...
Definition SBValue.cpp:942
lldb::SBTypeSynthetic GetTypeSynthetic()
Definition SBValue.cpp:365
void SetFormat(lldb::Format format)
Definition SBValue.cpp:1160
lldb::SBValue AddressOf()
Definition SBValue.cpp:1169
friend class SBFrame
Definition SBValue.h:443
bool SetValueFromCString(const char *value_str, lldb::SBError &error)
Definition SBValue.cpp:291
lldb::DynamicValueType GetPreferDynamicValue()
Definition SBValue.cpp:636
std::shared_ptr< lldb_private::ValueImpl > ValueImplSP
Definition SBValue.h:512
lldb::SBThread GetThread()
Definition SBValue.cpp:903
ValueImplSP m_opaque_sp
Definition SBValue.h:513
lldb::SBValue GetChildMemberWithName(const char *name)
Definition SBValue.cpp:552
lldb::SBTarget GetTarget()
Definition SBValue.cpp:877
uint64_t GetValueAsUnsigned(lldb::SBError &error, uint64_t fail_value=0)
Definition SBValue.cpp:742
uint32_t GetNumChildren()
Return the number of children of this variable.
Definition SBValue.cpp:827
void SetPreferDynamicValue(lldb::DynamicValueType use_dynamic)
Definition SBValue.cpp:644
ValueType GetValueType()
Definition SBValue.cpp:197
void * GetOpaqueType()
Definition SBValue.cpp:867
friend class SBType
Definition SBValue.h:447
bool IsValid()
Definition SBValue.cpp:80
lldb::SBValue GetValueForExpressionPath(const char *expr_path)
Definition SBValue.cpp:705
lldb::addr_t GetLoadAddress()
Definition SBValue.cpp:1184
lldb::SBType GetType()
Definition SBValue.cpp:225
void SetPreferSyntheticValue(bool use_synthetic)
Definition SBValue.cpp:659
lldb::SBDeclaration GetDeclaration()
Definition SBValue.cpp:1305
lldb::Format GetFormat()
Definition SBValue.cpp:1150
bool IsRuntimeSupportValue()
Definition SBValue.cpp:815
void SetSP(const lldb::WatchpointSP &sp)
A section + offset based address class.
Definition Address.h:62
bool SetLoadAddress(lldb::addr_t load_addr, Target *target, bool allow_section_end=false)
Set the address to represent load_addr.
Definition Address.cpp:1035
Generic representation of a type in a programming language.
A uniqued constant string class.
Definition ConstString.h:40
const char * AsCString(const char *value_if_empty=nullptr) const
Get the string value as a C string.
const char * GetCString() const
Get the string value as a C string.
An data extractor class.
A class that describes the declaration location of a lldb object.
Definition Declaration.h:24
bool DumpStopContext(Stream *s, bool show_fullpaths) const
FileSpec & GetFile()
Get accessor for file specification.
DumpValueObjectOptions & SetShowTypes(bool show=false)
DumpValueObjectOptions & SetHideRootType(bool hide_root_type=false)
DumpValueObjectOptions & SetUseSyntheticValue(bool use_synthetic=true)
DumpValueObjectOptions & SetHideRootName(bool hide_root_name)
DumpValueObjectOptions & SetUseDynamicType(lldb::DynamicValueType dyn=lldb::eNoDynamicValues)
DumpValueObjectOptions & SetAllowOnelinerMode(bool oneliner=false)
DumpValueObjectOptions & SetShowLocation(bool show=false)
void SetKeepInMemory(bool keep=true)
Definition Target.h:382
"lldb/Target/ExecutionContext.h" A class that contains an execution context.
StackFrame * GetFramePtr() const
Returns a pointer to the frame object.
This base class provides an interface to stack frames.
Definition StackFrame.h:44
An error handling class.
Definition Status.h:118
static Status FromErrorStringWithFormat(const char *format,...) __attribute__((format(printf
Definition Status.cpp:106
static Status FromErrorString(const char *str)
Definition Status.h:141
const char * AsCString(const char *default_error_str="unknown error") const
Get the error string associated with the current error.
Definition Status.cpp:195
bool Success() const
Test for success condition.
Definition Status.cpp:304
llvm::StringRef GetString() const
A stream class that can stream formatted output to a file.
Definition Stream.h:28
size_t PutCString(llvm::StringRef cstr)
Output a C string to the stream.
Definition Stream.cpp:65
lldb::ValueObjectSP GetLockedSP(ValueImpl &in_value)
static lldb::ValueObjectSP CreateValueObjectFromBool(lldb::TargetSP target, bool value, llvm::StringRef name)
Create a value object containing the given boolean value.
static lldb::ValueObjectSP CreateValueObjectFromExpression(llvm::StringRef name, llvm::StringRef expression, const ExecutionContext &exe_ctx)
static lldb::ValueObjectSP CreateValueObjectFromAddress(llvm::StringRef name, uint64_t address, const ExecutionContext &exe_ctx, CompilerType type, bool do_deref=true)
Given an address either create a value object containing the value at that address,...
static lldb::ValueObjectSP CreateValueObjectFromData(llvm::StringRef name, const DataExtractor &data, const ExecutionContext &exe_ctx, CompilerType type)
#define LLDB_WATCH_TYPE_WRITE
#define LLDB_INVALID_UID
#define LLDB_WATCH_TYPE_MODIFY
#define LLDB_WATCH_TYPE_READ
#define LLDB_INVALID_ADDRESS
#define UINT32_MAX
A class that represents a running process on the host machine.
@ eAddressTypeFile
Address is an address as found in an object or symbol file.
@ eAddressTypeLoad
Address is an address as in the current target inferior process.
const char * toString(AppleArm64ExceptionClass EC)
std::shared_ptr< lldb_private::StackFrame > StackFrameSP
std::shared_ptr< lldb_private::TypeSummaryImpl > TypeSummaryImplSP
DescriptionLevel
Description levels for "void GetDescription(Stream *, DescriptionLevel)" calls.
@ eDescriptionLevelBrief
@ eDescriptionLevelInitial
@ eDescriptionLevelFull
@ eDescriptionLevelVerbose
std::shared_ptr< lldb_private::Thread > ThreadSP
std::shared_ptr< lldb_private::TypeFormatImpl > TypeFormatImplSP
std::shared_ptr< lldb_private::ValueObject > ValueObjectSP
Format
Display format definitions.
std::shared_ptr< lldb_private::Process > ProcessSP
std::shared_ptr< lldb_private::Watchpoint > WatchpointSP
class LLDB_API SBAddress
Definition SBDefines.h:45
std::shared_ptr< lldb_private::SyntheticChildren > SyntheticChildrenSP
uint64_t user_id_t
Definition lldb-types.h:82
std::shared_ptr< lldb_private::ScriptedSyntheticChildren > ScriptedSyntheticChildrenSP
std::shared_ptr< lldb_private::TypeFilterImpl > TypeFilterImplSP
uint64_t addr_t
Definition lldb-types.h:80
std::shared_ptr< lldb_private::TypeImpl > TypeImplSP
std::shared_ptr< lldb_private::Target > TargetSP
class LLDB_API SBValue
Definition SBDefines.h:135
std::shared_ptr< lldb_private::DataExtractor > DataExtractorSP
std::shared_ptr< lldb_private::Module > ModuleSP