LLDB mainline
|
#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 () |
Scalar & | operator+= (Scalar rhs) |
Scalar & | operator<<= (const Scalar &rhs) |
Scalar & | operator>>= (const Scalar &rhs) |
Scalar & | operator&= (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 > | |
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) |
|
protected |
|
inline |
bool Scalar::AbsoluteValue | ( | ) |
|
inline |
Definition at line 98 of file Scalar.h.
References e_void, m_integer, and m_type.
Referenced by lldb_private::Value::Clear(), lldb_private::StackFrame::GetFrameBaseValue(), lldb_private::CompilerType::GetValueAsScalar(), lldb_private::Value::ResolveValue(), and lldb_private::StackFrame::UpdatePreviousFrameFromCurrentFrame().
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().
llvm::APFloat Scalar::CreateAPFloatFromAPFloat | ( | lldb::BasicType | basic_type | ) |
Definition at line 834 of file Scalar.cpp.
References lldb::eBasicTypeDouble, lldb::eBasicTypeFloat, lldb::eBasicTypeLongDouble, and m_float.
Referenced by lldb_private::ValueObject::CastToBasicType().
llvm::APFloat Scalar::CreateAPFloatFromAPSInt | ( | lldb::BasicType | basic_type | ) |
Definition at line 814 of file Scalar.cpp.
References lldb::eBasicTypeDouble, lldb::eBasicTypeFloat, lldb::eBasicTypeLongDouble, and m_integer.
Referenced by lldb_private::ValueObject::CastToBasicType().
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().
bool Scalar::ExtractBitfield | ( | uint32_t | bit_size, |
uint32_t | bit_offset | ||
) |
Definition at line 797 of file Scalar.cpp.
References e_float, e_int, e_void, GetByteSize(), m_integer, and m_type.
Referenced by lldb_private::DWARFExpression::Evaluate(), lldb_private::ValueObject::ResolveValue(), and lldb_private::ValueObjectChild::UpdateValue().
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().
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().
|
inline |
Definition at line 186 of file Scalar.h.
References m_float.
Referenced by lldb_private::ValueObject::GetValueAsAPFloat().
|
inline |
Definition at line 184 of file Scalar.h.
References m_integer.
Referenced by lldb_private::ValueObject::GetValueAsAPSInt().
|
protected |
size_t Scalar::GetAsMemoryData | ( | void * | dst, |
size_t | dst_len, | ||
lldb::ByteOrder | dst_byte_order, | ||
Status & | error | ||
) | const |
Definition at line 772 of file Scalar.cpp.
References lldb_private::DataExtractor::CopyByteOrderedData(), error(), lldb_private::DataExtractor::GetByteSize(), and GetData().
Referenced by lldb_private::Value::AppendDataToHostBuffer(), InterpreterStackFrame::AssignValue(), InterpreterStackFrame::ResolveConstant(), lldb_private::IRMemoryMap::WriteScalarToMemory(), and lldb_private::Process::WriteScalarToMemory().
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().
size_t Scalar::GetByteSize | ( | ) | const |
Definition at line 132 of file Scalar.cpp.
References e_float, e_int, e_void, m_float, m_integer, and m_type.
Referenced by lldb_private::Value::AppendDataToHostBuffer(), lldb_private::DWARFExpression::Evaluate(), ExtractBitfield(), GetBytes(), lldb_private::RegisterValue::GetByteSize(), GetData(), lldb_private::Value::GetValueAsData(), SignExtend(), lldb_private::FunctionCaller::WriteFunctionArguments(), lldb_private::IRMemoryMap::WriteScalarToMemory(), and lldb_private::Process::WriteScalarToMemory().
bool Scalar::GetData | ( | DataExtractor & | data, |
size_t | limit_byte_size = UINT32_MAX |
||
) | const |
Definition at line 85 of file Scalar.cpp.
References lldb_private::DataExtractor::Clear(), lldb::eByteOrderBig, lldb::eByteOrderLittle, GetBytes(), GetByteSize(), lldb_private::endian::InlHostByteOrder(), lldb_private::DataExtractor::SetByteOrder(), and lldb_private::DataExtractor::SetData().
Referenced by GetAsMemoryData(), lldb::SBTypeStaticField::GetConstantValue(), lldb_private::Value::GetData(), lldb_private::Value::GetValueAsData(), lldb_private::ValueObject::SetValueFromCString(), and lldb_private::ValueObjectConstResult::ValueObjectConstResult().
|
staticprotected |
Definition at line 43 of file Scalar.cpp.
References e_float.
Referenced by FloatPromote(), and GetPromoKey().
|
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().
|
inline |
|
inline |
Definition at line 103 of file Scalar.h.
References GetValueTypeAsCString(), and m_type.
Referenced by GetValue().
void Scalar::GetValue | ( | Stream & | s, |
bool | show_type | ||
) | const |
Definition at line 156 of file Scalar.cpp.
References e_float, e_int, e_void, GetTypeAsCString(), m_float, m_integer, m_type, lldb_private::Stream::Printf(), and lldb_private::Stream::PutCString().
Referenced by lldb_private::Value::Dump(), lldb_private::operator<<(), and lldb_private::CommandInterpreter::PreprocessToken().
|
static |
Definition at line 218 of file Scalar.cpp.
References e_float, e_int, and e_void.
Referenced by GetTypeAsCString().
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().
bool Scalar::IsSigned | ( | ) | const |
|
inline |
Definition at line 107 of file Scalar.h.
References e_float, e_int, and m_type.
Referenced by lldb::SBTypeStaticField::GetConstantValue(), lldb_private::AppleObjCTrampolineHandler::GetStepThroughDispatchPlan(), and lldb_private::ValueObject::ResolveValue().
bool Scalar::IsZero | ( | ) | const |
Definition at line 144 of file Scalar.cpp.
References e_float, e_int, e_void, m_float, m_integer, and m_type.
Referenced by lldb_private::DWARFExpression::Evaluate(), IRInterpreter::Interpret(), lldb_private::operator%(), and lldb_private::operator/().
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().
|
inlinestaticprivate |
bool Scalar::MakeSigned | ( | ) |
Definition at line 242 of file Scalar.cpp.
References e_float, e_int, e_void, m_integer, and m_type.
Referenced by lldb_private::DWARFExpression::Evaluate(), lldb_private::ValueObject::GetValueAsSigned(), and IRInterpreter::Interpret().
bool Scalar::MakeUnsigned | ( | ) |
Definition at line 260 of file Scalar.cpp.
References e_float, e_int, e_void, m_integer, and m_type.
Referenced by InterpreterStackFrame::AssignValue(), lldb_private::ValueObject::GetValueAsUnsigned(), and IRInterpreter::Interpret().
bool Scalar::OnesComplement | ( | ) |
Definition at line 504 of file Scalar.cpp.
Definition at line 408 of file Scalar.cpp.
References e_float, e_int, e_void, m_float, m_integer, m_type, and PromoteToMaxType().
|
staticprotected |
Definition at line 56 of file Scalar.cpp.
References e_float, e_int, e_void, FloatPromote(), GetPromoKey(), GetType(), and IntegralPromote().
Referenced by lldb_private::operator%(), lldb_private::operator&(), lldb_private::operator*(), operator+=(), lldb_private::operator-(), lldb_private::operator/(), lldb_private::operator<(), lldb_private::operator==(), lldb_private::operator^(), and lldb_private::operator|().
signed char Scalar::SChar | ( | signed char | fail_value = 0 | ) | const |
Definition at line 303 of file Scalar.cpp.
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().
Status Scalar::SetValueFromCString | ( | const char * | s, |
lldb::Encoding | encoding, | ||
size_t | byte_size | ||
) |
Definition at line 631 of file Scalar.cpp.
References e_float, e_int, e_void, lldb::eEncodingIEEE754, lldb::eEncodingInvalid, lldb::eEncodingSint, lldb::eEncodingUint, lldb::eEncodingVector, error(), integer, m_float, m_integer, and m_type.
Referenced by lldb_private::ValueObject::SetValueFromCString().
Status Scalar::SetValueFromData | ( | const DataExtractor & | data, |
lldb::Encoding | encoding, | ||
size_t | byte_size | ||
) |
Definition at line 702 of file Scalar.cpp.
References e_int, lldb::eEncodingIEEE754, lldb::eEncodingInvalid, lldb::eEncodingSint, lldb::eEncodingUint, lldb::eEncodingVector, error(), lldb_private::DataExtractor::GetByteOrder(), lldb_private::DataExtractor::GetByteSize(), lldb_private::DataExtractor::GetDataStart(), lldb_private::DataExtractor::GetDouble(), lldb_private::DataExtractor::GetFloat(), lldb_private::DataExtractor::GetLongDouble(), lldb_private::endian::InlHostByteOrder(), m_integer, and m_type.
Referenced by lldb_private::RegisterValue::GetScalarValue(), and lldb_private::ValueObject::SetData().
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().
bool Scalar::SignExtend | ( | uint32_t | bit_pos | ) |
Definition at line 746 of file Scalar.cpp.
References e_float, e_int, e_void, GetByteSize(), m_integer, and m_type.
Referenced by ReadIntegerArgument(), lldb_private::Target::ReadScalarIntegerFromMemory(), lldb_private::Process::ReadScalarIntegerFromMemory(), and lldb_private::RegisterValue::SignExtend().
int Scalar::SInt | ( | int | fail_value = 0 | ) | const |
Definition at line 319 of file Scalar.cpp.
Referenced by lldb_private::ClassDescriptorV2::iVarsStorage::fill().
llvm::APInt Scalar::SInt128 | ( | const llvm::APInt & | fail_value | ) | const |
long Scalar::SLong | ( | long | fail_value = 0 | ) | const |
Definition at line 325 of file Scalar.cpp.
long long Scalar::SLongLong | ( | long long | fail_value = 0 | ) | const |
Definition at line 331 of file Scalar.cpp.
Referenced by lldb_private::ValueObject::GetValueAsSigned(), IRInterpreter::Interpret(), and lldb_private::Process::ReadSignedIntegerFromMemory().
short Scalar::SShort | ( | short | fail_value = 0 | ) | const |
Definition at line 311 of file Scalar.cpp.
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().
unsigned char Scalar::UChar | ( | unsigned char | fail_value = 0 | ) | const |
Definition at line 307 of file Scalar.cpp.
Referenced by lldb_private::RegisterValue::GetAsUInt8().
unsigned int Scalar::UInt | ( | unsigned int | fail_value = 0 | ) | const |
Definition at line 321 of file Scalar.cpp.
Referenced by lldb_private::RegisterValue::GetAsUInt32(), DynamicLoaderMacOS::NotifyBreakpointHit(), DynamicLoaderMacOSXDYLD::NotifyBreakpointHit(), lldb_private::AbortWithPayloadFrameRecognizer::RecognizeFrame(), PlatformPOSIX::UnloadImage(), and lldb_private::PlatformWindows::UnloadImage().
llvm::APInt Scalar::UInt128 | ( | const llvm::APInt & | fail_value | ) | const |
Definition at line 351 of file Scalar.cpp.
References e_float, e_int, e_void, m_float, m_integer, m_type, and ToAPInt().
Referenced by InterpreterStackFrame::AssignValue(), lldb_private::DWARFExpression::Evaluate(), and lldb_private::RegisterValue::GetAsUInt128().
unsigned long Scalar::ULong | ( | unsigned long | fail_value = 0 | ) | const |
Definition at line 327 of file Scalar.cpp.
Referenced by lldb_private::AppleObjCRuntimeV2::SharedCacheClassInfoExtractor::UpdateISAToDescriptorMap(), and lldb_private::AppleObjCRuntimeV2::DynamicClassInfoExtractor::UpdateISAToDescriptorMap().
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().
bool Scalar::UnaryNegate | ( | ) |
unsigned short Scalar::UShort | ( | unsigned short | fail_value = 0 | ) | const |
Definition at line 315 of file Scalar.cpp.
Referenced by lldb_private::RegisterValue::GetAsUInt16().
|
protected |
Definition at line 201 of file Scalar.h.
Referenced by AbsoluteValue(), CreateAPFloatFromAPFloat(), Double(), Float(), FloatPromote(), GetAPFloat(), GetAs(), GetBytes(), GetByteSize(), GetPromoKey(), GetValue(), IsZero(), lldb_private::operator*(), operator+=(), lldb_private::operator-(), lldb_private::operator/(), lldb_private::operator<(), lldb_private::operator==(), Scalar(), SetValueFromCString(), SInt128(), UInt128(), and UnaryNegate().
|
protected |
Definition at line 200 of file Scalar.h.
Referenced by AbsoluteValue(), Clear(), ClearBit(), CreateAPFloatFromAPSInt(), Double(), ExtractBitfield(), Float(), FloatPromote(), GetAPSInt(), GetAs(), GetBytes(), GetByteSize(), GetPromoKey(), GetValue(), IntegralPromote(), IsSigned(), IsZero(), MakeSigned(), MakeUnsigned(), OnesComplement(), lldb_private::operator%(), lldb_private::operator&(), operator&=(), lldb_private::operator*(), operator+=(), lldb_private::operator-(), lldb_private::operator/(), lldb_private::operator<(), operator<<=(), lldb_private::operator==(), operator>>=(), lldb_private::operator^(), lldb_private::operator|(), SetBit(), SetValueFromCString(), SetValueFromData(), ShiftRightLogical(), SignExtend(), SInt128(), TruncOrExtendTo(), UInt128(), and UnaryNegate().
|
protected |
Definition at line 199 of file Scalar.h.
Referenced by AbsoluteValue(), Clear(), ClearBit(), Double(), ExtractBitfield(), Float(), FloatPromote(), GetAs(), GetBytes(), GetByteSize(), GetPromoKey(), GetType(), GetTypeAsCString(), GetValue(), IntegralPromote(), IsSigned(), IsValid(), IsZero(), MakeSigned(), MakeUnsigned(), OnesComplement(), lldb_private::operator%(), lldb_private::operator&(), operator&=(), lldb_private::operator*(), operator+=(), lldb_private::operator-(), lldb_private::operator/(), lldb_private::operator<(), operator<<=(), lldb_private::operator==(), operator>>=(), lldb_private::operator^(), lldb_private::operator|(), SetBit(), SetValueFromCString(), SetValueFromData(), ShiftRightLogical(), SignExtend(), SInt128(), UInt128(), and UnaryNegate().