LLDB mainline
lldb_private::Value Class Reference

#include <Value.h>

Public Types

enum class  ValueType {
  Invalid = -1 , Scalar = 0 , FileAddress , LoadAddress ,
  HostAddress
}
 Type that describes Value::m_value. More...
enum class  ContextType { Invalid = -1 , RegisterInfo = 0 , LLDBType , Variable }
 Type that describes Value::m_context. More...

Public Member Functions

 Value ()
 Value (const Scalar &scalar)
 Value (const void *bytes, int len)
 Value (const Value &rhs)
void SetBytes (const void *bytes, int len)
void AppendBytes (const void *bytes, int len)
Valueoperator= (const Value &rhs)
const CompilerTypeGetCompilerType ()
void SetCompilerType (const CompilerType &compiler_type)
ValueType GetValueType () const
AddressType GetValueAddressType () const
ContextType GetContextType () const
void SetValueType (ValueType value_type)
void ClearContext ()
void SetContext (ContextType context_type, void *p)
RegisterInfoGetRegisterInfo () const
TypeGetType ()
ScalarResolveValue (ExecutionContext *exe_ctx, Module *module=nullptr)
const ScalarGetScalar () const
 See comment on m_scalar to understand what GetScalar returns.
ScalarGetScalar ()
 See comment on m_scalar to understand what GetScalar returns.
size_t ResizeData (size_t len)
size_t AppendDataToHostBuffer (const Value &rhs)
DataBufferHeapGetBuffer ()
const DataBufferHeapGetBuffer () const
bool ValueOf (ExecutionContext *exe_ctx)
VariableGetVariable ()
void Dump (Stream *strm)
lldb::Format GetValueDefaultFormat ()
uint64_t GetValueByteSize (Status *error_ptr, ExecutionContext *exe_ctx)
Status GetValueAsData (ExecutionContext *exe_ctx, DataExtractor &data, Module *module)
void ConvertToLoadAddress (Module *module, Target *target)
 Convert this value's file address to a load address, if possible.
bool GetData (DataExtractor &data)
void Clear ()

Static Public Member Functions

static const char * GetValueTypeAsCString (ValueType context_type)
static const char * GetContextTypeAsCString (ContextType context_type)
static ValueType GetValueTypeFromAddressType (AddressType address_type)

Protected Attributes

Scalar m_value
 Represents a value, which can be a scalar, a load address, a file address, or a host address.
CompilerType m_compiler_type
void * m_context = nullptr
ValueType m_value_type = ValueType::Scalar
ContextType m_context_type = ContextType::Invalid
DataBufferHeap m_data_buffer

Detailed Description

Definition at line 38 of file Value.h.

Member Enumeration Documentation

◆ ContextType

Type that describes Value::m_context.

Enumerator
Invalid 

Undefined.

RegisterInfo 

RegisterInfo * (can be a scalar or a vector register).

LLDBType 

lldb_private::Type *.

Variable 

lldb_private::Variable *.

Definition at line 56 of file Value.h.

◆ ValueType

enum class lldb_private::Value::ValueType
strong

Type that describes Value::m_value.

Enumerator
Invalid 
Scalar 

A raw scalar value.

FileAddress 

A file address value.

LoadAddress 

A load address value.

HostAddress 

A host address value (for memory in the process that < A is using liblldb).

Definition at line 41 of file Value.h.

Constructor & Destructor Documentation

◆ Value() [1/4]

Value::Value ( )

Definition at line 44 of file Value.cpp.

References m_compiler_type, m_data_buffer, and m_value.

Referenced by AppendDataToHostBuffer(), operator=(), and Value().

◆ Value() [2/4]

Value::Value ( const Scalar & scalar)

Definition at line 46 of file Value.cpp.

References m_compiler_type, m_data_buffer, m_value, and Scalar.

◆ Value() [3/4]

Value::Value ( const void * bytes,
int len )

Definition at line 49 of file Value.cpp.

References HostAddress, m_compiler_type, m_data_buffer, m_value, m_value_type, and SetBytes().

◆ Value() [4/4]

Member Function Documentation

◆ AppendBytes()

void Value::AppendBytes ( const void * bytes,
int len )

Definition at line 96 of file Value.cpp.

References HostAddress, m_data_buffer, m_value, and m_value_type.

◆ AppendDataToHostBuffer()

◆ Clear()

◆ ClearContext()

void lldb_private::Value::ClearContext ( )
inline

Definition at line 91 of file Value.h.

References Invalid, m_context, and m_context_type.

Referenced by lldb_private::DWARFExpression::Evaluate().

◆ ConvertToLoadAddress()

void Value::ConvertToLoadAddress ( Module * module,
Target * target )

◆ Dump()

◆ GetBuffer() [1/2]

DataBufferHeap & lldb_private::Value::GetBuffer ( )
inline

Definition at line 122 of file Value.h.

References m_data_buffer.

Referenced by AppendDataToHostBuffer(), and lldb_private::DWARFExpression::Evaluate().

◆ GetBuffer() [2/2]

const DataBufferHeap & lldb_private::Value::GetBuffer ( ) const
inline

Definition at line 124 of file Value.h.

References m_data_buffer.

◆ GetCompilerType()

◆ GetContextType()

◆ GetContextTypeAsCString()

const char * Value::GetContextTypeAsCString ( ContextType context_type)
static

Definition at line 661 of file Value.cpp.

References Invalid, LLDBType, RegisterInfo, and Variable.

Referenced by Dump().

◆ GetData()

◆ GetRegisterInfo()

◆ GetScalar() [1/2]

Scalar & lldb_private::Value::GetScalar ( )
inline

See comment on m_scalar to understand what GetScalar returns.

Definition at line 116 of file Value.h.

References m_value, and Scalar.

◆ GetScalar() [2/2]

const Scalar & lldb_private::Value::GetScalar ( ) const
inline

See comment on m_scalar to understand what GetScalar returns.

Definition at line 113 of file Value.h.

References m_value, and Scalar.

Referenced by lldb_private::ClangExpressionDeclMap::AddOneFunction(), lldb_private::ClangExpressionDeclMap::AddOneGenericVariable(), ConvertToLoadAddress(), lldb_private::PlatformWindows::DoLoadImage(), lldb_private::DWARFExpression::Evaluate(), lldb_private::FunctionCaller::FetchFunctionResults(), ABIMacOSX_arm64::GetArgumentValues(), ABIMacOSX_arm::GetArgumentValues(), ABIMacOSX_i386::GetArgumentValues(), ABISysV_arm64::GetArgumentValues(), ABISysV_arm::GetArgumentValues(), ABISysV_i386::GetArgumentValues(), ABISysV_ppc64::GetArgumentValues(), ABISysV_ppc::GetArgumentValues(), ABISysV_s390x::GetArgumentValues(), ABISysV_x86_64::GetArgumentValues(), ABIWindows_x86_64::GetArgumentValues(), lldb_private::AppleGetQueuesHandler::GetCurrentQueues(), lldb_private::ItaniumABILanguageRuntime::GetExceptionObjectForThread(), lldb_private::ClangExpressionDeclMap::GetFunctionInfo(), lldb_private::AppleGetItemInfoHandler::GetItemInfo(), lldb_private::ValueObject::GetLocationAsCStringImpl(), lldb_private::AppleObjCRuntime::GetObjectDescription(), lldb_private::AppleObjCRuntime::GetObjectDescription(), lldb_private::AppleGetPendingItemsHandler::GetPendingItems(), ABIMacOSX_arm64::GetReturnValueObjectImpl(), ABIMacOSX_arm::GetReturnValueObjectImpl(), ABIMacOSX_i386::GetReturnValueObjectImpl(), ABISysV_arc::GetReturnValueObjectImpl(), ABISysV_arm64::GetReturnValueObjectImpl(), ABISysV_arm::GetReturnValueObjectImpl(), ABISysV_hexagon::GetReturnValueObjectImpl(), ABISysV_mips64::GetReturnValueObjectImpl(), ABISysV_mips::GetReturnValueObjectImpl(), ABISysV_riscv::GetReturnValueObjectImpl(), ABISysV_arc::GetReturnValueObjectSimple(), ABISysV_i386::GetReturnValueObjectSimple(), ABISysV_loongarch::GetReturnValueObjectSimple(), ABISysV_ppc::GetReturnValueObjectSimple(), ABISysV_riscv::GetReturnValueObjectSimple(), ABISysV_s390x::GetReturnValueObjectSimple(), ABISysV_x86_64::GetReturnValueObjectSimple(), ABIWindows_x86_64::GetReturnValueObjectSimple(), lldb_private::AppleObjCTrampolineHandler::GetStepThroughDispatchPlan(), lldb_private::AppleGetThreadItemInfoHandler::GetThreadItemInfo(), GetValObjFromFPRegs(), GetValObjFromFPRegs(), GetValObjFromIntRegs(), GetValObjFromIntRegs(), lldb_private::ClangExpressionDeclMap::GetVariableValue(), IRInterpreter::Interpret(), lldb_private::ThreadPlanAssemblyTracer::Log(), DynamicLoaderMacOS::NotifyBreakpointHit(), DynamicLoaderMacOSXDYLD::NotifyBreakpointHit(), lldb_private::AppleObjCRuntimeV2::ParseClassInfoArray(), lldb_private::DWARFExpression::ReadRegisterValueAsScalar(), lldb_private::AbortWithPayloadFrameRecognizer::RecognizeFrame(), lldb_private::AppleThreadPlanStepThroughObjCTrampoline::ShouldStop(), lldb_private::ValueObjectCast::UpdateValue(), lldb_private::ValueObjectChild::UpdateValue(), lldb_private::ValueObjectDynamicValue::UpdateValue(), lldb_private::ValueObjectMemory::UpdateValue(), and lldb_private::ValueObjectVariable::UpdateValue().

◆ GetType()

Type * Value::GetType ( )

Definition at line 148 of file Value.cpp.

References LLDBType, m_context, and m_context_type.

Referenced by GetCompilerType().

◆ GetValueAddressType()

◆ GetValueAsData()

Status Value::GetValueAsData ( ExecutionContext * exe_ctx,
DataExtractor & data,
Module * module )

Definition at line 323 of file Value.cpp.

References lldb_private::ConstString::AsCString(), lldb_private::Variable::CalculateSymbolContext(), lldb_private::DataExtractor::Clear(), lldb_private::eAddressTypeFile, lldb_private::eAddressTypeHost, lldb_private::eAddressTypeLoad, error(), FileAddress, lldb_private::Status::FromErrorString(), lldb_private::Status::FromErrorStringWithFormat(), lldb_private::ArchSpec::GetAddressByteSize(), lldb_private::ObjectFile::GetAddressByteSize(), lldb_private::Target::GetArchitecture(), lldb_private::ExecutionContext::GetBestExecutionContextScope(), lldb_private::ArchSpec::GetByteOrder(), lldb_private::ObjectFile::GetByteOrder(), lldb_private::CompilerType::GetByteSize(), GetCompilerType(), lldb_private::Module::GetFileSpec(), lldb_private::Address::GetLoadAddress(), lldb_private::Variable::GetName(), lldb_private::FileSpec::GetPath(), lldb_private::CompilerType::GetPointerByteSize(), lldb_private::ExecutionContext::GetProcessPtr(), lldb_private::ObjectFile::GetSectionList(), lldb_private::Process::GetState(), lldb_private::Process::GetTarget(), lldb_private::ExecutionContext::GetTargetPtr(), lldb_private::ExecutionContext::GetTargetRef(), GetValueByteSize(), GetVariable(), lldb_private::Target::HasLoadedSections(), HostAddress, lldb_private::endian::InlHostByteOrder(), Invalid, lldb_private::Process::IsAlive(), lldb_private::Address::IsSectionOffset(), lldb_private::Address::IsValid(), lldb_private::CompilerType::IsValid(), LLDB_INVALID_ADDRESS, LoadAddress, m_context_type, m_value, m_value_type, lldb_private::DataExtractor::PeekData(), lldb_private::Process::ReadMemory(), lldb_private::Target::ReadMemory(), RegisterInfo, lldb_private::Target::ResolveLoadAddress(), Scalar, lldb_private::DataExtractor::SetAddressByteSize(), lldb_private::DataExtractor::SetByteOrder(), lldb_private::DataExtractor::SetData(), lldb_private::StateIsStoppedState(), lldb_private::DataExtractor::ValidOffsetForDataOfSize(), and Variable.

Referenced by lldb_private::ValueObject::CreateConstantValue(), lldb_private::AppleObjCTrampolineHandler::AppleObjCVTables::RefreshTrampolines(), ResolveValue(), lldb_private::ValueObjectChild::UpdateValue(), lldb_private::ValueObjectMemory::UpdateValue(), and lldb_private::ValueObjectVariable::UpdateValue().

◆ GetValueByteSize()

◆ GetValueDefaultFormat()

◆ GetValueType()

◆ GetValueTypeAsCString()

const char * Value::GetValueTypeAsCString ( ValueType context_type)
static

Definition at line 645 of file Value.cpp.

References FileAddress, HostAddress, Invalid, LoadAddress, and Scalar.

Referenced by Dump().

◆ GetValueTypeFromAddressType()

◆ GetVariable()

Variable * Value::GetVariable ( )

Definition at line 630 of file Value.cpp.

References m_context, m_context_type, and Variable.

Referenced by GetCompilerType(), and GetValueAsData().

◆ operator=()

◆ ResizeData()

size_t Value::ResizeData ( size_t len)

◆ ResolveValue()

◆ SetBytes()

void Value::SetBytes ( const void * bytes,
int len )

◆ SetCompilerType()

void Value::SetCompilerType ( const CompilerType & compiler_type)

Definition at line 276 of file Value.cpp.

References m_compiler_type.

Referenced by lldb_private::ClangExpressionDeclMap::AddOneGenericVariable(), lldb_private::ClangExpressionDeclMap::AddOneVariable(), lldb_private::PlatformWindows::DoLoadImage(), lldb_private::FunctionCaller::FetchFunctionResults(), lldb_private::AppleObjCRuntime::GetBacktraceThreadFromException(), lldb_private::AppleObjCRuntimeV2::DynamicClassInfoExtractor::GetClassInfoUtilityFunction(), lldb_private::AppleGetQueuesHandler::GetCurrentQueues(), NSIndexPathSyntheticFrontEnd::Impl::InlinedIndexes::GetIndexAtIndex(), lldb_private::AppleGetItemInfoHandler::GetItemInfo(), lldb_private::AppleObjCRuntime::GetObjectDescription(), lldb_private::AppleGetPendingItemsHandler::GetPendingItems(), ABIMacOSX_arm64::GetReturnValueObjectImpl(), ABIMacOSX_arm::GetReturnValueObjectImpl(), ABIMacOSX_i386::GetReturnValueObjectImpl(), ABISysV_arm64::GetReturnValueObjectImpl(), ABISysV_arm::GetReturnValueObjectImpl(), ABISysV_mips64::GetReturnValueObjectImpl(), ABISysV_mips::GetReturnValueObjectImpl(), ABISysV_arc::GetReturnValueObjectSimple(), ABISysV_i386::GetReturnValueObjectSimple(), ABISysV_loongarch::GetReturnValueObjectSimple(), ABISysV_ppc::GetReturnValueObjectSimple(), ABISysV_riscv::GetReturnValueObjectSimple(), ABISysV_s390x::GetReturnValueObjectSimple(), ABISysV_x86_64::GetReturnValueObjectSimple(), ABIWindows_x86_64::GetReturnValueObjectSimple(), lldb_private::AppleObjCTrampolineHandler::GetStepThroughDispatchPlan(), lldb_private::AppleGetThreadItemInfoHandler::GetThreadItemInfo(), lldb_private::ClangExpressionDeclMap::GetVariableValue(), lldb_private::ThreadPlanAssemblyTracer::Log(), DynamicLoaderMacOS::NotifyBreakpointHit(), DynamicLoaderMacOSXDYLD::NotifyBreakpointHit(), lldb_private::AbortWithPayloadFrameRecognizer::RecognizeFrame(), lldb_private::AppleObjCTrampolineHandler::AppleObjCVTables::RefreshTrampolines(), and lldb_private::ValueObjectMemory::UpdateValue().

◆ SetContext()

◆ SetValueType()

void lldb_private::Value::SetValueType ( ValueType value_type)
inline

Definition at line 89 of file Value.h.

References m_value_type.

Referenced by lldb_private::ClangExpressionDeclMap::AddOneFunction(), lldb_private::ClangExpressionDeclMap::AddOneGenericVariable(), ConvertToLoadAddress(), lldb_private::FunctionCaller::FetchFunctionResults(), lldb_private::AppleGetQueuesHandler::GetCurrentQueues(), lldb_private::AppleGetItemInfoHandler::GetItemInfo(), lldb_private::AppleGetPendingItemsHandler::GetPendingItems(), ABIMacOSX_arm64::GetReturnValueObjectImpl(), ABISysV_arc::GetReturnValueObjectImpl(), ABISysV_arm64::GetReturnValueObjectImpl(), ABISysV_mips64::GetReturnValueObjectImpl(), ABISysV_riscv::GetReturnValueObjectImpl(), ABISysV_arc::GetReturnValueObjectSimple(), ABISysV_i386::GetReturnValueObjectSimple(), ABISysV_loongarch::GetReturnValueObjectSimple(), ABISysV_ppc::GetReturnValueObjectSimple(), ABISysV_riscv::GetReturnValueObjectSimple(), ABISysV_s390x::GetReturnValueObjectSimple(), ABISysV_x86_64::GetReturnValueObjectSimple(), ABIWindows_x86_64::GetReturnValueObjectSimple(), lldb_private::AppleObjCTrampolineHandler::GetStepThroughDispatchPlan(), lldb_private::AppleGetThreadItemInfoHandler::GetThreadItemInfo(), GetValObjFromFPRegs(), GetValObjFromFPRegs(), GetValObjFromIntRegs(), GetValObjFromIntRegs(), lldb_private::ClangExpressionDeclMap::GetVariableValue(), lldb_private::ThreadPlanAssemblyTracer::Log(), DynamicLoaderMacOS::NotifyBreakpointHit(), DynamicLoaderMacOSXDYLD::NotifyBreakpointHit(), lldb_private::DWARFExpression::ReadRegisterValueAsScalar(), lldb_private::AbortWithPayloadFrameRecognizer::RecognizeFrame(), lldb_private::AppleObjCTrampolineHandler::AppleObjCVTables::RefreshTrampolines(), lldb_private::RegisterContextUnwind::SavedLocationForRegister(), and SetContext().

◆ ValueOf()

bool Value::ValueOf ( ExecutionContext * exe_ctx)

Definition at line 199 of file Value.cpp.

References Invalid, LLDBType, m_context_type, RegisterInfo, ResolveValue(), and Variable.

Member Data Documentation

◆ m_compiler_type

CompilerType lldb_private::Value::m_compiler_type
protected

Definition at line 180 of file Value.h.

Referenced by Clear(), GetCompilerType(), operator=(), SetCompilerType(), Value(), Value(), Value(), and Value().

◆ m_context

void* lldb_private::Value::m_context = nullptr
protected

◆ m_context_type

◆ m_data_buffer

DataBufferHeap lldb_private::Value::m_data_buffer
protected

◆ m_value

Scalar lldb_private::Value::m_value
protected

Represents a value, which can be a scalar, a load address, a file address, or a host address.

The interpretation of m_value depends on m_value_type:

  • Scalar: m_value contains the scalar value.
  • Load Address: m_value contains the load address.
  • File Address: m_value contains the file address.
  • Host Address: m_value contains a pointer to the start of the buffer in host memory. Currently, this can point to either:
    • The m_data_buffer of this Value instance (e.g., in DWARF computations).
    • The m_data of a Value Object containing this Value.

Definition at line 179 of file Value.h.

Referenced by AppendBytes(), AppendDataToHostBuffer(), Clear(), Dump(), GetData(), GetScalar(), GetScalar(), GetValueAsData(), operator=(), ResizeData(), ResolveValue(), SetBytes(), Value(), Value(), Value(), and Value().

◆ m_value_type


The documentation for this class was generated from the following files: