[Lldb-commits] [PATCH] D143012: Add a bit of error checking to SBProcess::ReadMemory to check if a nullptr destination buffer was provided, return error

Jonas Devlieghere via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Mon Feb 6 15:03:00 PST 2023


JDevlieghere accepted this revision.
JDevlieghere added a comment.
This revision is now accepted and ready to land.

LGTM modulo inline comments



================
Comment at: lldb/source/API/SBProcess.cpp:807-811
+  if (!dst) {
+    sb_error.SetErrorStringWithFormat(
+        "no buffer provided to read %zu bytes into", dst_len);
+    return 0;
+  }
----------------
Nit: this isn't using `bytes_read` so I'd move the new code above it.


================
Comment at: lldb/test/API/python_api/process/TestProcessAPI.py:70-72
+        if error.Success():
+            self.fail("SBProcessReadMemory claims to have "
+                      "successfully read 0xffffffffffffffe8 bytes")
----------------
`self.assertFalse(error.Success(), "SBProcessReadMemory claims to have successfully read 0xffffffffffffffe8 bytes")`


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D143012/new/

https://reviews.llvm.org/D143012



More information about the lldb-commits mailing list