[Lldb-commits] [PATCH] D60022: [Process] Fix WriteMemory return value
Med Ismail Bennani via Phabricator via lldb-commits
lldb-commits at lists.llvm.org
Mon Apr 1 12:07:30 PDT 2019
This revision was automatically updated to reflect the committed changes.
Closed by commit rL357420: [Process] Fix WriteMemory return value (authored by mib, committed by ).
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.
Repository:
rL LLVM
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D60022/new/
https://reviews.llvm.org/D60022
Files:
lldb/trunk/packages/Python/lldbsuite/test/functionalities/gdb_remote_client/TestWriteMemory.py
lldb/trunk/source/Target/Process.cpp
Index: lldb/trunk/packages/Python/lldbsuite/test/functionalities/gdb_remote_client/TestWriteMemory.py
===================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/functionalities/gdb_remote_client/TestWriteMemory.py
+++ lldb/trunk/packages/Python/lldbsuite/test/functionalities/gdb_remote_client/TestWriteMemory.py
@@ -0,0 +1,29 @@
+from __future__ import print_function
+import lldb
+from lldbsuite.test.lldbtest import *
+from lldbsuite.test.decorators import *
+from gdbclientutils import *
+
+
+class TestWriteMemory(GDBRemoteTestBase):
+
+ def test(self):
+
+ class MyResponder(MockGDBServerResponder):
+ def setBreakpoint(self, packet):
+ return "OK"
+
+ self.server.responder = MyResponder()
+ target = self.dbg.CreateTarget('')
+ process = self.connect(target)
+
+ bp = target.BreakpointCreateByAddress(0x1000)
+ self.assertTrue(bp.IsValid())
+ self.assertEqual(bp.GetNumLocations(), 1)
+ bp.SetEnabled(True)
+ self.assertTrue(bp.IsEnabled())
+
+ err = lldb.SBError()
+ data = str("\x01\x02\x03\x04")
+ result = process.WriteMemory(0x1000, data, err)
+ self.assertEqual(result, 4)
Index: lldb/trunk/source/Target/Process.cpp
===================================================================
--- lldb/trunk/source/Target/Process.cpp
+++ lldb/trunk/source/Target/Process.cpp
@@ -2261,8 +2261,9 @@
});
if (bytes_written < size)
- WriteMemoryPrivate(addr + bytes_written, ubuf + bytes_written,
- size - bytes_written, error);
+ return bytes_written + WriteMemoryPrivate(addr + bytes_written,
+ ubuf + bytes_written,
+ size - bytes_written, error);
}
} else {
return WriteMemoryPrivate(addr, buf, size, error);
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D60022.193149.patch
Type: text/x-patch
Size: 1956 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20190401/8e180477/attachment.bin>
More information about the lldb-commits
mailing list