diff options
| -rw-r--r-- | lldb/test/lldbutil.py | 22 | ||||
| -rw-r--r-- | lldb/test/macosx/universal/TestUniversal.py | 11 |
2 files changed, 33 insertions, 0 deletions
diff --git a/lldb/test/lldbutil.py b/lldb/test/lldbutil.py index 9227d4b9492..fdeec8a4cf1 100644 --- a/lldb/test/lldbutil.py +++ b/lldb/test/lldbutil.py @@ -404,3 +404,25 @@ def print_stacktraces(process, string_buffer = False): 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() diff --git a/lldb/test/macosx/universal/TestUniversal.py b/lldb/test/macosx/universal/TestUniversal.py index 7a4a941f5eb..d01e281e5fd 100644 --- a/lldb/test/macosx/universal/TestUniversal.py +++ b/lldb/test/macosx/universal/TestUniversal.py @@ -20,6 +20,7 @@ class UniversalTestCase(TestBase): "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 @@ class UniversalTestCase(TestBase): 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 @@ class UniversalTestCase(TestBase): 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") |

