82 return this->
operator bool();
84SBValue::operator
bool()
const {
108 sb_error.
SetError(value_sp->GetError().Clone());
122 return value_sp->GetID();
134 return value_sp->GetName().GetCString();
145 return value_sp->GetQualifiedTypeName().GetCString();
156 return value_sp->GetDisplayTypeName().GetCString();
167 result = llvm::expectedToOptional(value_sp->GetByteSize()).value_or(0);
181 result = value_sp->IsInScope();
204 result = value_sp->GetValueType();
217 llvm::Expected<std::string> str = value_sp->GetObjectDescription();
219 llvm::consumeError(str.takeError());
233 type_sp = std::make_shared<TypeImpl>(value_sp->GetTypeImpl());
234 sb_type.
SetSP(type_sp);
247 if (value_sp->UpdateValueIfNeeded(
false))
248 result = value_sp->GetValueDidChange();
273 if (value_sp->GetSummaryAsCString(buffer, options.
ref()) && !buffer.empty())
274 stream.Printf(
"%s", buffer.c_str());
301 bool success =
false;
305 success = value_sp->SetValueFromCString(value_str,
error.ref());
338 if (value_sp->UpdateValueIfNeeded(
true)) {
341 format.
SetSP(format_sp);
354 if (value_sp->UpdateValueIfNeeded(
true)) {
357 summary.
SetSP(summary_sp);
370 if (value_sp->UpdateValueIfNeeded(
true)) {
373 if (synthetic_sp && !synthetic_sp->IsScripted()) {
375 std::static_pointer_cast<TypeFilterImpl>(synthetic_sp);
376 filter.
SetSP(filter_sp);
390 if (value_sp->UpdateValueIfNeeded(
true)) {
393 if (children_sp && children_sp->IsScripted()) {
395 std::static_pointer_cast<ScriptedSyntheticChildren>(children_sp);
396 synthetic.
SetSP(synth_sp);
410 value_sp->SetSyntheticChildrenOverride(synthetic_sp);
422 auto frontend = value_sp->GetSyntheticChildrenFrontEnd();
441 sb_value.
SetSP(value_sp->GetSyntheticChildAtOffset(
442 offset, type_sp->GetCompilerType(
false),
true),
456 if (value_sp && type_sp)
457 sb_value.
SetSP(value_sp->Cast(type_sp->GetCompilerType(
false)),
463 const char *expression) {
472 const char *expression,
482 new_value_sp = value_sp->CreateChildValueObjectFromExpression(
483 name, expression, exe_ctx, options.
ref());
485 new_value_sp->SetName(name);
487 sb_value.
SetSP(new_value_sp);
501 if (value_sp && type_impl_sp) {
502 CompilerType ast_type(type_impl_sp->GetCompilerType(
true));
504 new_value_sp = value_sp->CreateChildValueObjectFromAddress(
505 name, address, exe_ctx, ast_type);
507 sb_value.
SetSP(new_value_sp);
520 if (value_sp && type_impl_sp) {
522 new_value_sp = value_sp->CreateChildValueObjectFromData(
523 name, **data, exe_ctx, type_impl_sp->GetCompilerType(
true));
526 sb_value.
SetSP(new_value_sp);
548 language = frame->GuessLanguage().AsLanguageType();
549 auto type_system_or_err =
550 target_sp->GetScratchTypeSystemForLanguage(language);
551 if (!type_system_or_err) {
553 "cannot get a type system: {0}");
556 return value_sp->CreateChildValueObjectFromBool(
557 exe_ctx, *type_system_or_err, value, name);
559 sb_value.
SetSP(get_new_value());
572 use_dynamic = target_sp->GetPreferDynamicValue();
579 bool treat_as_array) {
586 const bool can_create =
true;
587 if (treat_as_array &&
588 (value_sp->IsPointerType() || value_sp->IsArrayType()))
589 child_sp = value_sp->GetSyntheticArrayMember(idx, can_create);
591 child_sp = value_sp->GetChildAtIndex(idx);
606 if (
auto idx_or_err = value_sp->GetIndexOfChildWithName(name))
609 llvm::consumeError(idx_or_err.takeError());
623 use_dynamic_value = target_sp->GetPreferDynamicValue();
637 child_sp = value_sp->GetChildMemberWithName(name);
667 value_sb.
SetSP(proxy_sp);
680 value_sb.
SetSP(proxy_sp);
692 value_sb.
SetSP(proxy_sp);
704 value_sb.
SetSP(proxy_sp);
739 return m_opaque_sp->SetUseSynthetic(use_synthetic);
748 return value_sp->IsDynamic();
758 return value_sp->IsSynthetic();
768 return value_sp->IsSyntheticChildrenGenerated();
778 return value_sp->SetSyntheticChildrenGenerated(is);
789 child_sp = value_sp->GetValueForExpressionPath(expr_path);
806 uint64_t ret_val = fail_value;
807 ret_val = value_sp->GetValueAsSigned(fail_value, &success);
826 uint64_t ret_val = fail_value;
827 ret_val = value_sp->GetValueAsUnsigned(fail_value, &success);
844 return value_sp->GetValueAsSigned(fail_value);
855 return value_sp->GetValueAsUnsigned(fail_value);
866 uint64_t ret_val = fail_value;
867 ret_val = value_sp->GetValueAsUnsigned(fail_value, &success);
873 return process_sp->FixDataAddress(ret_val);
882 bool has_children =
false;
886 has_children = value_sp->MightHaveChildren();
894 bool is_support =
false;
898 is_support = value_sp->IsRuntimeSupportValue();
912 uint32_t num_children = 0;
917 num_children = value_sp->GetNumChildrenIgnoringErrors(max);
930 sb_value = value_sp->Dereference(
error);
937bool SBValue::TypeIsPointerType() {
949 return value_sp->GetCompilerType().GetOpaqueQualType();
960 sb_target.
SetSP(target_sp);
973 sb_process.
SetSP(process_sp);
1022 return GetSP(locker);
1032 bool use_synthetic =
1033 target_sp->TargetProperties::GetEnableSyntheticValue();
1034 m_opaque_sp = std::make_shared<ValueImpl>(
sp, use_dynamic, use_synthetic);
1046 bool use_synthetic =
1047 target_sp->TargetProperties::GetEnableSyntheticValue();
1048 SetSP(
sp, use_dynamic, use_synthetic);
1052 SetSP(
sp, use_dynamic,
false);
1060 SetSP(
sp, use_dynamic, use_synthetic);
1069 m_opaque_sp = std::make_shared<ValueImpl>(
sp, use_dynamic, use_synthetic);
1076 std::make_shared<ValueImpl>(
sp, use_dynamic, use_synthetic, name);
1085 value_sp->GetExpressionPath(description.
ref());
1092 bool qualify_cxx_base_classes) {
1098 value_sp->GetExpressionPath(description.
ref());
1134 const char *name)
const {
1137 if (!expr || expr[0] ==
'\0') {
1153 std::lock_guard<TargetAPIMutex> guard(api_lock);
1162 target_sp->EvaluateExpression(expr, frame, res_val_sp, options.
ref(),
nullptr,
1166 res_val_sp->SetName(name);
1183 switch (description_level) {
1215 if (llvm::Error
error = value_sp->Dump(strm, options)) {
1232 return value_sp->GetFormat();
1242 value_sp->SetFormat(format);
1267 return value_sp->GetLoadAddress();
1279 TargetSP target_sp(value_sp->GetTargetSP());
1281 auto [value, addr_type] =
1282 value_sp->GetAddressOf(
true);
1284 ModuleSP module_sp(value_sp->GetModule());
1286 module_sp->ResolveFileAddress(value, addr);
1306 TargetSP target_sp(value_sp->GetTargetSP());
1309 value_sp->GetPointeeData(*data_sp, item_idx, item_count);
1310 if (data_sp->GetByteSize() > 0)
1327 value_sp->GetData(*data_sp,
error);
1328 if (
error.Success())
1345 if (!data_extractor) {
1351 value_sp->SetData(*data_extractor, set_error);
1361 "Couldn't set data: could not get SBValue: %s",
1389 if (value_sp->GetDeclaration(decl))
1405 if (value_sp && target_sp) {
1407 if (!read && !write)
1408 return sb_watchpoint;
1412 return sb_watchpoint;
1416 return sb_watchpoint;
1419 return sb_watchpoint;
1421 uint32_t watch_type = 0;
1437 target_sp->CreateWatchpoint(addr, byte_size, &type, watch_type, rc);
1438 error.SetError(std::move(rc));
1440 if (watchpoint_sp) {
1441 sb_watchpoint.
SetSP(watchpoint_sp);
1443 if (value_sp->GetDeclaration(decl)) {
1448 watchpoint_sp->SetDeclInfo(std::string(ss.
GetString()));
1452 }
else if (target_sp) {
1457 "could not set watchpoint, a target is required");
1460 return sb_watchpoint;
1471 return Watch(resolve_location, read, write,
error);
1481 return sb_watchpoint;
1491 persisted_sb.
SetSP(value_sp->Persist());
1493 return persisted_sb;
1503 vtable_sb.
SetSP(value_sp->GetVTable());
static llvm::raw_ostream & error(Stream &strm)
#define LLDB_INSTRUMENT_VA(...)
#define LLDB_LOG_ERROR(log, error,...)
static DumpValueObjectOptions GetDumpOptions(lldb::DescriptionLevel description_level, lldb::DynamicValueType dyn, bool use_synthetic)
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)
lldb::ScriptedSyntheticChildrenSP GetSP()
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.
bool CanSetValue()
Returns false if this value cannot be modified through SetValueFromCString() or SetData(),...
lldb::SBWatchpoint Watch(bool resolve_location, bool read, bool write, SBError &error)
Watch this value if it resides in memory.
lldb::SBTypeFormat GetTypeFormat()
lldb::SBError CanSet()
Returns an error describing why this value cannot be modified through SetValueFromCString() or SetDat...
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::SBScriptObject GetTypeSyntheticImplementation()
This function's primary use is to ease inspecting the internal state of scripted synthetic children p...
lldb::SBValue Dereference()
lldb::SBValue GetStaticValue()
lldb::SBValue Cast(lldb::SBType type)
void SetTypeSynthetic(lldb::SBTypeSynthetic &synthetic)
Override the SBTypeSynthetic chosen by the DataFormatter system for this instance.
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()
std::shared_ptr< lldb_private::ValueImpl > ValueImplSP
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()
lldb::SBValue GetParent()
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 * GetCString() const
Get the string value as a C string.
const char * AsCString(const char *value_if_empty) 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 & 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)
"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.
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.
static Status FromError(llvm::Error error)
Avoid using this in new code. Migrate APIs to llvm::Expected instead.
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.
A Lockable handle over a Target's API mutex, returned by Target::GetAPIMutex() and backing the public...
lldb::ValueObjectSP GetLockedSP(ValueImpl &in_value)
lldb::ValueObjectSP GetSP()
#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.
Log * GetLog(Cat mask)
Retrieve the Log object for the channel associated with the given log enum.
@ 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.
@ eDescriptionLevelInitial
@ eDescriptionLevelVerbose
std::shared_ptr< lldb_private::Thread > ThreadSP
std::shared_ptr< lldb_private::TypeFormatImpl > TypeFormatImplSP
std::shared_ptr< lldb_private::ValueObject > ValueObjectSP
class LLDB_API SBScriptObject
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
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