Index: lldb/include/lldb/Core/Value.h =================================================================== --- lldb/include/lldb/Core/Value.h +++ lldb/include/lldb/Core/Value.h @@ -37,27 +37,32 @@ class Value { public: - // Values Less than zero are an error, greater than or equal to zero returns - // what the Scalar result is. - enum ValueType { - // m_value contains... - // ============================ - eValueTypeScalar, // raw scalar value - eValueTypeFileAddress, // file address value - eValueTypeLoadAddress, // load address value - eValueTypeHostAddress // host address value (for memory in the process that - // is using liblldb) + /// Type that describes Value::m_value. + enum class ValueType { + Invalid = -1, + // m_value contains: + /// A raw scalar value. + Scalar = 0, + /// A file address value. + FileAddress, + /// A load address value. + LoadAddress, + /// A host address value (for memory in the process that < A is + /// using liblldb). + HostAddress }; - enum ContextType // Type that describes Value::m_context - { - // m_context contains... - // ==================== - eContextTypeInvalid, // undefined - eContextTypeRegisterInfo, // RegisterInfo * (can be a scalar or a vector - // register) - eContextTypeLLDBType, // lldb_private::Type * - eContextTypeVariable // lldb_private::Variable * + /// Type that describes Value::m_context. + enum class ContextType { + // m_context contains: + /// Undefined. + Invalid = -1, + /// RegisterInfo * (can be a scalar or a vector register). + RegisterInfo = 0, + /// lldb_private::Type *. + LLDBType, + /// lldb_private::Variable *. + Variable }; Value(); @@ -85,16 +90,16 @@ void ClearContext() { m_context = nullptr; - m_context_type = eContextTypeInvalid; + m_context_type = ContextType::Invalid; } void SetContext(ContextType context_type, void *p) { m_context_type = context_type; m_context = p; - if (m_context_type == eContextTypeRegisterInfo) { + if (m_context_type == ContextType::RegisterInfo) { RegisterInfo *reg_info = GetRegisterInfo(); if (reg_info->encoding == lldb::eEncodingVector) - SetValueType(eValueTypeScalar); + SetValueType(ValueType::Scalar); } } Index: lldb/include/lldb/Expression/ExpressionVariable.h =================================================================== --- lldb/include/lldb/Expression/ExpressionVariable.h +++ lldb/include/lldb/Expression/ExpressionVariable.h @@ -48,7 +48,7 @@ void SetRegisterInfo(const RegisterInfo *reg_info) { return m_frozen_sp->GetValue().SetContext( - Value::eContextTypeRegisterInfo, const_cast(reg_info)); + Value::ContextType::RegisterInfo, const_cast(reg_info)); } CompilerType GetCompilerType() { return m_frozen_sp->GetCompilerType(); } Index: lldb/source/Core/Value.cpp =================================================================== --- lldb/source/Core/Value.cpp +++ lldb/source/Core/Value.cpp @@ -40,17 +40,17 @@ Value::Value() : m_value(), m_compiler_type(), m_context(nullptr), - m_value_type(eValueTypeScalar), m_context_type(eContextTypeInvalid), + m_value_type(ValueType::Scalar), m_context_type(ContextType::Invalid), m_data_buffer() {} Value::Value(const Scalar &scalar) : m_value(scalar), m_compiler_type(), m_context(nullptr), - m_value_type(eValueTypeScalar), m_context_type(eContextTypeInvalid), + m_value_type(ValueType::Scalar), m_context_type(ContextType::Invalid), m_data_buffer() {} Value::Value(const void *bytes, int len) : m_value(), m_compiler_type(), m_context(nullptr), - m_value_type(eValueTypeHostAddress), m_context_type(eContextTypeInvalid), + m_value_type(ValueType::HostAddress), m_context_type(ContextType::Invalid), m_data_buffer() { SetBytes(bytes, len); } @@ -91,13 +91,13 @@ } void Value::SetBytes(const void *bytes, int len) { - m_value_type = eValueTypeHostAddress; + m_value_type = ValueType::HostAddress; m_data_buffer.CopyData(bytes, len); m_value = (uintptr_t)m_data_buffer.GetBytes(); } void Value::AppendBytes(const void *bytes, int len) { - m_value_type = eValueTypeHostAddress; + m_value_type = ValueType::HostAddress; m_data_buffer.AppendData(bytes, len); m_value = (uintptr_t)m_data_buffer.GetBytes(); } @@ -113,26 +113,27 @@ AddressType Value::GetValueAddressType() const { switch (m_value_type) { - case eValueTypeScalar: + case ValueType::Invalid: + case ValueType::Scalar: break; - case eValueTypeLoadAddress: + case ValueType::LoadAddress: return eAddressTypeLoad; - case eValueTypeFileAddress: + case ValueType::FileAddress: return eAddressTypeFile; - case eValueTypeHostAddress: + case ValueType::HostAddress: return eAddressTypeHost; } return eAddressTypeInvalid; } RegisterInfo *Value::GetRegisterInfo() const { - if (m_context_type == eContextTypeRegisterInfo) + if (m_context_type == ContextType::RegisterInfo) return static_cast(m_context); return nullptr; } Type *Value::GetType() { - if (m_context_type == eContextTypeLLDBType) + if (m_context_type == ContextType::LLDBType) return static_cast(m_context); return nullptr; } @@ -144,7 +145,9 @@ size_t curr_size = m_data_buffer.GetByteSize(); Status error; switch (rhs.GetValueType()) { - case eValueTypeScalar: { + case ValueType::Invalid: + return 0; + case ValueType::Scalar: { const size_t scalar_size = rhs.m_value.GetByteSize(); if (scalar_size > 0) { const size_t new_size = curr_size + scalar_size; @@ -156,9 +159,9 @@ } } } break; - case eValueTypeFileAddress: - case eValueTypeLoadAddress: - case eValueTypeHostAddress: { + case ValueType::FileAddress: + case ValueType::LoadAddress: + case ValueType::HostAddress: { const uint8_t *src = rhs.GetBuffer().GetBytes(); const size_t src_len = rhs.GetBuffer().GetByteSize(); if (src && src_len > 0) { @@ -174,7 +177,7 @@ } size_t Value::ResizeData(size_t len) { - m_value_type = eValueTypeHostAddress; + m_value_type = ValueType::HostAddress; m_data_buffer.SetByteSize(len); m_value = (uintptr_t)m_data_buffer.GetBytes(); return m_data_buffer.GetByteSize(); @@ -182,12 +185,12 @@ bool Value::ValueOf(ExecutionContext *exe_ctx) { switch (m_context_type) { - case eContextTypeInvalid: - case eContextTypeRegisterInfo: // RegisterInfo * - case eContextTypeLLDBType: // Type * + case ContextType::Invalid: + case ContextType::RegisterInfo: // RegisterInfo * + case ContextType::LLDBType: // Type * break; - case eContextTypeVariable: // Variable * + case ContextType::Variable: // Variable * ResolveValue(exe_ctx); return true; } @@ -196,7 +199,7 @@ uint64_t Value::GetValueByteSize(Status *error_ptr, ExecutionContext *exe_ctx) { switch (m_context_type) { - case eContextTypeRegisterInfo: // RegisterInfo * + case ContextType::RegisterInfo: // RegisterInfo * if (GetRegisterInfo()) { if (error_ptr) error_ptr->Clear(); @@ -204,9 +207,9 @@ } break; - case eContextTypeInvalid: - case eContextTypeLLDBType: // Type * - case eContextTypeVariable: // Variable * + case ContextType::Invalid: + case ContextType::LLDBType: // Type * + case ContextType::Variable: // Variable * { auto *scope = exe_ctx ? exe_ctx->GetBestExecutionContextScope() : nullptr; if (llvm::Optional size = GetCompilerType().GetByteSize(scope)) { @@ -225,19 +228,19 @@ const CompilerType &Value::GetCompilerType() { if (!m_compiler_type.IsValid()) { switch (m_context_type) { - case eContextTypeInvalid: + case ContextType::Invalid: break; - case eContextTypeRegisterInfo: + case ContextType::RegisterInfo: break; // TODO: Eventually convert into a compiler type? - case eContextTypeLLDBType: { + case ContextType::LLDBType: { Type *lldb_type = GetType(); if (lldb_type) m_compiler_type = lldb_type->GetForwardCompilerType(); } break; - case eContextTypeVariable: { + case ContextType::Variable: { Variable *variable = GetVariable(); if (variable) { Type *variable_type = variable->GetType(); @@ -257,14 +260,14 @@ lldb::Format Value::GetValueDefaultFormat() { switch (m_context_type) { - case eContextTypeRegisterInfo: + case ContextType::RegisterInfo: if (GetRegisterInfo()) return GetRegisterInfo()->format; break; - case eContextTypeInvalid: - case eContextTypeLLDBType: - case eContextTypeVariable: { + case ContextType::Invalid: + case ContextType::LLDBType: + case ContextType::Variable: { const CompilerType &ast_type = GetCompilerType(); if (ast_type.IsValid()) return ast_type.GetFormat(); @@ -277,14 +280,16 @@ bool Value::GetData(DataExtractor &data) { switch (m_value_type) { - case eValueTypeScalar: + case ValueType::Invalid: + return false; + case ValueType::Scalar: if (m_value.GetData(data)) return true; break; - case eValueTypeLoadAddress: - case eValueTypeFileAddress: - case eValueTypeHostAddress: + case ValueType::LoadAddress: + case ValueType::FileAddress: + case ValueType::HostAddress: if (m_data_buffer.GetByteSize()) { data.SetData(m_data_buffer.GetBytes(), m_data_buffer.GetByteSize(), data.GetByteOrder()); @@ -312,7 +317,10 @@ return error; switch (m_value_type) { - case eValueTypeScalar: { + case ValueType::Invalid: + error.SetErrorString("invalid value"); + break; + case ValueType::Scalar: { data.SetByteOrder(endian::InlHostByteOrder()); if (ast_type.IsValid()) data.SetAddressByteSize(ast_type.GetPointerByteSize()); @@ -332,7 +340,7 @@ error.SetErrorString("extracting data from value failed"); break; } - case eValueTypeLoadAddress: + case ValueType::LoadAddress: if (exe_ctx == nullptr) { error.SetErrorString("can't read load address (no execution context)"); } else { @@ -369,7 +377,7 @@ } break; - case eValueTypeFileAddress: + case ValueType::FileAddress: if (exe_ctx == nullptr) { error.SetErrorString("can't read file address (no execution context)"); } else if (exe_ctx->GetTargetPtr() == nullptr) { @@ -459,7 +467,7 @@ } break; - case eValueTypeHostAddress: + case ValueType::HostAddress: address = m_value.ULongLong(LLDB_INVALID_ADDRESS); address_type = eAddressTypeHost; if (exe_ctx) { @@ -564,12 +572,13 @@ const CompilerType &compiler_type = GetCompilerType(); if (compiler_type.IsValid()) { switch (m_value_type) { - case eValueTypeScalar: // raw scalar value + case ValueType::Invalid: + case ValueType::Scalar: // raw scalar value break; - case eValueTypeFileAddress: - case eValueTypeLoadAddress: // load address value - case eValueTypeHostAddress: // host address value (for memory in the process + case ValueType::FileAddress: + case ValueType::LoadAddress: // load address value + case ValueType::HostAddress: // host address value (for memory in the process // that is using liblldb) { DataExtractor data; @@ -581,17 +590,17 @@ data, 0, data.GetByteSize(), scalar, exe_ctx ? exe_ctx->GetBestExecutionContextScope() : nullptr)) { m_value = scalar; - m_value_type = eValueTypeScalar; + m_value_type = ValueType::Scalar; } else { if ((uintptr_t)addr != (uintptr_t)m_data_buffer.GetBytes()) { m_value.Clear(); - m_value_type = eValueTypeScalar; + m_value_type = ValueType::Scalar; } } } else { if ((uintptr_t)addr != (uintptr_t)m_data_buffer.GetBytes()) { m_value.Clear(); - m_value_type = eValueTypeScalar; + m_value_type = ValueType::Scalar; } } } break; @@ -601,7 +610,7 @@ } Variable *Value::GetVariable() { - if (m_context_type == eContextTypeVariable) + if (m_context_type == ContextType::Variable) return static_cast(m_context); return nullptr; } @@ -609,42 +618,44 @@ void Value::Clear() { m_value.Clear(); m_compiler_type.Clear(); - m_value_type = eValueTypeScalar; + m_value_type = ValueType::Scalar; m_context = nullptr; - m_context_type = eContextTypeInvalid; + m_context_type = ContextType::Invalid; m_data_buffer.Clear(); } const char *Value::GetValueTypeAsCString(ValueType value_type) { switch (value_type) { - case eValueTypeScalar: + case ValueType::Invalid: + return "invalid"; + case ValueType::Scalar: return "scalar"; - case eValueTypeFileAddress: + case ValueType::FileAddress: return "file address"; - case eValueTypeLoadAddress: + case ValueType::LoadAddress: return "load address"; - case eValueTypeHostAddress: + case ValueType::HostAddress: return "host address"; }; - return "???"; + llvm_unreachable("enum cases exhausted."); } const char *Value::GetContextTypeAsCString(ContextType context_type) { switch (context_type) { - case eContextTypeInvalid: + case ContextType::Invalid: return "invalid"; - case eContextTypeRegisterInfo: + case ContextType::RegisterInfo: return "RegisterInfo *"; - case eContextTypeLLDBType: + case ContextType::LLDBType: return "Type *"; - case eContextTypeVariable: + case ContextType::Variable: return "Variable *"; }; - return "???"; + llvm_unreachable("enum cases exhausted."); } void Value::ConvertToLoadAddress(Module *module, Target *target) { - if (!module || !target || (GetValueType() != eValueTypeFileAddress)) + if (!module || !target || (GetValueType() != ValueType::FileAddress)) return; lldb::addr_t file_addr = GetScalar().ULongLong(LLDB_INVALID_ADDRESS); @@ -658,7 +669,7 @@ if (load_addr == LLDB_INVALID_ADDRESS) return; - SetValueType(Value::eValueTypeLoadAddress); + SetValueType(Value::ValueType::LoadAddress); GetScalar() = load_addr; } Index: lldb/source/Core/ValueObject.cpp =================================================================== --- lldb/source/Core/ValueObject.cpp +++ lldb/source/Core/ValueObject.cpp @@ -336,8 +336,11 @@ Value::ValueType value_type = value.GetValueType(); switch (value_type) { - case Value::eValueTypeScalar: - if (value.GetContextType() == Value::eContextTypeRegisterInfo) { + case Value::ValueType::Invalid: + m_location_str = "invalid"; + break; + case Value::ValueType::Scalar: + if (value.GetContextType() == Value::ContextType::RegisterInfo) { RegisterInfo *reg_info = value.GetRegisterInfo(); if (reg_info) { if (reg_info->name) @@ -354,9 +357,9 @@ m_location_str = "scalar"; break; - case Value::eValueTypeLoadAddress: - case Value::eValueTypeFileAddress: - case Value::eValueTypeHostAddress: { + case Value::ValueType::LoadAddress: + case Value::ValueType::FileAddress: + case Value::ValueType::HostAddress: { uint32_t addr_nibble_size = data.GetAddressByteSize() * 2; sstr.Printf("0x%*.*llx", addr_nibble_size, addr_nibble_size, value.GetScalar().ULongLong(LLDB_INVALID_ADDRESS)); @@ -852,7 +855,10 @@ Value::ValueType value_type = m_value.GetValueType(); switch (value_type) { - case Value::eValueTypeScalar: { + case Value::ValueType::Invalid: + error.SetErrorString("invalid location"); + return false; + case Value::ValueType::Scalar: { Status set_error = m_value.GetScalar().SetValueFromData(data, encoding, byte_size); @@ -862,7 +868,7 @@ return false; } } break; - case Value::eValueTypeLoadAddress: { + case Value::ValueType::LoadAddress: { // If it is a load address, then the scalar value is the storage location // of the data, and we have to shove this value down to that load location. ExecutionContext exe_ctx(GetExecutionContextRef()); @@ -879,7 +885,7 @@ } } } break; - case Value::eValueTypeHostAddress: { + case Value::ValueType::HostAddress: { // If it is a host address, then we stuff the scalar as a DataBuffer into // the Value's data. DataBufferSP buffer_sp(new DataBufferHeap(byte_size, 0)); @@ -889,7 +895,7 @@ byte_size, m_data.GetByteOrder()); m_value.GetScalar() = (uintptr_t)m_data.GetDataStart(); } break; - case Value::eValueTypeFileAddress: + case Value::ValueType::FileAddress: break; } @@ -1107,7 +1113,7 @@ if (m_is_bitfield_for_scalar) my_format = eFormatUnsigned; else { - if (m_value.GetContextType() == Value::eContextTypeRegisterInfo) { + if (m_value.GetContextType() == Value::ContextType::RegisterInfo) { const RegisterInfo *reg_info = m_value.GetRegisterInfo(); if (reg_info) my_format = reg_info->format; @@ -1455,7 +1461,9 @@ return LLDB_INVALID_ADDRESS; switch (m_value.GetValueType()) { - case Value::eValueTypeScalar: + case Value::ValueType::Invalid: + return LLDB_INVALID_ADDRESS; + case Value::ValueType::Scalar: if (scalar_is_load_address) { if (address_type) *address_type = eAddressTypeLoad; @@ -1463,13 +1471,13 @@ } break; - case Value::eValueTypeLoadAddress: - case Value::eValueTypeFileAddress: { + case Value::ValueType::LoadAddress: + case Value::ValueType::FileAddress: { if (address_type) *address_type = m_value.GetValueAddressType(); return m_value.GetScalar().ULongLong(LLDB_INVALID_ADDRESS); } break; - case Value::eValueTypeHostAddress: { + case Value::ValueType::HostAddress: { if (address_type) *address_type = m_value.GetValueAddressType(); return LLDB_INVALID_ADDRESS; @@ -1489,13 +1497,15 @@ return address; switch (m_value.GetValueType()) { - case Value::eValueTypeScalar: + case Value::ValueType::Invalid: + return LLDB_INVALID_ADDRESS; + case Value::ValueType::Scalar: address = m_value.GetScalar().ULongLong(LLDB_INVALID_ADDRESS); break; - case Value::eValueTypeHostAddress: - case Value::eValueTypeLoadAddress: - case Value::eValueTypeFileAddress: { + case Value::ValueType::HostAddress: + case Value::ValueType::LoadAddress: + case Value::ValueType::FileAddress: { lldb::offset_t data_offset = 0; address = m_data.GetAddress(&data_offset); } break; @@ -1523,7 +1533,7 @@ Value::ValueType value_type = m_value.GetValueType(); - if (value_type == Value::eValueTypeScalar) { + if (value_type == Value::ValueType::Scalar) { // If the value is already a scalar, then let the scalar change itself: m_value.GetScalar().SetValueFromCString(value_str, encoding, byte_size); } else if (byte_size <= 16) { @@ -1534,7 +1544,7 @@ error = new_scalar.SetValueFromCString(value_str, encoding, byte_size); if (error.Success()) { switch (value_type) { - case Value::eValueTypeLoadAddress: { + case Value::ValueType::LoadAddress: { // If it is a load address, then the scalar value is the storage // location of the data, and we have to shove this value down to that // load location. @@ -1553,7 +1563,7 @@ } } } break; - case Value::eValueTypeHostAddress: { + case Value::ValueType::HostAddress: { // If it is a host address, then we stuff the scalar as a DataBuffer // into the Value's data. DataExtractor new_data; @@ -1570,8 +1580,11 @@ m_value.GetScalar() = (uintptr_t)m_data.GetDataStart(); } break; - case Value::eValueTypeFileAddress: - case Value::eValueTypeScalar: + case Value::ValueType::Invalid: + error.SetErrorString("invalid location"); + return false; + case Value::ValueType::FileAddress: + case Value::ValueType::Scalar: break; } } else { @@ -1980,7 +1993,7 @@ if (m_is_synthetic_children_generated) { UpdateValueIfNeeded(); - if (m_value.GetValueType() == Value::eValueTypeLoadAddress) { + if (m_value.GetValueType() == Value::ValueType::LoadAddress) { if (IsPointerOrReferenceType()) { s.Printf("((%s)0x%" PRIx64 ")", GetTypeName().AsCString("void"), GetValueAsUnsigned(0)); @@ -3093,7 +3106,7 @@ exe_ctx.GetAddressByteSize())); if (ptr_result_valobj_sp) { ptr_result_valobj_sp->GetValue().SetValueType( - Value::eValueTypeLoadAddress); + Value::ValueType::LoadAddress); Status err; ptr_result_valobj_sp = ptr_result_valobj_sp->Dereference(err); if (ptr_result_valobj_sp && !name.empty()) Index: lldb/source/Core/ValueObjectChild.cpp =================================================================== --- lldb/source/Core/ValueObjectChild.cpp +++ lldb/source/Core/ValueObjectChild.cpp @@ -125,28 +125,30 @@ case eAddressTypeFile: { lldb::ProcessSP process_sp(GetProcessSP()); if (process_sp && process_sp->IsAlive()) - m_value.SetValueType(Value::eValueTypeLoadAddress); + m_value.SetValueType(Value::ValueType::LoadAddress); else - m_value.SetValueType(Value::eValueTypeFileAddress); + m_value.SetValueType(Value::ValueType::FileAddress); } break; case eAddressTypeLoad: m_value.SetValueType(is_instance_ptr_base - ? Value::eValueTypeScalar - : Value::eValueTypeLoadAddress); + ? Value::ValueType::Scalar + : Value::ValueType::LoadAddress); break; case eAddressTypeHost: - m_value.SetValueType(Value::eValueTypeHostAddress); + m_value.SetValueType(Value::ValueType::HostAddress); break; case eAddressTypeInvalid: // TODO: does this make sense? - m_value.SetValueType(Value::eValueTypeScalar); + m_value.SetValueType(Value::ValueType::Scalar); break; } } switch (m_value.GetValueType()) { - case Value::eValueTypeLoadAddress: - case Value::eValueTypeFileAddress: - case Value::eValueTypeHostAddress: { + case Value::ValueType::Invalid: + break; + case Value::ValueType::LoadAddress: + case Value::ValueType::FileAddress: + case Value::ValueType::HostAddress: { lldb::addr_t addr = m_value.GetScalar().ULongLong(LLDB_INVALID_ADDRESS); if (addr == LLDB_INVALID_ADDRESS) { m_error.SetErrorString("parent address is invalid."); @@ -182,7 +184,7 @@ } } break; - case Value::eValueTypeScalar: + case Value::ValueType::Scalar: // try to extract the child value from the parent's scalar value { Scalar scalar(m_value.GetScalar()); Index: lldb/source/Core/ValueObjectConstResult.cpp =================================================================== --- lldb/source/Core/ValueObjectConstResult.cpp +++ lldb/source/Core/ValueObjectConstResult.cpp @@ -73,7 +73,7 @@ } m_value.GetScalar() = (uintptr_t)m_data.GetDataStart(); - m_value.SetValueType(Value::eValueTypeHostAddress); + m_value.SetValueType(Value::ValueType::HostAddress); m_value.SetCompilerType(compiler_type); m_name = name; SetIsConstant(); @@ -115,7 +115,7 @@ m_data.SetAddressByteSize(data_addr_size); m_data.SetData(data_sp); m_value.GetScalar() = (uintptr_t)data_sp->GetBytes(); - m_value.SetValueType(Value::eValueTypeHostAddress); + m_value.SetValueType(Value::ValueType::HostAddress); m_value.SetCompilerType(compiler_type); m_name = name; SetIsConstant(); @@ -145,19 +145,19 @@ m_value.GetScalar() = address; m_data.SetAddressByteSize(addr_byte_size); m_value.GetScalar().GetData(m_data, addr_byte_size); - // m_value.SetValueType(Value::eValueTypeHostAddress); + // m_value.SetValueType(Value::ValueType::HostAddress); switch (address_type) { case eAddressTypeInvalid: - m_value.SetValueType(Value::eValueTypeScalar); + m_value.SetValueType(Value::ValueType::Scalar); break; case eAddressTypeFile: - m_value.SetValueType(Value::eValueTypeFileAddress); + m_value.SetValueType(Value::ValueType::FileAddress); break; case eAddressTypeLoad: - m_value.SetValueType(Value::eValueTypeLoadAddress); + m_value.SetValueType(Value::ValueType::LoadAddress); break; case eAddressTypeHost: - m_value.SetValueType(Value::eValueTypeHostAddress); + m_value.SetValueType(Value::ValueType::HostAddress); break; } m_value.SetCompilerType(compiler_type); Index: lldb/source/Core/ValueObjectConstResultImpl.cpp =================================================================== --- lldb/source/Core/ValueObjectConstResultImpl.cpp +++ lldb/source/Core/ValueObjectConstResultImpl.cpp @@ -132,7 +132,7 @@ ConstString(new_name.c_str()), buffer, endian::InlHostByteOrder(), exe_ctx.GetAddressByteSize()); - m_address_of_backend->GetValue().SetValueType(Value::eValueTypeScalar); + m_address_of_backend->GetValue().SetValueType(Value::ValueType::Scalar); m_address_of_backend->GetValue().GetScalar() = m_live_address; return m_address_of_backend; Index: lldb/source/Core/ValueObjectMemory.cpp =================================================================== --- lldb/source/Core/ValueObjectMemory.cpp +++ lldb/source/Core/ValueObjectMemory.cpp @@ -57,20 +57,20 @@ // Do not attempt to construct one of these objects with no variable! assert(m_type_sp.get() != nullptr); SetName(ConstString(name)); - m_value.SetContext(Value::eContextTypeLLDBType, m_type_sp.get()); + m_value.SetContext(Value::ContextType::LLDBType, m_type_sp.get()); TargetSP target_sp(GetTargetSP()); lldb::addr_t load_address = m_address.GetLoadAddress(target_sp.get()); if (load_address != LLDB_INVALID_ADDRESS) { - m_value.SetValueType(Value::eValueTypeLoadAddress); + m_value.SetValueType(Value::ValueType::LoadAddress); m_value.GetScalar() = load_address; } else { lldb::addr_t file_address = m_address.GetFileAddress(); if (file_address != LLDB_INVALID_ADDRESS) { - m_value.SetValueType(Value::eValueTypeFileAddress); + m_value.SetValueType(Value::ValueType::FileAddress); m_value.GetScalar() = file_address; } else { m_value.GetScalar() = m_address.GetOffset(); - m_value.SetValueType(Value::eValueTypeScalar); + m_value.SetValueType(Value::ValueType::Scalar); } } } @@ -92,16 +92,16 @@ m_value.SetCompilerType(m_compiler_type); lldb::addr_t load_address = m_address.GetLoadAddress(target_sp.get()); if (load_address != LLDB_INVALID_ADDRESS) { - m_value.SetValueType(Value::eValueTypeLoadAddress); + m_value.SetValueType(Value::ValueType::LoadAddress); m_value.GetScalar() = load_address; } else { lldb::addr_t file_address = m_address.GetFileAddress(); if (file_address != LLDB_INVALID_ADDRESS) { - m_value.SetValueType(Value::eValueTypeFileAddress); + m_value.SetValueType(Value::ValueType::FileAddress); m_value.GetScalar() = file_address; } else { m_value.GetScalar() = m_address.GetOffset(); - m_value.SetValueType(Value::eValueTypeScalar); + m_value.SetValueType(Value::ValueType::Scalar); } } } @@ -168,15 +168,18 @@ Value::ValueType value_type = m_value.GetValueType(); switch (value_type) { - case Value::eValueTypeScalar: + case Value::ValueType::Invalid: + m_error.SetErrorString("Invalid value"); + return false; + case Value::ValueType::Scalar: // The variable value is in the Scalar value inside the m_value. We can // point our m_data right to it. m_error = m_value.GetValueAsData(&exe_ctx, m_data, GetModule().get()); break; - case Value::eValueTypeFileAddress: - case Value::eValueTypeLoadAddress: - case Value::eValueTypeHostAddress: + case Value::ValueType::FileAddress: + case Value::ValueType::LoadAddress: + case Value::ValueType::HostAddress: // The DWARF expression result was an address in the inferior process. If // this variable is an aggregate type, we just need the address as the // main value as all child variable objects will rely upon this location @@ -185,11 +188,11 @@ // sure this type has a value before we try and read it // If we have a file address, convert it to a load address if we can. - if (value_type == Value::eValueTypeFileAddress && + if (value_type == Value::ValueType::FileAddress && exe_ctx.GetProcessPtr()) { lldb::addr_t load_addr = m_address.GetLoadAddress(target); if (load_addr != LLDB_INVALID_ADDRESS) { - m_value.SetValueType(Value::eValueTypeLoadAddress); + m_value.SetValueType(Value::ValueType::LoadAddress); m_value.GetScalar() = load_addr; } } @@ -205,7 +208,7 @@ // extract read its value into m_data appropriately Value value(m_value); if (m_type_sp) - value.SetContext(Value::eContextTypeLLDBType, m_type_sp.get()); + value.SetContext(Value::ContextType::LLDBType, m_type_sp.get()); else { value.SetCompilerType(m_compiler_type); } Index: lldb/source/Core/ValueObjectRegister.cpp =================================================================== --- lldb/source/Core/ValueObjectRegister.cpp +++ lldb/source/Core/ValueObjectRegister.cpp @@ -249,9 +249,9 @@ Process *process = exe_ctx.GetProcessPtr(); if (process) m_data.SetAddressByteSize(process->GetAddressByteSize()); - m_value.SetContext(Value::eContextTypeRegisterInfo, + m_value.SetContext(Value::ContextType::RegisterInfo, (void *)&m_reg_info); - m_value.SetValueType(Value::eValueTypeHostAddress); + m_value.SetValueType(Value::ValueType::HostAddress); m_value.GetScalar() = (uintptr_t)m_data.GetDataStart(); SetValueIsValid(true); SetValueDidChange(!(m_old_reg_value == m_reg_value)); Index: lldb/source/Core/ValueObjectVariable.cpp =================================================================== --- lldb/source/Core/ValueObjectVariable.cpp +++ lldb/source/Core/ValueObjectVariable.cpp @@ -135,12 +135,12 @@ if (expr.GetExpressionData(m_data)) { if (m_data.GetDataStart() && m_data.GetByteSize()) m_value.SetBytes(m_data.GetDataStart(), m_data.GetByteSize()); - m_value.SetContext(Value::eContextTypeVariable, variable); + m_value.SetContext(Value::ContextType::Variable, variable); } else m_error.SetErrorString("empty constant data"); // constant bytes can't be edited - sorry - m_resolved_value.SetContext(Value::eContextTypeInvalid, nullptr); + m_resolved_value.SetContext(Value::ContextType::Invalid, nullptr); } else { lldb::addr_t loclist_base_load_addr = LLDB_INVALID_ADDRESS; ExecutionContext exe_ctx(GetExecutionContextRef()); @@ -163,7 +163,7 @@ if (expr.Evaluate(&exe_ctx, nullptr, loclist_base_load_addr, nullptr, nullptr, m_value, &m_error)) { m_resolved_value = m_value; - m_value.SetContext(Value::eContextTypeVariable, variable); + m_value.SetContext(Value::ContextType::Variable, variable); CompilerType compiler_type = GetCompilerType(); if (compiler_type.IsValid()) @@ -183,7 +183,7 @@ // // FIXME: When we grow m_value, we should represent the added bits as // undefined somehow instead of as 0's. - if (value_type == Value::eValueTypeHostAddress && + if (value_type == Value::ValueType::HostAddress && compiler_type.IsValid()) { if (size_t value_buf_size = m_value.GetBuffer().GetByteSize()) { size_t value_size = m_value.GetValueByteSize(&m_error, &exe_ctx); @@ -196,16 +196,19 @@ const bool process_is_alive = process && process->IsAlive(); switch (value_type) { - case Value::eValueTypeScalar: + case Value::ValueType::Invalid: + m_error.SetErrorString("invalid value"); + break; + case Value::ValueType::Scalar: // The variable value is in the Scalar value inside the m_value. We can // point our m_data right to it. m_error = m_value.GetValueAsData(&exe_ctx, m_data, GetModule().get()); break; - case Value::eValueTypeFileAddress: - case Value::eValueTypeLoadAddress: - case Value::eValueTypeHostAddress: + case Value::ValueType::FileAddress: + case Value::ValueType::LoadAddress: + case Value::ValueType::HostAddress: // The DWARF expression result was an address in the inferior process. // If this variable is an aggregate type, we just need the address as // the main value as all child variable objects will rely upon this @@ -214,7 +217,7 @@ // m_data. Make sure this type has a value before we try and read it // If we have a file address, convert it to a load address if we can. - if (value_type == Value::eValueTypeFileAddress && process_is_alive) + if (value_type == Value::ValueType::FileAddress && process_is_alive) m_value.ConvertToLoadAddress(GetModule().get(), target); if (!CanProvideValue()) { @@ -227,7 +230,7 @@ // Copy the Value and set the context to use our Variable so it can // extract read its value into m_data appropriately Value value(m_value); - value.SetContext(Value::eContextTypeVariable, variable); + value.SetContext(Value::ContextType::Variable, variable); m_error = value.GetValueAsData(&exe_ctx, m_data, GetModule().get()); @@ -240,7 +243,7 @@ SetValueIsValid(m_error.Success()); } else { // could not find location, won't allow editing - m_resolved_value.SetContext(Value::eContextTypeInvalid, nullptr); + m_resolved_value.SetContext(Value::ContextType::Invalid, nullptr); } } @@ -257,7 +260,9 @@ (type_info & (lldb::eTypeIsPointer | lldb::eTypeIsReference)) != 0; switch (value_type) { - case Value::eValueTypeFileAddress: + case Value::ValueType::Invalid: + break; + case Value::ValueType::FileAddress: // If this type is a pointer, then its children will be considered load // addresses if the pointer or reference is dereferenced, but only if // the process is alive. @@ -280,7 +285,7 @@ else valobj.SetAddressTypeOfChildren(eAddressTypeFile); break; - case Value::eValueTypeHostAddress: + case Value::ValueType::HostAddress: // Same as above for load addresses, except children of pointer or refs // are always load addresses. Host addresses are used to store freeze // dried variables. If this type is a struct, the entire struct @@ -291,8 +296,8 @@ else valobj.SetAddressTypeOfChildren(eAddressTypeHost); break; - case Value::eValueTypeLoadAddress: - case Value::eValueTypeScalar: + case Value::ValueType::LoadAddress: + case Value::ValueType::Scalar: valobj.SetAddressTypeOfChildren(eAddressTypeLoad); break; } @@ -343,7 +348,7 @@ } const char *ValueObjectVariable::GetLocationAsCString() { - if (m_resolved_value.GetContextType() == Value::eContextTypeRegisterInfo) + if (m_resolved_value.GetContextType() == Value::ContextType::RegisterInfo) return GetLocationAsCStringImpl(m_resolved_value, m_data); else return ValueObject::GetLocationAsCString(); @@ -356,7 +361,7 @@ return false; } - if (m_resolved_value.GetContextType() == Value::eContextTypeRegisterInfo) { + if (m_resolved_value.GetContextType() == Value::ContextType::RegisterInfo) { RegisterInfo *reg_info = m_resolved_value.GetRegisterInfo(); ExecutionContext exe_ctx(GetExecutionContextRef()); RegisterContext *reg_ctx = exe_ctx.GetRegisterContext(); @@ -385,7 +390,7 @@ return false; } - if (m_resolved_value.GetContextType() == Value::eContextTypeRegisterInfo) { + if (m_resolved_value.GetContextType() == Value::ContextType::RegisterInfo) { RegisterInfo *reg_info = m_resolved_value.GetRegisterInfo(); ExecutionContext exe_ctx(GetExecutionContextRef()); RegisterContext *reg_ctx = exe_ctx.GetRegisterContext(); Index: lldb/source/DataFormatters/TypeFormat.cpp =================================================================== --- lldb/source/DataFormatters/TypeFormat.cpp +++ lldb/source/DataFormatters/TypeFormat.cpp @@ -48,7 +48,7 @@ ExecutionContext exe_ctx(valobj->GetExecutionContextRef()); DataExtractor data; - if (context_type == Value::eContextTypeRegisterInfo) { + if (context_type == Value::ContextType::RegisterInfo) { const RegisterInfo *reg_info = value.GetRegisterInfo(); if (reg_info) { Status error; Index: lldb/source/Expression/DWARFExpression.cpp =================================================================== --- lldb/source/Expression/DWARFExpression.cpp +++ lldb/source/Expression/DWARFExpression.cpp @@ -174,8 +174,8 @@ RegisterValue reg_value; if (reg_ctx->ReadRegister(reg_info, reg_value)) { if (reg_value.GetScalarValue(value.GetScalar())) { - value.SetValueType(Value::eValueTypeScalar); - value.SetContext(Value::eContextTypeRegisterInfo, + value.SetValueType(Value::ValueType::Scalar); + value.SetContext(Value::ContextType::RegisterInfo, const_cast(reg_info)); if (error_ptr) error_ptr->Clear(); @@ -975,7 +975,7 @@ // address and whose size is the size of an address on the target machine. case DW_OP_addr: stack.push_back(Scalar(opcodes.GetAddress(&offset))); - stack.back().SetValueType(Value::eValueTypeFileAddress); + stack.back().SetValueType(Value::ValueType::FileAddress); // Convert the file address to a load address, so subsequent // DWARF operators can operate on it. if (frame) @@ -1034,14 +1034,14 @@ } Value::ValueType value_type = stack.back().GetValueType(); switch (value_type) { - case Value::eValueTypeHostAddress: { + case Value::ValueType::HostAddress: { void *src = (void *)stack.back().GetScalar().ULongLong(); intptr_t ptr; ::memcpy(&ptr, src, sizeof(void *)); stack.back().GetScalar() = ptr; stack.back().ClearContext(); } break; - case Value::eValueTypeFileAddress: { + case Value::ValueType::FileAddress: { auto file_addr = stack.back().GetScalar().ULongLong( LLDB_INVALID_ADDRESS); if (!module_sp) { @@ -1064,10 +1064,10 @@ return false; } stack.back().GetScalar() = load_Addr; - stack.back().SetValueType(Value::eValueTypeLoadAddress); + stack.back().SetValueType(Value::ValueType::LoadAddress); // Fall through to load address code below... } LLVM_FALLTHROUGH; - case Value::eValueTypeLoadAddress: + case Value::ValueType::LoadAddress: if (exe_ctx) { if (process) { lldb::addr_t pointer_addr = @@ -1099,9 +1099,10 @@ } break; - default: + case Value::ValueType::Scalar: + case Value::ValueType::Invalid: if (error_ptr) - error_ptr->SetErrorString("Unhandled value type for DW_OP_deref.\n"); + error_ptr->SetErrorString("Invalid value type for DW_OP_deref.\n"); return false; } @@ -1129,7 +1130,7 @@ uint8_t size = opcodes.GetU8(&offset); Value::ValueType value_type = stack.back().GetValueType(); switch (value_type) { - case Value::eValueTypeHostAddress: { + case Value::ValueType::HostAddress: { void *src = (void *)stack.back().GetScalar().ULongLong(); intptr_t ptr; ::memcpy(&ptr, src, sizeof(void *)); @@ -1169,7 +1170,7 @@ stack.back().GetScalar() = ptr; stack.back().ClearContext(); } break; - case Value::eValueTypeLoadAddress: + case Value::ValueType::LoadAddress: if (exe_ctx) { if (process) { lldb::addr_t pointer_addr = @@ -1209,19 +1210,23 @@ } } else { if (error_ptr) - error_ptr->SetErrorString("NULL process for DW_OP_deref.\n"); + error_ptr->SetErrorString("NULL process for DW_OP_deref_size.\n"); return false; } } else { if (error_ptr) error_ptr->SetErrorString( - "NULL execution context for DW_OP_deref.\n"); + "NULL execution context for DW_OP_deref_size.\n"); return false; } break; - default: - break; + case Value::ValueType::Scalar: + case Value::ValueType::FileAddress: + case Value::ValueType::Invalid: + if (error_ptr) + error_ptr->SetErrorString("Invalid value for DW_OP_deref_size.\n"); + return false; } } break; @@ -2007,7 +2012,7 @@ tmp.ResolveValue(exe_ctx) += (uint64_t)breg_offset; tmp.ClearContext(); stack.push_back(tmp); - stack.back().SetValueType(Value::eValueTypeLoadAddress); + stack.back().SetValueType(Value::ValueType::LoadAddress); } else return false; } break; @@ -2026,7 +2031,7 @@ tmp.ResolveValue(exe_ctx) += (uint64_t)breg_offset; tmp.ClearContext(); stack.push_back(tmp); - stack.back().SetValueType(Value::eValueTypeLoadAddress); + stack.back().SetValueType(Value::ValueType::LoadAddress); } else return false; } break; @@ -2039,7 +2044,7 @@ int64_t fbreg_offset = opcodes.GetSLEB128(&offset); value += fbreg_offset; stack.push_back(value); - stack.back().SetValueType(Value::eValueTypeLoadAddress); + stack.back().SetValueType(Value::ValueType::LoadAddress); } else return false; } else { @@ -2103,7 +2108,9 @@ const Value::ValueType curr_piece_source_value_type = curr_piece_source_value.GetValueType(); switch (curr_piece_source_value_type) { - case Value::eValueTypeLoadAddress: + case Value::ValueType::Invalid: + return false; + case Value::ValueType::LoadAddress: if (process) { if (curr_piece.ResizeData(piece_byte_size) == piece_byte_size) { lldb::addr_t load_addr = @@ -2130,8 +2137,8 @@ } break; - case Value::eValueTypeFileAddress: - case Value::eValueTypeHostAddress: + case Value::ValueType::FileAddress: + case Value::ValueType::HostAddress: if (error_ptr) { lldb::addr_t addr = curr_piece_source_value.GetScalar().ULongLong( LLDB_INVALID_ADDRESS); @@ -2139,14 +2146,14 @@ "failed to read memory DW_OP_piece(%" PRIu64 ") from %s address 0x%" PRIx64, piece_byte_size, curr_piece_source_value.GetValueType() == - Value::eValueTypeFileAddress + Value::ValueType::FileAddress ? "file" : "host", addr); } return false; - case Value::eValueTypeScalar: { + case Value::ValueType::Scalar: { uint32_t bit_size = piece_byte_size * 8; uint32_t bit_offset = 0; Scalar &scalar = curr_piece_source_value.GetScalar(); @@ -2215,7 +2222,9 @@ const uint64_t piece_bit_size = opcodes.GetULEB128(&offset); const uint64_t piece_bit_offset = opcodes.GetULEB128(&offset); switch (stack.back().GetValueType()) { - case Value::eValueTypeScalar: { + case Value::ValueType::Invalid: + return false; + case Value::ValueType::Scalar: { if (!stack.back().GetScalar().ExtractBitfield(piece_bit_size, piece_bit_offset)) { if (error_ptr) @@ -2228,9 +2237,9 @@ } } break; - case Value::eValueTypeFileAddress: - case Value::eValueTypeLoadAddress: - case Value::eValueTypeHostAddress: + case Value::ValueType::FileAddress: + case Value::ValueType::LoadAddress: + case Value::ValueType::HostAddress: if (error_ptr) { error_ptr->SetErrorStringWithFormat( "unable to extract DW_OP_bit_piece(bit_size = %" PRIu64 @@ -2342,7 +2351,7 @@ "Expression stack needs at least 1 item for DW_OP_stack_value."); return false; } - stack.back().SetValueType(Value::eValueTypeScalar); + stack.back().SetValueType(Value::ValueType::Scalar); break; // OPCODE: DW_OP_convert @@ -2430,7 +2439,7 @@ addr_t cfa = id.GetCallFrameAddress(); if (cfa != LLDB_INVALID_ADDRESS) { stack.push_back(Scalar(cfa)); - stack.back().SetValueType(Value::eValueTypeLoadAddress); + stack.back().SetValueType(Value::ValueType::LoadAddress); } else if (error_ptr) error_ptr->SetErrorString("Stack frame does not include a canonical " "frame address for DW_OP_call_frame_cfa " @@ -2490,7 +2499,7 @@ } stack.back().GetScalar() = tls_load_addr; - stack.back().SetValueType(Value::eValueTypeLoadAddress); + stack.back().SetValueType(Value::ValueType::LoadAddress); } break; // OPCODE: DW_OP_addrx (DW_OP_GNU_addr_index is the legacy name.) @@ -2510,7 +2519,7 @@ uint64_t index = opcodes.GetULEB128(&offset); lldb::addr_t value = ReadAddressFromDebugAddrSection(dwarf_cu, index); stack.push_back(Scalar(value)); - stack.back().SetValueType(Value::eValueTypeFileAddress); + stack.back().SetValueType(Value::ValueType::FileAddress); } break; // OPCODE: DW_OP_GNU_const_index Index: lldb/source/Expression/FunctionCaller.cpp =================================================================== --- lldb/source/Expression/FunctionCaller.cpp +++ lldb/source/Expression/FunctionCaller.cpp @@ -193,8 +193,8 @@ // Special case: if it's a pointer, don't do anything (the ABI supports // passing cstrings) - if (arg_value->GetValueType() == Value::eValueTypeHostAddress && - arg_value->GetContextType() == Value::eContextTypeInvalid && + if (arg_value->GetValueType() == Value::ValueType::HostAddress && + arg_value->GetContextType() == Value::ContextType::Invalid && arg_value->GetCompilerType().IsPointerType()) continue; @@ -295,7 +295,7 @@ return false; ret_value.SetCompilerType(m_function_return_type); - ret_value.SetValueType(Value::eValueTypeScalar); + ret_value.SetValueType(Value::ValueType::Scalar); return true; } Index: lldb/source/Plugins/ABI/AArch64/ABIMacOSX_arm64.cpp =================================================================== --- lldb/source/Plugins/ABI/AArch64/ABIMacOSX_arm64.cpp +++ lldb/source/Plugins/ABI/AArch64/ABIMacOSX_arm64.cpp @@ -654,7 +654,7 @@ const uint32_t type_flags = return_compiler_type.GetTypeInfo(nullptr); if (type_flags & eTypeIsScalar || type_flags & eTypeIsPointer) { - value.SetValueType(Value::eValueTypeScalar); + value.SetValueType(Value::ValueType::Scalar); bool success = false; if (type_flags & eTypeIsInteger || type_flags & eTypeIsPointer) { Index: lldb/source/Plugins/ABI/AArch64/ABISysV_arm64.cpp =================================================================== --- lldb/source/Plugins/ABI/AArch64/ABISysV_arm64.cpp +++ lldb/source/Plugins/ABI/AArch64/ABISysV_arm64.cpp @@ -622,7 +622,7 @@ const uint32_t type_flags = return_compiler_type.GetTypeInfo(nullptr); if (type_flags & eTypeIsScalar || type_flags & eTypeIsPointer) { - value.SetValueType(Value::eValueTypeScalar); + value.SetValueType(Value::ValueType::Scalar); bool success = false; if (type_flags & eTypeIsInteger || type_flags & eTypeIsPointer) { Index: lldb/source/Plugins/ABI/X86/ABISysV_i386.cpp =================================================================== --- lldb/source/Plugins/ABI/X86/ABISysV_i386.cpp +++ lldb/source/Plugins/ABI/X86/ABISysV_i386.cpp @@ -378,14 +378,14 @@ uint32_t ptr = thread.GetRegisterContext()->ReadRegisterAsUnsigned(eax_id, 0) & 0xffffffff; - value.SetValueType(Value::eValueTypeScalar); + value.SetValueType(Value::ValueType::Scalar); value.GetScalar() = ptr; return_valobj_sp = ValueObjectConstResult::Create( thread.GetStackFrameAtIndex(0).get(), value, ConstString("")); } else if ((type_flags & eTypeIsScalar) || (type_flags & eTypeIsEnumeration)) //'Integral' + 'Floating Point' { - value.SetValueType(Value::eValueTypeScalar); + value.SetValueType(Value::ValueType::Scalar); llvm::Optional byte_size = return_compiler_type.GetByteSize(&thread); if (!byte_size) @@ -453,7 +453,7 @@ uint32_t enm = thread.GetRegisterContext()->ReadRegisterAsUnsigned(eax_id, 0) & 0xffffffff; - value.SetValueType(Value::eValueTypeScalar); + value.SetValueType(Value::ValueType::Scalar); value.GetScalar() = enm; return_valobj_sp = ValueObjectConstResult::Create( thread.GetStackFrameAtIndex(0).get(), value, ConstString("")); Index: lldb/source/Plugins/ABI/X86/ABISysV_x86_64.cpp =================================================================== --- lldb/source/Plugins/ABI/X86/ABISysV_x86_64.cpp +++ lldb/source/Plugins/ABI/X86/ABISysV_x86_64.cpp @@ -399,7 +399,7 @@ const uint32_t type_flags = return_compiler_type.GetTypeInfo(); if (type_flags & eTypeIsScalar) { - value.SetValueType(Value::eValueTypeScalar); + value.SetValueType(Value::ValueType::Scalar); bool success = false; if (type_flags & eTypeIsInteger) { @@ -487,7 +487,7 @@ value.GetScalar() = (uint64_t)thread.GetRegisterContext()->ReadRegisterAsUnsigned(rax_id, 0); - value.SetValueType(Value::eValueTypeScalar); + value.SetValueType(Value::ValueType::Scalar); return_valobj_sp = ValueObjectConstResult::Create( thread.GetStackFrameAtIndex(0).get(), value, ConstString("")); } else if (type_flags & eTypeIsVector) { Index: lldb/source/Plugins/ABI/X86/ABIWindows_x86_64.cpp =================================================================== --- lldb/source/Plugins/ABI/X86/ABIWindows_x86_64.cpp +++ lldb/source/Plugins/ABI/X86/ABIWindows_x86_64.cpp @@ -408,7 +408,7 @@ const uint32_t type_flags = return_compiler_type.GetTypeInfo(); if (type_flags & eTypeIsScalar) { - value.SetValueType(Value::eValueTypeScalar); + value.SetValueType(Value::ValueType::Scalar); bool success = false; if (type_flags & eTypeIsInteger) { @@ -494,7 +494,7 @@ value.GetScalar() = (uint64_t)thread.GetRegisterContext()->ReadRegisterAsUnsigned(rax_id, 0); - value.SetValueType(Value::eValueTypeScalar); + value.SetValueType(Value::ValueType::Scalar); return_valobj_sp = ValueObjectConstResult::Create( thread.GetStackFrameAtIndex(0).get(), value, ConstString("")); } else if (type_flags & eTypeIsVector) { Index: lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOS.cpp =================================================================== --- lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOS.cpp +++ lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOS.cpp @@ -244,18 +244,18 @@ clang_ast_context->GetBuiltinTypeForEncodingAndBitSize( lldb::eEncodingUint, 32); - mode_value.SetValueType(Value::eValueTypeScalar); + mode_value.SetValueType(Value::ValueType::Scalar); mode_value.SetCompilerType(clang_uint32_type); if (process->GetTarget().GetArchitecture().GetAddressByteSize() == 4) { - count_value.SetValueType(Value::eValueTypeScalar); + count_value.SetValueType(Value::ValueType::Scalar); count_value.SetCompilerType(clang_uint32_type); } else { - count_value.SetValueType(Value::eValueTypeScalar); + count_value.SetValueType(Value::ValueType::Scalar); count_value.SetCompilerType(clang_uint64_type); } - headers_value.SetValueType(Value::eValueTypeScalar); + headers_value.SetValueType(Value::ValueType::Scalar); headers_value.SetCompilerType(clang_void_ptr_type); argument_values.PushValue(mode_value); Index: lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp =================================================================== --- lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp +++ lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp @@ -355,7 +355,7 @@ CompilerType clang_uint32_type = clang_ast_context->GetBuiltinTypeForEncodingAndBitSize( lldb::eEncodingUint, 32); - input_value.SetValueType(Value::eValueTypeScalar); + input_value.SetValueType(Value::ValueType::Scalar); input_value.SetCompilerType(clang_uint32_type); // input_value.SetContext (Value::eContextTypeClangType, // clang_uint32_type); Index: lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp =================================================================== --- lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp +++ lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp @@ -1493,7 +1493,7 @@ if (var_location_expr.GetExpressionData(const_value_extractor)) { var_location = Value(const_value_extractor.GetDataStart(), const_value_extractor.GetByteSize()); - var_location.SetValueType(Value::eValueTypeHostAddress); + var_location.SetValueType(Value::ValueType::HostAddress); } else { LLDB_LOG(log, "Error evaluating constant variable: {0}", err.AsCString()); return false; @@ -1512,10 +1512,10 @@ if (parser_type) *parser_type = TypeFromParser(type_to_use); - if (var_location.GetContextType() == Value::eContextTypeInvalid) + if (var_location.GetContextType() == Value::ContextType::Invalid) var_location.SetCompilerType(type_to_use); - if (var_location.GetValueType() == Value::eValueTypeFileAddress) { + if (var_location.GetValueType() == Value::ValueType::FileAddress) { SymbolContext var_sc; var->CalculateSymbolContext(&var_sc); @@ -1529,7 +1529,7 @@ if (load_addr != LLDB_INVALID_ADDRESS) { var_location.GetScalar() = load_addr; - var_location.SetValueType(Value::eValueTypeLoadAddress); + var_location.SetValueType(Value::ValueType::LoadAddress); } } @@ -1665,11 +1665,11 @@ const Address symbol_address = symbol.GetAddress(); lldb::addr_t symbol_load_addr = symbol_address.GetLoadAddress(target); - // parser_vars->m_lldb_value.SetContext(Value::eContextTypeClangType, + // parser_vars->m_lldb_value.SetContext(Value::ContextType::ClangType, // user_type.GetOpaqueQualType()); parser_vars->m_lldb_value.SetCompilerType(user_type); parser_vars->m_lldb_value.GetScalar() = symbol_load_addr; - parser_vars->m_lldb_value.SetValueType(Value::eValueTypeLoadAddress); + parser_vars->m_lldb_value.SetValueType(Value::ValueType::LoadAddress); parser_vars->m_named_decl = var_decl; parser_vars->m_llvm_value = nullptr; @@ -1860,14 +1860,14 @@ entity->GetParserVars(GetParserID()); if (load_addr != LLDB_INVALID_ADDRESS) { - parser_vars->m_lldb_value.SetValueType(Value::eValueTypeLoadAddress); + parser_vars->m_lldb_value.SetValueType(Value::ValueType::LoadAddress); parser_vars->m_lldb_value.GetScalar() = load_addr; } else { // We have to try finding a file address. lldb::addr_t file_addr = fun_address.GetFileAddress(); - parser_vars->m_lldb_value.SetValueType(Value::eValueTypeFileAddress); + parser_vars->m_lldb_value.SetValueType(Value::ValueType::FileAddress); parser_vars->m_lldb_value.GetScalar() = file_addr; } Index: lldb/source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.cpp =================================================================== --- lldb/source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.cpp +++ lldb/source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.cpp @@ -196,7 +196,7 @@ // class_type_or_name.Clear(); - value_type = Value::ValueType::eValueTypeScalar; + value_type = Value::ValueType::Scalar; // Only a pointer or reference type can have a different dynamic and static // type: Index: lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV1.cpp =================================================================== --- lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV1.cpp +++ lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV1.cpp @@ -49,7 +49,7 @@ TypeAndOrName &class_type_or_name, Address &address, Value::ValueType &value_type) { class_type_or_name.Clear(); - value_type = Value::ValueType::eValueTypeScalar; + value_type = Value::ValueType::Scalar; if (CouldHaveDynamicValue(in_value)) { auto class_descriptor(GetClassDescriptor(in_value)); if (class_descriptor && class_descriptor->IsValid() && Index: lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp =================================================================== --- lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp +++ lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp @@ -451,7 +451,7 @@ assert(in_value.GetTargetSP().get() == m_process->CalculateTarget().get()); class_type_or_name.Clear(); - value_type = Value::ValueType::eValueTypeScalar; + value_type = Value::ValueType::Scalar; // Make sure we can have a dynamic value before starting... if (CouldHaveDynamicValue(in_value)) { @@ -1346,12 +1346,12 @@ // Next make the runner function for our implementation utility function. Value value; - value.SetValueType(Value::eValueTypeScalar); + value.SetValueType(Value::ValueType::Scalar); value.SetCompilerType(clang_void_pointer_type); arguments.PushValue(value); arguments.PushValue(value); - value.SetValueType(Value::eValueTypeScalar); + value.SetValueType(Value::ValueType::Scalar); value.SetCompilerType(clang_uint32_t_type); arguments.PushValue(value); arguments.PushValue(value); @@ -1420,7 +1420,7 @@ options.SetIsForUtilityExpr(true); Value return_value; - return_value.SetValueType(Value::eValueTypeScalar); + return_value.SetValueType(Value::ValueType::Scalar); return_value.SetCompilerType(clang_uint32_t_type); return_value.GetScalar() = 0; @@ -1628,12 +1628,12 @@ // Next make the function caller for our implementation utility function. Value value; - value.SetValueType(Value::eValueTypeScalar); + value.SetValueType(Value::ValueType::Scalar); value.SetCompilerType(clang_void_pointer_type); arguments.PushValue(value); arguments.PushValue(value); - value.SetValueType(Value::eValueTypeScalar); + value.SetValueType(Value::ValueType::Scalar); value.SetCompilerType(clang_uint32_t_type); arguments.PushValue(value); arguments.PushValue(value); @@ -1698,7 +1698,7 @@ options.SetIsForUtilityExpr(true); Value return_value; - return_value.SetValueType(Value::eValueTypeScalar); + return_value.SetValueType(Value::ValueType::Scalar); return_value.SetCompilerType(clang_uint32_t_type); return_value.GetScalar() = 0; Index: lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTrampolineHandler.cpp =================================================================== --- lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTrampolineHandler.cpp +++ lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTrampolineHandler.cpp @@ -526,7 +526,7 @@ CompilerType clang_void_ptr_type = clang_ast_context->GetBasicType(eBasicTypeVoid).GetPointerType(); - input_value.SetValueType(Value::eValueTypeScalar); + input_value.SetValueType(Value::ValueType::Scalar); // input_value.SetContext (Value::eContextTypeClangType, // clang_void_ptr_type); input_value.SetCompilerType(clang_void_ptr_type); @@ -936,7 +936,7 @@ Value void_ptr_value; CompilerType clang_void_ptr_type = clang_ast_context->GetBasicType(eBasicTypeVoid).GetPointerType(); - void_ptr_value.SetValueType(Value::eValueTypeScalar); + void_ptr_value.SetValueType(Value::ValueType::Scalar); // void_ptr_value.SetContext (Value::eContextTypeClangType, // clang_void_ptr_type); void_ptr_value.SetCompilerType(clang_void_ptr_type); @@ -1048,7 +1048,7 @@ Value isa_value(*(argument_values.GetValueAtIndex(obj_index))); - isa_value.SetValueType(Value::eValueTypeLoadAddress); + isa_value.SetValueType(Value::ValueType::LoadAddress); isa_value.ResolveValue(&exe_ctx); if (isa_value.GetScalar().IsValid()) { isa_addr = isa_value.GetScalar().ULongLong(); @@ -1110,7 +1110,7 @@ CompilerType clang_int_type = clang_ast_context->GetBuiltinTypeForEncodingAndBitSize( lldb::eEncodingSint, 32); - flag_value.SetValueType(Value::eValueTypeScalar); + flag_value.SetValueType(Value::ValueType::Scalar); // flag_value.SetContext (Value::eContextTypeClangType, clang_int_type); flag_value.SetCompilerType(clang_int_type); Index: lldb/source/Plugins/Platform/POSIX/PlatformPOSIX.cpp =================================================================== --- lldb/source/Plugins/Platform/POSIX/PlatformPOSIX.cpp +++ lldb/source/Plugins/Platform/POSIX/PlatformPOSIX.cpp @@ -659,7 +659,7 @@ // We are passing four arguments, the basename, the list of places to look, // a buffer big enough for all the path + name combos, and // a pointer to the storage we've made for the result: - value.SetValueType(Value::eValueTypeScalar); + value.SetValueType(Value::ValueType::Scalar); value.SetCompilerType(clang_void_pointer_type); arguments.PushValue(value); value.SetCompilerType(clang_char_pointer_type); Index: lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp =================================================================== --- lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp +++ lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp @@ -1784,7 +1784,7 @@ if (location.Evaluate(nullptr, LLDB_INVALID_ADDRESS, nullptr, nullptr, location_result, &error)) { if (location_result.GetValueType() == - Value::eValueTypeFileAddress) { + Value::ValueType::FileAddress) { lldb::addr_t file_addr = location_result.GetScalar().ULongLong(); lldb::addr_t byte_size = 1; Index: lldb/source/Plugins/SystemRuntime/MacOSX/AppleGetItemInfoHandler.cpp =================================================================== --- lldb/source/Plugins/SystemRuntime/MacOSX/AppleGetItemInfoHandler.cpp +++ lldb/source/Plugins/SystemRuntime/MacOSX/AppleGetItemInfoHandler.cpp @@ -258,26 +258,26 @@ CompilerType clang_void_ptr_type = clang_ast_context->GetBasicType(eBasicTypeVoid).GetPointerType(); Value return_buffer_ptr_value; - return_buffer_ptr_value.SetValueType(Value::eValueTypeScalar); + return_buffer_ptr_value.SetValueType(Value::ValueType::Scalar); return_buffer_ptr_value.SetCompilerType(clang_void_ptr_type); CompilerType clang_int_type = clang_ast_context->GetBasicType(eBasicTypeInt); Value debug_value; - debug_value.SetValueType(Value::eValueTypeScalar); + debug_value.SetValueType(Value::ValueType::Scalar); debug_value.SetCompilerType(clang_int_type); CompilerType clang_uint64_type = clang_ast_context->GetBasicType(eBasicTypeUnsignedLongLong); Value item_value; - item_value.SetValueType(Value::eValueTypeScalar); + item_value.SetValueType(Value::ValueType::Scalar); item_value.SetCompilerType(clang_uint64_type); Value page_to_free_value; - page_to_free_value.SetValueType(Value::eValueTypeScalar); + page_to_free_value.SetValueType(Value::ValueType::Scalar); page_to_free_value.SetCompilerType(clang_void_ptr_type); Value page_to_free_size_value; - page_to_free_size_value.SetValueType(Value::eValueTypeScalar); + page_to_free_size_value.SetValueType(Value::ValueType::Scalar); page_to_free_size_value.SetCompilerType(clang_uint64_type); std::lock_guard guard(m_get_item_info_retbuffer_mutex); Index: lldb/source/Plugins/SystemRuntime/MacOSX/AppleGetPendingItemsHandler.cpp =================================================================== --- lldb/source/Plugins/SystemRuntime/MacOSX/AppleGetPendingItemsHandler.cpp +++ lldb/source/Plugins/SystemRuntime/MacOSX/AppleGetPendingItemsHandler.cpp @@ -261,26 +261,26 @@ CompilerType clang_void_ptr_type = clang_ast_context->GetBasicType(eBasicTypeVoid).GetPointerType(); Value return_buffer_ptr_value; - return_buffer_ptr_value.SetValueType(Value::eValueTypeScalar); + return_buffer_ptr_value.SetValueType(Value::ValueType::Scalar); return_buffer_ptr_value.SetCompilerType(clang_void_ptr_type); CompilerType clang_int_type = clang_ast_context->GetBasicType(eBasicTypeInt); Value debug_value; - debug_value.SetValueType(Value::eValueTypeScalar); + debug_value.SetValueType(Value::ValueType::Scalar); debug_value.SetCompilerType(clang_int_type); CompilerType clang_uint64_type = clang_ast_context->GetBasicType(eBasicTypeUnsignedLongLong); Value queue_value; - queue_value.SetValueType(Value::eValueTypeScalar); + queue_value.SetValueType(Value::ValueType::Scalar); queue_value.SetCompilerType(clang_uint64_type); Value page_to_free_value; - page_to_free_value.SetValueType(Value::eValueTypeScalar); + page_to_free_value.SetValueType(Value::ValueType::Scalar); page_to_free_value.SetCompilerType(clang_void_ptr_type); Value page_to_free_size_value; - page_to_free_size_value.SetValueType(Value::eValueTypeScalar); + page_to_free_size_value.SetValueType(Value::ValueType::Scalar); page_to_free_size_value.SetCompilerType(clang_uint64_type); std::lock_guard guard(m_get_pending_items_retbuffer_mutex); Index: lldb/source/Plugins/SystemRuntime/MacOSX/AppleGetQueuesHandler.cpp =================================================================== --- lldb/source/Plugins/SystemRuntime/MacOSX/AppleGetQueuesHandler.cpp +++ lldb/source/Plugins/SystemRuntime/MacOSX/AppleGetQueuesHandler.cpp @@ -264,22 +264,22 @@ CompilerType clang_void_ptr_type = clang_ast_context->GetBasicType(eBasicTypeVoid).GetPointerType(); Value return_buffer_ptr_value; - return_buffer_ptr_value.SetValueType(Value::eValueTypeScalar); + return_buffer_ptr_value.SetValueType(Value::ValueType::Scalar); return_buffer_ptr_value.SetCompilerType(clang_void_ptr_type); CompilerType clang_int_type = clang_ast_context->GetBasicType(eBasicTypeInt); Value debug_value; - debug_value.SetValueType(Value::eValueTypeScalar); + debug_value.SetValueType(Value::ValueType::Scalar); debug_value.SetCompilerType(clang_int_type); Value page_to_free_value; - page_to_free_value.SetValueType(Value::eValueTypeScalar); + page_to_free_value.SetValueType(Value::ValueType::Scalar); page_to_free_value.SetCompilerType(clang_void_ptr_type); CompilerType clang_uint64_type = clang_ast_context->GetBasicType(eBasicTypeUnsignedLongLong); Value page_to_free_size_value; - page_to_free_size_value.SetValueType(Value::eValueTypeScalar); + page_to_free_size_value.SetValueType(Value::ValueType::Scalar); page_to_free_size_value.SetCompilerType(clang_uint64_type); std::lock_guard guard(m_get_queues_retbuffer_mutex); Index: lldb/source/Plugins/SystemRuntime/MacOSX/AppleGetThreadItemInfoHandler.cpp =================================================================== --- lldb/source/Plugins/SystemRuntime/MacOSX/AppleGetThreadItemInfoHandler.cpp +++ lldb/source/Plugins/SystemRuntime/MacOSX/AppleGetThreadItemInfoHandler.cpp @@ -262,26 +262,26 @@ CompilerType clang_void_ptr_type = clang_ast_context->GetBasicType(eBasicTypeVoid).GetPointerType(); Value return_buffer_ptr_value; - return_buffer_ptr_value.SetValueType(Value::eValueTypeScalar); + return_buffer_ptr_value.SetValueType(Value::ValueType::Scalar); return_buffer_ptr_value.SetCompilerType(clang_void_ptr_type); CompilerType clang_int_type = clang_ast_context->GetBasicType(eBasicTypeInt); Value debug_value; - debug_value.SetValueType(Value::eValueTypeScalar); + debug_value.SetValueType(Value::ValueType::Scalar); debug_value.SetCompilerType(clang_int_type); CompilerType clang_uint64_type = clang_ast_context->GetBasicType(eBasicTypeUnsignedLongLong); Value thread_id_value; - thread_id_value.SetValueType(Value::eValueTypeScalar); + thread_id_value.SetValueType(Value::ValueType::Scalar); thread_id_value.SetCompilerType(clang_uint64_type); Value page_to_free_value; - page_to_free_value.SetValueType(Value::eValueTypeScalar); + page_to_free_value.SetValueType(Value::ValueType::Scalar); page_to_free_value.SetCompilerType(clang_void_ptr_type); Value page_to_free_size_value; - page_to_free_size_value.SetValueType(Value::eValueTypeScalar); + page_to_free_size_value.SetValueType(Value::ValueType::Scalar); page_to_free_size_value.SetCompilerType(clang_uint64_type); std::lock_guard guard(m_get_thread_item_info_retbuffer_mutex); Index: lldb/source/Target/ABI.cpp =================================================================== --- lldb/source/Target/ABI.cpp +++ lldb/source/Target/ABI.cpp @@ -120,11 +120,13 @@ const Value &result_value = live_valobj_sp->GetValue(); switch (result_value.GetValueType()) { - case Value::eValueTypeHostAddress: - case Value::eValueTypeFileAddress: - // we don't do anything with these for now + case Value::ValueType::Invalid: + return {}; + case Value::ValueType::HostAddress: + case Value::ValueType::FileAddress: + // we odon't do anything with these for now break; - case Value::eValueTypeScalar: + case Value::ValueType::Scalar: expr_variable_sp->m_flags |= ExpressionVariable::EVIsFreezeDried; expr_variable_sp->m_flags |= @@ -132,7 +134,7 @@ expr_variable_sp->m_flags |= ExpressionVariable::EVNeedsAllocation; break; - case Value::eValueTypeLoadAddress: + case Value::ValueType::LoadAddress: expr_variable_sp->m_live_sp = live_valobj_sp; expr_variable_sp->m_flags |= ExpressionVariable::EVIsProgramReference; Index: lldb/source/Target/RegisterContextUnwind.cpp =================================================================== --- lldb/source/Target/RegisterContextUnwind.cpp +++ lldb/source/Target/RegisterContextUnwind.cpp @@ -1521,7 +1521,7 @@ DWARFExpression dwarfexpr(opcode_ctx, dwarfdata, nullptr); dwarfexpr.SetRegisterKind(unwindplan_registerkind); Value cfa_val = Scalar(m_cfa); - cfa_val.SetValueType(Value::eValueTypeLoadAddress); + cfa_val.SetValueType(Value::ValueType::LoadAddress); Value result; Status error; if (dwarfexpr.Evaluate(&exe_ctx, this, 0, &cfa_val, nullptr, result, Index: lldb/source/Target/ThreadPlanTracer.cpp =================================================================== --- lldb/source/Target/ThreadPlanTracer.cpp +++ lldb/source/Target/ThreadPlanTracer.cpp @@ -191,7 +191,7 @@ for (int arg_index = 0; arg_index < num_args; ++arg_index) { Value value; - value.SetValueType(Value::eValueTypeScalar); + value.SetValueType(Value::ValueType::Scalar); value.SetCompilerType(intptr_type); value_list.PushValue(value); } Index: lldb/unittests/Expression/DWARFExpressionTest.cpp =================================================================== --- lldb/unittests/Expression/DWARFExpressionTest.cpp +++ lldb/unittests/Expression/DWARFExpressionTest.cpp @@ -34,9 +34,9 @@ return status.ToError(); switch (result.GetValueType()) { - case Value::eValueTypeScalar: + case Value::ValueType::Scalar: return result.GetScalar(); - case Value::eValueTypeHostAddress: { + case Value::ValueType::HostAddress: { // Convert small buffers to scalars to simplify the tests. DataBufferHeap &buf = result.GetBuffer(); if (buf.GetByteSize() <= 8) {