[Lldb-commits] [lldb] [LLDB][NFC] Calculate the region size of an in memory image if size isn't specified (PR #123148)

Jacob Lalonde via lldb-commits lldb-commits at lists.llvm.org
Thu Jan 16 13:15:50 PST 2025


================
@@ -2544,6 +2544,26 @@ ModuleSP Process::ReadModuleFromMemory(const FileSpec &file_spec,
       progress_up = std::make_unique<Progress>(
           "Reading binary from memory", file_spec.GetFilename().GetString());
 
+    if (size_to_read == 0) {
+      // No size was provided, figure out the size of the memory region that
+      // contains "header_addr"
+      MemoryRegionInfo header_region_info;
+      Status error(GetMemoryRegionInfo(header_addr, header_region_info));
+      // Default to 512 in case we can't find a memory region.
+      size_to_read = 512;
+      if (error.Success()) {
+        // We found a memory region, set the range of bytes ro read to read to
----------------
Jlalond wrote:

> set the range of bytes ro read to read to the end of the memory region.

Typo plus maybe rephrase to
> set the range to read to the end of the memory region.

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


More information about the lldb-commits mailing list