[Lldb-commits] [PATCH] D150826: [lldb] Implement GetValueTypeFromAddressType

Augusto Noronha via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Wed May 17 15:58:14 PDT 2023


augusto2112 created this revision.
augusto2112 added a reviewer: aprantl.
Herald added a project: All.
augusto2112 requested review of this revision.
Herald added a project: LLDB.
Herald added a subscriber: lldb-commits.

Value::ValueType is a superset of AddressType. Add a function to
convert an AddressType into a Value::ValueType.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D150826

Files:
  lldb/include/lldb/Core/Value.h
  lldb/source/Core/Value.cpp


Index: lldb/source/Core/Value.cpp
===================================================================
--- lldb/source/Core/Value.cpp
+++ 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<RegisterInfo *>(m_context);
Index: lldb/include/lldb/Core/Value.h
===================================================================
--- lldb/include/lldb/Core/Value.h
+++ 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;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D150826.523206.patch
Type: text/x-patch
Size: 1140 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20230517/765d9576/attachment.bin>


More information about the lldb-commits mailing list