[Lldb-commits] [lldb] r152190 - in /lldb/trunk: source/Core/RegisterValue.cpp source/Symbol/ClangASTContext.cpp test/functionalities/register/ test/functionalities/register/Makefile test/functionalities/register/TestRegisters.py test/functionalities/register/main.cpp
Johnny Chen
johnny.chen at apple.com
Tue Mar 6 17:12:24 PST 2012
Author: johnny
Date: Tue Mar 6 19:12:24 2012
New Revision: 152190
URL: http://llvm.org/viewvc/llvm-project?rev=152190&view=rev
Log:
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".
Added:
lldb/trunk/test/functionalities/register/
lldb/trunk/test/functionalities/register/Makefile
lldb/trunk/test/functionalities/register/TestRegisters.py
lldb/trunk/test/functionalities/register/main.cpp
Modified:
lldb/trunk/source/Core/RegisterValue.cpp
lldb/trunk/source/Symbol/ClangASTContext.cpp
Modified: lldb/trunk/source/Core/RegisterValue.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/RegisterValue.cpp?rev=152190&r1=152189&r2=152190&view=diff
==============================================================================
--- lldb/trunk/source/Core/RegisterValue.cpp (original)
+++ lldb/trunk/source/Core/RegisterValue.cpp Tue Mar 6 19:12:24 2012
@@ -202,6 +202,9 @@
else if (value_type == eTypeBytes)
{
m_data.buffer.byte_order = src_byte_order;
+ // Make sure to set the buffer length of the destination buffer to avoid
+ // problems due to uninitalized variables.
+ m_data.buffer.length = src_len;
}
const uint32_t bytes_copied = src_data.CopyByteOrderedData (0, // src offset
Modified: lldb/trunk/source/Symbol/ClangASTContext.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Symbol/ClangASTContext.cpp?rev=152190&r1=152189&r2=152190&view=diff
==============================================================================
--- lldb/trunk/source/Symbol/ClangASTContext.cpp (original)
+++ lldb/trunk/source/Symbol/ClangASTContext.cpp Tue Mar 6 19:12:24 2012
@@ -697,6 +697,10 @@
break;
case eEncodingVector:
+ // Sanity check that bit_size is a multiple of 8's.
+ if (bit_size && !(bit_size & 0x7u))
+ return ast->getExtVectorType (ast->UnsignedCharTy, bit_size/8).getAsOpaquePtr();
+ break;
default:
break;
}
Added: lldb/trunk/test/functionalities/register/Makefile
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/functionalities/register/Makefile?rev=152190&view=auto
==============================================================================
--- lldb/trunk/test/functionalities/register/Makefile (added)
+++ lldb/trunk/test/functionalities/register/Makefile Tue Mar 6 19:12:24 2012
@@ -0,0 +1,5 @@
+LEVEL = ../../make
+
+CXX_SOURCES := main.cpp
+
+include $(LEVEL)/Makefile.rules
Added: lldb/trunk/test/functionalities/register/TestRegisters.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/functionalities/register/TestRegisters.py?rev=152190&view=auto
==============================================================================
--- lldb/trunk/test/functionalities/register/TestRegisters.py (added)
+++ lldb/trunk/test/functionalities/register/TestRegisters.py Tue Mar 6 19:12:24 2012
@@ -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()
Added: lldb/trunk/test/functionalities/register/main.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/functionalities/register/main.cpp?rev=152190&view=auto
==============================================================================
--- lldb/trunk/test/functionalities/register/main.cpp (added)
+++ lldb/trunk/test/functionalities/register/main.cpp Tue Mar 6 19:12:24 2012
@@ -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;
+}
More information about the lldb-commits
mailing list