[Lldb-commits] [lldb] [lldb][NFCI] Simplify ProcessElfCore::GetAuxvData() (PR #102263)

Igor Kudrin via lldb-commits lldb-commits at lists.llvm.org
Fri Aug 9 10:53:41 PDT 2024


================
@@ -1077,10 +1077,10 @@ ArchSpec ProcessElfCore::GetArchitecture() {
 }
 
 DataExtractor ProcessElfCore::GetAuxvData() {
-  const uint8_t *start = m_auxv.GetDataStart();
-  size_t len = m_auxv.GetByteSize();
-  lldb::DataBufferSP buffer(new lldb_private::DataBufferHeap(start, len));
-  return DataExtractor(buffer, GetByteOrder(), GetAddressByteSize());
+  assert(m_auxv.GetByteSize() == 0 ||
+         (m_auxv.GetByteOrder() == GetByteOrder() &&
+          m_auxv.GetAddressByteSize() == GetAddressByteSize()));
----------------
igorkudrin wrote:

I'd also prefer to return a constant reference, but there are other implementations of this virtual function that can't do that, for example, `ProcessGDBRemote::GetAuxvData()`.

https://github.com/llvm/llvm-project/pull/102263


More information about the lldb-commits mailing list