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>

Collaboration diagram for lldb_private::Scalar:
Collaboration graph
[legend]

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)
 
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. More...
 
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. More...
 
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
 
Status SetValueFromCString (const char *s, lldb::Encoding encoding, size_t byte_size)
 
Status SetValueFromData (const DataExtractor &data, lldb::Encoding encoding, size_t byte_size)
 

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 friend Scalar operator+ (const Scalar &lhs, const Scalar &rhs)
 
const friend Scalar operator- (Scalar lhs, Scalar rhs)
 
const friend Scalar operator/ (Scalar lhs, Scalar rhs)
 
const friend Scalar operator* (Scalar lhs, Scalar rhs)
 
const friend Scalar operator& (Scalar lhs, Scalar rhs)
 
const friend Scalar operator| (Scalar lhs, Scalar rhs)
 
const friend Scalar operator% (Scalar lhs, Scalar rhs)
 
const friend Scalar operator^ (Scalar lhs, Scalar rhs)
 
const friend Scalar operator<< (const Scalar &lhs, const Scalar &rhs)
 
const friend 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 198 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/12]

lldb_private::Scalar::Scalar ( )
inline

Definition at line 52 of file Scalar.h.

◆ Scalar() [2/12]

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

Definition at line 53 of file Scalar.h.

◆ Scalar() [3/12]

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

Definition at line 54 of file Scalar.h.

◆ Scalar() [4/12]

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

Definition at line 56 of file Scalar.h.

◆ Scalar() [5/12]

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

Definition at line 57 of file Scalar.h.

◆ Scalar() [6/12]

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

Definition at line 59 of file Scalar.h.

◆ Scalar() [7/12]

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

Definition at line 61 of file Scalar.h.

◆ Scalar() [8/12]

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

Definition at line 63 of file Scalar.h.

◆ Scalar() [9/12]

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

Definition at line 64 of file Scalar.h.

◆ Scalar() [10/12]

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

Definition at line 65 of file Scalar.h.

References m_float.

◆ Scalar() [11/12]

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

Definition at line 70 of file Scalar.h.

◆ Scalar() [12/12]

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

Definition at line 72 of file Scalar.h.

Member Function Documentation

◆ AbsoluteValue()

bool Scalar::AbsoluteValue ( )

Definition at line 472 of file Scalar.cpp.

◆ Clear()

void lldb_private::Scalar::Clear ( )
inline

◆ ClearBit()

bool Scalar::ClearBit ( uint32_t  bit)

Definition at line 868 of file Scalar.cpp.

References bit.

◆ Double()

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

Definition at line 382 of file Scalar.cpp.

◆ 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 362 of file Scalar.cpp.

◆ FloatPromote()

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

Definition at line 193 of file Scalar.cpp.

Referenced by PromoteToMaxType().

◆ GetAs()

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

Definition at line 285 of file Scalar.cpp.

References 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 113 of file Scalar.cpp.

Referenced by 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 42 of file Scalar.cpp.

◆ GetPromoKey()

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

Definition at line 30 of file Scalar.cpp.

Referenced by PromoteToMaxType().

◆ GetType()

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

Definition at line 148 of file Scalar.h.

References m_type.

Referenced by PromoteToMaxType().

◆ GetTypeAsCString()

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

Definition at line 102 of file Scalar.h.

References GetValueTypeAsCString(), and m_type.

◆ GetValue()

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

◆ GetValueTypeAsCString()

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

Definition at line 217 of file Scalar.cpp.

Referenced by GetTypeAsCString().

◆ IntegralPromote()

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

Definition at line 178 of file Scalar.cpp.

References lldb_private::bits().

Referenced by PromoteToMaxType().

◆ IsSigned()

bool Scalar::IsSigned ( ) const

Definition at line 229 of file Scalar.cpp.

◆ 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 402 of file Scalar.cpp.

◆ 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 503 of file Scalar.cpp.

◆ operator&=()

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

Definition at line 464 of file Scalar.cpp.

References m_integer, and m_type.

◆ operator+=()

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

Definition at line 407 of file Scalar.cpp.

References m_float, and m_integer.

◆ operator<<=()

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

Definition at line 425 of file Scalar.cpp.

References m_integer, and m_type.

◆ operator>>=()

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

Definition at line 442 of file Scalar.cpp.

References m_integer, and m_type.

◆ PromoteToMaxType()

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

Definition at line 55 of file Scalar.cpp.

References FloatPromote(), GetPromoKey(), GetType(), and IntegralPromote().

◆ SChar()

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

Definition at line 302 of file Scalar.cpp.

◆ SetBit()

bool Scalar::SetBit ( uint32_t  bit)

Definition at line 881 of file Scalar.cpp.

References bit.

◆ 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 433 of file Scalar.cpp.

References 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

◆ SInt128()

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

Definition at line 338 of file Scalar.cpp.

References ToAPInt().

◆ SLong()

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

Definition at line 324 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 310 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 173 of file Scalar.cpp.

References lldb_private::bits().

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

◆ UChar()

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

Definition at line 306 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

Definition at line 350 of file Scalar.cpp.

References ToAPInt().

Referenced by InterpreterStackFrame::AssignValue(), and lldb_private::DWARFExpression::Evaluate().

◆ 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 334 of file Scalar.cpp.

Referenced by lldb_private::Value::ConvertToLoadAddress(), lldb_private::DWARFExpression::Evaluate(), lldb_private::ValueObject::GetAddressOf(), lldb_private::IndirectCallEdge::GetCallee(), lldb_private::AppleThreadPlanStepThroughObjCTrampoline::GetDescription(), lldb_private::ItaniumABILanguageRuntime::GetExceptionObjectForThread(), lldb_private::ValueObject::GetExpressionPath(), lldb_private::ClangExpressionDeclMap::GetFunctionInfo(), SymbolFileDWARF::GetGlobalAranges(), 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::RegisterContextUnwind::ReadFrameAddress(), lldb_private::IRMemoryMap::ReadPointerFromMemory(), lldb_private::Target::ReadPointerFromMemory(), lldb_private::Process::ReadPointerFromMemory(), lldb_private::Target::ReadUnsignedIntegerFromMemory(), lldb_private::Process::ReadUnsignedIntegerFromMemory(), lldb_private::Value::ResolveValue(), lldb_private::RegisterContextUnwind::SavedLocationForRegister(), 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 489 of file Scalar.cpp.

◆ UShort()

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

Definition at line 314 of file Scalar.cpp.

Friends And Related Function Documentation

◆ operator!=

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

◆ operator%

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

◆ operator&

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

◆ operator*

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

◆ operator+

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

◆ operator-

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

◆ operator/

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

◆ operator<

bool operator< ( Scalar  lhs,
Scalar  rhs 
)
friend

◆ operator<<

const friend 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 friend Scalar operator>> ( const Scalar lhs,
const Scalar rhs 
)
friend

◆ operator^

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

◆ operator|

const friend 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: