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 (uint8_t *storage, size_t length) const |
Store the binary representation of this value into the given storage. | |
void | GetBytes (llvm::MutableArrayRef< uint8_t > storage) const |
size_t | GetByteSize () const |
bool | GetData (DataExtractor &data) const |
Get data with a byte size of GetByteSize(). | |
bool | GetData (DataExtractor &data, size_t result_byte_size) const |
Get data with a byte size forced to result_byte_size . | |
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 | |
llvm::APFloat::cmpResult | compare (Scalar lhs, Scalar rhs) |
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== (const Scalar &lhs, const 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) |
bool | operator> (const Scalar &lhs, const Scalar &rhs) |
bool | operator>= (const Scalar &lhs, const Scalar &rhs) |
|
protected |
|
inline |
Definition at line 52 of file Scalar.h.
References m_float.
Referenced by compare, operator!=, operator%, operator&, operator&=(), operator*, operator+, operator+=(), operator-, operator/, operator<, operator<<, operator<<=(), operator<=, operator==, operator>, operator>=, operator>>, operator>>=(), operator^, operator|, PromoteToMaxType(), and ShiftRightLogical().
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
bool Scalar::AbsoluteValue | ( | ) |
|
inline |
bool Scalar::ClearBit | ( | uint32_t | bit | ) |
Definition at line 918 of file Scalar.cpp.
References lldb_private::bit(), e_float, e_int, e_void, m_integer, and m_type.
llvm::APFloat Scalar::CreateAPFloatFromAPFloat | ( | lldb::BasicType | basic_type | ) |
Definition at line 850 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 830 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 413 of file Scalar.cpp.
References e_float, e_int, e_void, m_float, m_integer, and m_type.
Referenced by LongDouble().
bool Scalar::ExtractBitfield | ( | uint32_t | bit_size, |
uint32_t | bit_offset ) |
Definition at line 813 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 |
bool Scalar::FloatPromote | ( | const llvm::fltSemantics & | semantics | ) |
Definition at line 224 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 190 of file Scalar.h.
References m_float.
Referenced by lldb_private::ValueObject::GetValueAsAPFloat().
|
inline |
Definition at line 188 of file Scalar.h.
References m_integer.
Referenced by lldb_private::formatters::MsvcStlVectorBoolSyntheticFrontEnd::GetChildAtIndex(), and 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 788 of file Scalar.cpp.
References lldb_private::DataExtractor::CopyByteOrderedData(), error(), lldb_private::Status::FromErrorString(), lldb_private::DataExtractor::GetByteSize(), and GetData().
Referenced by lldb_private::Value::AppendDataToHostBuffer(), InterpreterStackFrame::AssignValue(), lldb_private::RegisterContextUnifiedCore::RegisterContextUnifiedCore(), InterpreterStackFrame::ResolveConstant(), lldb_private::IRMemoryMap::WriteScalarToMemory(), and lldb_private::Process::WriteScalarToMemory().
void Scalar::GetBytes | ( | llvm::MutableArrayRef< uint8_t > | storage | ) | const |
Definition at line 144 of file Scalar.cpp.
References e_float, e_int, e_void, GetByteSize(), m_float, m_integer, and m_type.
void Scalar::GetBytes | ( | uint8_t * | storage, |
size_t | length ) 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 138 of file Scalar.cpp.
References GetBytes(), and GetByteSize().
Referenced by GetBytes(), GetData(), and GetData().
size_t Scalar::GetByteSize | ( | ) | const |
Definition at line 162 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(), GetBytes(), GetData(), GetData(), SignExtend(), lldb_private::FunctionCaller::WriteFunctionArguments(), lldb_private::IRMemoryMap::WriteScalarToMemory(), and lldb_private::Process::WriteScalarToMemory().
bool Scalar::GetData | ( | DataExtractor & | data | ) | const |
Get data with a byte size of GetByteSize().
Definition at line 85 of file Scalar.cpp.
References lldb_private::DataExtractor::Clear(), GetBytes(), GetByteSize(), lldb_private::endian::InlHostByteOrder(), lldb_private::DataExtractor::SetByteOrder(), and lldb_private::DataExtractor::SetData().
Referenced by GetAsMemoryData(), lldb::SBTypeStaticField::GetConstantValue(), and lldb_private::ValueObject::SetValueFromCString().
bool Scalar::GetData | ( | DataExtractor & | data, |
size_t | result_byte_size ) const |
Get data with a byte size forced to result_byte_size
.
Definition at line 98 of file Scalar.cpp.
References lldb_private::DataExtractor::Clear(), lldb::eByteOrderBig, GetBytes(), GetByteSize(), lldb_private::endian::InlHostByteOrder(), lldb_private::DataExtractor::SetByteOrder(), and lldb_private::DataExtractor::SetData().
|
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 107 of file Scalar.h.
References GetValueTypeAsCString(), and m_type.
Referenced by GetValue().
Definition at line 186 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::operator<<(), and lldb_private::CommandInterpreter::PreprocessToken().
|
static |
Definition at line 248 of file Scalar.cpp.
References e_float, e_int, and e_void.
Referenced by GetTypeAsCString().
Definition at line 209 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 111 of file Scalar.h.
References e_float, e_int, and m_type.
Referenced by lldb_private::formatters::MsvcStlVectorBoolSyntheticFrontEnd::GetChildAtIndex(), lldb::SBTypeStaticField::GetConstantValue(), lldb_private::AppleObjCTrampolineHandler::GetStepThroughDispatchPlan(), and lldb_private::ValueObject::ResolveValue().
bool Scalar::IsZero | ( | ) | const |
Definition at line 174 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 433 of file Scalar.cpp.
References Double().
|
inlinestaticprivate |
bool Scalar::MakeSigned | ( | ) |
Definition at line 272 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 290 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 520 of file Scalar.cpp.
Definition at line 438 of file Scalar.cpp.
References e_float, e_int, e_void, m_float, m_integer, m_type, PromoteToMaxType(), and Scalar().
|
staticprotected |
Definition at line 56 of file Scalar.cpp.
References e_float, e_int, e_void, FloatPromote(), GetPromoKey(), GetType(), IntegralPromote(), and Scalar().
Referenced by lldb_private::compare(), lldb_private::operator%(), lldb_private::operator&(), lldb_private::operator*(), 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 333 of file Scalar.cpp.
References GetAs().
bool Scalar::SetBit | ( | uint32_t | bit | ) |
Definition at line 931 of file Scalar.cpp.
References lldb_private::bit(), e_float, e_int, e_void, m_integer, and m_type.
Status Scalar::SetValueFromCString | ( | const char * | s, |
lldb::Encoding | encoding, | ||
size_t | byte_size ) |
Definition at line 648 of file Scalar.cpp.
References e_float, e_int, e_void, lldb::eEncodingIEEE754, lldb::eEncodingInvalid, lldb::eEncodingSint, lldb::eEncodingUint, lldb::eEncodingVector, error(), lldb_private::Status::FromError(), lldb_private::Status::FromErrorString(), lldb_private::Status::FromErrorStringWithFormatv(), 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 718 of file Scalar.cpp.
References e_int, lldb::eEncodingIEEE754, lldb::eEncodingInvalid, lldb::eEncodingSint, lldb::eEncodingUint, lldb::eEncodingVector, error(), lldb_private::Status::FromErrorString(), lldb_private::Status::FromErrorStringWithFormatv(), 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().
Definition at line 464 of file Scalar.cpp.
References e_int, e_void, m_integer, m_type, and Scalar().
Referenced by IRInterpreter::Interpret().
bool Scalar::SignExtend | ( | uint32_t | bit_pos | ) |
Definition at line 762 of file Scalar.cpp.
References e_float, e_int, e_void, GetByteSize(), m_integer, and m_type.
Referenced by ReadIntegerArgument(), ReadIntegerArgument(), ReadIntegerArgument(), ReadIntegerArgument(), ReadIntegerArgument(), lldb_private::Process::ReadScalarIntegerFromMemory(), and lldb_private::Target::ReadScalarIntegerFromMemory().
int Scalar::SInt | ( | int | fail_value = 0 | ) | const |
Definition at line 349 of file Scalar.cpp.
References GetAs().
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 355 of file Scalar.cpp.
References GetAs().
long long Scalar::SLongLong | ( | long long | fail_value = 0 | ) | const |
Definition at line 361 of file Scalar.cpp.
References GetAs().
Referenced by lldb_private::ValueObject::GetValueAsSigned(), lldb_private::Process::ReadSignedIntegerFromMemory(), and lldb_private::Target::ReadSignedIntegerFromMemory().
short Scalar::SShort | ( | short | fail_value = 0 | ) | const |
Definition at line 341 of file Scalar.cpp.
References GetAs().
void Scalar::TruncOrExtendTo | ( | uint16_t | bits, |
bool | sign ) |
Convert to an integer with bits
and the given signedness.
Definition at line 204 of file Scalar.cpp.
References lldb_private::bits(), and m_integer.
Referenced by lldb_private::DWARFExpression::Evaluate(), and lldb_private::dil::Interpreter::Visit().
unsigned char Scalar::UChar | ( | unsigned char | fail_value = 0 | ) | const |
Definition at line 337 of file Scalar.cpp.
References GetAs().
unsigned int Scalar::UInt | ( | unsigned int | fail_value = 0 | ) | const |
Definition at line 351 of file Scalar.cpp.
References GetAs().
Referenced by DynamicLoaderMacOS::NotifyBreakpointHit(), DynamicLoaderMacOSXDYLD::NotifyBreakpointHit(), lldb_private::AbortWithPayloadFrameRecognizer::RecognizeFrame(), and lldb_private::PlatformWindows::UnloadImage().
llvm::APInt Scalar::UInt128 | ( | const llvm::APInt & | fail_value | ) | const |
Definition at line 381 of file Scalar.cpp.
References e_float, e_int, e_void, m_float, m_integer, m_type, and ToAPInt().
Referenced by InterpreterStackFrame::AssignValue().
unsigned long Scalar::ULong | ( | unsigned long | fail_value = 0 | ) | const |
Definition at line 357 of file Scalar.cpp.
References GetAs().
Referenced by lldb_private::AppleObjCRuntimeV2::ParseClassInfoArray().
unsigned long long Scalar::ULongLong | ( | unsigned long long | fail_value = 0 | ) | const |
Definition at line 365 of file Scalar.cpp.
References GetAs().
Referenced by lldb_private::Value::ConvertToLoadAddress(), lldb_private::DWARFExpression::Evaluate(), lldb_private::ItaniumABILanguageRuntime::GetExceptionObjectForThread(), lldb_private::ClangExpressionDeclMap::GetFunctionInfo(), lldb_private::ValueObject::GetLocationAsCStringImpl(), lldb_private::AppleObjCRuntime::GetObjectDescription(), lldb_private::AppleObjCTrampolineHandler::GetStepThroughDispatchPlan(), lldb_private::ValueObject::GetValueAsUnsigned(), lldb_private::ClangExpressionDeclMap::GetVariableValue(), IRInterpreter::Interpret(), lldb_private::ValueObject::IsLogicalTrue(), lldb_private::ThreadPlanAssemblyTracer::Log(), DynamicLoaderMacOS::NotifyBreakpointHit(), DynamicLoaderMacOSXDYLD::NotifyBreakpointHit(), lldb_private::Value::operator=(), lldb_private::StopInfoWatchpoint::PerformAction(), lldb_private::IRMemoryMap::ReadPointerFromMemory(), lldb_private::Process::ReadPointerFromMemory(), lldb_private::Target::ReadPointerFromMemory(), lldb_private::Process::ReadUnsignedIntegerFromMemory(), lldb_private::Target::ReadUnsignedIntegerFromMemory(), lldb_private::AbortWithPayloadFrameRecognizer::RecognizeFrame(), lldb_private::AppleThreadPlanStepThroughObjCTrampoline::ShouldStop(), and lldb_private::Value::Value().
bool Scalar::UnaryNegate | ( | ) |
unsigned short Scalar::UShort | ( | unsigned short | fail_value = 0 | ) | const |
Definition at line 345 of file Scalar.cpp.
References GetAs().
|
protected |
Definition at line 205 of file Scalar.h.
Referenced by AbsoluteValue(), lldb_private::compare(), CreateAPFloatFromAPFloat(), Double(), Float(), FloatPromote(), GetAPFloat(), GetAs(), GetBytes(), GetByteSize(), GetPromoKey(), GetValue(), IsZero(), lldb_private::operator*(), operator+=(), lldb_private::operator-(), lldb_private::operator/(), Scalar(), Scalar(), Scalar(), Scalar(), Scalar(), Scalar(), Scalar(), Scalar(), Scalar(), Scalar(), Scalar(), Scalar(), Scalar(), SetValueFromCString(), SInt128(), UInt128(), and UnaryNegate().
|
protected |
Definition at line 204 of file Scalar.h.
Referenced by AbsoluteValue(), Clear(), ClearBit(), lldb_private::compare(), 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/(), operator<<=(), operator>>=(), lldb_private::operator^(), lldb_private::operator|(), Scalar(), Scalar(), Scalar(), Scalar(), Scalar(), Scalar(), Scalar(), Scalar(), Scalar(), SetBit(), SetValueFromCString(), SetValueFromData(), ShiftRightLogical(), SignExtend(), SInt128(), TruncOrExtendTo(), UInt128(), and UnaryNegate().
|
protected |
Definition at line 203 of file Scalar.h.
Referenced by AbsoluteValue(), Clear(), ClearBit(), lldb_private::compare(), 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/(), operator<<=(), operator>>=(), lldb_private::operator^(), lldb_private::operator|(), Scalar(), Scalar(), Scalar(), Scalar(), Scalar(), Scalar(), Scalar(), Scalar(), Scalar(), Scalar(), Scalar(), Scalar(), SetBit(), SetValueFromCString(), SetValueFromData(), ShiftRightLogical(), SignExtend(), SInt128(), UInt128(), and UnaryNegate().