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

Greg Clayton via lldb-commits lldb-commits at lists.llvm.org
Thu Aug 8 22:45:04 PDT 2024


================
@@ -669,6 +669,13 @@ class ObjectFile : public std::enable_shared_from_this<ObjectFile>,
   // transparent decompression of section contents.
   size_t CopyData(lldb::offset_t offset, size_t length, void *dst) const;
 
+  // Returns a pointer to the data at the specified offset. If the offset is
+  // invalid, this function will return nullptr. The 'available_bytes' argument
+  // will be set to the number of bytes available at the given offset, which
+  // will be at most 'length' bytes.
+  const uint8_t *PeekData(lldb::addr_t offset, size_t length,
+                          size_t &available_bytes) const;
+
----------------
clayborg wrote:

return `llvm::ArrayRef<uint8_t>` and get rid of the `size_t &available_bytes` parameter as the size of the returned ArrayRef will be sufficient. Also, please provide a default implementation that returns an empty array so subclasses that don't override this don't have to have change to their header and implementation file.

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


More information about the lldb-commits mailing list