[Lldb-commits] [lldb] [lldb][minidump] Fix Memory64List DataSize over-counting on a failed read (PR #212861)

Jacob Lalonde via lldb-commits lldb-commits at lists.llvm.org
Wed Jul 29 13:46:04 PDT 2026


================
@@ -0,0 +1,47 @@
+#include <cstdint>
+#include <cstdio>
+#include <cstring>
+#include <sys/mman.h>
+#include <sys/syscall.h>
+#include <unistd.h>
+
+// Set up two memory regions to exercise save-core's Memory64List accounting:
+//
+//   good - a large, fully-readable region (so the dump uses a Memory64List and
+//          there is a real range whose bytes must line up in the shared blob).
+//   bad  - a read/write region whose tail is unreadable: an anonymous in-memory
+//          file (memfd) one page long, mapped four pages long, so the pages
+//          past the file's end fault when read. Reading into that tail fails
+//          part-way, which used to make save-core count the partially-read
+//          bytes into the range's DataSize even though they were never written,
+//          desyncing the blob. A memfd is used so the test does not touch the
+//          filesystem.
+int main() {
+  const size_t page = sysconf(_SC_PAGESIZE);
+
+  const size_t good_size = 2 * 1024 * 1024;
----------------
Jlalond wrote:

Nit: The good bad variable nameing is a bit weird

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


More information about the lldb-commits mailing list