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) | |
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 |
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 > | |
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 97 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 868 of file Scalar.cpp.
References bit, e_float, e_int, e_void, m_integer, and m_type.
Referenced by lldb_private::RegisterValue::ClearBit().
double Scalar::Double | ( | double | fail_value = 0.0 | ) | const |
Definition at line 382 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().
Definition at line 798 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 362 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 193 of file Scalar.cpp.
References e_float, e_int, e_void, GetFloatPromoKey(), m_float, m_integer, and m_type.
Referenced by PromoteToMaxType().
|
protected |
size_t Scalar::GetAsMemoryData | ( | void * | dst, |
size_t | dst_len, | ||
lldb::ByteOrder | dst_byte_order, | ||
Status & | error | ||
) | const |
Definition at line 773 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 113 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 131 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 84 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_private::Value::GetData(), lldb_private::Value::GetValueAsData(), lldb_private::ValueObject::SetValueFromCString(), and lldb_private::ValueObjectConstResult::ValueObjectConstResult().
|
staticprotected |
Definition at line 42 of file Scalar.cpp.
References e_float.
Referenced by FloatPromote(), and GetPromoKey().
|
protected |
Definition at line 30 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 102 of file Scalar.h.
References GetValueTypeAsCString(), and m_type.
Referenced by GetValue().
void Scalar::GetValue | ( | Stream * | s, |
bool | show_type | ||
) | const |
Definition at line 155 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 217 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 178 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 106 of file Scalar.h.
References e_float, e_int, and m_type.
Referenced by lldb_private::AppleObjCTrampolineHandler::GetStepThroughDispatchPlan(), and lldb_private::ValueObject::ResolveValue().
bool Scalar::IsZero | ( | ) | const |
Definition at line 143 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 402 of file Scalar.cpp.
References Double().
Referenced by lldb_private::RegisterValue::GetAsLongDouble().
|
inlinestaticprivate |
bool Scalar::MakeSigned | ( | ) |
Definition at line 241 of file Scalar.cpp.
References e_float, e_int, e_void, m_integer, and m_type.
Referenced by lldb_private::ValueObject::GetValueAsSigned(), and IRInterpreter::Interpret().
bool Scalar::MakeUnsigned | ( | ) |
Definition at line 259 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 503 of file Scalar.cpp.
Definition at line 407 of file Scalar.cpp.
References e_float, e_int, e_void, m_float, m_integer, m_type, and PromoteToMaxType().
|
staticprotected |
Definition at line 55 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 302 of file Scalar.cpp.
bool Scalar::SetBit | ( | uint32_t | bit | ) |
Definition at line 881 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 630 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 701 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 433 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 745 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 318 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 324 of file Scalar.cpp.
long long Scalar::SLongLong | ( | long long | fail_value = 0 | ) | const |
Definition at line 330 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 310 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 173 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 306 of file Scalar.cpp.
Referenced by lldb_private::RegisterValue::GetAsUInt8().
unsigned int Scalar::UInt | ( | unsigned int | fail_value = 0 | ) | const |
Definition at line 320 of file Scalar.cpp.
Referenced by lldb_private::RegisterValue::GetAsUInt32(), DynamicLoaderMacOS::NotifyBreakpointHit(), DynamicLoaderMacOSXDYLD::NotifyBreakpointHit(), DWARFASTParserClang::ParseInheritance(), PlatformPOSIX::UnloadImage(), and lldb_private::PlatformWindows::UnloadImage().
llvm::APInt Scalar::UInt128 | ( | const llvm::APInt & | fail_value | ) | const |
Definition at line 350 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 326 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 334 of file Scalar.cpp.
Referenced by lldb_private::Value::ConvertToLoadAddress(), lldb_private::DWARFExpression::Evaluate(), lldb_private::ValueObject::GetAddressOf(), lldb_private::RegisterValue::GetAsUInt64(), 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::Target::ReadPointerFromMemory(), lldb_private::IRMemoryMap::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().
bool Scalar::UnaryNegate | ( | ) |
unsigned short Scalar::UShort | ( | unsigned short | fail_value = 0 | ) | const |
Definition at line 314 of file Scalar.cpp.
Referenced by lldb_private::RegisterValue::GetAsUInt16().
|
protected |
Definition at line 192 of file Scalar.h.
Referenced by AbsoluteValue(), Double(), Float(), FloatPromote(), 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 191 of file Scalar.h.
Referenced by AbsoluteValue(), Clear(), ClearBit(), Double(), ExtractBitfield(), Float(), FloatPromote(), 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 190 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().