summaryrefslogtreecommitdiffstats
path: root/lldb/test/functionalities/register
diff options
context:
space:
mode:
authorJohnny Chen <johnny.chen@apple.com>2012-03-07 01:12:24 +0000
committerJohnny Chen <johnny.chen@apple.com>2012-03-07 01:12:24 +0000
commitc79c93ad966bed87be3fad1809320ab674be818f (patch)
treeeb9f08629290b7d5eb2ce8864cab6593fb7295db /lldb/test/functionalities/register
parent205a429891aeaceb6ad36b35f0ccc881031d0988 (diff)
downloadbcm5719-llvm-c79c93ad966bed87be3fad1809320ab674be818f.tar.gz
bcm5719-llvm-c79c93ad966bed87be3fad1809320ab674be818f.zip
rdar://problem/10611315
expression command doesn't handle xmm or stmm registers... o Update ClangASTContext::GetBuiltinTypeForEncodingAndBitSize() to now handle eEncodingVector. o Modify RegisterValue::SetFromMemoryData() to fix the subtle error due to unitialized variables. o Add a test file for "expr $xmm0". llvm-svn: 152190
Diffstat (limited to 'lldb/test/functionalities/register')
-rw-r--r--lldb/test/functionalities/register/Makefile5
-rw-r--r--lldb/test/functionalities/register/TestRegisters.py55
-rw-r--r--lldb/test/functionalities/register/main.cpp18
3 files changed, 78 insertions, 0 deletions
diff --git a/lldb/test/functionalities/register/Makefile b/lldb/test/functionalities/register/Makefile
new file mode 100644
index 00000000000..8a7102e347a
--- /dev/null
+++ b/lldb/test/functionalities/register/Makefile
@@ -0,0 +1,5 @@
+LEVEL = ../../make
+
+CXX_SOURCES := main.cpp
+
+include $(LEVEL)/Makefile.rules
diff --git a/lldb/test/functionalities/register/TestRegisters.py b/lldb/test/functionalities/register/TestRegisters.py
new file mode 100644
index 00000000000..80e82d6c355
--- /dev/null
+++ b/lldb/test/functionalities/register/TestRegisters.py
@@ -0,0 +1,55 @@
+"""
+Test the 'memory read' command.
+"""
+
+import os, time
+import re
+import unittest2
+import lldb
+from lldbtest import *
+
+class MemoryReadTestCase(TestBase):
+
+ mydir = os.path.join("functionalities", "memory", "read")
+
+ @unittest2.skipUnless(os.uname()[4] in ['x86_64'], "requires x86_64")
+ def test_register_commands(self):
+ """Test commands related to registers, in particular xmm registers."""
+ self.buildDefault()
+ self.register_commands()
+
+ def register_commands(self):
+ """Test commands related to registers, in particular xmm registers."""
+ exe = os.path.join(os.getcwd(), "a.out")
+ self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
+
+ # Break in main().
+ self.expect("breakpoint set -n main",
+ BREAKPOINT_CREATED,
+ startstr = "Breakpoint created: 1: name = 'main'")
+
+ self.runCmd("run", RUN_SUCCEEDED)
+
+ # The stop reason of the thread should be breakpoint.
+ self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT,
+ substrs = ['stopped', 'stop reason = breakpoint'])
+
+ # Test some register-related commands.
+
+ self.runCmd("register read -a")
+ self.runCmd("register read xmm0")
+
+ # rdar://problem/10611315
+ # expression command doesn't handle xmm or stmm registers...
+ self.expect("expr $xmm0",
+ substrs = ['vector_type'])
+
+ self.expect("expr (unsigned int)$xmm0[0]",
+ substrs = ['unsigned int'])
+
+
+if __name__ == '__main__':
+ import atexit
+ lldb.SBDebugger.Initialize()
+ atexit.register(lambda: lldb.SBDebugger.Terminate())
+ unittest2.main()
diff --git a/lldb/test/functionalities/register/main.cpp b/lldb/test/functionalities/register/main.cpp
new file mode 100644
index 00000000000..92095866663
--- /dev/null
+++ b/lldb/test/functionalities/register/main.cpp
@@ -0,0 +1,18 @@
+//===-- main.cpp ------------------------------------------------*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+#include <stdio.h>
+
+int main (int argc, char const *argv[])
+{
+ char my_string[] = {'a', 'b', 'c', 'd', 'e', 'f', 'g', 0};
+ double my_double = 1234.5678;
+ printf("my_string=%s\n", my_string);
+ printf("my_double=%g\n", my_double);
+ return 0;
+}
OpenPOWER on IntegriCloud