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