60 const char *name =
nullptr)
64 if ((
m_valobj_sp = in_valobj_sp->GetQualifiedRepresentationIfAvailable(
100 return target_sp && target_sp->IsValid();
107 std::unique_lock<std::recursive_mutex> &lock,
116 Target *target = value_sp->GetTargetSP().get();
118 if (value_sp->GetError().Fail())
124 lock = std::unique_lock<std::recursive_mutex>(target->
GetAPIMutex());
126 ProcessSP process_sp(value_sp->GetProcessSP());
127 if (process_sp && !stop_locker.
TryLock(&process_sp->GetRunLock())) {
138 value_sp = dynamic_sp;
144 value_sp = synthetic_sp;
150 value_sp->SetName(
m_name);
216 std::unique_lock<std::recursive_mutex>
m_lock;
247 return this->
operator bool();
249SBValue::operator
bool()
const {
273 sb_error.
SetError(value_sp->GetError().Clone());
287 return value_sp->GetID();
299 return value_sp->GetName().GetCString();
310 return value_sp->GetQualifiedTypeName().GetCString();
321 return value_sp->GetDisplayTypeName().GetCString();
332 result = llvm::expectedToOptional(value_sp->GetByteSize()).value_or(0);
346 result = value_sp->IsInScope();
369 result = value_sp->GetValueType();
382 llvm::Expected<std::string> str = value_sp->GetObjectDescription();
384 llvm::consumeError(str.takeError());
398 type_sp = std::make_shared<TypeImpl>(value_sp->GetTypeImpl());
399 sb_type.
SetSP(type_sp);
412 if (value_sp->UpdateValueIfNeeded(
false))
413 result = value_sp->GetValueDidChange();
438 if (value_sp->GetSummaryAsCString(buffer, options.
ref()) && !buffer.empty())
439 stream.Printf(
"%s", buffer.c_str());
466 bool success =
false;
470 success = value_sp->SetValueFromCString(value_str,
error.ref());
485 if (value_sp->UpdateValueIfNeeded(
true)) {
488 format.
SetSP(format_sp);
501 if (value_sp->UpdateValueIfNeeded(
true)) {
504 summary.
SetSP(summary_sp);
517 if (value_sp->UpdateValueIfNeeded(
true)) {
520 if (synthetic_sp && !synthetic_sp->IsScripted()) {
522 std::static_pointer_cast<TypeFilterImpl>(synthetic_sp);
523 filter.
SetSP(filter_sp);
537 if (value_sp->UpdateValueIfNeeded(
true)) {
540 if (children_sp && children_sp->IsScripted()) {
542 std::static_pointer_cast<ScriptedSyntheticChildren>(children_sp);
543 synthetic.
SetSP(synth_sp);
561 sb_value.
SetSP(value_sp->GetSyntheticChildAtOffset(
562 offset, type_sp->GetCompilerType(
false),
true),
576 if (value_sp && type_sp)
577 sb_value.
SetSP(value_sp->Cast(type_sp->GetCompilerType(
false)),
583 const char *expression) {
592 const char *expression,
603 name, expression, exe_ctx, options.
ref());
607 sb_value.
SetSP(new_value_sp);
621 if (value_sp && type_impl_sp) {
622 CompilerType ast_type(type_impl_sp->GetCompilerType(
true));
627 sb_value.
SetSP(new_value_sp);
640 if (value_sp && type_impl_sp) {
643 name, **data, exe_ctx, type_impl_sp->GetCompilerType(
true));
646 sb_value.
SetSP(new_value_sp);
658 if (value_sp && target_sp) {
662 sb_value.
SetSP(new_value_sp);
675 use_dynamic = target_sp->GetPreferDynamicValue();
682 bool treat_as_array) {
689 const bool can_create =
true;
690 if (treat_as_array &&
691 (value_sp->IsPointerType() || value_sp->IsArrayType()))
692 child_sp = value_sp->GetSyntheticArrayMember(idx, can_create);
694 child_sp = value_sp->GetChildAtIndex(idx);
709 if (
auto idx_or_err = value_sp->GetIndexOfChildWithName(name))
712 llvm::consumeError(idx_or_err.takeError());
726 use_dynamic_value = target_sp->GetPreferDynamicValue();
740 child_sp = value_sp->GetChildMemberWithName(name);
756 value_sb.
SetSP(proxy_sp);
769 value_sb.
SetSP(proxy_sp);
781 value_sb.
SetSP(proxy_sp);
793 value_sb.
SetSP(proxy_sp);
828 return m_opaque_sp->SetUseSynthetic(use_synthetic);
837 return value_sp->IsDynamic();
847 return value_sp->IsSynthetic();
857 return value_sp->IsSyntheticChildrenGenerated();
867 return value_sp->SetSyntheticChildrenGenerated(is);
878 child_sp = value_sp->GetValueForExpressionPath(expr_path);
895 uint64_t ret_val = fail_value;
896 ret_val = value_sp->GetValueAsSigned(fail_value, &success);
915 uint64_t ret_val = fail_value;
916 ret_val = value_sp->GetValueAsUnsigned(fail_value, &success);
933 return value_sp->GetValueAsSigned(fail_value);
944 return value_sp->GetValueAsUnsigned(fail_value);
955 uint64_t ret_val = fail_value;
956 ret_val = value_sp->GetValueAsUnsigned(fail_value, &success);
962 return process_sp->FixDataAddress(ret_val);
971 bool has_children =
false;
975 has_children = value_sp->MightHaveChildren();
983 bool is_support =
false;
987 is_support = value_sp->IsRuntimeSupportValue();
1001 uint32_t num_children = 0;
1006 num_children = value_sp->GetNumChildrenIgnoringErrors(max);
1008 return num_children;
1026bool SBValue::TypeIsPointerType() {
1038 return value_sp->GetCompilerType().GetOpaqueQualType();
1049 sb_target.
SetSP(target_sp);
1062 sb_process.
SetSP(process_sp);
1100 && !
m_opaque_sp->GetRootSP()->GetError().Fail()))) {
1111 return GetSP(locker);
1121 bool use_synthetic =
1122 target_sp->TargetProperties::GetEnableSyntheticValue();
1123 m_opaque_sp = std::make_shared<ValueImpl>(
sp, use_dynamic, use_synthetic);
1135 bool use_synthetic =
1136 target_sp->TargetProperties::GetEnableSyntheticValue();
1137 SetSP(
sp, use_dynamic, use_synthetic);
1141 SetSP(
sp, use_dynamic,
false);
1149 SetSP(
sp, use_dynamic, use_synthetic);
1158 m_opaque_sp = std::make_shared<ValueImpl>(
sp, use_dynamic, use_synthetic);
1165 std::make_shared<ValueImpl>(
sp, use_dynamic, use_synthetic, name);
1174 value_sp->GetExpressionPath(description.
ref());
1181 bool qualify_cxx_base_classes) {
1187 value_sp->GetExpressionPath(description.
ref());
1223 const char *name)
const {
1226 if (!expr || expr[0] ==
'\0') {
1242 std::lock_guard<std::recursive_mutex> guard(target_sp->GetAPIMutex());
1251 target_sp->EvaluateExpression(expr, frame, res_val_sp, options.
ref(),
nullptr,
1273 if (llvm::Error
error = value_sp->Dump(strm, options)) {
1290 return value_sp->GetFormat();
1300 value_sp->SetFormat(format);
1325 return value_sp->GetLoadAddress();
1337 TargetSP target_sp(value_sp->GetTargetSP());
1339 auto [value, addr_type] =
1340 value_sp->GetAddressOf(
true);
1342 ModuleSP module_sp(value_sp->GetModule());
1344 module_sp->ResolveFileAddress(value, addr);
1364 TargetSP target_sp(value_sp->GetTargetSP());
1367 value_sp->GetPointeeData(*data_sp, item_idx, item_count);
1368 if (data_sp->GetByteSize() > 0)
1385 value_sp->GetData(*data_sp,
error);
1386 if (
error.Success())
1403 if (!data_extractor) {
1409 value_sp->SetData(*data_extractor, set_error);
1419 "Couldn't set data: could not get SBValue: %s",
1447 if (value_sp->GetDeclaration(decl))
1463 if (value_sp && target_sp) {
1465 if (!read && !write)
1466 return sb_watchpoint;
1470 return sb_watchpoint;
1474 return sb_watchpoint;
1477 return sb_watchpoint;
1479 uint32_t watch_type = 0;
1495 target_sp->CreateWatchpoint(addr, byte_size, &type, watch_type, rc);
1496 error.SetError(std::move(rc));
1498 if (watchpoint_sp) {
1499 sb_watchpoint.
SetSP(watchpoint_sp);
1501 if (value_sp->GetDeclaration(decl)) {
1506 watchpoint_sp->SetDeclInfo(std::string(ss.
GetString()));
1510 }
else if (target_sp) {
1515 "could not set watchpoint, a target is required");
1518 return sb_watchpoint;
1529 return Watch(resolve_location, read, write,
error);
1539 return sb_watchpoint;
1549 persisted_sb.
SetSP(value_sp->Persist());
1551 return persisted_sb;
1561 vtable_sb.
SetSP(value_sp->GetVTable());
static llvm::raw_ostream & error(Stream &strm)
#define LLDB_INSTRUMENT_VA(...)
StackFrameSP GetFrameSP()
lldb::DynamicValueType m_use_dynamic
lldb::ValueObjectSP GetRootSP()
void SetUseSynthetic(bool use_synthetic)
ValueImpl(const ValueImpl &rhs)=default
ValueImpl(lldb::ValueObjectSP in_valobj_sp, lldb::DynamicValueType use_dynamic, bool use_synthetic, const char *name=nullptr)
lldb::ValueObjectSP GetSP(Process::StopLocker &stop_locker, std::unique_lock< std::recursive_mutex > &lock, Status &error)
ValueImpl & operator=(const ValueImpl &rhs)
lldb::DynamicValueType GetUseDynamic()
void SetUseDynamic(lldb::DynamicValueType use_dynamic)
lldb::ValueObjectSP m_valobj_sp
ValueObjectSP GetLockedSP(ValueImpl &in_value)
Process::StopLocker m_stop_locker
std::unique_lock< std::recursive_mutex > m_lock
lldb_private::DataExtractor * get() const
void SetDeclaration(const lldb_private::Declaration &lldb_object_ref)
void SetError(uint32_t err, lldb::ErrorType type)
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)
void SetSP(const lldb::ProcessSP &process_sp)
lldb_private::Stream & ref()
void SetSP(const lldb::TargetSP &target_sp)
void SetThread(const lldb::ThreadSP &lldb_object_sp)
void SetSP(const lldb::TypeFilterImplSP &typefilter_impl_sp)
lldb_private::TypeSummaryOptions & ref()
void SetSP(const lldb::TypeSummaryImplSP &typefilter_impl_sp)
void SetSP(const lldb::ScriptedSyntheticChildrenSP &typefilter_impl_sp)
void SetSP(const lldb::TypeImplSP &type_impl_sp)
lldb::addr_t GetValueAsAddress()
bool SetData(lldb::SBData &data, lldb::SBError &error)
bool GetDescription(lldb::SBStream &description)
lldb::SBValue EvaluateExpression(const char *expr) const
lldb::SBValue GetChildAtIndex(uint32_t idx)
lldb::SBTypeFilter GetTypeFilter()
lldb::SBAddress GetAddress()
lldb::SBData GetPointeeData(uint32_t item_idx=0, uint32_t item_count=1)
Get an SBData wrapping what this SBValue points to.
const char * GetTypeName()
bool GetExpressionPath(lldb::SBStream &description)
lldb::SBValue CreateValueFromData(const char *name, lldb::SBData data, lldb::SBType type)
void SetSP(const lldb::ValueObjectSP &sp)
lldb::SBValue CreateValueFromAddress(const char *name, lldb::addr_t address, lldb::SBType type)
const char * GetDisplayTypeName()
lldb::SBValue CreateValueFromExpression(const char *name, const char *expression)
lldb::SBData GetData()
Get an SBData wrapping the contents of this SBValue.
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.
void SetSyntheticChildrenGenerated(bool)
lldb::SBProcess GetProcess()
const char * GetLocation()
lldb::SBValue CreateBoolValue(const char *name, bool value)
lldb::SBValue & operator=(const lldb::SBValue &rhs)
int64_t GetValueAsSigned(lldb::SBError &error, int64_t fail_value=0)
lldb::SBWatchpoint WatchPointee(bool resolve_location, bool read, bool write, SBError &error)
Watch this value that this value points to in memory.
lldb::SBWatchpoint Watch(bool resolve_location, bool read, bool write, SBError &error)
Watch this value if it resides in memory.
lldb::SBTypeFormat GetTypeFormat()
bool MightHaveChildren()
Find out if a SBValue might have children.
lldb::SBTypeSummary GetTypeSummary()
lldb::SBValue GetDynamicValue(lldb::DynamicValueType use_dynamic)
bool IsSyntheticChildrenGenerated()
lldb::SBValue GetSyntheticValue()
lldb::SBValue CreateChildAtOffset(const char *name, uint32_t offset, lldb::SBType type)
lldb::SBValue Dereference()
std::shared_ptr< ValueImpl > ValueImplSP
lldb::SBValue GetStaticValue()
lldb::SBValue Cast(lldb::SBType type)
lldb::SBValue GetNonSyntheticValue()
bool GetPreferSyntheticValue()
uint32_t GetIndexOfChildWithName(const char *name)
lldb::SBValue GetVTable()
If this value represents a C++ class that has a vtable, return an value that represents the virtual f...
const char * GetObjectDescription()
const char * GetSummary()
lldb::ValueObjectSP GetSP() const
Same as the protected version of GetSP that takes a locker, except that we make the locker locally in...
lldb::SBTypeSynthetic GetTypeSynthetic()
void SetFormat(lldb::Format format)
lldb::SBValue AddressOf()
bool SetValueFromCString(const char *value_str, lldb::SBError &error)
lldb::DynamicValueType GetPreferDynamicValue()
lldb::SBThread GetThread()
lldb::SBValue GetChildMemberWithName(const char *name)
lldb::SBTarget GetTarget()
uint64_t GetValueAsUnsigned(lldb::SBError &error, uint64_t fail_value=0)
uint32_t GetNumChildren()
Return the number of children of this variable.
void SetPreferDynamicValue(lldb::DynamicValueType use_dynamic)
lldb::SBValue GetValueForExpressionPath(const char *expr_path)
lldb::addr_t GetLoadAddress()
void SetPreferSyntheticValue(bool use_synthetic)
lldb::SBDeclaration GetDeclaration()
bool IsRuntimeSupportValue()
void SetSP(const lldb::WatchpointSP &sp)
A section + offset based address class.
bool SetLoadAddress(lldb::addr_t load_addr, Target *target, bool allow_section_end=false)
Set the address to represent load_addr.
Generic representation of a type in a programming language.
A uniqued constant string class.
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.
A class that describes the declaration location of a lldb object.
bool DumpStopContext(Stream *s, bool show_fullpaths) const
FileSpec & GetFile()
Get accessor for file specification.
DumpValueObjectOptions & SetUseSyntheticValue(bool use_synthetic=true)
DumpValueObjectOptions & SetUseDynamicType(lldb::DynamicValueType dyn=lldb::eNoDynamicValues)
void SetKeepInMemory(bool keep=true)
"lldb/Target/ExecutionContext.h" A class that contains an execution context.
StackFrame * GetFramePtr() const
Returns a pointer to the frame object.
bool TryLock(ProcessRunLock *lock)
ProcessRunLock::ProcessRunLocker StopLocker
This base class provides an interface to stack frames.
static Status FromErrorStringWithFormat(const char *format,...) __attribute__((format(printf
static Status FromErrorString(const char *str)
const char * AsCString(const char *default_error_str="unknown error") const
Get the error string associated with the current error.
bool Success() const
Test for success condition.
llvm::StringRef GetString() const
A stream class that can stream formatted output to a file.
size_t PutCString(llvm::StringRef cstr)
Output a C string to the stream.
std::recursive_mutex & GetAPIMutex()
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_WATCH_TYPE_MODIFY
#define LLDB_WATCH_TYPE_READ
#define LLDB_INVALID_ADDRESS
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
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
std::shared_ptr< lldb_private::SyntheticChildren > SyntheticChildrenSP
std::shared_ptr< lldb_private::ScriptedSyntheticChildren > ScriptedSyntheticChildrenSP
std::shared_ptr< lldb_private::TypeFilterImpl > TypeFilterImplSP
std::shared_ptr< lldb_private::TypeImpl > TypeImplSP
std::shared_ptr< lldb_private::Target > TargetSP
std::shared_ptr< lldb_private::DataExtractor > DataExtractorSP
std::shared_ptr< lldb_private::Module > ModuleSP