[Lldb-commits] [lldb] r127660 - in /lldb/trunk/test/unique-types: ./ Makefile main.cpp

Greg Clayton gclayton at apple.com
Mon Mar 14 21:25:12 PDT 2011


Author: gclayton
Date: Mon Mar 14 23:25:12 2011
New Revision: 127660

URL: http://llvm.org/viewvc/llvm-project?rev=127660&view=rev
Log:
Added a test case for unique types. In the test case there are two std::vector
types that have different contents. Currently LLDB is incorrectly uniquing,
on MacOSX, the std::vector _VectorImpl class from the two different vector
templates. The DWARF looks like:

0x0000008e:         DW_TAG_structure_type [7] *
                     DW_AT_name( "_Vector_base<int,std::allocator<int> >" )
                     DW_AT_declaration( 0x01 )
                     DW_AT_sibling( {0x00000103} )

0x00000098:             DW_TAG_structure_type [8] *
                         DW_AT_name( "_Vector_impl" )
                         DW_AT_byte_size( 0x18 )
                         DW_AT_decl_file( "/usr/include/c++/4.2.1/bits/stl_vector.h" )
                         DW_AT_decl_line( 83 )

0x000000a0:                 DW_TAG_inheritance [9]  
                             DW_AT_type( {0x000006fa} ( allocator<int> ) )
                             DW_AT_data_member_location( +0 )
                             DW_AT_accessibility( DW_ACCESS_public )



0x0000011b:         DW_TAG_structure_type [7] *
                     DW_AT_name( "_Vector_base<short int,std::allocator<short int> >" )
                     DW_AT_declaration( 0x01 )
                     DW_AT_sibling( {0x00000190} )

0x00000125:             DW_TAG_structure_type [8] *
                         DW_AT_name( "_Vector_impl" )
                         DW_AT_byte_size( 0x18 )
                         DW_AT_decl_file( "/usr/include/c++/4.2.1/bits/stl_vector.h" )
                         DW_AT_decl_line( 83 )

0x0000012d:                 DW_TAG_inheritance [9]  
                             DW_AT_type( {0x00000f75} ( allocator<short int> ) )
                             DW_AT_data_member_location( +0 )
                             DW_AT_accessibility( DW_ACCESS_public )


In this case it using DIE 0x00000098 for both 0x00000098 and 0x00000125.

This test will help detect this issue once I have a fix for it. I have a fix
that I am testing.


Added:
    lldb/trunk/test/unique-types/
    lldb/trunk/test/unique-types/Makefile
    lldb/trunk/test/unique-types/main.cpp

Added: lldb/trunk/test/unique-types/Makefile
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/unique-types/Makefile?rev=127660&view=auto
==============================================================================
--- lldb/trunk/test/unique-types/Makefile (added)
+++ lldb/trunk/test/unique-types/Makefile Mon Mar 14 23:25:12 2011
@@ -0,0 +1,5 @@
+LEVEL = ../make
+
+CXX_SOURCES := main.cpp
+
+include $(LEVEL)/Makefile.rules

Added: lldb/trunk/test/unique-types/main.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/unique-types/main.cpp?rev=127660&view=auto
==============================================================================
--- lldb/trunk/test/unique-types/main.cpp (added)
+++ lldb/trunk/test/unique-types/main.cpp Mon Mar 14 23:25:12 2011
@@ -0,0 +1,16 @@
+#include <vector>
+
+#include <stdio.h>
+#include <stdint.h>
+
+int main (int argc, char const *argv[], char const *envp[])
+{
+    std::vector<int> ints;
+    std::vector<short> shorts;  
+    for (int i=0; i<12; i++)
+    {
+        ints.push_back(i);
+        shorts.push_back((short)i);
+    }
+    return 0;
+}





More information about the lldb-commits mailing list