LLDB mainline
lldb_private::ExpressionVariable Class Reference

#include <ExpressionVariable.h>

Inheritance diagram for lldb_private::ExpressionVariable:
[legend]

Public Types

enum  Flags {
  EVNone = 0 , EVIsLLDBAllocated = 1 << 0 , EVIsProgramReference = 1 << 1 , EVNeedsAllocation = 1 << 2 ,
  EVIsFreezeDried = 1 << 3 , EVNeedsFreezeDry , EVKeepInTarget = 1 << 5 , EVTypeIsReference = 1 << 6 ,
  EVBareRegister = 1 << 7
}
typedef uint16_t FlagType

Public Member Functions

 ExpressionVariable ()
virtual ~ExpressionVariable ()=default
llvm::Expected< uint64_t > GetByteSize ()
ConstString GetName ()
lldb::ValueObjectSP GetValueObject ()
uint8_t * GetValueBytes ()
void ValueUpdated ()
RegisterInfoGetRegisterInfo ()
void SetRegisterInfo (const RegisterInfo *reg_info)
CompilerType GetCompilerType ()
void SetCompilerType (const CompilerType &compiler_type)
void SetName (ConstString name)
void TransferAddress (bool force=false)
 This function is used to copy the address-of m_live_sp into m_frozen_sp.
void PreserveDynamicOption (lldb::DynamicValueType dyn_type)
 When we build an expression variable we know whether we're going to use the static or dynamic result.
lldb::ValueObjectSP GetLiveObject ()
 We don't try to get the dynamic value of the live object when we fetch it here.

Public Attributes

FlagType m_flags
lldb::DynamicValueType m_dyn_option = lldb::eNoDynamicValues
lldb::ValueObjectSP m_frozen_sp
 These members should be private.
lldb::ValueObjectSP m_live_sp
 The ValueObject counterpart to m_frozen_sp that tracks the value in inferior memory.

Static Public Attributes

static char ID
 LLVM RTTI support.

Detailed Description

Definition at line 25 of file ExpressionVariable.h.

Member Typedef Documentation

◆ FlagType

Definition at line 122 of file ExpressionVariable.h.

Member Enumeration Documentation

◆ Flags

Enumerator
EVNone 
EVIsLLDBAllocated 

This variable is resident in a location specifically allocated for it by LLDB in the target process.

EVIsProgramReference 

This variable is a reference to a (possibly invalid) area managed by the target program.

EVNeedsAllocation 

Space for this variable has yet to be allocated in the target process.

EVIsFreezeDried 

This variable's authoritative version is in m_frozen_sp (for example, for statically-computed results)

EVNeedsFreezeDry 

Copy from m_live_sp to m_frozen_sp during dematerialization.

EVKeepInTarget 

Keep the allocation after the expression is complete rather than freeze drying its contents and freeing it.

EVTypeIsReference 

The original type of this variable is a reference, so materialize the value rather than the location.

EVBareRegister 

This variable is a direct reference to $pc or some other entity.

Definition at line 97 of file ExpressionVariable.h.

Constructor & Destructor Documentation

◆ ExpressionVariable()

ExpressionVariable::ExpressionVariable ( )

Definition at line 20 of file ExpressionVariable.cpp.

References m_flags.

◆ ~ExpressionVariable()

virtual lldb_private::ExpressionVariable::~ExpressionVariable ( )
virtualdefault

Member Function Documentation

◆ GetByteSize()

llvm::Expected< uint64_t > lldb_private::ExpressionVariable::GetByteSize ( )
inline

Definition at line 36 of file ExpressionVariable.h.

References GetValueObject().

◆ GetCompilerType()

CompilerType lldb_private::ExpressionVariable::GetCompilerType ( )
inline

Definition at line 63 of file ExpressionVariable.h.

References GetValueObject().

◆ GetLiveObject()

lldb::ValueObjectSP lldb_private::ExpressionVariable::GetLiveObject ( )
inline

We don't try to get the dynamic value of the live object when we fetch it here.

The live object describes the container of the value in the target, but it's type is of the object for convenience. So it can't produce the dynamic value. Instead, we use TransferAddress to adjust the value held by the LiveObject.

Definition at line 95 of file ExpressionVariable.h.

References m_live_sp.

◆ GetName()

ConstString lldb_private::ExpressionVariable::GetName ( )
inline

Definition at line 40 of file ExpressionVariable.h.

References m_frozen_sp.

Referenced by lldb_private::ClangREPL::PrintOneVariable().

◆ GetRegisterInfo()

RegisterInfo * lldb_private::ExpressionVariable::GetRegisterInfo ( )
inline

Definition at line 54 of file ExpressionVariable.h.

References m_frozen_sp.

◆ GetValueBytes()

uint8_t * ExpressionVariable::GetValueBytes ( )

Definition at line 22 of file ExpressionVariable.cpp.

References GetValueObject().

◆ GetValueObject()

lldb::ValueObjectSP lldb_private::ExpressionVariable::GetValueObject ( )
inline

Definition at line 42 of file ExpressionVariable.h.

References lldb::eDynamicDontRunTarget, and m_frozen_sp.

Referenced by GetByteSize(), GetCompilerType(), and GetValueBytes().

◆ PreserveDynamicOption()

void lldb_private::ExpressionVariable::PreserveDynamicOption ( lldb::DynamicValueType dyn_type)
inline

When we build an expression variable we know whether we're going to use the static or dynamic result.

If we present the dynamic value once, we should use the dynamic value in future references to the variable, so we record that fact here.

Definition at line 87 of file ExpressionVariable.h.

References m_dyn_option.

◆ SetCompilerType()

void lldb_private::ExpressionVariable::SetCompilerType ( const CompilerType & compiler_type)
inline

Definition at line 65 of file ExpressionVariable.h.

References m_frozen_sp.

◆ SetName()

void lldb_private::ExpressionVariable::SetName ( ConstString name)
inline

Definition at line 69 of file ExpressionVariable.h.

References m_frozen_sp.

◆ SetRegisterInfo()

void lldb_private::ExpressionVariable::SetRegisterInfo ( const RegisterInfo * reg_info)
inline

Definition at line 58 of file ExpressionVariable.h.

References m_frozen_sp, and lldb_private::Value::RegisterInfo.

◆ TransferAddress()

void ExpressionVariable::TransferAddress ( bool force = false)

This function is used to copy the address-of m_live_sp into m_frozen_sp.

It is necessary because the results of certain cast and pointer- arithmetic operations (such as those described in bugzilla issues 11588 and 11618) generate frozen objects that do not have a valid address-of, which can be troublesome when using synthetic children providers. Transferring the address-of the live object solves these issues and provides the expected user-level behavior. The other job we do in TransferAddress is adjust the value in the live address slot in the target for the "offset to top" in multiply inherited class hierarchies.

Definition at line 40 of file ExpressionVariable.cpp.

References lldb_private::ValueObject::AddrAndType::address, lldb_private::eAddressTypeLoad, error(), lldb_private::Expressions, lldb_private::GetLog(), LLDB_INVALID_ADDRESS, LLDB_LOG, m_dyn_option, m_frozen_sp, m_live_sp, and lldb_private::ValueObject::AddrAndType::type.

◆ ValueUpdated()

void lldb_private::ExpressionVariable::ValueUpdated ( )
inline

Definition at line 52 of file ExpressionVariable.h.

References m_frozen_sp.

Member Data Documentation

◆ ID

char ExpressionVariable::ID
static

LLVM RTTI support.

Definition at line 30 of file ExpressionVariable.h.

◆ m_dyn_option

lldb::DynamicValueType lldb_private::ExpressionVariable::m_dyn_option = lldb::eNoDynamicValues

Definition at line 147 of file ExpressionVariable.h.

Referenced by PreserveDynamicOption(), and TransferAddress().

◆ m_flags

FlagType lldb_private::ExpressionVariable::m_flags

Definition at line 124 of file ExpressionVariable.h.

Referenced by ExpressionVariable().

◆ m_frozen_sp

lldb::ValueObjectSP lldb_private::ExpressionVariable::m_frozen_sp

These members should be private.

A value object whose value's data lives in host (lldb's) memory. The m_frozen_sp holds the data & type of the expression variable or result in the host. The m_frozen_sp also can present a dynamic value if one is available. The m_frozen_sp manages the copy of this value in m_frozen_sp that we insert in the target so that it can be referred to in future expressions. We don't actually use the contents of the live_sp to create the value in the target, that comes from the frozen sp. The live_sp is mostly to track the target-side of the value.

Definition at line 137 of file ExpressionVariable.h.

Referenced by GetName(), GetRegisterInfo(), GetValueObject(), SetCompilerType(), SetName(), SetRegisterInfo(), TransferAddress(), and ValueUpdated().

◆ m_live_sp

lldb::ValueObjectSP lldb_private::ExpressionVariable::m_live_sp

The ValueObject counterpart to m_frozen_sp that tracks the value in inferior memory.

This object may not always exist; its presence depends on whether it is logical for the value to exist in the inferior memory. For example, when evaluating a C++ expression that generates an r-value, such as a single function call, there is no memory address in the inferior to track.

Definition at line 144 of file ExpressionVariable.h.

Referenced by GetLiveObject(), and TransferAddress().


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