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 ValueLocker locker;
490 lldb::ValueObjectSP value_sp(GetSP(locker));
491
492 auto get_new_value = [&]() -> lldb::ValueObjectSP {
493 if (!value_sp)
494 return {};
495
496 lldb::TargetSP target_sp = value_sp->GetTargetSP();
497 if (!target_sp)
498 return {};
499
501 ExecutionContext exe_ctx(value_sp->GetExecutionContextRef());
502 if (StackFrame *frame = exe_ctx.GetFramePtr())
503 language = frame->GuessLanguage().AsLanguageType();
504 auto type_system_or_err =
505 target_sp->GetScratchTypeSystemForLanguage(language);
506 if (!type_system_or_err) {
507 LLDB_LOG_ERROR(GetLog(LLDBLog::Types), type_system_or_err.takeError(),
508 "cannot get a type system: {0}");
509 return {};
510 }
511 return ValueObject::CreateValueObjectFromBool(exe_ctx, *type_system_or_err,
512 value, name);
513 };
514 sb_value.SetSP(get_new_value());
515 return sb_value;
516}
517
519 LLDB_INSTRUMENT_VA(this, idx);
520
522 TargetSP target_sp;
523 if (m_opaque_sp)
524 target_sp = m_opaque_sp->GetTargetSP();
525
526 if (target_sp)
527 use_dynamic = target_sp->GetPreferDynamicValue();
528
529 return GetChildAtIndex(idx, use_dynamic, /*treat_as_array=*/false);
530}
531
533 lldb::DynamicValueType use_dynamic,
534 bool treat_as_array) {
535 LLDB_INSTRUMENT_VA(this, idx, use_dynamic, treat_as_array);
536 ValueLocker locker;
537 lldb::ValueObjectSP value_sp(GetSP(locker));
538
539 lldb::ValueObjectSP child_sp;
540 if (value_sp) {
541 const bool can_create = true;
542 if (treat_as_array &&
543 (value_sp->IsPointerType() || value_sp->IsArrayType()))
544 child_sp = value_sp->GetSyntheticArrayMember(idx, can_create);
545 else
546 child_sp = value_sp->GetChildAtIndex(idx);
547 }
548
549 SBValue sb_value;
550 sb_value.SetSP(child_sp, use_dynamic, GetPreferSyntheticValue());
551
552 return sb_value;
553}
554
555uint32_t SBValue::GetIndexOfChildWithName(const char *name) {
556 LLDB_INSTRUMENT_VA(this, name);
557
558 ValueLocker locker;
559 lldb::ValueObjectSP value_sp(GetSP(locker));
560 if (value_sp) {
561 if (auto idx_or_err = value_sp->GetIndexOfChildWithName(name))
562 return *idx_or_err;
563 else
564 llvm::consumeError(idx_or_err.takeError());
565 }
566 return UINT32_MAX;
567}
568
570 LLDB_INSTRUMENT_VA(this, name);
571
572 lldb::DynamicValueType use_dynamic_value = eNoDynamicValues;
573 TargetSP target_sp;
574 if (m_opaque_sp)
575 target_sp = m_opaque_sp->GetTargetSP();
576
577 if (target_sp)
578 use_dynamic_value = target_sp->GetPreferDynamicValue();
579 return GetChildMemberWithName(name, use_dynamic_value);
580}
581
584 lldb::DynamicValueType use_dynamic_value) {
585 LLDB_INSTRUMENT_VA(this, name, use_dynamic_value);
586
587 lldb::ValueObjectSP child_sp;
588
589 ValueLocker locker;
590 lldb::ValueObjectSP value_sp(GetSP(locker));
591 if (value_sp) {
592 child_sp = value_sp->GetChildMemberWithName(name);
593 }
594
595 SBValue sb_value;
596 sb_value.SetSP(child_sp, use_dynamic_value, GetPreferSyntheticValue());
597
598 return sb_value;
599}
600
602 LLDB_INSTRUMENT_VA(this, use_dynamic);
603
604 SBValue value_sb;
605 if (IsValid()) {
606 ValueImplSP proxy_sp(new ValueImpl(m_opaque_sp->GetRootSP(), use_dynamic,
607 m_opaque_sp->GetUseSynthetic()));
608 value_sb.SetSP(proxy_sp);
609 }
610 return value_sb;
611}
612
614 LLDB_INSTRUMENT_VA(this);
615
616 SBValue value_sb;
617 if (IsValid()) {
618 ValueImplSP proxy_sp(new ValueImpl(m_opaque_sp->GetRootSP(),
620 m_opaque_sp->GetUseSynthetic()));
621 value_sb.SetSP(proxy_sp);
622 }
623 return value_sb;
624}
625
627 LLDB_INSTRUMENT_VA(this);
628
629 SBValue value_sb;
630 if (IsValid()) {
631 ValueImplSP proxy_sp(new ValueImpl(m_opaque_sp->GetRootSP(),
632 m_opaque_sp->GetUseDynamic(), false));
633 value_sb.SetSP(proxy_sp);
634 }
635 return value_sb;
636}
637
639 LLDB_INSTRUMENT_VA(this);
640
641 SBValue value_sb;
642 if (IsValid()) {
643 ValueImplSP proxy_sp(new ValueImpl(m_opaque_sp->GetRootSP(),
644 m_opaque_sp->GetUseDynamic(), true));
645 value_sb.SetSP(proxy_sp);
646 if (!value_sb.IsSynthetic()) {
647 return {};
648 }
649 }
650 return value_sb;
651}
652
654 LLDB_INSTRUMENT_VA(this);
655
656 if (!IsValid())
657 return eNoDynamicValues;
658 return m_opaque_sp->GetUseDynamic();
659}
660
662 LLDB_INSTRUMENT_VA(this, use_dynamic);
663
664 if (IsValid())
665 return m_opaque_sp->SetUseDynamic(use_dynamic);
666}
667
669 LLDB_INSTRUMENT_VA(this);
670
671 if (!IsValid())
672 return false;
673 return m_opaque_sp->GetUseSynthetic();
674}
675
676void SBValue::SetPreferSyntheticValue(bool use_synthetic) {
677 LLDB_INSTRUMENT_VA(this, use_synthetic);
678
679 if (IsValid())
680 return m_opaque_sp->SetUseSynthetic(use_synthetic);
681}
682
684 LLDB_INSTRUMENT_VA(this);
685
686 ValueLocker locker;
687 lldb::ValueObjectSP value_sp(GetSP(locker));
688 if (value_sp)
689 return value_sp->IsDynamic();
690 return false;
691}
692
694 LLDB_INSTRUMENT_VA(this);
695
696 ValueLocker locker;
697 lldb::ValueObjectSP value_sp(GetSP(locker));
698 if (value_sp)
699 return value_sp->IsSynthetic();
700 return false;
701}
702
704 LLDB_INSTRUMENT_VA(this);
705
706 ValueLocker locker;
707 lldb::ValueObjectSP value_sp(GetSP(locker));
708 if (value_sp)
709 return value_sp->IsSyntheticChildrenGenerated();
710 return false;
711}
712
714 LLDB_INSTRUMENT_VA(this, is);
715
716 ValueLocker locker;
717 lldb::ValueObjectSP value_sp(GetSP(locker));
718 if (value_sp)
719 return value_sp->SetSyntheticChildrenGenerated(is);
720}
721
723 LLDB_INSTRUMENT_VA(this, expr_path);
724
725 lldb::ValueObjectSP child_sp;
726 ValueLocker locker;
727 lldb::ValueObjectSP value_sp(GetSP(locker));
728 if (value_sp) {
729 // using default values for all the fancy options, just do it if you can
730 child_sp = value_sp->GetValueForExpressionPath(expr_path);
731 }
732
733 SBValue sb_value;
734 sb_value.SetSP(child_sp, GetPreferDynamicValue(), GetPreferSyntheticValue());
735
736 return sb_value;
737}
738
739int64_t SBValue::GetValueAsSigned(SBError &error, int64_t fail_value) {
740 LLDB_INSTRUMENT_VA(this, error, fail_value);
741
742 error.Clear();
743 ValueLocker locker;
744 lldb::ValueObjectSP value_sp(GetSP(locker));
745 if (value_sp) {
746 bool success = true;
747 uint64_t ret_val = fail_value;
748 ret_val = value_sp->GetValueAsSigned(fail_value, &success);
749 if (!success)
750 error = Status::FromErrorString("could not resolve value");
751 return ret_val;
752 } else
753 error = Status::FromErrorStringWithFormat("could not get SBValue: %s",
754 locker.GetError().AsCString());
755
756 return fail_value;
757}
758
759uint64_t SBValue::GetValueAsUnsigned(SBError &error, uint64_t fail_value) {
760 LLDB_INSTRUMENT_VA(this, error, fail_value);
761
762 error.Clear();
763 ValueLocker locker;
764 lldb::ValueObjectSP value_sp(GetSP(locker));
765 if (value_sp) {
766 bool success = true;
767 uint64_t ret_val = fail_value;
768 ret_val = value_sp->GetValueAsUnsigned(fail_value, &success);
769 if (!success)
770 error = Status::FromErrorString("could not resolve value");
771 return ret_val;
772 } else
773 error = Status::FromErrorStringWithFormat("could not get SBValue: %s",
774 locker.GetError().AsCString());
775
776 return fail_value;
777}
778
779int64_t SBValue::GetValueAsSigned(int64_t fail_value) {
780 LLDB_INSTRUMENT_VA(this, fail_value);
781
782 ValueLocker locker;
783 lldb::ValueObjectSP value_sp(GetSP(locker));
784 if (value_sp) {
785 return value_sp->GetValueAsSigned(fail_value);
786 }
787 return fail_value;
788}
789
790uint64_t SBValue::GetValueAsUnsigned(uint64_t fail_value) {
791 LLDB_INSTRUMENT_VA(this, fail_value);
792
793 ValueLocker locker;
794 lldb::ValueObjectSP value_sp(GetSP(locker));
795 if (value_sp) {
796 return value_sp->GetValueAsUnsigned(fail_value);
797 }
798 return fail_value;
799}
800
802 addr_t fail_value = LLDB_INVALID_ADDRESS;
803 ValueLocker locker;
804 lldb::ValueObjectSP value_sp(GetSP(locker));
805 if (value_sp) {
806 bool success = true;
807 uint64_t ret_val = fail_value;
808 ret_val = value_sp->GetValueAsUnsigned(fail_value, &success);
809 if (!success)
810 return fail_value;
811 ProcessSP process_sp = m_opaque_sp->GetProcessSP();
812 if (!process_sp)
813 return ret_val;
814 return process_sp->FixDataAddress(ret_val);
815 }
816
817 return fail_value;
818}
819
821 LLDB_INSTRUMENT_VA(this);
822
823 bool has_children = false;
824 ValueLocker locker;
825 lldb::ValueObjectSP value_sp(GetSP(locker));
826 if (value_sp)
827 has_children = value_sp->MightHaveChildren();
828
829 return has_children;
830}
831
833 LLDB_INSTRUMENT_VA(this);
834
835 bool is_support = false;
836 ValueLocker locker;
837 lldb::ValueObjectSP value_sp(GetSP(locker));
838 if (value_sp)
839 is_support = value_sp->IsRuntimeSupportValue();
840
841 return is_support;
842}
843
845 LLDB_INSTRUMENT_VA(this);
846
848}
849
850uint32_t SBValue::GetNumChildren(uint32_t max) {
851 LLDB_INSTRUMENT_VA(this, max);
852
853 uint32_t num_children = 0;
854
855 ValueLocker locker;
856 lldb::ValueObjectSP value_sp(GetSP(locker));
857 if (value_sp)
858 num_children = value_sp->GetNumChildrenIgnoringErrors(max);
859
860 return num_children;
861}
862
864 LLDB_INSTRUMENT_VA(this);
865
866 SBValue sb_value;
867 ValueLocker locker;
868 lldb::ValueObjectSP value_sp(GetSP(locker));
869 if (value_sp) {
871 sb_value = value_sp->Dereference(error);
872 }
873
874 return sb_value;
875}
876
877// Deprecated - please use GetType().IsPointerType() instead.
878bool SBValue::TypeIsPointerType() {
879 LLDB_INSTRUMENT_VA(this);
880
881 return GetType().IsPointerType();
882}
883
885 LLDB_INSTRUMENT_VA(this);
886
887 ValueLocker locker;
888 lldb::ValueObjectSP value_sp(GetSP(locker));
889 if (value_sp)
890 return value_sp->GetCompilerType().GetOpaqueQualType();
891 return nullptr;
892}
893
895 LLDB_INSTRUMENT_VA(this);
896
897 SBTarget sb_target;
898 TargetSP target_sp;
899 if (m_opaque_sp) {
900 target_sp = m_opaque_sp->GetTargetSP();
901 sb_target.SetSP(target_sp);
902 }
903
904 return sb_target;
905}
906
908 LLDB_INSTRUMENT_VA(this);
909
910 SBProcess sb_process;
911 ProcessSP process_sp;
912 if (m_opaque_sp) {
913 process_sp = m_opaque_sp->GetProcessSP();
914 sb_process.SetSP(process_sp);
915 }
916
917 return sb_process;
918}
919
921 LLDB_INSTRUMENT_VA(this);
922
923 SBThread sb_thread;
924 ThreadSP thread_sp;
925 if (m_opaque_sp) {
926 thread_sp = m_opaque_sp->GetThreadSP();
927 sb_thread.SetThread(thread_sp);
928 }
929
930 return sb_thread;
931}
932
934 LLDB_INSTRUMENT_VA(this);
935
936 SBFrame sb_frame;
937 StackFrameSP frame_sp;
938 if (m_opaque_sp) {
939 frame_sp = m_opaque_sp->GetFrameSP();
940 sb_frame.SetFrameSP(frame_sp);
941 }
942
943 return sb_frame;
944}
945
947 // IsValid means that the SBValue has a value in it. But that's not the
948 // only time that ValueObjects are useful. We also want to return the value
949 // if there's an error state in it.
950 if (!m_opaque_sp || (!m_opaque_sp->IsValid()
951 && (m_opaque_sp->GetRootSP()
952 && !m_opaque_sp->GetRootSP()->GetError().Fail()))) {
953 locker.GetError() = Status::FromErrorString("No value");
954 return ValueObjectSP();
955 }
956 return locker.GetLockedSP(*m_opaque_sp.get());
957}
958
960 LLDB_INSTRUMENT_VA(this);
961
962 ValueLocker locker;
963 return GetSP(locker);
964}
965
966void SBValue::SetSP(ValueImplSP impl_sp) { m_opaque_sp = impl_sp; }
967
969 if (sp) {
970 lldb::TargetSP target_sp(sp->GetTargetSP());
971 if (target_sp) {
972 lldb::DynamicValueType use_dynamic = target_sp->GetPreferDynamicValue();
973 bool use_synthetic =
974 target_sp->TargetProperties::GetEnableSyntheticValue();
975 m_opaque_sp = std::make_shared<ValueImpl>(sp, use_dynamic, use_synthetic);
976 } else
977 m_opaque_sp = std::make_shared<ValueImpl>(sp, eNoDynamicValues, true);
978 } else
979 m_opaque_sp = std::make_shared<ValueImpl>(sp, eNoDynamicValues, false);
980}
981
983 lldb::DynamicValueType use_dynamic) {
984 if (sp) {
985 lldb::TargetSP target_sp(sp->GetTargetSP());
986 if (target_sp) {
987 bool use_synthetic =
988 target_sp->TargetProperties::GetEnableSyntheticValue();
989 SetSP(sp, use_dynamic, use_synthetic);
990 } else
991 SetSP(sp, use_dynamic, true);
992 } else
993 SetSP(sp, use_dynamic, false);
994}
995
996void SBValue::SetSP(const lldb::ValueObjectSP &sp, bool use_synthetic) {
997 if (sp) {
998 lldb::TargetSP target_sp(sp->GetTargetSP());
999 if (target_sp) {
1000 lldb::DynamicValueType use_dynamic = target_sp->GetPreferDynamicValue();
1001 SetSP(sp, use_dynamic, use_synthetic);
1002 } else
1003 SetSP(sp, eNoDynamicValues, use_synthetic);
1004 } else
1005 SetSP(sp, eNoDynamicValues, use_synthetic);
1006}
1007
1009 lldb::DynamicValueType use_dynamic, bool use_synthetic) {
1010 m_opaque_sp = std::make_shared<ValueImpl>(sp, use_dynamic, use_synthetic);
1011}
1012
1014 lldb::DynamicValueType use_dynamic, bool use_synthetic,
1015 const char *name) {
1016 m_opaque_sp =
1017 std::make_shared<ValueImpl>(sp, use_dynamic, use_synthetic, name);
1018}
1019
1021 LLDB_INSTRUMENT_VA(this, description);
1022
1023 ValueLocker locker;
1024 lldb::ValueObjectSP value_sp(GetSP(locker));
1025 if (value_sp) {
1026 value_sp->GetExpressionPath(description.ref());
1027 return true;
1028 }
1029 return false;
1030}
1031
1033 bool qualify_cxx_base_classes) {
1034 LLDB_INSTRUMENT_VA(this, description, qualify_cxx_base_classes);
1035
1036 ValueLocker locker;
1037 lldb::ValueObjectSP value_sp(GetSP(locker));
1038 if (value_sp) {
1039 value_sp->GetExpressionPath(description.ref());
1040 return true;
1041 }
1042 return false;
1043}
1044
1046 LLDB_INSTRUMENT_VA(this, expr);
1047
1048 ValueLocker locker;
1049 lldb::ValueObjectSP value_sp(GetSP(locker));
1050 if (!value_sp)
1051 return SBValue();
1052
1053 lldb::TargetSP target_sp = value_sp->GetTargetSP();
1054 if (!target_sp)
1055 return SBValue();
1056
1058 options.SetFetchDynamicValue(target_sp->GetPreferDynamicValue());
1059 options.SetUnwindOnError(true);
1060 options.SetIgnoreBreakpoints(true);
1061
1062 return EvaluateExpression(expr, options, nullptr);
1063}
1064
1067 const SBExpressionOptions &options) const {
1068 LLDB_INSTRUMENT_VA(this, expr, options);
1069
1070 return EvaluateExpression(expr, options, nullptr);
1071}
1072
1074 const SBExpressionOptions &options,
1075 const char *name) const {
1076 LLDB_INSTRUMENT_VA(this, expr, options, name);
1077
1078 if (!expr || expr[0] == '\0') {
1079 return SBValue();
1080 }
1081
1082
1083 ValueLocker locker;
1084 lldb::ValueObjectSP value_sp(GetSP(locker));
1085 if (!value_sp) {
1086 return SBValue();
1087 }
1088
1089 lldb::TargetSP target_sp = value_sp->GetTargetSP();
1090 if (!target_sp) {
1091 return SBValue();
1092 }
1093
1094 std::lock_guard<std::recursive_mutex> guard(target_sp->GetAPIMutex());
1095 ExecutionContext exe_ctx(target_sp.get());
1096
1097 StackFrame *frame = exe_ctx.GetFramePtr();
1098 if (!frame) {
1099 return SBValue();
1100 }
1101
1102 ValueObjectSP res_val_sp;
1103 target_sp->EvaluateExpression(expr, frame, res_val_sp, options.ref(), nullptr,
1104 value_sp.get());
1105
1106 if (name)
1107 res_val_sp->SetName(ConstString(name));
1108
1109 SBValue result;
1110 result.SetSP(res_val_sp, options.GetFetchDynamicValue());
1111 return result;
1112}
1113
1115 LLDB_INSTRUMENT_VA(this, description);
1116
1117 return GetDescription(description, eDescriptionLevelFull);
1118}
1119
1122 lldb::DynamicValueType dyn, bool use_synthetic) {
1123 DumpValueObjectOptions options;
1124 switch (description_level) {
1126 return options;
1128 options.SetAllowOnelinerMode(true);
1129 options.SetHideRootName(true);
1130 options.SetHideRootType(true);
1131 break;
1133 options.SetShowTypes(true);
1134 options.SetShowLocation(true);
1135 break;
1136 default:
1137 break;
1138 }
1139 options.SetUseDynamicType(dyn);
1140 options.SetUseSyntheticValue(use_synthetic);
1141 return options;
1142}
1143
1145 lldb::DescriptionLevel description_level) {
1146 LLDB_INSTRUMENT_VA(this, description, description_level);
1147
1148 Stream &strm = description.ref();
1149
1150 ValueLocker locker;
1151 lldb::ValueObjectSP value_sp(GetSP(locker));
1152 if (value_sp) {
1153 const DumpValueObjectOptions options =
1154 GetDumpOptions(description_level, m_opaque_sp->GetUseDynamic(),
1155 m_opaque_sp->GetUseSynthetic());
1156 if (llvm::Error error = value_sp->Dump(strm, options)) {
1157 strm << "error: " << toString(std::move(error));
1158 return false;
1159 }
1160 } else {
1161 strm.PutCString("No value");
1162 }
1163
1164 return true;
1165}
1166
1168 LLDB_INSTRUMENT_VA(this);
1169
1170 ValueLocker locker;
1171 lldb::ValueObjectSP value_sp(GetSP(locker));
1172 if (value_sp)
1173 return value_sp->GetFormat();
1174 return eFormatDefault;
1175}
1176
1178 LLDB_INSTRUMENT_VA(this, format);
1179
1180 ValueLocker locker;
1181 lldb::ValueObjectSP value_sp(GetSP(locker));
1182 if (value_sp)
1183 value_sp->SetFormat(format);
1184}
1185
1187 LLDB_INSTRUMENT_VA(this);
1188
1189 SBValue sb_value;
1190 ValueLocker locker;
1191 lldb::ValueObjectSP value_sp(GetSP(locker));
1192 if (value_sp) {
1193 Status error;
1194 sb_value.SetSP(value_sp->AddressOf(error), GetPreferDynamicValue(),
1196 }
1197
1198 return sb_value;
1199}
1200
1202 LLDB_INSTRUMENT_VA(this);
1203
1205 ValueLocker locker;
1206 lldb::ValueObjectSP value_sp(GetSP(locker));
1207 if (value_sp)
1208 return value_sp->GetLoadAddress();
1209
1210 return value;
1211}
1212
1214 LLDB_INSTRUMENT_VA(this);
1215
1216 Address addr;
1217 ValueLocker locker;
1218 lldb::ValueObjectSP value_sp(GetSP(locker));
1219 if (value_sp) {
1220 TargetSP target_sp(value_sp->GetTargetSP());
1221 if (target_sp) {
1222 auto [value, addr_type] =
1223 value_sp->GetAddressOf(/*scalar_is_load_address=*/true);
1224 if (addr_type == eAddressTypeFile) {
1225 ModuleSP module_sp(value_sp->GetModule());
1226 if (module_sp)
1227 module_sp->ResolveFileAddress(value, addr);
1228 } else if (addr_type == eAddressTypeLoad) {
1229 // no need to check the return value on this.. if it can actually do
1230 // the resolve addr will be in the form (section,offset), otherwise it
1231 // will simply be returned as (NULL, value)
1232 addr.SetLoadAddress(value, target_sp.get());
1233 }
1234 }
1235 }
1236
1237 return SBAddress(addr);
1238}
1239
1240lldb::SBData SBValue::GetPointeeData(uint32_t item_idx, uint32_t item_count) {
1241 LLDB_INSTRUMENT_VA(this, item_idx, item_count);
1242
1243 lldb::SBData sb_data;
1244 ValueLocker locker;
1245 lldb::ValueObjectSP value_sp(GetSP(locker));
1246 if (value_sp) {
1247 TargetSP target_sp(value_sp->GetTargetSP());
1248 if (target_sp) {
1249 DataExtractorSP data_sp(new DataExtractor());
1250 value_sp->GetPointeeData(*data_sp, item_idx, item_count);
1251 if (data_sp->GetByteSize() > 0)
1252 *sb_data = data_sp;
1253 }
1254 }
1255
1256 return sb_data;
1257}
1258
1260 LLDB_INSTRUMENT_VA(this);
1261
1262 lldb::SBData sb_data;
1263 ValueLocker locker;
1264 lldb::ValueObjectSP value_sp(GetSP(locker));
1265 if (value_sp) {
1266 DataExtractorSP data_sp(new DataExtractor());
1267 Status error;
1268 value_sp->GetData(*data_sp, error);
1269 if (error.Success())
1270 *sb_data = data_sp;
1271 }
1272
1273 return sb_data;
1274}
1275
1277 LLDB_INSTRUMENT_VA(this, data, error);
1278
1279 ValueLocker locker;
1280 lldb::ValueObjectSP value_sp(GetSP(locker));
1281 bool ret = true;
1282
1283 if (value_sp) {
1284 DataExtractor *data_extractor = data.get();
1285
1286 if (!data_extractor) {
1287 error = Status::FromErrorString("No data to set");
1288 ret = false;
1289 } else {
1290 Status set_error;
1291
1292 value_sp->SetData(*data_extractor, set_error);
1293
1294 if (!set_error.Success()) {
1295 error = Status::FromErrorStringWithFormat("Couldn't set data: %s",
1296 set_error.AsCString());
1297 ret = false;
1298 }
1299 }
1300 } else {
1302 "Couldn't set data: could not get SBValue: %s",
1303 locker.GetError().AsCString());
1304 ret = false;
1305 }
1306
1307 return ret;
1308}
1309
1310lldb::SBValue SBValue::Clone(const char *new_name) {
1311 LLDB_INSTRUMENT_VA(this, new_name);
1312
1313 ValueLocker locker;
1314 lldb::ValueObjectSP value_sp(GetSP(locker));
1315
1316 if (value_sp)
1317 return lldb::SBValue(value_sp->Clone(ConstString(new_name)));
1318 else
1319 return lldb::SBValue();
1320}
1321
1323 LLDB_INSTRUMENT_VA(this);
1324
1325 ValueLocker locker;
1326 lldb::ValueObjectSP value_sp(GetSP(locker));
1327 SBDeclaration decl_sb;
1328 if (value_sp) {
1329 Declaration decl;
1330 if (value_sp->GetDeclaration(decl))
1331 decl_sb.SetDeclaration(decl);
1332 }
1333 return decl_sb;
1334}
1335
1336lldb::SBWatchpoint SBValue::Watch(bool resolve_location, bool read, bool write,
1337 SBError &error) {
1338 LLDB_INSTRUMENT_VA(this, resolve_location, read, write, error);
1339
1340 SBWatchpoint sb_watchpoint;
1341
1342 // If the SBValue is not valid, there's no point in even trying to watch it.
1343 ValueLocker locker;
1344 lldb::ValueObjectSP value_sp(GetSP(locker));
1345 TargetSP target_sp(GetTarget().GetSP());
1346 if (value_sp && target_sp) {
1347 // Read and Write cannot both be false.
1348 if (!read && !write)
1349 return sb_watchpoint;
1350
1351 // If the value is not in scope, don't try and watch and invalid value
1352 if (!IsInScope())
1353 return sb_watchpoint;
1354
1355 addr_t addr = GetLoadAddress();
1356 if (addr == LLDB_INVALID_ADDRESS)
1357 return sb_watchpoint;
1358 size_t byte_size = GetByteSize();
1359 if (byte_size == 0)
1360 return sb_watchpoint;
1361
1362 uint32_t watch_type = 0;
1363 if (read) {
1364 watch_type |= LLDB_WATCH_TYPE_READ;
1365 // read + write, the most likely intention
1366 // is to catch all writes to this, not just
1367 // value modifications.
1368 if (write)
1369 watch_type |= LLDB_WATCH_TYPE_WRITE;
1370 } else {
1371 if (write)
1372 watch_type |= LLDB_WATCH_TYPE_MODIFY;
1373 }
1374
1375 Status rc;
1376 CompilerType type(value_sp->GetCompilerType());
1377 WatchpointSP watchpoint_sp =
1378 target_sp->CreateWatchpoint(addr, byte_size, &type, watch_type, rc);
1379 error.SetError(std::move(rc));
1380
1381 if (watchpoint_sp) {
1382 sb_watchpoint.SetSP(watchpoint_sp);
1383 Declaration decl;
1384 if (value_sp->GetDeclaration(decl)) {
1385 if (decl.GetFile()) {
1386 StreamString ss;
1387 // True to show fullpath for declaration file.
1388 decl.DumpStopContext(&ss, true);
1389 watchpoint_sp->SetDeclInfo(std::string(ss.GetString()));
1390 }
1391 }
1392 }
1393 } else if (target_sp) {
1394 error = Status::FromErrorStringWithFormat("could not get SBValue: %s",
1395 locker.GetError().AsCString());
1396 } else {
1398 "could not set watchpoint, a target is required");
1399 }
1400
1401 return sb_watchpoint;
1402}
1403
1404// FIXME: Remove this method impl (as well as the decl in .h) once it is no
1405// longer needed.
1406// Backward compatibility fix in the interim.
1407lldb::SBWatchpoint SBValue::Watch(bool resolve_location, bool read,
1408 bool write) {
1409 LLDB_INSTRUMENT_VA(this, resolve_location, read, write);
1410
1411 SBError error;
1412 return Watch(resolve_location, read, write, error);
1413}
1414
1415lldb::SBWatchpoint SBValue::WatchPointee(bool resolve_location, bool read,
1416 bool write, SBError &error) {
1417 LLDB_INSTRUMENT_VA(this, resolve_location, read, write, error);
1418
1419 SBWatchpoint sb_watchpoint;
1420 if (IsInScope() && GetType().IsPointerType())
1421 sb_watchpoint = Dereference().Watch(resolve_location, read, write, error);
1422 return sb_watchpoint;
1423}
1424
1426 LLDB_INSTRUMENT_VA(this);
1427
1428 ValueLocker locker;
1429 lldb::ValueObjectSP value_sp(GetSP(locker));
1430 SBValue persisted_sb;
1431 if (value_sp) {
1432 persisted_sb.SetSP(value_sp->Persist());
1433 }
1434 return persisted_sb;
1435}
1436
1438 SBValue vtable_sb;
1439 ValueLocker locker;
1440 lldb::ValueObjectSP value_sp(GetSP(locker));
1441 if (!value_sp)
1442 return vtable_sb;
1443
1444 vtable_sb.SetSP(value_sp->GetVTable());
1445 return vtable_sb;
1446}
static llvm::raw_ostream & error(Stream &strm)
#define LLDB_INSTRUMENT_VA(...)
#define LLDB_LOG_ERROR(log, error,...)
Definition Log.h:399
static DumpValueObjectOptions GetDumpOptions(lldb::DescriptionLevel description_level, lldb::DynamicValueType dyn, bool use_synthetic)
Definition SBValue.cpp:1121
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:801
bool IsInScope()
Definition SBValue.cpp:173
bool SetData(lldb::SBData &data, lldb::SBError &error)
Definition SBValue.cpp:1276
bool GetDescription(lldb::SBStream &description)
Definition SBValue.cpp:1114
bool GetValueDidChange()
Definition SBValue.cpp:240
lldb::SBValue EvaluateExpression(const char *expr) const
Definition SBValue.cpp:1045
lldb::SBValue GetChildAtIndex(uint32_t idx)
Definition SBValue.cpp:518
lldb::SBTypeFilter GetTypeFilter()
Definition SBValue.cpp:345
lldb::SBAddress GetAddress()
Definition SBValue.cpp:1213
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:1240
const char * GetTypeName()
Definition SBValue.cpp:137
bool GetExpressionPath(lldb::SBStream &description)
Definition SBValue.cpp:1020
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:1425
void SetSP(const lldb::ValueObjectSP &sp)
Definition SBValue.cpp:968
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:1259
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:1310
void SetSyntheticChildrenGenerated(bool)
Definition SBValue.cpp:713
void Clear()
Definition SBValue.cpp:94
lldb::SBProcess GetProcess()
Definition SBValue.cpp:907
const char * GetLocation()
Definition SBValue.cpp:279
lldb::SBValue CreateBoolValue(const char *name, bool value)
Definition SBValue.cpp:485
bool IsSynthetic()
Definition SBValue.cpp:693
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:739
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:1415
lldb::SBWatchpoint Watch(bool resolve_location, bool read, bool write, SBError &error)
Watch this value if it resides in memory.
Definition SBValue.cpp:1336
lldb::SBTypeFormat GetTypeFormat()
Definition SBValue.cpp:313
lldb::user_id_t GetID()
Definition SBValue.cpp:116
lldb::SBFrame GetFrame()
Definition SBValue.cpp:933
const char * GetValue()
Definition SBValue.cpp:187
bool MightHaveChildren()
Find out if a SBValue might have children.
Definition SBValue.cpp:820
lldb::SBTypeSummary GetTypeSummary()
Definition SBValue.cpp:329
lldb::SBValue GetDynamicValue(lldb::DynamicValueType use_dynamic)
Definition SBValue.cpp:601
bool IsDynamic()
Definition SBValue.cpp:683
bool IsSyntheticChildrenGenerated()
Definition SBValue.cpp:703
const char * GetName()
Definition SBValue.cpp:126
lldb::SBValue GetSyntheticValue()
Definition SBValue.cpp:638
lldb::SBValue CreateChildAtOffset(const char *name, uint32_t offset, lldb::SBType type)
Definition SBValue.cpp:385
lldb::SBValue Dereference()
Definition SBValue.cpp:863
lldb::SBValue GetStaticValue()
Definition SBValue.cpp:613
lldb::SBValue Cast(lldb::SBType type)
Definition SBValue.cpp:404
friend class SBThread
Definition SBValue.h:446
lldb::SBValue GetNonSyntheticValue()
Definition SBValue.cpp:626
bool GetPreferSyntheticValue()
Definition SBValue.cpp:668
uint32_t GetIndexOfChildWithName(const char *name)
Definition SBValue.cpp:555
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:1437
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:959
lldb::SBTypeSynthetic GetTypeSynthetic()
Definition SBValue.cpp:365
void SetFormat(lldb::Format format)
Definition SBValue.cpp:1177
lldb::SBValue AddressOf()
Definition SBValue.cpp:1186
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:653
std::shared_ptr< lldb_private::ValueImpl > ValueImplSP
Definition SBValue.h:512
lldb::SBThread GetThread()
Definition SBValue.cpp:920
ValueImplSP m_opaque_sp
Definition SBValue.h:513
lldb::SBValue GetChildMemberWithName(const char *name)
Definition SBValue.cpp:569
lldb::SBTarget GetTarget()
Definition SBValue.cpp:894
uint64_t GetValueAsUnsigned(lldb::SBError &error, uint64_t fail_value=0)
Definition SBValue.cpp:759
uint32_t GetNumChildren()
Return the number of children of this variable.
Definition SBValue.cpp:844
void SetPreferDynamicValue(lldb::DynamicValueType use_dynamic)
Definition SBValue.cpp:661
ValueType GetValueType()
Definition SBValue.cpp:197
void * GetOpaqueType()
Definition SBValue.cpp:884
friend class SBType
Definition SBValue.h:447
bool IsValid()
Definition SBValue.cpp:80
lldb::SBValue GetValueForExpressionPath(const char *expr_path)
Definition SBValue.cpp:722
lldb::addr_t GetLoadAddress()
Definition SBValue.cpp:1201
lldb::SBType GetType()
Definition SBValue.cpp:225
void SetPreferSyntheticValue(bool use_synthetic)
Definition SBValue.cpp:676
lldb::SBDeclaration GetDeclaration()
Definition SBValue.cpp:1322
lldb::Format GetFormat()
Definition SBValue.cpp:1167
bool IsRuntimeSupportValue()
Definition SBValue.cpp:832
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:1034
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:383
"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:194
bool Success() const
Test for success condition.
Definition Status.cpp:303
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 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)
static lldb::ValueObjectSP CreateValueObjectFromBool(const ExecutionContext &exe_ctx, lldb::TypeSystemSP typesystem, bool value, llvm::StringRef name)
Create a value object containing the given boolean value.
#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.
Log * GetLog(Cat mask)
Retrieve the Log object for the channel associated with the given log enum.
Definition Log.h:332
@ 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.
std::string toString(FormatterBytecode::OpCodes op)
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.
LanguageType
Programming language type.
@ eLanguageTypeC
Non-standardized C, such as K&R.
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