LLDB mainline
Public Types | Public Member Functions | Static Public Member Functions | Protected Types | Protected Member Functions | Static Protected Member Functions | Protected Attributes | Static Private Member Functions | Friends | List of all members
lldb_private::Scalar Class Reference

#include <Scalar.h>

Public Types

enum  Type { e_void = 0 , e_int , e_float }
 

Public Member Functions

 Scalar ()
 
 Scalar (int v)
 
 Scalar (unsigned int v)
 
 Scalar (long v)
 
 Scalar (unsigned long v)
 
 Scalar (long long v)
 
 Scalar (unsigned long long v)
 
 Scalar (float v)
 
 Scalar (double v)
 
 Scalar (long double v)
 
 Scalar (llvm::APInt v)
 
 Scalar (llvm::APSInt v)
 
 Scalar (llvm::APFloat v)
 
bool SignExtend (uint32_t bit_pos)
 
bool ExtractBitfield (uint32_t bit_size, uint32_t bit_offset)
 
bool SetBit (uint32_t bit)
 
bool ClearBit (uint32_t bit)
 
void GetBytes (llvm::MutableArrayRef< uint8_t > storage) const
 Store the binary representation of this value into the given storage.
 
size_t GetByteSize () const
 
bool GetData (DataExtractor &data, size_t limit_byte_size=UINT32_MAX) const
 
size_t GetAsMemoryData (void *dst, size_t dst_len, lldb::ByteOrder dst_byte_order, Status &error) const
 
bool IsZero () const
 
void Clear ()
 
const char * GetTypeAsCString () const
 
void GetValue (Stream &s, bool show_type) const
 
bool IsValid () const
 
void TruncOrExtendTo (uint16_t bits, bool sign)
 Convert to an integer with bits and the given signedness.
 
bool IntegralPromote (uint16_t bits, bool sign)
 
bool FloatPromote (const llvm::fltSemantics &semantics)
 
bool IsSigned () const
 
bool MakeSigned ()
 
bool MakeUnsigned ()
 
Scalaroperator+= (Scalar rhs)
 
Scalaroperator<<= (const Scalar &rhs)
 
Scalaroperator>>= (const Scalar &rhs)
 
Scalaroperator&= (const Scalar &rhs)
 
bool ShiftRightLogical (const Scalar &rhs)
 
bool AbsoluteValue ()
 
bool UnaryNegate ()
 
bool OnesComplement ()
 
Scalar::Type GetType () const
 
int SInt (int fail_value=0) const
 
unsigned char UChar (unsigned char fail_value=0) const
 
signed char SChar (signed char fail_value=0) const
 
unsigned short UShort (unsigned short fail_value=0) const
 
short SShort (short fail_value=0) const
 
unsigned int UInt (unsigned int fail_value=0) const
 
long SLong (long fail_value=0) const
 
unsigned long ULong (unsigned long fail_value=0) const
 
long long SLongLong (long long fail_value=0) const
 
unsigned long long ULongLong (unsigned long long fail_value=0) const
 
llvm::APInt SInt128 (const llvm::APInt &fail_value) const
 
llvm::APInt UInt128 (const llvm::APInt &fail_value) const
 
float Float (float fail_value=0.0f) const
 
double Double (double fail_value=0.0) const
 
long double LongDouble (long double fail_value=0.0) const
 
llvm::APSInt GetAPSInt () const
 
llvm::APFloat GetAPFloat () const
 
Status SetValueFromCString (const char *s, lldb::Encoding encoding, size_t byte_size)
 
Status SetValueFromData (const DataExtractor &data, lldb::Encoding encoding, size_t byte_size)
 
llvm::APFloat CreateAPFloatFromAPSInt (lldb::BasicType basic_type)
 
llvm::APFloat CreateAPFloatFromAPFloat (lldb::BasicType basic_type)
 

Static Public Member Functions

static const char * GetValueTypeAsCString (Scalar::Type value_type)
 

Protected Types

using PromotionKey = std::tuple< Type, unsigned, bool >
 

Protected Member Functions

template<typename T >
GetAs (T fail_value) const
 
PromotionKey GetPromoKey () const
 

Static Protected Member Functions

static Type PromoteToMaxType (Scalar &lhs, Scalar &rhs)
 
static PromotionKey GetFloatPromoKey (const llvm::fltSemantics &semantics)
 

Protected Attributes

Scalar::Type m_type = e_void
 
llvm::APSInt m_integer
 
llvm::APFloat m_float
 

Static Private Member Functions

template<typename T >
static llvm::APSInt MakeAPSInt (T v)
 

Friends

const Scalar operator+ (const Scalar &lhs, const Scalar &rhs)
 
const Scalar operator- (Scalar lhs, Scalar rhs)
 
const Scalar operator/ (Scalar lhs, Scalar rhs)
 
const Scalar operator* (Scalar lhs, Scalar rhs)
 
const Scalar operator& (Scalar lhs, Scalar rhs)
 
const Scalar operator| (Scalar lhs, Scalar rhs)
 
const Scalar operator% (Scalar lhs, Scalar rhs)
 
const Scalar operator^ (Scalar lhs, Scalar rhs)
 
const Scalar operator<< (const Scalar &lhs, const Scalar &rhs)
 
const Scalar operator>> (const Scalar &lhs, const Scalar &rhs)
 
bool operator== (Scalar lhs, Scalar rhs)
 
bool operator!= (const Scalar &lhs, const Scalar &rhs)
 
bool operator< (Scalar lhs, Scalar rhs)
 
bool operator<= (const Scalar &lhs, const Scalar &rhs)
 
bool operator> (const Scalar &lhs, const Scalar &rhs)
 
bool operator>= (const Scalar &lhs, const Scalar &rhs)
 

Detailed Description

Definition at line 34 of file Scalar.h.

Member Typedef Documentation

◆ PromotionKey

using lldb_private::Scalar::PromotionKey = std::tuple<Type, unsigned, bool>
protected

Definition at line 207 of file Scalar.h.

Member Enumeration Documentation

◆ Type

Enumerator
e_void 
e_int 
e_float 

Definition at line 45 of file Scalar.h.

Constructor & Destructor Documentation

◆ Scalar() [1/13]

lldb_private::Scalar::Scalar ( )
inline

Definition at line 52 of file Scalar.h.

◆ Scalar() [2/13]

lldb_private::Scalar::Scalar ( int  v)
inline

Definition at line 53 of file Scalar.h.

◆ Scalar() [3/13]

lldb_private::Scalar::Scalar ( unsigned int  v)
inline

Definition at line 54 of file Scalar.h.

◆ Scalar() [4/13]

lldb_private::Scalar::Scalar ( long  v)
inline

Definition at line 56 of file Scalar.h.

◆ Scalar() [5/13]

lldb_private::Scalar::Scalar ( unsigned long  v)
inline

Definition at line 57 of file Scalar.h.

◆ Scalar() [6/13]

lldb_private::Scalar::Scalar ( long long  v)
inline

Definition at line 59 of file Scalar.h.

◆ Scalar() [7/13]

lldb_private::Scalar::Scalar ( unsigned long long  v)
inline

Definition at line 61 of file Scalar.h.

◆ Scalar() [8/13]

lldb_private::Scalar::Scalar ( float  v)
inline

Definition at line 63 of file Scalar.h.

◆ Scalar() [9/13]

lldb_private::Scalar::Scalar ( double  v)
inline

Definition at line 64 of file Scalar.h.

◆ Scalar() [10/13]

lldb_private::Scalar::Scalar ( long double  v)
inline

Definition at line 65 of file Scalar.h.

References m_float.

◆ Scalar() [11/13]

lldb_private::Scalar::Scalar ( llvm::APInt  v)
inline

Definition at line 70 of file Scalar.h.

◆ Scalar() [12/13]

lldb_private::Scalar::Scalar ( llvm::APSInt  v)
inline

Definition at line 72 of file Scalar.h.

◆ Scalar() [13/13]

lldb_private::Scalar::Scalar ( llvm::APFloat  v)
inline

Definition at line 74 of file Scalar.h.

Member Function Documentation

◆ AbsoluteValue()

bool Scalar::AbsoluteValue ( )

Definition at line 473 of file Scalar.cpp.

References e_float, e_int, e_void, m_float, m_integer, and m_type.

◆ Clear()

void lldb_private::Scalar::Clear ( )
inline

◆ ClearBit()

bool Scalar::ClearBit ( uint32_t  bit)

Definition at line 909 of file Scalar.cpp.

References bit, e_float, e_int, e_void, m_integer, and m_type.

Referenced by lldb_private::RegisterValue::ClearBit().

◆ CreateAPFloatFromAPFloat()

llvm::APFloat Scalar::CreateAPFloatFromAPFloat ( lldb::BasicType  basic_type)

◆ CreateAPFloatFromAPSInt()

llvm::APFloat Scalar::CreateAPFloatFromAPSInt ( lldb::BasicType  basic_type)

◆ Double()

double Scalar::Double ( double  fail_value = 0.0) const

Definition at line 383 of file Scalar.cpp.

References e_float, e_int, e_void, m_float, m_integer, and m_type.

Referenced by lldb_private::RegisterValue::GetAsDouble(), and LongDouble().

◆ ExtractBitfield()

bool Scalar::ExtractBitfield ( uint32_t  bit_size,
uint32_t  bit_offset 
)

◆ Float()

float Scalar::Float ( float  fail_value = 0.0f) const

Definition at line 363 of file Scalar.cpp.

References e_float, e_int, e_void, m_float, m_integer, and m_type.

Referenced by lldb_private::RegisterValue::GetAsFloat().

◆ FloatPromote()

bool Scalar::FloatPromote ( const llvm::fltSemantics &  semantics)

Definition at line 194 of file Scalar.cpp.

References e_float, e_int, e_void, GetFloatPromoKey(), m_float, m_integer, and m_type.

Referenced by PromoteToMaxType().

◆ GetAPFloat()

llvm::APFloat lldb_private::Scalar::GetAPFloat ( ) const
inline

Definition at line 186 of file Scalar.h.

References m_float.

Referenced by lldb_private::ValueObject::GetValueAsAPFloat().

◆ GetAPSInt()

llvm::APSInt lldb_private::Scalar::GetAPSInt ( ) const
inline

Definition at line 184 of file Scalar.h.

References m_integer.

Referenced by lldb_private::ValueObject::GetValueAsAPSInt().

◆ GetAs()

template<typename T >
T Scalar::GetAs ( fail_value) const
protected

Definition at line 286 of file Scalar.cpp.

References e_float, e_int, e_void, m_float, m_integer, m_type, and ToAPInt().

◆ GetAsMemoryData()

size_t Scalar::GetAsMemoryData ( void *  dst,
size_t  dst_len,
lldb::ByteOrder  dst_byte_order,
Status error 
) const

◆ GetBytes()

void Scalar::GetBytes ( llvm::MutableArrayRef< uint8_t >  storage) const

Store the binary representation of this value into the given storage.

Exactly GetByteSize() bytes will be stored, and the buffer must be large enough to hold this data.

Definition at line 114 of file Scalar.cpp.

References e_float, e_int, e_void, GetByteSize(), m_float, m_integer, and m_type.

Referenced by lldb_private::RegisterValue::GetBytes(), GetData(), and lldb_private::ValueObjectConstResult::ValueObjectConstResult().

◆ GetByteSize()

size_t Scalar::GetByteSize ( ) const

◆ GetData()

bool Scalar::GetData ( DataExtractor data,
size_t  limit_byte_size = UINT32_MAX 
) const

◆ GetFloatPromoKey()

Scalar::PromotionKey Scalar::GetFloatPromoKey ( const llvm::fltSemantics &  semantics)
staticprotected

Definition at line 43 of file Scalar.cpp.

References e_float.

Referenced by FloatPromote(), and GetPromoKey().

◆ GetPromoKey()

Scalar::PromotionKey Scalar::GetPromoKey ( ) const
protected

Definition at line 31 of file Scalar.cpp.

References e_float, e_int, e_void, GetFloatPromoKey(), m_float, m_integer, and m_type.

Referenced by IntegralPromote(), and PromoteToMaxType().

◆ GetType()

Scalar::Type lldb_private::Scalar::GetType ( ) const
inline

Definition at line 149 of file Scalar.h.

References m_type.

Referenced by PromoteToMaxType().

◆ GetTypeAsCString()

const char * lldb_private::Scalar::GetTypeAsCString ( ) const
inline

Definition at line 103 of file Scalar.h.

References GetValueTypeAsCString(), and m_type.

Referenced by GetValue().

◆ GetValue()

void Scalar::GetValue ( Stream s,
bool  show_type 
) const

◆ GetValueTypeAsCString()

const char * Scalar::GetValueTypeAsCString ( Scalar::Type  value_type)
static

Definition at line 218 of file Scalar.cpp.

References e_float, e_int, and e_void.

Referenced by GetTypeAsCString().

◆ IntegralPromote()

bool Scalar::IntegralPromote ( uint16_t  bits,
bool  sign 
)

Definition at line 179 of file Scalar.cpp.

References lldb_private::bits(), e_float, e_int, e_void, GetPromoKey(), m_integer, and m_type.

Referenced by PromoteToMaxType().

◆ IsSigned()

bool Scalar::IsSigned ( ) const

Definition at line 230 of file Scalar.cpp.

References e_float, e_int, e_void, m_integer, and m_type.

◆ IsValid()

bool lldb_private::Scalar::IsValid ( ) const
inline

◆ IsZero()

bool Scalar::IsZero ( ) const

◆ LongDouble()

long double Scalar::LongDouble ( long double  fail_value = 0.0) const

No way to get more precision at the moment.

Definition at line 403 of file Scalar.cpp.

References Double().

Referenced by lldb_private::RegisterValue::GetAsLongDouble().

◆ MakeAPSInt()

template<typename T >
static llvm::APSInt lldb_private::Scalar::MakeAPSInt ( v)
inlinestaticprivate

Definition at line 36 of file Scalar.h.

◆ MakeSigned()

bool Scalar::MakeSigned ( )

◆ MakeUnsigned()

bool Scalar::MakeUnsigned ( )

◆ OnesComplement()

bool Scalar::OnesComplement ( )

Definition at line 504 of file Scalar.cpp.

References e_int, m_integer, and m_type.

◆ operator&=()

Scalar & Scalar::operator&= ( const Scalar rhs)

Definition at line 465 of file Scalar.cpp.

References e_int, e_void, m_integer, and m_type.

◆ operator+=()

Scalar & Scalar::operator+= ( Scalar  rhs)

Definition at line 408 of file Scalar.cpp.

References e_float, e_int, e_void, m_float, m_integer, m_type, and PromoteToMaxType().

◆ operator<<=()

Scalar & Scalar::operator<<= ( const Scalar rhs)

Definition at line 426 of file Scalar.cpp.

References e_int, e_void, m_integer, and m_type.

◆ operator>>=()

Scalar & Scalar::operator>>= ( const Scalar rhs)

Definition at line 443 of file Scalar.cpp.

References e_float, e_int, e_void, m_integer, and m_type.

◆ PromoteToMaxType()

Scalar::Type Scalar::PromoteToMaxType ( Scalar lhs,
Scalar rhs 
)
staticprotected

◆ SChar()

signed char Scalar::SChar ( signed char  fail_value = 0) const

Definition at line 303 of file Scalar.cpp.

◆ SetBit()

bool Scalar::SetBit ( uint32_t  bit)

Definition at line 922 of file Scalar.cpp.

References bit, e_float, e_int, e_void, m_integer, and m_type.

Referenced by lldb_private::RegisterValue::SetBit().

◆ SetValueFromCString()

Status Scalar::SetValueFromCString ( const char *  s,
lldb::Encoding  encoding,
size_t  byte_size 
)

◆ SetValueFromData()

Status Scalar::SetValueFromData ( const DataExtractor data,
lldb::Encoding  encoding,
size_t  byte_size 
)

◆ ShiftRightLogical()

bool Scalar::ShiftRightLogical ( const Scalar rhs)

Definition at line 434 of file Scalar.cpp.

References e_int, e_void, m_integer, and m_type.

Referenced by IRInterpreter::Interpret().

◆ SignExtend()

bool Scalar::SignExtend ( uint32_t  bit_pos)

◆ SInt()

int Scalar::SInt ( int  fail_value = 0) const

Definition at line 319 of file Scalar.cpp.

Referenced by lldb_private::ClassDescriptorV2::iVarsStorage::fill().

◆ SInt128()

llvm::APInt Scalar::SInt128 ( const llvm::APInt &  fail_value) const

Definition at line 339 of file Scalar.cpp.

References e_float, e_int, e_void, m_float, m_integer, m_type, and ToAPInt().

◆ SLong()

long Scalar::SLong ( long  fail_value = 0) const

Definition at line 325 of file Scalar.cpp.

◆ SLongLong()

long long Scalar::SLongLong ( long long  fail_value = 0) const

◆ SShort()

short Scalar::SShort ( short  fail_value = 0) const

Definition at line 311 of file Scalar.cpp.

◆ TruncOrExtendTo()

void Scalar::TruncOrExtendTo ( uint16_t  bits,
bool  sign 
)

Convert to an integer with bits and the given signedness.

Definition at line 174 of file Scalar.cpp.

References lldb_private::bits(), and m_integer.

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

◆ UChar()

unsigned char Scalar::UChar ( unsigned char  fail_value = 0) const

Definition at line 307 of file Scalar.cpp.

Referenced by lldb_private::RegisterValue::GetAsUInt8().

◆ UInt()

unsigned int Scalar::UInt ( unsigned int  fail_value = 0) const

◆ UInt128()

llvm::APInt Scalar::UInt128 ( const llvm::APInt &  fail_value) const

◆ ULong()

unsigned long Scalar::ULong ( unsigned long  fail_value = 0) const

◆ ULongLong()

unsigned long long Scalar::ULongLong ( unsigned long long  fail_value = 0) const

Definition at line 335 of file Scalar.cpp.

Referenced by lldb_private::Value::ConvertToLoadAddress(), lldb_private::DWARFExpression::Evaluate(), lldb_private::ValueObject::GetAddressOf(), lldb_private::RegisterValue::GetAsUInt64(), lldb_private::AppleThreadPlanStepThroughObjCTrampoline::GetDescription(), lldb_private::ItaniumABILanguageRuntime::GetExceptionObjectForThread(), lldb_private::ValueObject::GetExpressionPath(), lldb_private::ClangExpressionDeclMap::GetFunctionInfo(), lldb_private::ValueObject::GetLocationAsCStringImpl(), lldb_private::AppleObjCRuntime::GetObjectDescription(), lldb_private::ValueObject::GetPointeeData(), lldb_private::ValueObject::GetPointerValue(), lldb_private::AppleObjCTrampolineHandler::GetStepThroughDispatchPlan(), lldb_private::Value::GetValueAsData(), lldb_private::ValueObject::GetValueAsUnsigned(), lldb_private::ClangExpressionDeclMap::GetVariableValue(), IRInterpreter::Interpret(), lldb_private::ValueObject::IsLogicalTrue(), lldb_private::ThreadPlanAssemblyTracer::Log(), DynamicLoaderMacOS::NotifyBreakpointHit(), DynamicLoaderMacOSXDYLD::NotifyBreakpointHit(), ObjCExceptionRecognizedStackFrame::ObjCExceptionRecognizedStackFrame(), lldb_private::Value::operator=(), lldb_private::StopInfoWatchpoint::PerformAction(), lldb_private::Target::ReadPointerFromMemory(), lldb_private::IRMemoryMap::ReadPointerFromMemory(), lldb_private::Process::ReadPointerFromMemory(), lldb_private::Target::ReadUnsignedIntegerFromMemory(), lldb_private::Process::ReadUnsignedIntegerFromMemory(), lldb_private::AbortWithPayloadFrameRecognizer::RecognizeFrame(), lldb_private::Value::ResolveValue(), lldb_private::ValueObject::SetData(), lldb_private::ValueObject::SetValueFromCString(), lldb_private::AppleThreadPlanStepThroughObjCTrampoline::ShouldStop(), lldb_private::ValueObjectChild::UpdateValue(), and lldb_private::Value::Value().

◆ UnaryNegate()

bool Scalar::UnaryNegate ( )

Definition at line 490 of file Scalar.cpp.

References e_float, e_int, e_void, m_float, m_integer, and m_type.

◆ UShort()

unsigned short Scalar::UShort ( unsigned short  fail_value = 0) const

Definition at line 315 of file Scalar.cpp.

Referenced by lldb_private::RegisterValue::GetAsUInt16().

Friends And Related Function Documentation

◆ operator!=

bool operator!= ( const Scalar lhs,
const Scalar rhs 
)
friend

◆ operator%

const Scalar operator% ( Scalar  lhs,
Scalar  rhs 
)
friend

◆ operator&

const Scalar operator& ( Scalar  lhs,
Scalar  rhs 
)
friend

◆ operator*

const Scalar operator* ( Scalar  lhs,
Scalar  rhs 
)
friend

◆ operator+

const Scalar operator+ ( const Scalar lhs,
const Scalar rhs 
)
friend

◆ operator-

const Scalar operator- ( Scalar  lhs,
Scalar  rhs 
)
friend

◆ operator/

const Scalar operator/ ( Scalar  lhs,
Scalar  rhs 
)
friend

◆ operator<

bool operator< ( Scalar  lhs,
Scalar  rhs 
)
friend

◆ operator<<

const Scalar operator<< ( const Scalar lhs,
const Scalar rhs 
)
friend

◆ operator<=

bool operator<= ( const Scalar lhs,
const Scalar rhs 
)
friend

◆ operator==

bool operator== ( Scalar  lhs,
Scalar  rhs 
)
friend

◆ operator>

bool operator> ( const Scalar lhs,
const Scalar rhs 
)
friend

◆ operator>=

bool operator>= ( const Scalar lhs,
const Scalar rhs 
)
friend

◆ operator>>

const Scalar operator>> ( const Scalar lhs,
const Scalar rhs 
)
friend

◆ operator^

const Scalar operator^ ( Scalar  lhs,
Scalar  rhs 
)
friend

◆ operator|

const Scalar operator| ( Scalar  lhs,
Scalar  rhs 
)
friend

Member Data Documentation

◆ m_float

llvm::APFloat lldb_private::Scalar::m_float
protected

◆ m_integer

llvm::APSInt lldb_private::Scalar::m_integer
protected

◆ m_type

Scalar::Type lldb_private::Scalar::m_type = e_void
protected

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