[Lldb-commits] [lldb] r146716 - in /lldb/trunk/test/python_api/process: TestProcessAPI.py main.cpp

Johnny Chen johnny.chen at apple.com
Thu Dec 15 16:25:30 PST 2011


Author: johnny
Date: Thu Dec 15 18:25:30 2011
New Revision: 146716

URL: http://llvm.org/viewvc/llvm-project?rev=146716&view=rev
Log:
Add a test sequence of SBProcess.ReadCStringFromMemory() with (char *)my_char_ptr as the address to read from.

    char *my_char_ptr = (char *)"Does it work?";

Modified:
    lldb/trunk/test/python_api/process/TestProcessAPI.py
    lldb/trunk/test/python_api/process/main.cpp

Modified: lldb/trunk/test/python_api/process/TestProcessAPI.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/python_api/process/TestProcessAPI.py?rev=146716&r1=146715&r2=146716&view=diff
==============================================================================
--- lldb/trunk/test/python_api/process/TestProcessAPI.py (original)
+++ lldb/trunk/test/python_api/process/TestProcessAPI.py Thu Dec 15 18:25:30 2011
@@ -105,6 +105,19 @@
                     exe=False,
             startstr = 'x')
 
+        # Read (char *)my_char_ptr.
+        val = frame.FindValue("my_char_ptr", lldb.eValueTypeVariableGlobal)
+        self.DebugSBValue(val)
+        cstring = process.ReadCStringFromMemory(val.GetValueAsUnsigned(), 256, error)
+        if not error.Success():
+            self.fail("SBProcess.ReadCStringFromMemory() failed")
+        if self.TraceOn():
+            print "cstring read is:", cstring
+
+        self.expect(cstring, "Result from SBProcess.ReadCStringFromMemory() matches our expected output",
+                    exe=False,
+            startstr = 'Does it work?')
+
         # Get the SBValue for the global variable 'my_cstring'.
         val = frame.FindValue("my_cstring", lldb.eValueTypeVariableGlobal)
         self.DebugSBValue(val)

Modified: lldb/trunk/test/python_api/process/main.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/python_api/process/main.cpp?rev=146716&r1=146715&r2=146716&view=diff
==============================================================================
--- lldb/trunk/test/python_api/process/main.cpp (original)
+++ lldb/trunk/test/python_api/process/main.cpp Thu Dec 15 18:25:30 2011
@@ -13,6 +13,7 @@
 
 char my_char = 'u';
 char my_cstring[] = "lldb.SBProcess.ReadCStringFromMemory() works!";
+char *my_char_ptr = (char *)"Does it work?";
 uint32_t my_uint32 = 12345;
 int my_int = 0;
 





More information about the lldb-commits mailing list