[Lldb-commits] [lldb] r131069 - in /lldb/trunk/test: lldbutil.py macosx/universal/TestUniversal.py
Johnny Chen
johnny.chen at apple.com
Sun May 8 10:25:28 PDT 2011
Author: johnny
Date: Sun May 8 12:25:27 2011
New Revision: 131069
URL: http://llvm.org/viewvc/llvm-project?rev=131069&view=rev
Log:
Add test scenario to verify 'eax' register is available when launching the i386 slice
of a universal binary and 'rax' register is available when launching the x86_64 slice.
rdar://problem/9403437
Modified:
lldb/trunk/test/lldbutil.py
lldb/trunk/test/macosx/universal/TestUniversal.py
Modified: lldb/trunk/test/lldbutil.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/lldbutil.py?rev=131069&r1=131068&r2=131069&view=diff
==============================================================================
--- lldb/trunk/test/lldbutil.py (original)
+++ lldb/trunk/test/lldbutil.py Sun May 8 12:25:27 2011
@@ -404,3 +404,25 @@
if string_buffer:
return output.getvalue()
+
+# ===================================
+# Utility functions related to Frames
+# ===================================
+
+def print_registers(frame, string_buffer = False):
+ """Prints the all the register sets of the frame."""
+
+ output = StringIO.StringIO() if string_buffer else sys.stdout
+
+ print >> output, "Register sets for " + repr(frame)
+
+ registerList = frame.GetRegisters()
+ print >> output, "Frame registers (size of register set = %d):" % registerList.GetSize()
+ for value in registerList:
+ #print >> output, value
+ print >> output, "%s (number of children = %d):" % (value.GetName(), value.GetNumChildren())
+ for child in value:
+ print >> output, "Name: %s, Value: %s" % (child.GetName(), child.GetValue(frame))
+
+ if string_buffer:
+ return output.getvalue()
Modified: lldb/trunk/test/macosx/universal/TestUniversal.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/macosx/universal/TestUniversal.py?rev=131069&r1=131068&r2=131069&view=diff
==============================================================================
--- lldb/trunk/test/macosx/universal/TestUniversal.py (original)
+++ lldb/trunk/test/macosx/universal/TestUniversal.py Sun May 8 12:25:27 2011
@@ -20,6 +20,7 @@
"requires Darwin & i386")
def test_process_launch_for_universal(self):
"""Test process launch of a universal binary."""
+ from lldbutil import print_registers
# Invoke the default build rule.
self.buildDefault()
@@ -48,6 +49,11 @@
self.invoke(process, 'GetAddressByteSize') == 8,
"64-bit process launched")
+ frame = process.GetThreadAtIndex(0).GetFrameAtIndex(0)
+ registers = print_registers(frame, string_buffer=True)
+ self.expect(registers, exe=False,
+ substrs = ['Name: rax'])
+
self.runCmd("continue")
# Now specify i386 as the architecture for "testit".
@@ -74,6 +80,11 @@
self.assertTrue(pointerSize == 4,
"AddressByteSize of 32-bit process should be 4, got %d instead." % pointerSize)
+ frame = process.GetThreadAtIndex(0).GetFrameAtIndex(0)
+ registers = print_registers(frame, string_buffer=True)
+ self.expect(registers, exe=False,
+ substrs = ['Name: eax'])
+
self.runCmd("continue")
More information about the lldb-commits
mailing list