Go to the documentation of this file.
9 #ifndef LLDB_CORE_VALUEOBJECT_H
10 #define LLDB_CORE_VALUEOBJECT_H
28 #include "llvm/ADT/ArrayRef.h"
29 #include "llvm/ADT/SmallVector.h"
30 #include "llvm/ADT/StringRef.h"
33 #include <initializer_list>
45 class DumpValueObjectOptions;
46 class EvaluateExpressionOptions;
47 class ExecutionContextScope;
51 class SymbolContextScope;
53 class TypeSummaryImpl;
54 class TypeSummaryOptions;
210 bool dot =
false,
bool no_ivar =
false,
bool bitfield =
true,
256 return g_default_options;
265 bool use_selected =
false);
296 const bool accept_invalid_exe_ctx =
false;
413 llvm::StringRef expression,
416 const GetValueForExpressionPathOptions &options =
444 bool *success =
nullptr);
446 virtual int64_t
GetValueAsSigned(int64_t fail_value,
bool *success =
nullptr);
472 virtual lldb::ValueObjectSP
GetChildAtIndex(
size_t idx,
bool can_create);
476 size_t *index_of_error =
nullptr);
480 size_t *index_of_error =
nullptr);
544 bool do_dump_error =
true);
577 virtual lldb::ValueObjectSP
582 virtual lldb::ValueObjectSP
627 lldb::TypeSP &type_sp);
655 static lldb::ValueObjectSP
657 llvm::StringRef expression,
660 static lldb::ValueObjectSP
662 llvm::StringRef expression,
666 static lldb::ValueObjectSP
671 static lldb::ValueObjectSP
681 std::pair<size_t, bool>
683 uint32_t max_length = 0,
bool honor_array =
true,
696 const bool accept_invalid_exe_ctx =
801 std::lock_guard<std::recursive_mutex> guard(
m_mutex);
806 std::lock_guard<std::recursive_mutex> guard(
m_mutex);
808 return ((iter ==
m_children.end()) ?
nullptr : iter->second);
814 std::lock_guard<std::recursive_mutex> guard(
m_mutex);
823 std::lock_guard<std::recursive_mutex> guard(
m_mutex);
968 bool synthetic_array_member,
969 int32_t synthetic_index);
1012 llvm::StringRef expression_cstr,
1015 const GetValueForExpressionPathOptions &options,
1024 #endif // LLDB_CORE_VALUEOBJECT_H
virtual CompilerType MaybeCalculateCompleteType()
virtual lldb::addr_t GetLiveAddress()
PrintableRepresentationSpecialCases
@ eExpressionPathScanEndReasonNoSuchChild
Child element not found.
virtual uint64_t GetData(DataExtractor &data, Status &error)
bool IsPointerOrReferenceType(CompilerType *pointee_type=nullptr) const
@ eExpressionPathAftermathTakeAddress
Take target's address.
lldb::ValueObjectSP GetValueForExpressionPath(llvm::StringRef expression, ExpressionPathScanEndReason *reason_to_stop=nullptr, ExpressionPathEndResultType *final_value_type=nullptr, const GetValueForExpressionPathOptions &options=GetValueForExpressionPathOptions::DefaultOptions(), ExpressionPathAftermath *final_task_on_target=nullptr)
virtual lldb::offset_t GetByteOffset()
virtual uint64_t GetValueAsUnsigned(uint64_t fail_value, bool *success=nullptr)
@ eClearUserVisibleDataItemsDescription
lldb::ValueObjectSP GetChildAtIndexPath(llvm::ArrayRef< size_t > idxs, size_t *index_of_error=nullptr)
GetValueForExpressionPathOptions & DontAllowBitfieldSyntax()
const ValueObject & operator=(const ValueObject &)=delete
virtual bool CanProvideValue()
@ eExpressionPathAftermathNothing
Just return it.
virtual bool IsRuntimeSupportValue()
void ClearUserVisibleData(uint32_t items=ValueObject::eClearUserVisibleDataItemsAllStrings)
void SetValueIsValid(bool valid)
const EvaluationPoint & GetUpdatePoint() const
Format
Display format definitions.
virtual void SetLanguageFlags(uint64_t flags)
ChildrenMap::iterator ChildrenIterator
const Value & GetValue() const
virtual size_t GetPointeeData(DataExtractor &data, uint32_t item_idx=0, uint32_t item_count=1)
std::shared_ptr< T > GetSharedPointer(T *desired_object)
lldb::ValueObjectSP Persist()
@ eClearUserVisibleDataItemsLocation
virtual bool IsSynthetic()
ValueObjectManager * m_manager
This object is managed by the root object (any ValueObject that gets created without a parent....
lldb::ThreadSP GetThreadSP() const
Get accessor that creates a strong reference from the weak thread reference contained in this object.
GetValueForExpressionPathOptions & SetSyntheticChildrenTraversal(SyntheticChildrenTraversal traverse)
@ eValueObjectRepresentationStyleValue
@ eExpressionPathScanEndReasonRangeOperatorInvalid
[] not valid on objects other than scalars, pointers or arrays.
bool m_is_getting_summary
ConstString GetTypeName(bool BaseOnly=false) const
virtual void SetFormat(lldb::Format format)
ConstString m_name
The name of this object.
ValueObject * FollowParentChain(std::function< bool(ValueObject *)>)
Given a ValueObject, loop over itself and its parent, and its parent's parent, .
@ eClearUserVisibleDataItemsSummary
GetValueForExpressionPathOptions(bool dot=false, bool no_ivar=false, bool bitfield=true, SyntheticChildrenTraversal synth_traverse=SyntheticChildrenTraversal::ToSynthetic)
std::string m_location_str
Cached location string that will get cleared if/when the value is updated.
std::string m_object_desc_str
Cached result of the "object printer".
void SetValueDidChange(bool value_changed)
lldb::addr_t GetPointerValue(AddressType *address_type=nullptr)
virtual int64_t GetValueAsSigned(int64_t fail_value, bool *success=nullptr)
lldb::ValueObjectSP GetQualifiedRepresentationIfAvailable(lldb::DynamicValueType dynValue, bool synthValue)
LanguageType
Programming language type.
ValueObject(ExecutionContextScope *exe_scope, ValueObjectManager &manager, AddressType child_ptr_or_ref_addr_type=eAddressTypeLoad)
Use this constructor to create a "root variable object".
virtual bool IsSyntheticChildrenGenerated()
@ eExpressionPathAftermathDereference
Dereference the target.
std::string m_summary_str
Cached summary string that will get cleared if/when the value is updated.
CompilerType m_override_type
If the type of the value object should be overridden, the type to impose.
virtual uint32_t GetBitfieldBitSize()
void SetPreferredDisplayLanguage(lldb::LanguageType lt)
virtual bool IsPointerType()
GetValueForExpressionPathOptions & DoCheckDotVsArrowSyntax()
llvm::SmallVector< uint8_t, 16 > m_value_checksum
ChildrenManager m_children
@ eValueObjectRepresentationStyleName
ValueObject * m_synthetic_value
virtual bool IsArrayType()
virtual ConstString GetQualifiedTypeName()
SyntheticChildrenTraversal
virtual bool IsPointerOrReferenceType()
lldb::LanguageType m_preferred_display_language
DataExtractor & GetDataExtractor()
std::map< ConstString, ValueObject * > m_synthetic_children
std::string m_old_value_str
Cached old value string from the last time the value was gotten.
virtual ConstString GetTypeName()
ValueObjectManager * GetManager()
virtual void GetExpressionPath(Stream &s, GetExpressionPathFormat=eGetExpressionPathFormatDereferencePointers)
void UpdateChildrenAddressType()
@ eValueObjectRepresentationStyleLocation
const Status & GetError()
bool IsUninitializedReference()
@ eClearUserVisibleDataItemsAllStrings
virtual lldb::ValueObjectSP GetDynamicValue(lldb::DynamicValueType valueType)
void SetUpdateID(ProcessModID new_id)
DataExtractor m_data
A data extractor that can be used to extract the value.
@ eClearUserVisibleDataItemsValue
bool m_check_dot_vs_arrow_syntax
virtual lldb::ValueObjectSP GetChildAtIndex(size_t idx, bool can_create)
lldb::ProcessSP GetProcessSP() const
static lldb::ValueObjectSP CreateValueObjectFromExpression(llvm::StringRef name, llvm::StringRef expression, const ExecutionContext &exe_ctx)
virtual void SetSyntheticChildrenGenerated(bool b)
void SetSyntheticChildren(const lldb::SyntheticChildrenSP &synth_sp)
static llvm::raw_ostream & error(Stream &strm)
lldb::TypeSummaryImplSP GetSummaryFormat()
AddressType m_address_type_of_ptr_or_ref_children
virtual SymbolContextScope * GetSymbolContextScope()
ValueObject * m_deref_valobj
@ eExpressionPathScanEndReasonRangeOperatorExpanded
[] was expanded into a VOList.
@ eExpressionPathScanEndReasonNoSuchSyntheticChild
(Synthetic) child element not found.
virtual bool MightHaveChildren()
Find out if a ValueObject might have children.
ExpressionPathEndResultType
virtual void ValueUpdated()
uint32_t m_last_format_mgr_revision
void SetValueFormat(lldb::TypeFormatImplSP format)
@ eExpressionPathEndResultTypeUnboundedRange
A range [].
std::pair< size_t, bool > ReadPointedString(lldb::WritableDataBufferSP &buffer_sp, Status &error, uint32_t max_length=0, bool honor_array=true, lldb::Format item_format=lldb::eFormatCharArray)
virtual lldb::ValueObjectSP Dereference(Status &error)
virtual lldb::ValueObjectSP GetStaticValue()
lldb::user_id_t GetID() const
Returns a unique id for this ValueObject.
virtual bool IsPossibleDynamicType()
virtual size_t CalculateNumChildren(uint32_t max=UINT32_MAX)=0
Should only be called by ValueObject::GetNumChildren().
virtual lldb::DynamicValueType GetDynamicValueTypeImpl()
virtual bool IsBaseClass()
virtual lldb::ValueObjectSP GetChildMemberWithName(ConstString name, bool can_create)
@ eExpressionPathScanEndReasonArrayRangeOperatorMet
[] is good for arrays, but I cannot parse it.
lldb::Format GetFormat() const
@ eClearUserVisibleDataItemsAll
void SetPreferredDisplayLanguageIfNeeded(lldb::LanguageType)
lldb::ValueObjectSP GetSP()
@ eExpressionPathScanEndReasonBitfieldRangeOperatorMet
[] is good for bitfields, but I cannot parse after it.
ProcessModID m_user_id_of_forced_summary
void SetAddressTypeOfChildren(AddressType at)
ValueObject * GetChildAtIndex(size_t idx)
virtual bool IsDereferenceOfParent()
virtual lldb::ValueObjectSP GetNonSyntheticValue()
virtual bool UpdateValue()=0
virtual bool ResolveValue(Scalar &scalar)
static const GetValueForExpressionPathOptions DefaultOptions()
@ eValueObjectRepresentationStyleChildrenCount
@ eExpressionPathScanEndReasonDereferencingFailed
Impossible to apply * operator.
static lldb::ValueObjectSP CreateValueObjectFromAddress(llvm::StringRef name, uint64_t address, const ExecutionContext &exe_ctx, CompilerType type)
lldb::Format m_last_format
virtual void CalculateSyntheticValue()
virtual TypeImpl GetTypeImpl()
ProcessModID GetModID() const
@ eExpressionPathScanEndReasonFragileIVarNotAllowed
ObjC ivar expansion not allowed.
bool m_is_array_item_for_pointer
virtual void SetLiveAddress(lldb::addr_t addr=LLDB_INVALID_ADDRESS, AddressType address_type=eAddressTypeLoad)
bool m_allow_bitfields_syntax
lldb::TypeFormatImplSP GetValueFormat()
lldb::ValueObjectSP GetSyntheticBitFieldChild(uint32_t from, uint32_t to, bool can_create)
@ eExpressionPathScanEndReasonDotInsteadOfArrow
. used when -> should be used.
virtual void CalculateDynamicValue(lldb::DynamicValueType use_dynamic)
bool UpdateValueIfNeeded(bool update_format=true)
bool HasChildAtIndex(size_t idx)
@ eValueObjectRepresentationStyleLanguageSpecific
@ eExpressionPathScanEndReasonTakingAddressFailed
Impossible to apply & operator.
virtual lldb::ValueObjectSP CastPointerType(const char *name, CompilerType &ast_type)
ChildrenManager()=default
lldb::StackFrameSP GetFrameSP() const
Get accessor that creates a strong reference from the weak frame reference contained in this object.
virtual size_t GetIndexOfChildWithName(ConstString name)
GetValueForExpressionPathOptions & DontAllowFragileIVar()
virtual lldb::ValueObjectSP GetSyntheticChildAtOffset(uint32_t offset, const CompilerType &type, bool can_create, ConstString name_const_str=ConstString())
ClearUserVisibleDataItems
const char * GetObjectDescription()
std::recursive_mutex m_mutex
virtual lldb::ValueObjectSP CreateConstantValue(ConstString name)
void SetSummaryFormat(lldb::TypeSummaryImplSP format)
@ eExpressionPathScanEndReasonEndOfString
Out of data to parse.
lldb::SyntheticChildrenSP m_synthetic_children_sp
bool m_is_deref_of_parent
virtual ValueObject * GetParent()
@ eExpressionPathScanEndReasonUnknown
lldb::TypeFormatImplSP m_type_format_sp
virtual const ValueObject * GetParent() const
const ExecutionContextRef & GetExecutionContextRef() const
lldb::ThreadSP GetThreadSP() const
virtual lldb::ValueObjectSP Cast(const CompilerType &compiler_type)
@ eExpressionPathScanEndReasonUnexpectedSymbol
Something is malformed in he expression.
bool IsIntegerType(bool &is_signed) const
string(SUBSTRING ${p} 10 -1 pStripped) if($
@ eAddressTypeLoad
Address is an address as in the current target inferior process.
@ eExpressionPathEndResultTypeBitfield
A bitfield.
lldb::ValueObjectSP GetSyntheticArrayMember(size_t index, bool can_create)
void SetChildAtIndex(size_t idx, ValueObject *valobj)
@ eClearUserVisibleDataItemsNothing
void SetName(ConstString name)
Change the name of the current ValueObject.
virtual bool IsLogicalTrue(Status &error)
lldb::user_id_t GetID() const
Get accessor for the user ID.
bool NeedsUpdating(bool accept_invalid_exe_ctx)
virtual lldb::ValueType GetValueType() const =0
@ eExpressionPathEndResultTypeValueObjectList
Several items in a VOList.
virtual bool SetValueFromCString(const char *value_str, Status &error)
virtual lldb::LanguageType GetPreferredDisplayLanguage()
EvaluationPoint m_update_point
Stores both the stop id and the full context at which this value was last updated.
const char * GetSummaryAsCString(lldb::LanguageType lang=lldb::eLanguageTypeUnknown)
virtual uint32_t GetBitfieldBitOffset()
ValueObject * GetNonBaseClassParent()
bool IsScalarType() const
size_t GetNumChildren(uint32_t max=UINT32_MAX)
@ eValueObjectRepresentationStyleExpressionPath
virtual const char * GetValueAsCString()
bool m_is_bitfield_for_scalar
virtual bool GetIsConstant() const
@ eExpressionPathScanEndReasonArrowInsteadOfDot
-> used when . should be used.
virtual bool HasDynamicValueTypeInfo()
uint64_t m_language_flags
bool IsCStringContainer(bool check_pointer=false)
Returns true if this is a char* or a char[] if it is a char* and check_pointer is true,...
@ eGetExpressionPathFormatHonorPointers
ConstString GetName() const
@ eLanguageTypeUnknown
Unknown or invalid language value.
lldb::SyntheticChildrenSP GetSyntheticChildren()
virtual lldb::ValueObjectSP Clone(ConstString new_name)
Creates a copy of the ValueObject with a new name and setting the current ValueObject as its parent.
virtual ValueObject * CreateChildAtIndex(size_t idx, bool synthetic_array_member, int32_t synthetic_index)
Should only be called by ValueObject::GetChildAtIndex().
bool SyncWithProcessState(bool accept_invalid_exe_ctx)
EvaluationPoint & GetUpdatePoint()
bool IsPointerType(CompilerType *pointee_type=nullptr) const
A class wrapping common implementation details for operations in ValueObjectConstResult ( & Child ) t...
UserID m_id
Unique identifier for every value object.
ValueObject * m_parent
The parent value object, or nullptr if this has no parent.
virtual CompilerType GetCompilerTypeImpl()=0
@ eExpressionPathScanEndReasonSyntheticValueMissing
getting the synthetic children failed.
virtual bool DoesProvideSyntheticValue()
uint32_t GetTypeInfo(CompilerType *pointee_or_element_compiler_type=nullptr) const
SyntheticChildrenTraversal m_synthetic_children_traversal
virtual bool GetDeclaration(Declaration &decl)
@ eExpressionPathEndResultTypePlain
Anything but...
@ eGetExpressionPathFormatDereferencePointers
bool IsArrayType(CompilerType *element_type=nullptr, uint64_t *size=nullptr, bool *is_incomplete=nullptr) const
GetValueForExpressionPathOptions & DoAllowBitfieldSyntax()
CompilerType GetCompilerType()
bool UpdateFormatsIfNeeded()
ValueObject * m_root
The root of the hierarchy for this ValueObject (or nullptr if never calculated).
bool m_children_count_valid
lldb::DynamicValueType GetDynamicValueType()
bool m_is_child_at_offset
@ eFormatCharArray
Print characters with no single quotes, used for character arrays that can contain non printable char...
@ eValueObjectRepresentationStyleType
lldb::ValueObjectSP GetSyntheticChild(ConstString key) const
std::map< size_t, ValueObject * > ChildrenMap
virtual lldb::ValueObjectSP GetSyntheticBase(uint32_t offset, const CompilerType &type, bool can_create, ConstString name_const_str=ConstString())
virtual lldb::ModuleSP GetModule()
Return the module associated with this value object in case the value is from an executable file and ...
virtual uint32_t GetTypeInfo(CompilerType *pointee_or_element_compiler_type=nullptr)
#define LLDB_INVALID_ADDRESS
ClusterManager< ValueObject > ValueObjectManager
bool GetValueIsValid() const
Generic representation of a type in a programming language.
virtual const char * GetLocationAsCString()
std::string m_value_str
Cached value string that will get cleared if/when the value is updated.
virtual lldb::VariableSP GetVariable()
void SetHasCompleteType()
bool HasSpecialPrintableRepresentation(ValueObjectRepresentationStyle val_obj_display, lldb::Format custom_format)
ExpressionPathScanEndReason
virtual void DoUpdateChildrenAddressType(ValueObject &valobj)
virtual bool IsScalarType()
ExecutionContextRef m_exe_ctx_ref
virtual bool SetData(DataExtractor &data, Status &error)
virtual ConstString GetDisplayTypeName()
A class that represents a running process on the host machine.
void AddSyntheticChild(ConstString key, ValueObject *valobj)
struct lldb_private::ValueObject::Bitflags m_flags
virtual lldb::addr_t GetAddressOf(bool scalar_is_load_address=true, AddressType *address_type=nullptr)
lldb::TargetSP GetTargetSP() const
Get accessor that creates a strong reference from the weak target reference contained in this object.
const ExecutionContextRef & GetExecutionContextRef() const
lldb::ValueObjectSP GetChildAtNamePath(llvm::ArrayRef< ConstString > names, ConstString *name_of_error=nullptr)
void SetNumChildren(size_t num_children)
lldb::LanguageType GetMinimumLanguage()
A ValueObject that obtains its children from some source other than real information.
bool m_did_calculate_complete_objc_class_type
@ eExpressionPathEndResultTypeInvalid
lldb::TargetSP GetTargetSP() const
ValueObjectRepresentationStyle
virtual LazyBool CanUpdateWithInvalidExecutionContext()
static lldb::ValueObjectSP CreateValueObjectFromData(llvm::StringRef name, const DataExtractor &data, const ExecutionContext &exe_ctx, CompilerType type)
ValueObject * m_dynamic_value
ChildrenMap::value_type ChildrenPair
bool DumpPrintableRepresentation(Stream &s, ValueObjectRepresentationStyle val_obj_display=eValueObjectRepresentationStyleSummary, lldb::Format custom_format=lldb::eFormatInvalid, PrintableRepresentationSpecialCases special=PrintableRepresentationSpecialCases::eAllow, bool do_dump_error=true)
void ClearDynamicTypeInformation()
bool m_is_synthetic_children_generated
size_t GetChildrenCount()
Status m_error
An error object that can describe any errors that occur when updating values.
virtual lldb::ValueObjectSP AddressOf(Status &error)
virtual bool HasSyntheticValue()
lldb::ProcessSP GetProcessSP() const
Get accessor that creates a strong reference from the weak process reference contained in this object...
const char * GetLocationAsCStringImpl(const Value &value, const DataExtractor &data)
@ eExpressionPathEndResultTypeBoundedRange
A range [low-high].
A child of another ValueObject.
@ eClearUserVisibleDataItemsSyntheticChildren
@ eValueObjectRepresentationStyleSummary
bool IsIntegerType(bool &is_signed)
void Clear(size_t new_count=0)
virtual std::optional< uint64_t > GetByteSize()=0
@ eExpressionPathScanEndReasonRangeOperatorNotAllowed
[] not allowed by options.
virtual uint64_t GetLanguageFlags()
@ eExpressionPathScanEndReasonEmptyRangeNotAllowed
[] only allowed for arrays.
lldb::ValueObjectSP GetSyntheticValue()
lldb::StackFrameSP GetFrameSP() const
GetValueForExpressionPathOptions & DoAllowFragileIVar()
Execution context objects refer to objects in the execution of the program that is being debugged.
lldb::TypeSummaryImplSP m_type_summary_sp
lldb::ValueObjectSP GetSyntheticExpressionPathChild(const char *expression, bool can_create)
lldb::ValueObjectSP m_addr_of_valobj_sp
We have to hold onto a shared pointer to this one because it is created as an independent ValueObject...
virtual bool IsArrayItemForPointer()
AddressType GetAddressTypeOfChildren()
virtual lldb::LanguageType GetObjectRuntimeLanguage()
void SetChildrenCount(size_t count)
GetValueForExpressionPathOptions & DontCheckDotVsArrowSyntax()
lldb::ValueObjectSP GetValueForExpressionPath_Impl(llvm::StringRef expression_cstr, ExpressionPathScanEndReason *reason_to_stop, ExpressionPathEndResultType *final_value_type, const GetValueForExpressionPathOptions &options, ExpressionPathAftermath *final_task_on_target)