================
@@ -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()));
----------------
clayborg wrote:

There is no need to copy the data extractor. It contains no modifiable state as 
the position curser is passed in as variables when acessing the data within. I 
would highly suggest changing to:
```
const DataExtractor &ProcessElfCore::GetAuxvData() { 
  // Feel free to add asserts here if you want them as long as the code 
functions correctly
  // even if the asserts get triggered.
  return m_auxv; 
}
```

https://github.com/llvm/llvm-project/pull/102263
_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to