[Lldb-commits] [lldb] r155508 - in /lldb/branches/lldb-platform-work: ./ include/lldb/Core/ lldb.xcodeproj/ source/Core/ source/Plugins/SymbolFile/DWARF/ source/Target/ test/ test/functionalities/load_unload/ test/lang/objc/objc-checker/ test/lang/objcxx/ test/lang/objcxx/sample/ test/make/

Johnny Chen johnny.chen at apple.com
Tue Apr 24 16:49:18 PDT 2012


Author: johnny
Date: Tue Apr 24 18:49:17 2012
New Revision: 155508

URL: http://llvm.org/viewvc/llvm-project?rev=155508&view=rev
Log:
Merge changes from ToT.  Resolved conflict: lldb.xcodeproj/project.pbxproj.

svn merge -r 155455:155505 https://johnny@llvm.org/svn/llvm-project/lldb/trunk .

Added:
    lldb/branches/lldb-platform-work/source/Plugins/SymbolFile/DWARF/DWARFDeclContext.cpp
      - copied unchanged from r155505, lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDeclContext.cpp
    lldb/branches/lldb-platform-work/source/Plugins/SymbolFile/DWARF/DWARFDeclContext.h
      - copied unchanged from r155505, lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDeclContext.h
    lldb/branches/lldb-platform-work/test/lang/objcxx/
      - copied from r155505, lldb/trunk/test/lang/objcxx/
    lldb/branches/lldb-platform-work/test/lang/objcxx/sample/
      - copied from r155505, lldb/trunk/test/lang/objcxx/sample/
    lldb/branches/lldb-platform-work/test/lang/objcxx/sample/Makefile
      - copied unchanged from r155505, lldb/trunk/test/lang/objcxx/sample/Makefile
    lldb/branches/lldb-platform-work/test/lang/objcxx/sample/main.mm
      - copied unchanged from r155505, lldb/trunk/test/lang/objcxx/sample/main.mm
Modified:
    lldb/branches/lldb-platform-work/   (props changed)
    lldb/branches/lldb-platform-work/include/lldb/Core/ValueObject.h
    lldb/branches/lldb-platform-work/lldb.xcodeproj/project.pbxproj
    lldb/branches/lldb-platform-work/source/Core/ValueObject.cpp
    lldb/branches/lldb-platform-work/source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.cpp
    lldb/branches/lldb-platform-work/source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.h
    lldb/branches/lldb-platform-work/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp
    lldb/branches/lldb-platform-work/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.h
    lldb/branches/lldb-platform-work/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
    lldb/branches/lldb-platform-work/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
    lldb/branches/lldb-platform-work/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp
    lldb/branches/lldb-platform-work/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.h
    lldb/branches/lldb-platform-work/source/Target/Target.cpp
    lldb/branches/lldb-platform-work/test/dotest.py
    lldb/branches/lldb-platform-work/test/functionalities/load_unload/TestLoadUnload.py
    lldb/branches/lldb-platform-work/test/lang/objc/objc-checker/TestObjCCheckers.py
    lldb/branches/lldb-platform-work/test/lang/objc/objc-checker/main.m
    lldb/branches/lldb-platform-work/test/make/Makefile.rules

Propchange: lldb/branches/lldb-platform-work/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Tue Apr 24 18:49:17 2012
@@ -1 +1 @@
-/lldb/trunk:154224-155455
+/lldb/trunk:154224-155505

Modified: lldb/branches/lldb-platform-work/include/lldb/Core/ValueObject.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/include/lldb/Core/ValueObject.h?rev=155508&r1=155507&r2=155508&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/include/lldb/Core/ValueObject.h (original)
+++ lldb/branches/lldb-platform-work/include/lldb/Core/ValueObject.h Tue Apr 24 18:49:17 2012
@@ -656,17 +656,23 @@
     }
 
     virtual uint32_t
-    GetBitfieldBitSize()
+    GetBitfieldBitSize ()
     {
         return 0;
     }
 
     virtual uint32_t
-    GetBitfieldBitOffset()
+    GetBitfieldBitOffset ()
     {
         return 0;
     }
     
+    bool
+    IsBitfield ()
+    {
+        return (GetBitfieldBitSize() != 0) || (GetBitfieldBitOffset() != 0);
+    }
+    
     virtual bool
     IsArrayItemForPointer()
     {

Modified: lldb/branches/lldb-platform-work/lldb.xcodeproj/project.pbxproj
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/lldb.xcodeproj/project.pbxproj?rev=155508&r1=155507&r2=155508&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/lldb.xcodeproj/project.pbxproj (original)
+++ lldb/branches/lldb-platform-work/lldb.xcodeproj/project.pbxproj Tue Apr 24 18:49:17 2012
@@ -386,6 +386,8 @@
 		26A527C414E24F5F00F3A14A /* ThreadMachCore.h in Headers */ = {isa = PBXBuildFile; fileRef = 26A527C014E24F5F00F3A14A /* ThreadMachCore.h */; };
 		26A69C5F137A17A500262477 /* RegisterValue.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 26C6886E137880C400407EDF /* RegisterValue.cpp */; };
 		26A7A035135E6E4200FB369E /* NamedOptionValue.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 26A7A034135E6E4200FB369E /* NamedOptionValue.cpp */; };
+		26B1EFAE154638AF00E2DAC7 /* DWARFDeclContext.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 26B1EFAC154638AF00E2DAC7 /* DWARFDeclContext.cpp */; };
+		26B1EFAF154638AF00E2DAC7 /* DWARFDeclContext.h in Headers */ = {isa = PBXBuildFile; fileRef = 26B1EFAD154638AF00E2DAC7 /* DWARFDeclContext.h */; };
 		26B1FCB813381071002886E2 /* CoreFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 26F5C39010F3FA26009D5894 /* CoreFoundation.framework */; };
 		26B1FCBC13381071002886E2 /* libobjc.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 26F5C37410F3F61B009D5894 /* libobjc.dylib */; };
 		26B1FCC21338115F002886E2 /* Host.mm in Sources */ = {isa = PBXBuildFile; fileRef = 26BC7EE810F1B88F00F91463 /* Host.mm */; };
@@ -934,6 +936,8 @@
 		26A7A034135E6E4200FB369E /* NamedOptionValue.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = NamedOptionValue.cpp; path = source/Interpreter/NamedOptionValue.cpp; sourceTree = "<group>"; };
 		26A7A036135E6E5300FB369E /* NamedOptionValue.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = NamedOptionValue.h; path = include/lldb/Interpreter/NamedOptionValue.h; sourceTree = "<group>"; };
 		26B167A41123BF5500DC7B4F /* ThreadSafeValue.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ThreadSafeValue.h; path = include/lldb/Core/ThreadSafeValue.h; sourceTree = "<group>"; };
+		26B1EFAC154638AF00E2DAC7 /* DWARFDeclContext.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DWARFDeclContext.cpp; sourceTree = "<group>"; };
+		26B1EFAD154638AF00E2DAC7 /* DWARFDeclContext.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DWARFDeclContext.h; sourceTree = "<group>"; };
 		26B42C4C1187ABA50079C8C8 /* LLDB.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = LLDB.h; path = include/lldb/API/LLDB.h; sourceTree = "<group>"; };
 		26B4E26E112F35F700AB3F64 /* TimeValue.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TimeValue.h; path = include/lldb/Host/TimeValue.h; sourceTree = "<group>"; };
 		26B7564C14F89356008D9CB3 /* PlatformiOSSimulator.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PlatformiOSSimulator.cpp; sourceTree = "<group>"; };
@@ -1847,6 +1851,8 @@
 				260C89CC10F57C5600BB2B04 /* DWARFDebugPubnamesSet.h */,
 				260C89CD10F57C5600BB2B04 /* DWARFDebugRanges.cpp */,
 				260C89CE10F57C5600BB2B04 /* DWARFDebugRanges.h */,
+				26B1EFAC154638AF00E2DAC7 /* DWARFDeclContext.cpp */,
+				26B1EFAD154638AF00E2DAC7 /* DWARFDeclContext.h */,
 				260C89CF10F57C5600BB2B04 /* DWARFDefines.cpp */,
 				260C89D010F57C5600BB2B04 /* DWARFDefines.h */,
 				260C89D110F57C5600BB2B04 /* DWARFDIECollection.cpp */,
@@ -3223,6 +3229,7 @@
 				2694E9A514FC0BBD0076DE67 /* PlatformLinux.h in Headers */,
 				2663E379152BD1890091EC22 /* ReadWriteLock.h in Headers */,
 				945759681534941F005A9070 /* PlatformPOSIX.h in Headers */,
+				26B1EFAF154638AF00E2DAC7 /* DWARFDeclContext.h in Headers */,
 			);
 			runOnlyForDeploymentPostprocessing = 0;
 		};
@@ -3939,6 +3946,7 @@
 				2694E9A414FC0BBD0076DE67 /* PlatformLinux.cpp in Sources */,
 				945E8D80152F6AB40019BCCD /* StreamGDBRemote.cpp in Sources */,
 				945759671534941F005A9070 /* PlatformPOSIX.cpp in Sources */,
+				26B1EFAE154638AF00E2DAC7 /* DWARFDeclContext.cpp in Sources */,
 			);
 			runOnlyForDeploymentPostprocessing = 0;
 		};

Modified: lldb/branches/lldb-platform-work/source/Core/ValueObject.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/source/Core/ValueObject.cpp?rev=155508&r1=155507&r2=155508&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/source/Core/ValueObject.cpp (original)
+++ lldb/branches/lldb-platform-work/source/Core/ValueObject.cpp Tue Apr 24 18:49:17 2012
@@ -3485,7 +3485,13 @@
         data.SetByteOrder (m_data.GetByteOrder());
         data.SetAddressByteSize(m_data.GetAddressByteSize());
         
-        m_error = m_value.GetValueAsData (&exe_ctx, ast, data, 0, GetModule().get());
+        if (IsBitfield())
+        {
+            Value v(Scalar(GetValueAsUnsigned(UINT64_MAX)));
+            m_error = v.GetValueAsData (&exe_ctx, ast, data, 0, GetModule().get());
+        }
+        else
+            m_error = m_value.GetValueAsData (&exe_ctx, ast, data, 0, GetModule().get());
         
         valobj_sp = ValueObjectConstResult::Create (exe_ctx.GetBestExecutionContextScope(), 
                                                     ast,

Modified: lldb/branches/lldb-platform-work/source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.cpp?rev=155508&r1=155507&r2=155508&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.cpp (original)
+++ lldb/branches/lldb-platform-work/source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.cpp Tue Apr 24 18:49:17 2012
@@ -184,6 +184,23 @@
     return cu;
 }
 
+bool
+DWARFDebugInfo::ContainsCompileUnit (const DWARFCompileUnit *cu) const
+{
+    // Not a verify efficient function, but it is handy for use in assertions
+    // to make sure that a compile unit comes from a debug information file.
+    CompileUnitColl::const_iterator end_pos = m_compile_units.end();
+    CompileUnitColl::const_iterator pos;
+    
+    for (pos = m_compile_units.begin(); pos != end_pos; ++pos)
+    {
+        if (pos->get() == cu)
+            return true;
+    }
+    return false;
+}
+
+
 static bool CompileUnitOffsetLessThan (const DWARFCompileUnitSP& a, const DWARFCompileUnitSP& b)
 {
     return a->GetOffset() < b->GetOffset();

Modified: lldb/branches/lldb-platform-work/source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.h?rev=155508&r1=155507&r2=155508&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.h (original)
+++ lldb/branches/lldb-platform-work/source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.h Tue Apr 24 18:49:17 2012
@@ -46,6 +46,7 @@
 
     void AddCompileUnit(DWARFCompileUnitSP& cu);
     uint32_t GetNumCompileUnits();
+    bool ContainsCompileUnit (const DWARFCompileUnit *cu) const;
     DWARFCompileUnit* GetCompileUnitAtIndex(uint32_t idx);
     DWARFCompileUnitSP GetCompileUnit(dw_offset_t cu_offset, uint32_t* idx_ptr = NULL);
     DWARFCompileUnitSP GetCompileUnitContainingDIE(dw_offset_t die_offset);

Modified: lldb/branches/lldb-platform-work/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp?rev=155508&r1=155507&r2=155508&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp (original)
+++ lldb/branches/lldb-platform-work/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp Tue Apr 24 18:49:17 2012
@@ -23,6 +23,7 @@
 #include "DWARFDebugAbbrev.h"
 #include "DWARFDebugAranges.h"
 #include "DWARFDebugInfo.h"
+#include "DWARFDeclContext.h"
 #include "DWARFDIECollection.h"
 #include "DWARFFormValue.h"
 #include "DWARFLocationDescription.h"
@@ -1739,6 +1740,36 @@
     }
 }
 
+void
+DWARFDebugInfoEntry::GetDWARFDeclContext (SymbolFileDWARF* dwarf2Data,
+                                          DWARFCompileUnit* cu,
+                                          DWARFDeclContext &dwarf_decl_ctx) const
+{
+    const dw_tag_t tag = Tag();
+    if (tag != DW_TAG_compile_unit)
+    {
+        dwarf_decl_ctx.AppendDeclContext(tag, GetName(dwarf2Data, cu));
+        const DWARFDebugInfoEntry *parent_decl_ctx_die = GetParentDeclContextDIE (dwarf2Data, cu);
+        if (parent_decl_ctx_die && parent_decl_ctx_die != this)
+        {
+            if (parent_decl_ctx_die->Tag() != DW_TAG_compile_unit)
+                parent_decl_ctx_die->GetDWARFDeclContext (dwarf2Data, cu, dwarf_decl_ctx);
+        }
+    }
+}
+
+
+bool
+DWARFDebugInfoEntry::MatchesDWARFDeclContext (SymbolFileDWARF* dwarf2Data,
+                                              DWARFCompileUnit* cu,
+                                              const DWARFDeclContext &dwarf_decl_ctx) const
+{
+    
+    DWARFDeclContext this_dwarf_decl_ctx;
+    GetDWARFDeclContext (dwarf2Data, cu, this_dwarf_decl_ctx);
+    return this_dwarf_decl_ctx == dwarf_decl_ctx;
+}
+
 const DWARFDebugInfoEntry *
 DWARFDebugInfoEntry::GetParentDeclContextDIE (SymbolFileDWARF* dwarf2Data, 
 											  DWARFCompileUnit* cu) const

Modified: lldb/branches/lldb-platform-work/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.h?rev=155508&r1=155507&r2=155508&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.h (original)
+++ lldb/branches/lldb-platform-work/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.h Tue Apr 24 18:49:17 2012
@@ -41,6 +41,8 @@
 typedef UInt32ToDIEMMap::iterator                           UInt32ToDIEMMapIter;
 typedef UInt32ToDIEMMap::const_iterator                     UInt32ToDIEMMapConstIter;
 
+class DWARFDeclContext;
+
 #define DIE_SIBLING_IDX_BITSIZE 31
 #define DIE_ABBR_IDX_BITSIZE 15
 
@@ -359,6 +361,15 @@
                                                         DWARFCompileUnit* cu,
                                                         DWARFDIECollection &decl_context_dies) const;
 
+    void                            GetDWARFDeclContext (SymbolFileDWARF* dwarf2Data,
+                                                         DWARFCompileUnit* cu,
+                                                         DWARFDeclContext &dwarf_decl_ctx) const;
+
+
+    bool                            MatchesDWARFDeclContext(SymbolFileDWARF* dwarf2Data,
+                                                            DWARFCompileUnit* cu,
+                                                            const DWARFDeclContext &dwarf_decl_ctx) const;
+
     const   DWARFDebugInfoEntry*    GetParentDeclContextDIE (SymbolFileDWARF* dwarf2Data, 
                                                              DWARFCompileUnit* cu) const;
     const   DWARFDebugInfoEntry*    GetParentDeclContextDIE (SymbolFileDWARF* dwarf2Data, 

Modified: lldb/branches/lldb-platform-work/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp?rev=155508&r1=155507&r2=155508&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp (original)
+++ lldb/branches/lldb-platform-work/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp Tue Apr 24 18:49:17 2012
@@ -57,6 +57,7 @@
 #include "DWARFDebugLine.h"
 #include "DWARFDebugPubnames.h"
 #include "DWARFDebugRanges.h"
+#include "DWARFDeclContext.h"
 #include "DWARFDIECollection.h"
 #include "DWARFFormValue.h"
 #include "DWARFLocationList.h"
@@ -4447,6 +4448,7 @@
     return type_sp;
 }
 
+
 //----------------------------------------------------------------------
 // This function helps to ensure that the declaration contexts match for
 // two different DIEs. Often times debug information will refer to a 
@@ -4463,7 +4465,16 @@
 SymbolFileDWARF::DIEDeclContextsMatch (DWARFCompileUnit* cu1, const DWARFDebugInfoEntry *die1,
                                        DWARFCompileUnit* cu2, const DWARFDebugInfoEntry *die2)
 {
-    assert (die1 != die2);
+    if (die1 == die2)
+        return true;
+
+#if defined (LLDB_CONFIGURATION_DEBUG)
+    // You can't and shouldn't call this function with a compile unit from
+    // two different SymbolFileDWARF instances.
+    assert (DebugInfo()->ContainsCompileUnit (cu1));
+    assert (DebugInfo()->ContainsCompileUnit (cu2));
+#endif
+
     DWARFDIECollection decl_ctx_1;
     DWARFDIECollection decl_ctx_2;
     //The declaration DIE stack is a stack of the declaration context 
@@ -4544,13 +4555,20 @@
                                           
 // This function can be used when a DIE is found that is a forward declaration
 // DIE and we want to try and find a type that has the complete definition.
+// "cu" and "die" must be from this SymbolFileDWARF
 TypeSP
-SymbolFileDWARF::FindDefinitionTypeForDIE (DWARFCompileUnit* cu, 
+SymbolFileDWARF::FindDefinitionTypeForDIE (DWARFCompileUnit* cu,
                                            const DWARFDebugInfoEntry *die, 
                                            const ConstString &type_name)
 {
     TypeSP type_sp;
 
+#if defined (LLDB_CONFIGURATION_DEBUG)
+    // You can't and shouldn't call this function with a compile unit from
+    // another SymbolFileDWARF instance.
+    assert (DebugInfo()->ContainsCompileUnit (cu));
+#endif
+
     if (cu == NULL || die == NULL || !type_name)
         return type_sp;
 
@@ -4705,6 +4723,158 @@
 }
 
 TypeSP
+SymbolFileDWARF::FindDefinitionTypeForDWARFDeclContext (const DWARFDeclContext &dwarf_decl_ctx)
+{
+    TypeSP type_sp;
+
+    const uint32_t dwarf_decl_ctx_count = dwarf_decl_ctx.GetSize();
+    if (dwarf_decl_ctx_count > 0)
+    {
+        const ConstString type_name(dwarf_decl_ctx[0].name);
+        const dw_tag_t tag = dwarf_decl_ctx[0].tag;
+
+        if (type_name)
+        {
+            LogSP log (LogChannelDWARF::GetLogIfAny(DWARF_LOG_TYPE_COMPLETION|DWARF_LOG_LOOKUPS));
+            if (log)
+            {
+                GetObjectFile()->GetModule()->LogMessage (log.get(),
+                                                          "SymbolFileDWARF::FindDefinitionTypeForDWARFDeclContext(tag=%s, qualified-name='%s')",
+                                                          DW_TAG_value_to_name(dwarf_decl_ctx[0].tag),
+                                                          dwarf_decl_ctx.GetQualifiedName());
+            }
+            
+            DIEArray die_offsets;
+            
+            if (m_using_apple_tables)
+            {
+                if (m_apple_types_ap.get())
+                {
+                    if (m_apple_types_ap->GetHeader().header_data.atoms.size() > 1)
+                    {
+                        m_apple_types_ap->FindByNameAndTag (type_name.GetCString(), tag, die_offsets);
+                    }
+                    else
+                    {
+                        m_apple_types_ap->FindByName (type_name.GetCString(), die_offsets);
+                    }
+                }
+            }
+            else
+            {
+                if (!m_indexed)
+                    Index ();
+                
+                m_type_index.Find (type_name, die_offsets);
+            }
+            
+            const size_t num_matches = die_offsets.size();
+            
+            
+            DWARFCompileUnit* type_cu = NULL;
+            const DWARFDebugInfoEntry* type_die = NULL;
+            if (num_matches)
+            {
+                DWARFDebugInfo* debug_info = DebugInfo();
+                for (size_t i=0; i<num_matches; ++i)
+                {
+                    const dw_offset_t die_offset = die_offsets[i];
+                    type_die = debug_info->GetDIEPtrWithCompileUnitHint (die_offset, &type_cu);
+                    
+                    if (type_die)
+                    {
+                        bool try_resolving_type = false;
+                        
+                        // Don't try and resolve the DIE we are looking for with the DIE itself!
+                        const dw_tag_t type_tag = type_die->Tag();
+                        // Make sure the tags match
+                        if (type_tag == tag)
+                        {
+                            // The tags match, lets try resolving this type
+                            try_resolving_type = true;
+                        }
+                        else
+                        {
+                            // The tags don't match, but we need to watch our for a
+                            // forward declaration for a struct and ("struct foo")
+                            // ends up being a class ("class foo { ... };") or
+                            // vice versa.
+                            switch (type_tag)
+                            {
+                                case DW_TAG_class_type:
+                                    // We had a "class foo", see if we ended up with a "struct foo { ... };"
+                                    try_resolving_type = (tag == DW_TAG_structure_type);
+                                    break;
+                                case DW_TAG_structure_type:
+                                    // We had a "struct foo", see if we ended up with a "class foo { ... };"
+                                    try_resolving_type = (tag == DW_TAG_class_type);
+                                    break;
+                                default:
+                                    // Tags don't match, don't event try to resolve
+                                    // using this type whose name matches....
+                                    break;
+                            }
+                        }
+                        
+                        if (try_resolving_type)
+                        {
+                            DWARFDeclContext type_dwarf_decl_ctx;
+                            type_die->GetDWARFDeclContext (this, type_cu, type_dwarf_decl_ctx);
+
+                            if (log)
+                            {
+                                GetObjectFile()->GetModule()->LogMessage (log.get(),
+                                                                          "SymbolFileDWARF::FindDefinitionTypeForDWARFDeclContext(tag=%s, qualified-name='%s') trying die=0x%8.8x (%s)",
+                                                                          DW_TAG_value_to_name(dwarf_decl_ctx[0].tag),
+                                                                          dwarf_decl_ctx.GetQualifiedName(),
+                                                                          type_die->GetOffset(),
+                                                                          type_dwarf_decl_ctx.GetQualifiedName());
+                            }
+                            
+                            // Make sure the decl contexts match all the way up
+                            if (dwarf_decl_ctx == type_dwarf_decl_ctx)
+                            {
+                                Type *resolved_type = ResolveType (type_cu, type_die, false);
+                                if (resolved_type && resolved_type != DIE_IS_BEING_PARSED)
+                                {
+                                    type_sp = resolved_type->shared_from_this();
+                                    break;
+                                }
+                            }
+                        }
+                        else
+                        {
+                            if (log)
+                            {
+                                std::string qualified_name;
+                                type_die->GetQualifiedName(this, type_cu, qualified_name);
+                                GetObjectFile()->GetModule()->LogMessage (log.get(),
+                                                                          "SymbolFileDWARF::FindDefinitionTypeForDWARFDeclContext(tag=%s, qualified-name='%s') ignoring die=0x%8.8x (%s)",
+                                                                          DW_TAG_value_to_name(dwarf_decl_ctx[0].tag),
+                                                                          dwarf_decl_ctx.GetQualifiedName(),
+                                                                          type_die->GetOffset(),
+                                                                          qualified_name.c_str());
+                            }
+                        }
+                    }
+                    else
+                    {
+                        if (m_using_apple_tables)
+                        {
+                            GetObjectFile()->GetModule()->ReportErrorIfModifyDetected ("the DWARF debug information has been modified (.apple_types accelerator table had bad die 0x%8.8x for '%s')\n",
+                                                                                       die_offset, type_name.GetCString());
+                        }
+                    }            
+                    
+                }
+            }
+        }
+    }
+    return type_sp;
+}
+
+
+TypeSP
 SymbolFileDWARF::ParseType (const SymbolContext& sc, DWARFCompileUnit* dwarf_cu, const DWARFDebugInfoEntry *die, bool *type_is_new_ptr)
 {
     TypeSP type_sp;
@@ -5136,14 +5306,18 @@
                                                                       type_name_cstr);
                         }
                     
-                        type_sp = FindDefinitionTypeForDIE (dwarf_cu, die, type_name_const_str);
+                        DWARFDeclContext die_decl_ctx;
+                        die->GetDWARFDeclContext(this, dwarf_cu, die_decl_ctx);
+
+                        //type_sp = FindDefinitionTypeForDIE (dwarf_cu, die, type_name_const_str);
+                        type_sp = FindDefinitionTypeForDWARFDeclContext (die_decl_ctx);
 
                         if (!type_sp && m_debug_map_symfile)
                         {
                             // We weren't able to find a full declaration in
                             // this DWARF, see if we have a declaration anywhere    
                             // else...
-                            type_sp = m_debug_map_symfile->FindDefinitionTypeForDIE (dwarf_cu, die, type_name_const_str);
+                            type_sp = m_debug_map_symfile->FindDefinitionTypeForDWARFDeclContext (die_decl_ctx);
                         }
 
                         if (type_sp)

Modified: lldb/branches/lldb-platform-work/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h?rev=155508&r1=155507&r2=155508&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h (original)
+++ lldb/branches/lldb-platform-work/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h Tue Apr 24 18:49:17 2012
@@ -40,13 +40,12 @@
 #include "NameToDIE.h"
 #include "UniqueDWARFASTType.h"
 
-
 //----------------------------------------------------------------------
 // Forward Declarations for this DWARF plugin
 //----------------------------------------------------------------------
 class DWARFAbbreviationDeclaration;
 class DWARFAbbreviationDeclarationSet;
-class DWARFCompileUnit;
+class DWARFileUnit;
 class DWARFDebugAbbrev;
 class DWARFDebugAranges;
 class DWARFDebugInfo;
@@ -54,6 +53,7 @@
 class DWARFDebugLine;
 class DWARFDebugPubnames;
 class DWARFDebugRanges;
+class DWARFDeclContext;
 class DWARFDIECollection;
 class DWARFFormValue;
 class SymbolFileDWARFDebugMap;
@@ -409,6 +409,9 @@
                                 DWARFCompileUnit* dwarf_cu, 
                                 const DWARFDebugInfoEntry *die, 
                                 const lldb_private::ConstString &type_name);
+    
+    lldb::TypeSP            FindDefinitionTypeForDWARFDeclContext (
+                                const DWARFDeclContext &die_decl_ctx);
 
     lldb::TypeSP            FindCompleteObjCDefinitionTypeForDIE (
                                 const DWARFDebugInfoEntry *die, 

Modified: lldb/branches/lldb-platform-work/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp?rev=155508&r1=155507&r2=155508&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp (original)
+++ lldb/branches/lldb-platform-work/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp Tue Apr 24 18:49:17 2012
@@ -957,15 +957,13 @@
 }
 
 TypeSP
-SymbolFileDWARFDebugMap::FindDefinitionTypeForDIE (DWARFCompileUnit* cu, 
-                                                   const DWARFDebugInfoEntry *die, 
-                                                   const ConstString &type_name)
+SymbolFileDWARFDebugMap::FindDefinitionTypeForDWARFDeclContext (const DWARFDeclContext &die_decl_ctx)
 {
     TypeSP type_sp;
     SymbolFileDWARF *oso_dwarf;
     for (uint32_t oso_idx = 0; ((oso_dwarf = GetSymbolFileByOSOIndex (oso_idx)) != NULL); ++oso_idx)
     {
-        type_sp = oso_dwarf->FindDefinitionTypeForDIE (cu, die, type_name);
+        type_sp = oso_dwarf->FindDefinitionTypeForDWARFDeclContext (die_decl_ctx);
         if (type_sp)
             break;
     }

Modified: lldb/branches/lldb-platform-work/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.h?rev=155508&r1=155507&r2=155508&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.h (original)
+++ lldb/branches/lldb-platform-work/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.h Tue Apr 24 18:49:17 2012
@@ -23,6 +23,7 @@
 class SymbolFileDWARF;
 class DWARFCompileUnit;
 class DWARFDebugInfoEntry;
+class DWARFDeclContext;
 
 class SymbolFileDWARFDebugMap : public lldb_private::SymbolFile
 {
@@ -227,9 +228,7 @@
     SetCompileUnit (SymbolFileDWARF *oso_dwarf, const lldb::CompUnitSP &cu_sp);
 
     lldb::TypeSP
-    FindDefinitionTypeForDIE (DWARFCompileUnit* cu, 
-                              const DWARFDebugInfoEntry *die, 
-                              const lldb_private::ConstString &type_name);    
+    FindDefinitionTypeForDWARFDeclContext (const DWARFDeclContext &die_decl_ctx);    
 
     bool
     Supports_DW_AT_APPLE_objc_complete_type (SymbolFileDWARF *skip_dwarf_oso);

Modified: lldb/branches/lldb-platform-work/source/Target/Target.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/source/Target/Target.cpp?rev=155508&r1=155507&r2=155508&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/source/Target/Target.cpp (original)
+++ lldb/branches/lldb-platform-work/source/Target/Target.cpp Tue Apr 24 18:49:17 2012
@@ -1594,6 +1594,9 @@
                                                                          expr_path_options, 
                                                                          var_sp, 
                                                                          error);
+            // if this expression results in a bitfield, we give up and let the IR handle it
+            if (result_valobj_sp && result_valobj_sp->IsBitfield())
+                result_valobj_sp.reset();
         }
     }
     else if (m_process_sp)

Modified: lldb/branches/lldb-platform-work/test/dotest.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/test/dotest.py?rev=155508&r1=155507&r2=155508&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/test/dotest.py (original)
+++ lldb/branches/lldb-platform-work/test/dotest.py Tue Apr 24 18:49:17 2012
@@ -244,9 +244,11 @@
 -l   : don't skip long running test
 -n   : don't print the headers like build dir, lldb version, and svn info at all
 -p   : specify a regexp filename pattern for inclusion in the test suite
--r   : specify a dir to relocate the tests and their intermediate files to;
-       the directory must not exist before running this test driver;
+-R   : specify a dir to relocate the tests and their intermediate files to;
+       BE WARNED THAT the directory, if exists, will be deleted before running this test driver;
        no cleanup of intermediate test files is performed in this case
+-r   : similar to '-R',
+       except that the directory must not exist before running this test driver
 -S   : skip the build and cleanup while running the test
        use this option with care as you would need to build the inferior(s) by hand
        and build the executable(s) with the correct name(s)
@@ -535,6 +537,17 @@
                 usage()
             regexp = sys.argv[index]
             index += 1
+        elif sys.argv[index].startswith('-R'):
+            # Increment by 1 to fetch the relocated directory argument.
+            index += 1
+            if index >= len(sys.argv) or sys.argv[index].startswith('-'):
+                usage()
+            rdir = os.path.abspath(sys.argv[index])
+            if os.path.exists(rdir):
+                import shutil
+                print "Removing tree:", rdir
+                shutil.rmtree(rdir)
+            index += 1
         elif sys.argv[index].startswith('-r'):
             # Increment by 1 to fetch the relocated directory argument.
             index += 1
@@ -624,12 +637,17 @@
         from shutil import copytree, ignore_patterns
 
         tmpdirs = []
+        orig_testdirs = testdirs[:]
         for srcdir in testdirs:
             # For example, /Volumes/data/lldb/svn/ToT/test/functionalities/watchpoint/hello_watchpoint
             # shall be split into ['/Volumes/data/lldb/svn/ToT/', 'functionalities/watchpoint/hello_watchpoint'].
             # Utilize the relative path to the 'test' directory to make our destination dir path.
-            dstdir = os.path.join(rdir, srcdir.split("test"+os.sep)[1])
-            #print "(srcdir, dstdir)=(%s, %s)" % (srcdir, dstdir)
+            if ("test"+os.sep) in srcdir:
+                to_split_on = "test"+os.sep
+            else:
+                to_split_on = "test"
+            dstdir = os.path.join(rdir, srcdir.split(to_split_on)[1])
+            dstdir = dstdir.rstrip(os.sep)
             # Don't copy the *.pyc and .svn stuffs.
             copytree(srcdir, dstdir, ignore=ignore_patterns('*.pyc', '.svn'))
             tmpdirs.append(dstdir)
@@ -640,7 +658,7 @@
         # With '-r dir' specified, there's no cleanup of intermediate test files.
         os.environ["LLDB_DO_CLEANUP"] = 'NO'
 
-        # If testdirs is ['test'], the make directory has already been copied
+        # If the original testdirs is ['test'], the make directory has already been copied
         # recursively and is contained within the rdir/test dir.  For anything
         # else, we would need to copy over the make directory and its contents,
         # so that, os.listdir(rdir) looks like, for example:
@@ -648,7 +666,7 @@
         #     array_types conditional_break make
         #
         # where the make directory contains the Makefile.rules file.
-        if len(testdirs) != 1 or os.path.basename(testdirs[0]) != 'test':
+        if len(testdirs) != 1 or os.path.basename(orig_testdirs[0]) != 'test':
             # Don't copy the .svn stuffs.
             copytree('make', os.path.join(rdir, 'make'),
                      ignore=ignore_patterns('.svn'))
@@ -1222,11 +1240,13 @@
             # The purpose is to separate the configuration-specific directories
             # from each other.
             if rdir:
-                from shutil import copytree, ignore_patterns
+                from shutil import copytree, rmtree, ignore_patterns
 
                 newrdir = "%s.%s" % (rdir, configPostfix)
 
                 # Copy the tree to a new directory with postfix name configPostfix.
+                if os.path.exists(newrdir):
+                    rmtree(newrdir)
                 copytree(rdir, newrdir, ignore=ignore_patterns('*.pyc', '*.o', '*.d'))
 
                # Update the LLDB_TEST environment variable to reflect new top

Modified: lldb/branches/lldb-platform-work/test/functionalities/load_unload/TestLoadUnload.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/test/functionalities/load_unload/TestLoadUnload.py?rev=155508&r1=155507&r2=155508&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/test/functionalities/load_unload/TestLoadUnload.py (original)
+++ lldb/branches/lldb-platform-work/test/functionalities/load_unload/TestLoadUnload.py Tue Apr 24 18:49:17 2012
@@ -90,7 +90,8 @@
             dylibPath = 'DYLD_LIBRARY_PATH'
 
         # The directory to relocate the dynamic library and its debugging info.
-        new_dir = os.path.join(os.getcwd(), "hidden")
+        special_dir = "hidden"
+        new_dir = os.path.join(os.getcwd(), special_dir)
 
         old_dylib = os.path.join(os.getcwd(), dylibName)
         new_dylib = os.path.join(new_dir, dylibName)
@@ -118,7 +119,7 @@
         # For now we don't track DYLD_LIBRARY_PATH, so the old library will be in
         # the modules list.
         self.expect("target modules list",
-            substrs = [old_dylib],
+            substrs = [os.path.basename(old_dylib)],
             matching=True)
 
         self.runCmd("run")
@@ -128,10 +129,7 @@
         # After run, make sure the hidden library is present, and the one we didn't 
         # load is not.
         self.expect("target modules list",
-            substrs = [new_dylib])
-        self.expect("target modules list",
-            substrs = [old_dylib],
-            matching=False)
+            substrs = [special_dir, os.path.basename(new_dylib)])
 
     def test_lldb_process_load_and_unload_commands(self):
         """Test that lldb process load/unload command work correctly."""

Modified: lldb/branches/lldb-platform-work/test/lang/objc/objc-checker/TestObjCCheckers.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/test/lang/objc/objc-checker/TestObjCCheckers.py?rev=155508&r1=155507&r2=155508&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/test/lang/objc/objc-checker/TestObjCCheckers.py (original)
+++ lldb/branches/lldb-platform-work/test/lang/objc/objc-checker/TestObjCCheckers.py Tue Apr 24 18:49:17 2012
@@ -17,6 +17,8 @@
     @dsym_test
     def test_objc_checker_with_dsym(self):
         """Test that checkers catch unrecognized selectors"""
+        if self.getArchitecture() == 'i386':
+            self.skipTest("requires Objective-C 2.0 runtime")
         self.buildDsym()
         self.do_test_checkers()
 
@@ -24,6 +26,8 @@
     @dwarf_test
     def test_objc_checker_with_dwarf(self):
         """Test that checkers catch unrecognized selectors"""
+        if self.getArchitecture() == 'i386':
+            self.skipTest("requires Objective-C 2.0 runtime")
         self.buildDwarf()
         self.do_test_checkers()
 

Modified: lldb/branches/lldb-platform-work/test/lang/objc/objc-checker/main.m
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/test/lang/objc/objc-checker/main.m?rev=155508&r1=155507&r2=155508&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/test/lang/objc/objc-checker/main.m (original)
+++ lldb/branches/lldb-platform-work/test/lang/objc/objc-checker/main.m Tue Apr 24 18:49:17 2012
@@ -22,9 +22,11 @@
 
 int main ()
 {
+  NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
   Simple *my_simple = [[Simple alloc] init];
   my_simple.value = 20;
   // Set a breakpoint here.
   NSLog (@"Object has value: %d.", my_simple.value); 
+  [pool drain];
   return 0;
 }

Modified: lldb/branches/lldb-platform-work/test/make/Makefile.rules
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/test/make/Makefile.rules?rev=155508&r1=155507&r2=155508&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/test/make/Makefile.rules (original)
+++ lldb/branches/lldb-platform-work/test/make/Makefile.rules Tue Apr 24 18:49:17 2012
@@ -136,7 +136,7 @@
 	OBJECTS +=$(strip $(OBJCXX_SOURCES:.mm=.o))
 	CXX = $(call cxx_compiler,$(CC))
 	LD = $(call cxx_linker,$(CC))
-	ifeq $(findstring lobjc,$(LDFLAGS)) ""
+	ifeq "$(findstring lobjc,$(LDFLAGS))" ""
 		LDFLAGS +=-lobjc
 	endif
 endif
@@ -172,7 +172,7 @@
 	ARCHIVE_OBJECTS +=$(strip $(ARCHIVE_OBJCXX_SOURCES:.mm=.o))
 	CXX = $(call cxx_compiler,$(CC))
 	LD = $(call cxx_linker,$(CC))
-	ifeq $(findstring lobjc,$(LDFLAGS)) ""
+	ifeq "$(findstring lobjc,$(LDFLAGS))" ""
 		LDFLAGS +=-lobjc
 	endif
 endif
@@ -283,6 +283,11 @@
 	sinclude $(DYLIB_PREREQS)
 endif
 
+# Define a suffix rule for .mm -> .o
+.SUFFIXES: .mm .o
+.mm.o:
+	$(CXX) $(CXXFLAGS) -c $<
+
 .PHONY: clean
 dsym:	$(DSYM)
 all:	$(EXE) $(DSYM)





More information about the lldb-commits mailing list