[Lldb-commits] [lldb] [lldb] Add 'FindInMemory()' overload for PostMortemProcess. (PR #102536)

Pavel Labath via lldb-commits lldb-commits at lists.llvm.org
Mon Aug 12 03:01:09 PDT 2024


================
@@ -482,6 +482,13 @@ size_t ObjectFile::CopyData(lldb::offset_t offset, size_t length,
   return m_data.CopyData(offset, length, dst);
 }
 
+llvm::ArrayRef<uint8_t> ObjectFile::PeekData(lldb::addr_t offset,
+                                             size_t length) const {
+  const uint8_t *data = m_data.PeekData(offset, length);
+  llvm::ArrayRef<uint8_t> array(data, length);
+  return array;
+}
+
----------------
labath wrote:

Could we avoid adding this function? You should be able access the same data using the `DataExtractor` overload of `GetData` (line 471, just call `GetData` on the returned DataExtractor), and this function is basically unimplementable for in-memory object files, which read their data on demand (as there's noone who can own the returned data).

(I realize this PR is not interested in those, but this API is going to be available for all object files)

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


More information about the lldb-commits mailing list