[Lldb-commits] [PATCH] D96459: [LLDB] Pull AuxVec info into NativeRegisterContextLinux_arm64

Muhammad Omair Javaid via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Mon Feb 22 06:31:50 PST 2021


omjavaid updated this revision to Diff 325434.
omjavaid added a comment.

Rebased after updates to parent.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D96459/new/

https://reviews.llvm.org/D96459

Files:
  lldb/source/Plugins/Process/Linux/NativeProcessLinux.cpp
  lldb/source/Plugins/Process/Linux/NativeProcessLinux.h
  lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_arm64.cpp
  lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_arm64.h


Index: lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_arm64.h
===================================================================
--- lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_arm64.h
+++ lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_arm64.h
@@ -166,6 +166,8 @@
 
   Status ReadHardwareDebugInfo();
 
+  uint32_t QueryAuxvForOptionalRegset();
+
   Status WriteHardwareDebugRegs(int hwbType);
 
   uint32_t CalculateFprOffset(const RegisterInfo *reg_info) const;
Index: lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_arm64.cpp
===================================================================
--- lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_arm64.cpp
+++ lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_arm64.cpp
@@ -21,6 +21,7 @@
 #include "Plugins/Process/Linux/NativeProcessLinux.h"
 #include "Plugins/Process/Linux/Procfs.h"
 #include "Plugins/Process/POSIX/ProcessPOSIXLog.h"
+#include "Plugins/Process/Utility/AuxVector.h"
 #include "Plugins/Process/Utility/RegisterInfoPOSIX_arm64.h"
 
 // System includes - They have to be included after framework includes because
@@ -78,7 +79,7 @@
   // At this stage we configure register sets supported by this AArch64 target.
   // ReadSVEHeader is called to check for SVE support.
   Status error = ReadSVEHeader();
-  uint32_t opt_regset = RegisterInfoPOSIX_arm64::eRegsetEnableDefault;
+  uint32_t opt_regset = QueryAuxvForOptionalRegset();
   if (error.Success()) {
     // SVE is supported, enable its register set.
     // Setting m_sve_state to SVEState::Unknown it will be updated by
@@ -98,6 +99,10 @@
   return static_cast<RegisterInfoPOSIX_arm64 &>(*m_register_info_interface_up);
 }
 
+uint32_t NativeRegisterContextLinux_arm64::QueryAuxvForOptionalRegset() {
+  return RegisterInfoPOSIX_arm64::eRegsetEnableSVE;
+}
+
 uint32_t NativeRegisterContextLinux_arm64::GetRegisterSetCount() const {
   return GetRegisterInfo().GetRegisterSetCount();
 }
Index: lldb/source/Plugins/Process/Linux/NativeProcessLinux.h
===================================================================
--- lldb/source/Plugins/Process/Linux/NativeProcessLinux.h
+++ lldb/source/Plugins/Process/Linux/NativeProcessLinux.h
@@ -156,6 +156,8 @@
 
   static Status SetDefaultPtraceOpts(const lldb::pid_t);
 
+  llvm::Optional<uint64_t> GetAuxValue(enum AuxVector::EntryType type);
+
   void MonitorCallback(lldb::pid_t pid, bool exited, WaitStatus status);
 
   void WaitForNewThread(::pid_t tid);
Index: lldb/source/Plugins/Process/Linux/NativeProcessLinux.cpp
===================================================================
--- lldb/source/Plugins/Process/Linux/NativeProcessLinux.cpp
+++ lldb/source/Plugins/Process/Linux/NativeProcessLinux.cpp
@@ -2021,3 +2021,18 @@
 
   return error;
 }
+
+llvm::Optional<uint64_t>
+NativeProcessLinux::GetAuxValue(enum AuxVector::EntryType type) {
+  if (m_aux_vector == nullptr) {
+    auto buffer_or_error = GetAuxvData();
+    if (!buffer_or_error)
+      return llvm::None;
+    DataExtractor auxv_data(buffer_or_error.get()->getBufferStart(),
+                            buffer_or_error.get()->getBufferSize(),
+                            GetByteOrder(), GetAddressByteSize());
+    m_aux_vector = std::make_unique<AuxVector>(auxv_data);
+  }
+
+  return m_aux_vector->GetAuxValue(type);
+}


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D96459.325434.patch
Type: text/x-patch
Size: 3361 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20210222/f561d0a0/attachment-0001.bin>


More information about the lldb-commits mailing list