[Lldb-commits] [lldb] 8fe9718 - [lldb] Implement GetValueTypeFromAddressType
Augusto Noronha via lldb-commits
lldb-commits at lists.llvm.org
Thu May 18 10:32:49 PDT 2023
Author: Augusto Noronha
Date: 2023-05-18T10:29:15-07:00
New Revision: 8fe9718dd5f27168fc282c6420bfae0eb7ee6819
URL: https://github.com/llvm/llvm-project/commit/8fe9718dd5f27168fc282c6420bfae0eb7ee6819
DIFF: https://github.com/llvm/llvm-project/commit/8fe9718dd5f27168fc282c6420bfae0eb7ee6819.diff
LOG: [lldb] Implement GetValueTypeFromAddressType
Value::ValueType is a superset of AddressType. Add a function to
convert an AddressType into a Value::ValueType.
Differential Revision: https://reviews.llvm.org/D150826
Added:
Modified:
lldb/include/lldb/Core/Value.h
lldb/source/Core/Value.cpp
Removed:
################################################################################
diff --git a/lldb/include/lldb/Core/Value.h b/lldb/include/lldb/Core/Value.h
index fdda9f1db491a..ead23acc6f9b1 100644
--- a/lldb/include/lldb/Core/Value.h
+++ b/lldb/include/lldb/Core/Value.h
@@ -145,6 +145,8 @@ class Value {
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
index ccd36096b5456..5a2631ca501f6 100644
--- a/lldb/source/Core/Value.cpp
+++ b/lldb/source/Core/Value.cpp
@@ -121,6 +121,20 @@ AddressType Value::GetValueAddressType() const {
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;
+ }
+ llvm_unreachable("Unexpected address type!");
+}
+
RegisterInfo *Value::GetRegisterInfo() const {
if (m_context_type == ContextType::RegisterInfo)
return static_cast<RegisterInfo *>(m_context);
More information about the lldb-commits
mailing list