mib updated this revision to Diff 498201. mib retitled this revision from "[lldb] Extend SWIG SBProcess interface with WriteCStringToMemory method" to "[lldb] Extend SWIG SBProcess interface with WriteMemoryAsCString method". mib edited the summary of this revision.
CHANGES SINCE LAST ACTION https://reviews.llvm.org/D144224/new/ https://reviews.llvm.org/D144224 Files: lldb/bindings/interface/SBProcessExtensions.i Index: lldb/bindings/interface/SBProcessExtensions.i =================================================================== --- lldb/bindings/interface/SBProcessExtensions.i +++ lldb/bindings/interface/SBProcessExtensions.i @@ -2,6 +2,16 @@ %extend lldb::SBProcess { #ifdef SWIGPYTHON %pythoncode %{ + def WriteMemoryAsCString(self, addr, str, error): + ''' + WriteMemoryAsCString(self, addr, str, error): + This functions the same as `WriteMemory` except a null-terminator is appended + to the end of the buffer if it is not there already. + ''' + if not str[-1] == '\0': + str += '\0' + return self.WriteMemory(addr, str, error) + def __get_is_alive__(self): '''Returns "True" if the process is currently alive, "False" otherwise''' s = self.GetState()
Index: lldb/bindings/interface/SBProcessExtensions.i =================================================================== --- lldb/bindings/interface/SBProcessExtensions.i +++ lldb/bindings/interface/SBProcessExtensions.i @@ -2,6 +2,16 @@ %extend lldb::SBProcess { #ifdef SWIGPYTHON %pythoncode %{ + def WriteMemoryAsCString(self, addr, str, error): + ''' + WriteMemoryAsCString(self, addr, str, error): + This functions the same as `WriteMemory` except a null-terminator is appended + to the end of the buffer if it is not there already. + ''' + if not str[-1] == '\0': + str += '\0' + return self.WriteMemory(addr, str, error) + def __get_is_alive__(self): '''Returns "True" if the process is currently alive, "False" otherwise''' s = self.GetState()
_______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits