[Lldb-commits] [lldb] r134301 - /lldb/trunk/include/lldb/API/SBProcess.h

Johnny Chen johnny.chen at apple.com
Fri Jul 1 17:57:53 PDT 2011


Author: johnny
Date: Fri Jul  1 19:57:52 2011
New Revision: 134301

URL: http://llvm.org/viewvc/llvm-project?rev=134301&view=rev
Log:
Furnish some docstrings to be swigified into the generated lldb.py module.
Especially SBProcess.ReadMemory() and SBProcess.WriteMemory() because the generated autodoc strings
make no sense for Python programmers due to typemap (see lldb.swig).

Modified:
    lldb/trunk/include/lldb/API/SBProcess.h

Modified: lldb/trunk/include/lldb/API/SBProcess.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/API/SBProcess.h?rev=134301&r1=134300&r2=134301&view=diff
==============================================================================
--- lldb/trunk/include/lldb/API/SBProcess.h (original)
+++ lldb/trunk/include/lldb/API/SBProcess.h Fri Jul  1 19:57:52 2011
@@ -89,7 +89,11 @@
     RemoteAttachToProcessWithID (lldb::pid_t pid,
                                  lldb::SBError& error);
     
-    // See SBTarget.Launch for argument description and usage.
+#ifdef SWIG
+    %feature("docstring",
+             "See SBTarget.Launch for argument description and usage."
+             ) RemoteLaunch;
+#endif
     bool
     RemoteLaunch (char const **argv,
                   char const **envp,
@@ -141,6 +145,12 @@
     uint32_t
     GetAddressByteSize() const;
 
+#ifdef SWIG
+    %feature("docstring",
+             "Kills the process and shuts down all threads that were spawned to"
+             " track and monitor process."
+             ) Destroy;
+#endif
     lldb::SBError
     Destroy ();
 
@@ -150,18 +160,48 @@
     lldb::SBError
     Stop ();
 
+#ifdef SWIG
+    %feature("docstring", "Same as Destroy(self).") Destroy;
+#endif
     lldb::SBError
     Kill ();
 
     lldb::SBError
     Detach ();
 
+#ifdef SWIG
+    %feature("docstring", "Sends the process a unix signal.") Signal;
+#endif
     lldb::SBError
     Signal (int signal);
 
+#ifdef SWIG
+    %feature("autodoc",
+"Reads memory from the current process's address space and removes any
+traps that may have been inserted into the memory. It returns the byte
+buffer in a Python string. Example:
+
+# Read 4 bytes from address 'addr' and assume error.Success() is True.
+content = process.ReadMemory(addr, 4, error)
+# Use 'ascii' encoding as each byte of 'content' is within [0..255].
+new_bytes = bytearray(content, 'ascii')"
+             ) ReadMemory;
+#endif
     size_t
     ReadMemory (addr_t addr, void *buf, size_t size, lldb::SBError &error);
 
+#ifdef SWIG
+    %feature("autodoc",
+"Writes memory to the current process's address space and maintains any
+traps that might be present due to software breakpoints. Example:
+
+# Create a Python string from the byte array.
+new_value = str(bytes)
+result = process.WriteMemory(addr, new_value, error)
+if not error.Success() or result != len(bytes):
+    print 'SBProcess.WriteMemory() failed!'"
+             ) WriteMemory;
+#endif
     size_t
     WriteMemory (addr_t addr, const void *buf, size_t size, lldb::SBError &error);
 





More information about the lldb-commits mailing list