diff --git a/lldb/include/lldb/Core/Value.h b/lldb/include/lldb/Core/Value.h --- a/lldb/include/lldb/Core/Value.h +++ b/lldb/include/lldb/Core/Value.h @@ -145,6 +145,8 @@ void Clear(); + static ValueType GetValueTypeFromAddressType(AddressType address_type); + protected: Scalar m_value; CompilerType m_compiler_type; diff --git a/lldb/source/Core/Value.cpp b/lldb/source/Core/Value.cpp --- a/lldb/source/Core/Value.cpp +++ b/lldb/source/Core/Value.cpp @@ -121,6 +121,19 @@ return eAddressTypeInvalid; } +Value::ValueType Value::GetValueTypeFromAddressType(AddressType address_type) { + switch (address_type) { + case eAddressTypeFile: + return Value::ValueType::FileAddress; + case eAddressTypeLoad: + return Value::ValueType::LoadAddress; + case eAddressTypeHost: + return Value::ValueType::HostAddress; + case eAddressTypeInvalid: + return Value::ValueType::Invalid; + } +} + RegisterInfo *Value::GetRegisterInfo() const { if (m_context_type == ContextType::RegisterInfo) return static_cast(m_context);