[Lldb-commits] [lldb] r158232 - /lldb/trunk/test/functionalities/register/TestRegisters.py

Johnny Chen johnny.chen at apple.com
Fri Jun 8 14:46:18 PDT 2012


Author: johnny
Date: Fri Jun  8 16:46:18 2012
New Revision: 158232

URL: http://llvm.org/viewvc/llvm-project?rev=158232&view=rev
Log:
Add a test case for r158222.

Modified:
    lldb/trunk/test/functionalities/register/TestRegisters.py

Modified: lldb/trunk/test/functionalities/register/TestRegisters.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/functionalities/register/TestRegisters.py?rev=158232&r1=158231&r2=158232&view=diff
==============================================================================
--- lldb/trunk/test/functionalities/register/TestRegisters.py (original)
+++ lldb/trunk/test/functionalities/register/TestRegisters.py Fri Jun  8 16:46:18 2012
@@ -26,6 +26,13 @@
         self.buildDefault()
         self.convenience_registers()
 
+    def test_convenience_registers_with_process_attach(self):
+        """Test convenience registers after a 'process attach'."""
+        if not self.getArchitecture() in ['x86_64']:
+            self.skipTest("This test requires x86_64 as the architecture for the inferior")
+        self.buildDefault()
+        self.convenience_registers_with_process_attach()
+
     def register_commands(self):
         """Test commands related to registers, in particular xmm registers."""
         exe = os.path.join(os.getcwd(), "a.out")
@@ -88,6 +95,26 @@
         self.expect("expr -- $ax == (($ah << 8) | $al)",
             substrs = ['true'])
 
+    def convenience_registers_with_process_attach(self):
+        """Test convenience registers after a 'process attach'."""
+        exe = self.lldbHere
+        
+        # Spawn a new process and don't display the stdout if not in TraceOn() mode.
+        import subprocess
+        popen = subprocess.Popen([exe, self.lldbOption],
+                                 stdout = open(os.devnull, 'w') if not self.TraceOn() else None)
+        if self.TraceOn():
+            print "pid of spawned process: %d" % popen.pid
+
+        self.runCmd("process attach -p %d" % popen.pid)
+
+        # Add a hook to kill the child process during teardown.
+        self.addTearDownHook(
+            lambda: popen.kill())
+
+        # Check that "register read eax" works.
+        self.runCmd("register read eax")
+
 
 if __name__ == '__main__':
     import atexit





More information about the lldb-commits mailing list