[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
Wed Feb 10 15:55:13 PST 2021
omjavaid created this revision.
omjavaid added a reviewer: labath.
Herald added a subscriber: kristof.beyls.
omjavaid requested review of this revision.
This patch builds on D96458 <https://reviews.llvm.org/D96458> and add ability to pull in Aux Vector HWCAP information into NativeRegisterContextLinux_arm64.
In following up patches we will use this information to decide on whether we need to support certain Arm64 feature registers or not.
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
@@ -84,6 +85,25 @@
return static_cast<RegisterInfoPOSIX_arm64 &>(*m_register_info_interface_up);
}
+uint32_t NativeRegisterContextLinux_arm64::QueryAuxvForOptionalRegset() {
+ NativeProcessProtocol &process = m_thread.GetProcess();
+ auto buffer_or_error = process.GetAuxvData();
+ if (!buffer_or_error)
+ return 0;
+
+ DataExtractor auxv_data(buffer_or_error.get()->getBufferStart(),
+ buffer_or_error.get()->getBufferSize(),
+ process.GetByteOrder(), process.GetAddressByteSize());
+
+ std::unique_ptr<AuxVector> aux_vector =
+ std::make_unique<AuxVector>(auxv_data);
+
+ llvm::Optional<uint64_t> auxv_at_hwcap =
+ aux_vector->GetAuxValue(AuxVector::AUXV_AT_HWCAP);
+
+ return 0;
+}
+
uint32_t NativeRegisterContextLinux_arm64::GetRegisterSetCount() const {
return GetRegisterInfo().GetRegisterSetCount();
}
@@ -1094,8 +1114,8 @@
// Read SVE configuration data and configure register infos.
if (!m_sve_header_is_valid && m_sve_state != SVEState::Disabled) {
Status error = ReadSVEHeader();
- uint32_t opt_regset = ARM64_REGS_CONFIG_DEFAULT;
if (m_sve_state == SVEState::Unknown) {
+ uint32_t opt_regset = QueryAuxvForOptionalRegset();
if (error.Success()) {
opt_regset |= ARM64_REGS_CONFIG_SVE;
GetRegisterInfo().ConfigureRegisterInfos(opt_regset);
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.322849.patch
Type: text/x-patch
Size: 3911 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20210210/fe4958f9/attachment.bin>
More information about the lldb-commits
mailing list