[llvm-branch-commits] [lldb] r179679 - Merge trunk rev 179594 back into the Windows branch.

Carlo Kok ck at remobjects.com
Wed Apr 17 01:38:53 PDT 2013


Modified: lldb/branches/windows/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.cpp?rev=179679&r1=179678&r2=179679&view=diff
==============================================================================
--- lldb/branches/windows/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.cpp (original)
+++ lldb/branches/windows/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.cpp Wed Apr 17 03:38:48 2013
@@ -68,7 +68,7 @@ DWARFCompileUnit::Clear()
 }
 
 bool
-DWARFCompileUnit::Extract(const DataExtractor &debug_info, uint32_t* offset_ptr)
+DWARFCompileUnit::Extract(const DataExtractor &debug_info, lldb::offset_t *offset_ptr)
 {
     Clear();
 
@@ -103,7 +103,7 @@ DWARFCompileUnit::Extract(const DataExtr
 
 
 dw_offset_t
-DWARFCompileUnit::Extract(dw_offset_t offset, const DataExtractor& debug_info_data, const DWARFAbbreviationDeclarationSet* abbrevs)
+DWARFCompileUnit::Extract(lldb::offset_t offset, const DataExtractor& debug_info_data, const DWARFAbbreviationDeclarationSet* abbrevs)
 {
     Clear();
 
@@ -167,17 +167,17 @@ DWARFCompileUnit::ExtractDIEsIfNeeded (b
 
     // Set the offset to that of the first DIE and calculate the start of the
     // next compilation unit header.
-    uint32_t offset = GetFirstDIEOffset();
-    uint32_t next_cu_offset = GetNextCompileUnitOffset();
+    lldb::offset_t offset = GetFirstDIEOffset();
+    lldb::offset_t next_cu_offset = GetNextCompileUnitOffset();
 
     DWARFDebugInfoEntry die;
         // Keep a flat array of the DIE for binary lookup by DIE offset
     if (!cu_die_only)
     {
-        LogSP log (LogChannelDWARF::GetLogIfAny(DWARF_LOG_DEBUG_INFO | DWARF_LOG_LOOKUPS));
+        Log *log (LogChannelDWARF::GetLogIfAny(DWARF_LOG_DEBUG_INFO | DWARF_LOG_LOOKUPS));
         if (log)
         {
-            m_dwarf2Data->GetObjectFile()->GetModule()->LogMessageVerboseBacktrace (log.get(),
+            m_dwarf2Data->GetObjectFile()->GetModule()->LogMessageVerboseBacktrace (log,
                                                                                     "DWARFCompileUnit::ExtractDIEsIfNeeded () for compile unit at .debug_info[0x%8.8x]",
                                                                                     GetOffset());
         }
@@ -273,7 +273,7 @@ DWARFCompileUnit::ExtractDIEsIfNeeded (b
     // unit header).
     if (offset > next_cu_offset)
     {
-        m_dwarf2Data->GetObjectFile()->GetModule()->ReportWarning ("DWARF compile unit extends beyond its bounds cu 0x%8.8x at 0x%8.8x\n", 
+        m_dwarf2Data->GetObjectFile()->GetModule()->ReportWarning ("DWARF compile unit extends beyond its bounds cu 0x%8.8x at 0x%8.8" PRIx64 "\n",
                                                                    GetOffset(), 
                                                                    offset);
     }
@@ -288,7 +288,7 @@ DWARFCompileUnit::ExtractDIEsIfNeeded (b
         DWARFDebugInfoEntry::collection exact_size_die_array (m_die_array.begin(), m_die_array.end());
         exact_size_die_array.swap (m_die_array);
     }
-    LogSP log (LogChannelDWARF::GetLogIfAll (DWARF_LOG_DEBUG_INFO | DWARF_LOG_VERBOSE));
+    Log *log (LogChannelDWARF::GetLogIfAll (DWARF_LOG_DEBUG_INFO | DWARF_LOG_VERBOSE));
     if (log)
     {
         StreamString strm;
@@ -414,7 +414,7 @@ DWARFCompileUnit::BuildAddressRangeTable
                 {
                     const LineTable::FileAddressRanges::Entry &range = file_ranges.GetEntryRef(idx);
                     debug_aranges->AppendRange(GetOffset(), range.GetRangeBase(), range.GetRangeEnd());
-                    printf ("0x%8.8x: [0x%16.16llx - 0x%16.16llx)\n", GetOffset(), range.GetRangeBase(), range.GetRangeEnd());
+                    printf ("0x%8.8x: [0x%16.16" PRIx64 " - 0x%16.16" PRIx64 ")\n", GetOffset(), range.GetRangeBase(), range.GetRangeEnd());
                 }
             }
         }
@@ -434,11 +434,11 @@ DWARFCompileUnit::GetFunctionAranges ()
     if (m_func_aranges_ap.get() == NULL)
     {
         m_func_aranges_ap.reset (new DWARFDebugAranges());
-        LogSP log (LogChannelDWARF::GetLogIfAll(DWARF_LOG_DEBUG_ARANGES));
+        Log *log (LogChannelDWARF::GetLogIfAll(DWARF_LOG_DEBUG_ARANGES));
 
         if (log)
         {
-            m_dwarf2Data->GetObjectFile()->GetModule()->LogMessage (log.get(), 
+            m_dwarf2Data->GetObjectFile()->GetModule()->LogMessage (log,
                                                                     "DWARFCompileUnit::GetFunctionAranges() for compile unit at .debug_info[0x%8.8x]",
                                                                     GetOffset());
         }
@@ -609,11 +609,11 @@ DWARFCompileUnit::Index (const uint32_t
 
     const uint8_t *fixed_form_sizes = DWARFFormValue::GetFixedFormSizesForAddressSize (GetAddressByteSize());
 
-    LogSP log (LogChannelDWARF::GetLogIfAll (DWARF_LOG_LOOKUPS));
+    Log *log (LogChannelDWARF::GetLogIfAll (DWARF_LOG_LOOKUPS));
     
     if (log)
     {
-        m_dwarf2Data->GetObjectFile()->GetModule()->LogMessage (log.get(), 
+        m_dwarf2Data->GetObjectFile()->GetModule()->LogMessage (log, 
                                                                 "DWARFCompileUnit::Index() for compile unit at .debug_info[0x%8.8x]",
                                                                 GetOffset());
     }
@@ -764,28 +764,22 @@ DWARFCompileUnit::Index (const uint32_t
                 {
                     // Note, this check is also done in ParseMethodName, but since this is a hot loop, we do the
                     // simple inlined check outside the call.
-                    if (ObjCLanguageRuntime::IsPossibleObjCMethodName(name))
+                    ObjCLanguageRuntime::MethodName objc_method(name, true);
+                    if (objc_method.IsValid(true))
                     {
-                        ConstString objc_class_name;
-                        ConstString objc_selector_name;
-                        ConstString objc_fullname_no_category_name;
-                        ConstString objc_class_name_no_category;
-                        if (ObjCLanguageRuntime::ParseMethodName (name,
-                                                                  &objc_class_name,
-                                                                  &objc_selector_name,
-                                                                  &objc_fullname_no_category_name,
-                                                                  &objc_class_name_no_category))
-                        {
-                            func_fullnames.Insert (ConstString(name), die.GetOffset());
-                            if (objc_class_name)
-                                objc_class_selectors.Insert(objc_class_name, die.GetOffset());
-                            if (objc_class_name_no_category)
-                                objc_class_selectors.Insert(objc_class_name_no_category, die.GetOffset());
-                            if (objc_selector_name)
-                                func_selectors.Insert (objc_selector_name, die.GetOffset());
-                            if (objc_fullname_no_category_name)
-                                func_fullnames.Insert (objc_fullname_no_category_name, die.GetOffset());
-                        }
+                        ConstString objc_class_name_with_category (objc_method.GetClassNameWithCategory());
+                        ConstString objc_selector_name (objc_method.GetSelector());
+                        ConstString objc_fullname_no_category_name (objc_method.GetFullNameWithoutCategory(true));
+                        ConstString objc_class_name_no_category (objc_method.GetClassName());
+                        func_fullnames.Insert (ConstString(name), die.GetOffset());
+                        if (objc_class_name_with_category)
+                            objc_class_selectors.Insert(objc_class_name_with_category, die.GetOffset());
+                        if (objc_class_name_no_category && objc_class_name_no_category != objc_class_name_with_category)
+                            objc_class_selectors.Insert(objc_class_name_no_category, die.GetOffset());
+                        if (objc_selector_name)
+                            func_selectors.Insert (objc_selector_name, die.GetOffset());
+                        if (objc_fullname_no_category_name)
+                            func_fullnames.Insert (objc_fullname_no_category_name, die.GetOffset());
                     }
                     // If we have a mangled name, then the DW_AT_name attribute
                     // is usually the method name without the class or any parameters
@@ -964,15 +958,16 @@ DWARFCompileUnit::ParseProducerInfo ()
             }
             else if (strstr(producer_cstr, "clang"))
             {
-                RegularExpression clang_regex("clang-([0-9]+)\\.([0-9]+)\\.([0-9]+)");
-                if (clang_regex.Execute (producer_cstr, 3))
+                static RegularExpression g_clang_version_regex("clang-([0-9]+)\\.([0-9]+)\\.([0-9]+)");
+                RegularExpression::Match regex_match(3);
+                if (g_clang_version_regex.Execute (producer_cstr, &regex_match))
                 {
                     std::string str;
-                    if (clang_regex.GetMatchAtIndex (producer_cstr, 1, str))
+                    if (regex_match.GetMatchAtIndex (producer_cstr, 1, str))
                         m_producer_version_major = Args::StringToUInt32(str.c_str(), UINT32_MAX, 10);
-                    if (clang_regex.GetMatchAtIndex (producer_cstr, 2, str))
+                    if (regex_match.GetMatchAtIndex (producer_cstr, 2, str))
                         m_producer_version_minor = Args::StringToUInt32(str.c_str(), UINT32_MAX, 10);
-                    if (clang_regex.GetMatchAtIndex (producer_cstr, 3, str))
+                    if (regex_match.GetMatchAtIndex (producer_cstr, 3, str))
                         m_producer_version_update = Args::StringToUInt32(str.c_str(), UINT32_MAX, 10);
                 }
                 m_producer = eProducerClang;

Modified: lldb/branches/windows/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.h?rev=179679&r1=179678&r2=179679&view=diff
==============================================================================
--- lldb/branches/windows/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.h (original)
+++ lldb/branches/windows/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.h Wed Apr 17 03:38:48 2013
@@ -29,8 +29,8 @@ public:
 
     DWARFCompileUnit(SymbolFileDWARF* dwarf2Data);
 
-    bool        Extract(const lldb_private::DataExtractor &debug_info, uint32_t* offset_ptr);
-    dw_offset_t Extract(dw_offset_t offset, const lldb_private::DataExtractor& debug_info_data, const DWARFAbbreviationDeclarationSet* abbrevs);
+    bool        Extract(const lldb_private::DataExtractor &debug_info, lldb::offset_t *offset_ptr);
+    dw_offset_t Extract(lldb::offset_t offset, const lldb_private::DataExtractor& debug_info_data, const DWARFAbbreviationDeclarationSet* abbrevs);
     size_t      ExtractDIEsIfNeeded (bool cu_die_only);
     bool        LookupAddress(
                     const dw_addr_t address,

Modified: lldb/branches/windows/source/Plugins/SymbolFile/DWARF/DWARFDebugAbbrev.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Plugins/SymbolFile/DWARF/DWARFDebugAbbrev.cpp?rev=179679&r1=179678&r2=179679&view=diff
==============================================================================
--- lldb/branches/windows/source/Plugins/SymbolFile/DWARF/DWARFDebugAbbrev.cpp (original)
+++ lldb/branches/windows/source/Plugins/SymbolFile/DWARF/DWARFDebugAbbrev.cpp Wed Apr 17 03:38:48 2013
@@ -30,9 +30,9 @@ DWARFAbbreviationDeclarationSet::Clear()
 // DWARFAbbreviationDeclarationSet::Extract()
 //----------------------------------------------------------------------
 bool
-DWARFAbbreviationDeclarationSet::Extract(const DataExtractor& data, uint32_t* offset_ptr)
+DWARFAbbreviationDeclarationSet::Extract(const DataExtractor& data, lldb::offset_t *offset_ptr)
 {
-    const uint32_t begin_offset = *offset_ptr;
+    const lldb::offset_t begin_offset = *offset_ptr;
     m_offset = begin_offset;
     Clear();
     DWARFAbbreviationDeclaration abbrevDeclaration;
@@ -144,7 +144,7 @@ DWARFDebugAbbrev::DWARFDebugAbbrev() :
 void
 DWARFDebugAbbrev::Parse(const DataExtractor& data)
 {
-    uint32_t offset = 0;
+    lldb::offset_t offset = 0;
 
     while (data.ValidOffset(offset))
     {

Modified: lldb/branches/windows/source/Plugins/SymbolFile/DWARF/DWARFDebugAbbrev.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Plugins/SymbolFile/DWARF/DWARFDebugAbbrev.h?rev=179679&r1=179678&r2=179679&view=diff
==============================================================================
--- lldb/branches/windows/source/Plugins/SymbolFile/DWARF/DWARFDebugAbbrev.h (original)
+++ lldb/branches/windows/source/Plugins/SymbolFile/DWARF/DWARFDebugAbbrev.h Wed Apr 17 03:38:48 2013
@@ -43,7 +43,7 @@ public:
     void Clear();
     dw_offset_t GetOffset() const { return m_offset; }
     void Dump(lldb_private::Stream *s) const;
-    bool Extract(const lldb_private::DataExtractor& data, uint32_t* offset_ptr);
+    bool Extract(const lldb_private::DataExtractor& data, lldb::offset_t *offset_ptr);
     //void Encode(BinaryStreamBuf& debug_abbrev_buf) const;
     dw_uleb128_t AppendAbbrevDeclSequential(const DWARFAbbreviationDeclaration& abbrevDecl);
 

Modified: lldb/branches/windows/source/Plugins/SymbolFile/DWARF/DWARFDebugArangeSet.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Plugins/SymbolFile/DWARF/DWARFDebugArangeSet.cpp?rev=179679&r1=179678&r2=179679&view=diff
==============================================================================
--- lldb/branches/windows/source/Plugins/SymbolFile/DWARF/DWARFDebugArangeSet.cpp (original)
+++ lldb/branches/windows/source/Plugins/SymbolFile/DWARF/DWARFDebugArangeSet.cpp Wed Apr 17 03:38:48 2013
@@ -162,7 +162,7 @@ DWARFDebugArangeSet::AddDescriptor(const
 }
 
 bool
-DWARFDebugArangeSet::Extract(const DataExtractor &data, uint32_t* offset_ptr)
+DWARFDebugArangeSet::Extract(const DataExtractor &data, lldb::offset_t *offset_ptr)
 {
     if (data.ValidOffset(*offset_ptr))
     {

Modified: lldb/branches/windows/source/Plugins/SymbolFile/DWARF/DWARFDebugArangeSet.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Plugins/SymbolFile/DWARF/DWARFDebugArangeSet.h?rev=179679&r1=179678&r2=179679&view=diff
==============================================================================
--- lldb/branches/windows/source/Plugins/SymbolFile/DWARF/DWARFDebugArangeSet.h (original)
+++ lldb/branches/windows/source/Plugins/SymbolFile/DWARF/DWARFDebugArangeSet.h Wed Apr 17 03:38:48 2013
@@ -41,12 +41,12 @@ public:
         void        SetHeader(uint16_t version, uint32_t cu_offset, uint8_t addr_size, uint8_t seg_size);
         void        AddDescriptor(const DWARFDebugArangeSet::Descriptor& range);
         void        Compact();
-        bool        Extract(const lldb_private::DataExtractor &data, uint32_t* offset_ptr);
+        bool        Extract(const lldb_private::DataExtractor &data, lldb::offset_t *offset_ptr);
         void        Dump(lldb_private::Stream *s) const;
         dw_offset_t GetCompileUnitDIEOffset() const { return m_header.cu_offset; }
         dw_offset_t GetOffsetOfNextEntry() const;
         dw_offset_t FindAddress(dw_addr_t address) const;
-        uint32_t    NumDescriptors() const { return m_arange_descriptors.size(); }
+        size_t      NumDescriptors() const { return m_arange_descriptors.size(); }
         const Header&       GetHeader() const { return m_header; }
         const Descriptor*   GetDescriptor(uint32_t i) const
         {

Modified: lldb/branches/windows/source/Plugins/SymbolFile/DWARF/DWARFDebugAranges.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Plugins/SymbolFile/DWARF/DWARFDebugAranges.cpp?rev=179679&r1=179678&r2=179679&view=diff
==============================================================================
--- lldb/branches/windows/source/Plugins/SymbolFile/DWARF/DWARFDebugAranges.cpp (original)
+++ lldb/branches/windows/source/Plugins/SymbolFile/DWARF/DWARFDebugAranges.cpp Wed Apr 17 03:38:48 2013
@@ -60,7 +60,7 @@ DWARFDebugAranges::Extract(const DataExt
 {
     if (debug_aranges_data.ValidOffset(0))
     {
-        uint32_t offset = 0;
+        lldb::offset_t offset = 0;
 
         DWARFDebugArangeSet set;
         Range range;
@@ -138,7 +138,7 @@ DWARFDebugAranges::Sort (bool minimize)
     Timer scoped_timer(__PRETTY_FUNCTION__, "%s this = %p",
                        __PRETTY_FUNCTION__, this);
 
-    LogSP log (LogChannelDWARF::GetLogIfAll(DWARF_LOG_DEBUG_ARANGES));
+    Log *log (LogChannelDWARF::GetLogIfAll(DWARF_LOG_DEBUG_ARANGES));
     size_t orig_arange_size = 0;
     if (log)
     {
@@ -160,7 +160,7 @@ DWARFDebugAranges::Sort (bool minimize)
                          (uint64_t)delta,
                          (uint64_t)delta * sizeof(Range));
         }
-        Dump (log.get());
+        Dump (log);
     }
 }
 

Modified: lldb/branches/windows/source/Plugins/SymbolFile/DWARF/DWARFDebugAranges.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Plugins/SymbolFile/DWARF/DWARFDebugAranges.h?rev=179679&r1=179678&r2=179679&view=diff
==============================================================================
--- lldb/branches/windows/source/Plugins/SymbolFile/DWARF/DWARFDebugAranges.h (original)
+++ lldb/branches/windows/source/Plugins/SymbolFile/DWARF/DWARFDebugAranges.h Wed Apr 17 03:38:48 2013
@@ -66,7 +66,7 @@ public:
     {
         return m_aranges.IsEmpty(); 
     }
-    uint32_t
+    size_t
     GetNumRanges() const
     {
         return m_aranges.GetSize();

Modified: lldb/branches/windows/source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.cpp?rev=179679&r1=179678&r2=179679&view=diff
==============================================================================
--- lldb/branches/windows/source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.cpp (original)
+++ lldb/branches/windows/source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.cpp Wed Apr 17 03:38:48 2013
@@ -54,7 +54,7 @@ DWARFDebugInfo::GetCompileUnitAranges ()
 {
     if (m_cu_aranges_ap.get() == NULL && m_dwarf2Data)
     {
-        LogSP log (LogChannelDWARF::GetLogIfAll(DWARF_LOG_DEBUG_ARANGES));
+        Log *log (LogChannelDWARF::GetLogIfAll(DWARF_LOG_DEBUG_ARANGES));
 
         m_cu_aranges_ap.reset (new DWARFDebugAranges());
         const DataExtractor &debug_aranges_data = m_dwarf2Data->get_debug_aranges_data();
@@ -73,10 +73,9 @@ DWARFDebugInfo::GetCompileUnitAranges ()
                 log->Printf ("DWARFDebugInfo::GetCompileUnitAranges() for \"%s/%s\" by parsing", 
                              m_dwarf2Data->GetObjectFile()->GetFileSpec().GetDirectory().GetCString(),
                              m_dwarf2Data->GetObjectFile()->GetFileSpec().GetFilename().GetCString());
-            const uint32_t num_compile_units = GetNumCompileUnits();
-            uint32_t idx;
+            const size_t num_compile_units = GetNumCompileUnits();
             const bool clear_dies_if_already_not_parsed = true;
-            for (idx = 0; idx < num_compile_units; ++idx)
+            for (size_t idx = 0; idx < num_compile_units; ++idx)
             {
                 DWARFCompileUnit* cu = GetCompileUnitAtIndex(idx);
                 if (cu)
@@ -148,7 +147,7 @@ DWARFDebugInfo::ParseCompileUnitHeadersI
     {
         if (m_dwarf2Data != NULL)
         {
-            uint32_t offset = 0;
+            lldb::offset_t offset = 0;
             const DataExtractor &debug_info_data = m_dwarf2Data->get_debug_info_data();
             while (debug_info_data.ValidOffset(offset))
             {
@@ -168,7 +167,7 @@ DWARFDebugInfo::ParseCompileUnitHeadersI
     }
 }
 
-uint32_t
+size_t
 DWARFDebugInfo::GetNumCompileUnits()
 {
     ParseCompileUnitHeadersIfNeeded();
@@ -395,7 +394,7 @@ DWARFDebugInfo::Parse(SymbolFileDWARF* d
 {
     if (dwarf2Data)
     {
-        uint32_t offset = 0;
+        lldb::offset_t offset = 0;
         uint32_t depth = 0;
         DWARFCompileUnitSP cu(new DWARFCompileUnit(dwarf2Data));
         if (cu.get() == NULL)

Modified: lldb/branches/windows/source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.h?rev=179679&r1=179678&r2=179679&view=diff
==============================================================================
--- lldb/branches/windows/source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.h (original)
+++ lldb/branches/windows/source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.h Wed Apr 17 03:38:48 2013
@@ -45,7 +45,7 @@ public:
             DWARFDebugInfoEntry** block_die);
 
     void AddCompileUnit(DWARFCompileUnitSP& cu);
-    uint32_t GetNumCompileUnits();
+    size_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);

Modified: lldb/branches/windows/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp?rev=179679&r1=179678&r2=179679&view=diff
==============================================================================
--- lldb/branches/windows/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp (original)
+++ lldb/branches/windows/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp Wed Apr 17 03:38:48 2013
@@ -89,7 +89,7 @@ bool
 DWARFDebugInfoEntry::Attributes::ExtractFormValueAtIndex (SymbolFileDWARF* dwarf2Data, uint32_t i, DWARFFormValue &form_value) const
 {
     form_value.SetForm(FormAtIndex(i));
-    dw_offset_t offset = DIEOffsetAtIndex(i);
+    lldb::offset_t offset = DIEOffsetAtIndex(i);
     return form_value.ExtractValue(dwarf2Data->get_debug_info_data(), &offset, CompileUnitAtIndex(i));
 }
 
@@ -119,7 +119,7 @@ DWARFDebugInfoEntry::FastExtract
     const DataExtractor& debug_info_data,
     const DWARFCompileUnit* cu,
     const uint8_t *fixed_form_sizes,
-    uint32_t* offset_ptr
+    lldb::offset_t *offset_ptr
 )
 {
     m_offset = *offset_ptr;
@@ -134,7 +134,7 @@ DWARFDebugInfoEntry::FastExtract
     
     if (m_abbr_idx)
     {
-        uint32_t offset = *offset_ptr;
+        lldb::offset_t offset = *offset_ptr;
 
         const DWARFAbbreviationDeclaration *abbrevDecl = cu->GetAbbreviations()->GetAbbreviationDeclaration(m_abbr_idx);
         
@@ -184,8 +184,13 @@ DWARFDebugInfoEntry::FastExtract
 
                     // Compile unit address sized values
                     case DW_FORM_addr        :
+                        form_size = cu->GetAddressByteSize();
+                        break;
                     case DW_FORM_ref_addr    :
+                        if (cu->GetVersion() <= 2)
                         form_size = cu->GetAddressByteSize();
+                        else
+                            form_size = 4; // 4 bytes for DWARF 32, 8 bytes for DWARF 64, but we don't support DWARF64 yet
                         break;
                     
                     // 0 sized form
@@ -273,14 +278,14 @@ DWARFDebugInfoEntry::Extract
 (
     SymbolFileDWARF* dwarf2Data,
     const DWARFCompileUnit* cu,
-    uint32_t* offset_ptr
+    lldb::offset_t *offset_ptr
 )
 {
     const DataExtractor& debug_info_data = dwarf2Data->get_debug_info_data();
 //    const DataExtractor& debug_str_data = dwarf2Data->get_debug_str_data();
     const uint32_t cu_end_offset = cu->GetNextCompileUnitOffset();
     const uint8_t cu_addr_size = cu->GetAddressByteSize();
-    uint32_t offset = *offset_ptr;
+    lldb::offset_t offset = *offset_ptr;
 //  if (offset >= cu_end_offset)
 //      Log::Error("DIE at offset 0x%8.8x is beyond the end of the current compile unit (0x%8.8x)", m_offset, cu_end_offset);
     if ((offset < cu_end_offset) && debug_info_data.ValidOffset(offset))
@@ -343,8 +348,13 @@ DWARFDebugInfoEntry::Extract
 
                             // Compile unit address sized values
                             case DW_FORM_addr        :
+                                form_size = cu_addr_size;
+                                break;
                             case DW_FORM_ref_addr    :
+                                if (cu->GetVersion() <= 2)
                                 form_size = cu_addr_size;
+                                else
+                                    form_size = 4; // 4 bytes for DWARF 32, 8 bytes for DWARF 64, but we don't support DWARF64 yet
                                 break;
 
                             // 0 sized form
@@ -745,12 +755,12 @@ DWARFDebugInfoEntry::GetDIENamesAndRange
     if (dwarf2Data == NULL)
         return false;
 
-    dw_addr_t lo_pc = DW_INVALID_ADDRESS;
-    dw_addr_t hi_pc = DW_INVALID_ADDRESS;
+    dw_addr_t lo_pc = LLDB_INVALID_ADDRESS;
+    dw_addr_t hi_pc = LLDB_INVALID_ADDRESS;
     std::vector<dw_offset_t> die_offsets;
     bool set_frame_base_loclist_addr = false;
     
-    dw_offset_t offset;
+    lldb::offset_t offset;
     const DWARFAbbreviationDeclaration* abbrevDecl = GetAbbreviationDeclarationPtr(dwarf2Data, cu, offset);
 
     if (abbrevDecl)
@@ -859,7 +869,7 @@ DWARFDebugInfoEntry::GetDIENamesAndRange
                             if (loc_list_length > 0)
                             {
                                 frame_base->SetOpcodeData(debug_loc_data, debug_loc_offset, loc_list_length);
-                                if (lo_pc != DW_INVALID_ADDRESS)
+                                if (lo_pc != LLDB_INVALID_ADDRESS)
                                 {
                                     assert (lo_pc >= cu->GetBaseAddress());
                                     frame_base->SetLocationListSlide(lo_pc - cu->GetBaseAddress());
@@ -882,9 +892,9 @@ DWARFDebugInfoEntry::GetDIENamesAndRange
 
     if (ranges.IsEmpty())
     {
-        if (lo_pc != DW_INVALID_ADDRESS)
+        if (lo_pc != LLDB_INVALID_ADDRESS)
         {
-            if (hi_pc != DW_INVALID_ADDRESS && hi_pc > lo_pc)
+            if (hi_pc != LLDB_INVALID_ADDRESS && hi_pc > lo_pc)
                 ranges.Append(DWARFDebugRanges::Range (lo_pc, hi_pc - lo_pc));
             else
                 ranges.Append(DWARFDebugRanges::Range (lo_pc, 0));
@@ -934,7 +944,7 @@ DWARFDebugInfoEntry::Dump
 ) const
 {
     const DataExtractor& debug_info_data = dwarf2Data->get_debug_info_data();
-    uint32_t offset = m_offset;
+    lldb::offset_t offset = m_offset;
 
     if (debug_info_data.ValidOffset(offset))
     {
@@ -1028,7 +1038,7 @@ DWARFDebugInfoEntry::DumpAttribute
     SymbolFileDWARF* dwarf2Data,
     const DWARFCompileUnit* cu,
     const DataExtractor& debug_info_data,
-    uint32_t* offset_ptr,
+    lldb::offset_t *offset_ptr,
     Stream &s,
     dw_attr_t attr,
     dw_form_t form
@@ -1158,7 +1168,7 @@ DWARFDebugInfoEntry::DumpAttribute
         {
             if ( !verbose )
                 form_value.Dump(s, debug_str_data, cu);
-            uint32_t ranges_offset = form_value.Unsigned();
+            lldb::offset_t ranges_offset = form_value.Unsigned();
             dw_addr_t base_addr = cu ? cu->GetBaseAddress() : 0;
             if (dwarf2Data)
                 DWARFDebugRanges::Dump(s, dwarf2Data->get_debug_ranges_data(), &ranges_offset, base_addr);
@@ -1190,7 +1200,7 @@ DWARFDebugInfoEntry::GetAttributes
     uint32_t curr_depth
 ) const
 {
-    uint32_t offset;
+    lldb::offset_t offset;
     const DWARFAbbreviationDeclaration* abbrevDecl = GetAbbreviationDeclarationPtr(dwarf2Data, cu, offset);
 
     if (abbrevDecl)
@@ -1287,7 +1297,7 @@ DWARFDebugInfoEntry::GetAttributeValue
     dw_offset_t* end_attr_offset_ptr
 ) const
 {
-    uint32_t offset;
+    lldb::offset_t offset;
     const DWARFAbbreviationDeclaration* abbrevDecl = GetAbbreviationDeclarationPtr(dwarf2Data, cu, offset);
 
     if (abbrevDecl)
@@ -1438,7 +1448,7 @@ DWARFDebugInfoEntry::GetAttributeValueAs
             // We have a location list offset as the value that is
             // the offset into the .debug_loc section that describes
             // the value over it's lifetime
-            dw_offset_t debug_loc_offset = form_value.Unsigned();
+            lldb::offset_t debug_loc_offset = form_value.Unsigned();
             if (dwarf2Data)
             {
                 assert(dwarf2Data->get_debug_loc_data().GetAddressByteSize() == cu->GetAddressByteSize());
@@ -1553,7 +1563,7 @@ DWARFDebugInfoEntry::GetName
 (
     SymbolFileDWARF* dwarf2Data,
     const DWARFCompileUnit* cu,
-    const uint32_t die_offset,
+    const dw_offset_t die_offset,
     Stream &s
 )
 {
@@ -1564,7 +1574,7 @@ DWARFDebugInfoEntry::GetName
     }
     
     DWARFDebugInfoEntry die;
-    uint32_t offset = die_offset;
+    lldb::offset_t offset = die_offset;
     if (die.Extract(dwarf2Data, cu, &offset))
     {
         if (die.IsNULL())
@@ -1602,7 +1612,7 @@ DWARFDebugInfoEntry::AppendTypeName
 (
     SymbolFileDWARF* dwarf2Data,
     const DWARFCompileUnit* cu,
-    const uint32_t die_offset,
+    const dw_offset_t die_offset,
     Stream &s
 )
 {
@@ -1613,7 +1623,7 @@ DWARFDebugInfoEntry::AppendTypeName
     }
     
     DWARFDebugInfoEntry die;
-    uint32_t offset = die_offset;
+    lldb::offset_t offset = die_offset;
     if (die.Extract(dwarf2Data, cu, &offset))
     {
         if (die.IsNULL())
@@ -1720,11 +1730,11 @@ DWARFDebugInfoEntry::BuildAddressRangeTa
     {
         if (m_tag == DW_TAG_subprogram)
         {
-            dw_addr_t hi_pc = DW_INVALID_ADDRESS;
-            dw_addr_t lo_pc = GetAttributeValueAsUnsigned(dwarf2Data, cu, DW_AT_low_pc, DW_INVALID_ADDRESS);
-            if (lo_pc != DW_INVALID_ADDRESS)
-                hi_pc = GetAttributeValueAsUnsigned(dwarf2Data, cu, DW_AT_high_pc, DW_INVALID_ADDRESS);
-            if (hi_pc != DW_INVALID_ADDRESS)
+            dw_addr_t hi_pc = LLDB_INVALID_ADDRESS;
+            dw_addr_t lo_pc = GetAttributeValueAsUnsigned(dwarf2Data, cu, DW_AT_low_pc, LLDB_INVALID_ADDRESS);
+            if (lo_pc != LLDB_INVALID_ADDRESS)
+                hi_pc = GetAttributeValueAsUnsigned(dwarf2Data, cu, DW_AT_high_pc, LLDB_INVALID_ADDRESS);
+            if (hi_pc != LLDB_INVALID_ADDRESS)
             {
             /// printf("BuildAddressRangeTable() 0x%8.8x: %30s: [0x%8.8x - 0x%8.8x)\n", m_offset, DW_TAG_value_to_name(tag), lo_pc, hi_pc);
                 debug_aranges->AppendRange (cu->GetOffset(), lo_pc, hi_pc);
@@ -1761,11 +1771,11 @@ DWARFDebugInfoEntry::BuildFunctionAddres
     {
         if (m_tag == DW_TAG_subprogram)
         {
-            dw_addr_t hi_pc = DW_INVALID_ADDRESS;
-            dw_addr_t lo_pc = GetAttributeValueAsUnsigned(dwarf2Data, cu, DW_AT_low_pc, DW_INVALID_ADDRESS);
-            if (lo_pc != DW_INVALID_ADDRESS)
-                hi_pc = GetAttributeValueAsUnsigned(dwarf2Data, cu, DW_AT_high_pc, DW_INVALID_ADDRESS);
-            if (hi_pc != DW_INVALID_ADDRESS)
+            dw_addr_t hi_pc = LLDB_INVALID_ADDRESS;
+            dw_addr_t lo_pc = GetAttributeValueAsUnsigned(dwarf2Data, cu, DW_AT_low_pc, LLDB_INVALID_ADDRESS);
+            if (lo_pc != LLDB_INVALID_ADDRESS)
+                hi_pc = GetAttributeValueAsUnsigned(dwarf2Data, cu, DW_AT_high_pc, LLDB_INVALID_ADDRESS);
+            if (hi_pc != LLDB_INVALID_ADDRESS)
             {
             //  printf("BuildAddressRangeTable() 0x%8.8x: [0x%16.16" PRIx64 " - 0x%16.16" PRIx64 ")\n", m_offset, lo_pc, hi_pc); // DEBUG ONLY
                 debug_aranges->AppendRange (GetOffset(), lo_pc, hi_pc);
@@ -2052,11 +2062,11 @@ DWARFDebugInfoEntry::LookupAddress
 
         if (match_addr_range)
         {
-            dw_addr_t lo_pc = GetAttributeValueAsUnsigned(dwarf2Data, cu, DW_AT_low_pc, DW_INVALID_ADDRESS);
-            if (lo_pc != DW_INVALID_ADDRESS)
+            dw_addr_t lo_pc = GetAttributeValueAsUnsigned(dwarf2Data, cu, DW_AT_low_pc, LLDB_INVALID_ADDRESS);
+            if (lo_pc != LLDB_INVALID_ADDRESS)
             {
-                dw_addr_t hi_pc = GetAttributeValueAsUnsigned(dwarf2Data, cu, DW_AT_high_pc, DW_INVALID_ADDRESS);
-                if (hi_pc != DW_INVALID_ADDRESS)
+                dw_addr_t hi_pc = GetAttributeValueAsUnsigned(dwarf2Data, cu, DW_AT_high_pc, LLDB_INVALID_ADDRESS);
+                if (hi_pc != LLDB_INVALID_ADDRESS)
                 {
                     //  printf("\n0x%8.8x: %30s: address = 0x%8.8x  [0x%8.8x - 0x%8.8x) ", m_offset, DW_TAG_value_to_name(tag), address, lo_pc, hi_pc);
                     if ((lo_pc <= address) && (address < hi_pc))
@@ -2166,7 +2176,7 @@ DWARFDebugInfoEntry::LookupAddress
 const DWARFAbbreviationDeclaration* 
 DWARFDebugInfoEntry::GetAbbreviationDeclarationPtr (SymbolFileDWARF* dwarf2Data,
                                                     const DWARFCompileUnit *cu,
-                                                    dw_offset_t &offset) const
+                                                    lldb::offset_t &offset) const
 {
     if (dwarf2Data)
     {

Modified: lldb/branches/windows/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.h?rev=179679&r1=179678&r2=179679&view=diff
==============================================================================
--- lldb/branches/windows/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.h (original)
+++ lldb/branches/windows/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.h Wed Apr 17 03:38:48 2013
@@ -75,7 +75,7 @@ public:
         bool ContainsAttribute(dw_attr_t attr) const;
         bool RemoveAttribute(dw_attr_t attr);
         void Clear() { m_infos.clear(); }
-        uint32_t Size() const { return m_infos.size(); }
+        size_t Size() const { return m_infos.size(); }
 
     protected:
         struct Info
@@ -145,12 +145,12 @@ public:
                     const lldb_private::DataExtractor& debug_info_data,
                     const DWARFCompileUnit* cu,
                     const uint8_t *fixed_form_sizes,
-                    dw_offset_t* offset_ptr);
+                    lldb::offset_t* offset_ptr);
 
     bool        Extract(
                     SymbolFileDWARF* dwarf2Data,
                     const DWARFCompileUnit* cu,
-                    dw_offset_t* offset_ptr);
+                    lldb::offset_t* offset_ptr);
 
     bool        LookupAddress(
                     const dw_addr_t address,
@@ -277,7 +277,7 @@ public:
                     SymbolFileDWARF* dwarf2Data,
                     const DWARFCompileUnit* cu,
                     const lldb_private::DataExtractor& debug_info_data,
-                    uint32_t* offset_ptr,
+                    lldb::offset_t *offset_ptr,
                     lldb_private::Stream &s,
                     dw_attr_t attr,
                     dw_form_t form);
@@ -304,7 +304,7 @@ public:
     const DWARFAbbreviationDeclaration* 
     GetAbbreviationDeclarationPtr (SymbolFileDWARF* dwarf2Data,
                                    const DWARFCompileUnit *cu,
-                                   dw_offset_t &offset) const;
+                                   lldb::offset_t &offset) const;
 
     dw_tag_t
     Tag () const 

Modified: lldb/branches/windows/source/Plugins/SymbolFile/DWARF/DWARFDebugLine.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Plugins/SymbolFile/DWARF/DWARFDebugLine.cpp?rev=179679&r1=179678&r2=179679&view=diff
==============================================================================
--- lldb/branches/windows/source/Plugins/SymbolFile/DWARF/DWARFDebugLine.cpp (original)
+++ lldb/branches/windows/source/Plugins/SymbolFile/DWARF/DWARFDebugLine.cpp Wed Apr 17 03:38:48 2013
@@ -35,11 +35,11 @@ void
 DWARFDebugLine::Parse(const DataExtractor& debug_line_data)
 {
     m_lineTableMap.clear();
-    dw_offset_t offset = 0;
+    lldb::offset_t offset = 0;
     LineTable::shared_ptr line_table_sp(new LineTable);
     while (debug_line_data.ValidOffset(offset))
     {
-        const uint32_t debug_line_offset = offset;
+        const lldb::offset_t debug_line_offset = offset;
 
         if (line_table_sp.get() == NULL)
             break;
@@ -135,7 +135,7 @@ DWARFDebugLine::DumpStatementTable(Log *
 {
     if (debug_line_data.ValidOffset(debug_line_offset))
     {
-        uint32_t offset = debug_line_offset;
+        lldb::offset_t offset = debug_line_offset;
         log->Printf(  "----------------------------------------------------------------------\n"
                     "debug_line[0x%8.8x]\n"
                     "----------------------------------------------------------------------\n", debug_line_offset);
@@ -185,7 +185,7 @@ DWARFDebugLine::DumpOpcodes(Log *log, Sy
 dw_offset_t
 DWARFDebugLine::DumpStatementOpcodes(Log *log, const DataExtractor& debug_line_data, const dw_offset_t debug_line_offset, uint32_t flags)
 {
-    uint32_t offset = debug_line_offset;
+    lldb::offset_t offset = debug_line_offset;
     if (debug_line_data.ValidOffset(offset))
     {
         Prologue prologue;
@@ -200,7 +200,7 @@ DWARFDebugLine::DumpStatementOpcodes(Log
         else
         {
             offset = debug_line_offset;
-            log->Printf( "0x%8.8x: skipping pad byte %2.2x", offset, debug_line_data.GetU8(&offset));
+            log->Printf( "0x%8.8" PRIx64 ": skipping pad byte %2.2x", offset, debug_line_data.GetU8(&offset));
             return offset;
         }
 
@@ -388,7 +388,7 @@ DWARFDebugLine::DumpStatementOpcodes(Log
 void
 DWARFDebugLine::Parse(const DataExtractor& debug_line_data, DWARFDebugLine::State::Callback callback, void* userData)
 {
-    uint32_t offset = 0;
+    lldb::offset_t offset = 0;
     if (debug_line_data.ValidOffset(offset))
     {
         if (!ParseStatementTable(debug_line_data, &offset, callback, userData))
@@ -401,9 +401,9 @@ DWARFDebugLine::Parse(const DataExtracto
 // DWARFDebugLine::ParsePrologue
 //----------------------------------------------------------------------
 bool
-DWARFDebugLine::ParsePrologue(const DataExtractor& debug_line_data, dw_offset_t* offset_ptr, Prologue* prologue)
+DWARFDebugLine::ParsePrologue(const DataExtractor& debug_line_data, lldb::offset_t* offset_ptr, Prologue* prologue)
 {
-    const uint32_t prologue_offset = *offset_ptr;
+    const lldb::offset_t prologue_offset = *offset_ptr;
 
     //DEBUG_PRINTF("0x%8.8x: ParsePrologue()\n", *offset_ptr);
 
@@ -416,7 +416,7 @@ DWARFDebugLine::ParsePrologue(const Data
       return false;
 
     prologue->prologue_length   = debug_line_data.GetU32(offset_ptr);
-    const dw_offset_t end_prologue_offset = prologue->prologue_length + *offset_ptr;
+    const lldb::offset_t end_prologue_offset = prologue->prologue_length + *offset_ptr;
     prologue->min_inst_length   = debug_line_data.GetU8(offset_ptr);
     prologue->default_is_stmt   = debug_line_data.GetU8(offset_ptr);
     prologue->line_base         = debug_line_data.GetU8(offset_ptr);
@@ -459,8 +459,8 @@ DWARFDebugLine::ParsePrologue(const Data
     if (*offset_ptr != end_prologue_offset)
     {
         Host::SystemLog (Host::eSystemLogWarning, 
-                         "warning: parsing line table prologue at 0x%8.8x should have ended at 0x%8.8x but it ended ad 0x%8.8x\n", 
-                         prologue_offset, 
+                         "warning: parsing line table prologue at 0x%8.8" PRIx64 " should have ended at 0x%8.8" PRIx64 " but it ended ad 0x%8.8" PRIx64 "\n",
+                         prologue_offset,
                          end_prologue_offset, 
                          *offset_ptr);
     }
@@ -474,7 +474,7 @@ DWARFDebugLine::ParseSupportFiles (const
                                    dw_offset_t stmt_list,
                                    FileSpecList &support_files)
 {
-    uint32_t offset = stmt_list + 4;    // Skip the total length
+    lldb::offset_t offset = stmt_list + 4;    // Skip the total length
     const char * s;
     uint32_t version = debug_line_data.GetU16(&offset);
     if (version != 2)
@@ -559,7 +559,7 @@ DWARFDebugLine::ParseSupportFiles (const
     if (offset != end_prologue_offset)
     {
         Host::SystemLog (Host::eSystemLogError, 
-                         "warning: parsing line table prologue at 0x%8.8x should have ended at 0x%8.8x but it ended ad 0x%8.8x\n", 
+                         "warning: parsing line table prologue at 0x%8.8x should have ended at 0x%8.8x but it ended ad 0x%8.8" PRIx64 "\n",
                          stmt_list, 
                          end_prologue_offset, 
                          offset);
@@ -578,12 +578,12 @@ bool
 DWARFDebugLine::ParseStatementTable
 (
     const DataExtractor& debug_line_data,
-    dw_offset_t* offset_ptr,
+    lldb::offset_t* offset_ptr,
     DWARFDebugLine::State::Callback callback,
     void* userData
 )
 {
-    LogSP log (LogChannelDWARF::GetLogIfAll(DWARF_LOG_DEBUG_LINE));
+    Log *log (LogChannelDWARF::GetLogIfAll(DWARF_LOG_DEBUG_LINE));
     Prologue::shared_ptr prologue(new Prologue());
 
 
@@ -603,11 +603,11 @@ DWARFDebugLine::ParseStatementTable
     }
 
     if (log)
-        prologue->Dump (log.get());
+        prologue->Dump (log);
 
     const dw_offset_t end_offset = debug_line_offset + prologue->total_length + sizeof(prologue->total_length);
 
-    State state(prologue, log.get(), callback, userData);
+    State state(prologue, log, callback, userData);
 
     while (*offset_ptr < end_offset)
     {
@@ -618,7 +618,7 @@ DWARFDebugLine::ParseStatementTable
         {
             // Extended Opcodes always start with a zero opcode followed by
             // a uleb128 length so you can skip ones you don't know about
-            dw_offset_t ext_offset = *offset_ptr;
+            lldb::offset_t ext_offset = *offset_ptr;
             dw_uleb128_t len = debug_line_data.GetULEB128(offset_ptr);
             dw_offset_t arg_size = len - (*offset_ptr - ext_offset);
 
@@ -878,7 +878,7 @@ ParseStatementTableCallback(dw_offset_t
 // the prologue and all rows.
 //----------------------------------------------------------------------
 bool
-DWARFDebugLine::ParseStatementTable(const DataExtractor& debug_line_data, uint32_t* offset_ptr, LineTable* line_table)
+DWARFDebugLine::ParseStatementTable(const DataExtractor& debug_line_data, lldb::offset_t *offset_ptr, LineTable* line_table)
 {
     return ParseStatementTable(debug_line_data, offset_ptr, ParseStatementTableCallback, line_table);
 }

Modified: lldb/branches/windows/source/Plugins/SymbolFile/DWARF/DWARFDebugLine.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Plugins/SymbolFile/DWARF/DWARFDebugLine.h?rev=179679&r1=179678&r2=179679&view=diff
==============================================================================
--- lldb/branches/windows/source/Plugins/SymbolFile/DWARF/DWARFDebugLine.h (original)
+++ lldb/branches/windows/source/Plugins/SymbolFile/DWARF/DWARFDebugLine.h Wed Apr 17 03:38:48 2013
@@ -197,11 +197,11 @@ public:
     static bool DumpOpcodes(lldb_private::Log *log, SymbolFileDWARF* dwarf2Data, dw_offset_t line_offset = DW_INVALID_OFFSET, uint32_t dump_flags = 0);   // If line_offset is invalid, dump everything
     static bool DumpLineTableRows(lldb_private::Log *log, SymbolFileDWARF* dwarf2Data, dw_offset_t line_offset = DW_INVALID_OFFSET);  // If line_offset is invalid, dump everything
     static bool ParseSupportFiles(const lldb::ModuleSP &module_sp, const lldb_private::DataExtractor& debug_line_data, const char *cu_comp_dir, dw_offset_t stmt_list, lldb_private::FileSpecList &support_files);
-    static bool ParsePrologue(const lldb_private::DataExtractor& debug_line_data, dw_offset_t* offset_ptr, Prologue* prologue);
-    static bool ParseStatementTable(const lldb_private::DataExtractor& debug_line_data, dw_offset_t* offset_ptr, State::Callback callback, void* userData);
+    static bool ParsePrologue(const lldb_private::DataExtractor& debug_line_data, lldb::offset_t* offset_ptr, Prologue* prologue);
+    static bool ParseStatementTable(const lldb_private::DataExtractor& debug_line_data, lldb::offset_t* offset_ptr, State::Callback callback, void* userData);
     static dw_offset_t DumpStatementTable(lldb_private::Log *log, const lldb_private::DataExtractor& debug_line_data, const dw_offset_t line_offset);
     static dw_offset_t DumpStatementOpcodes(lldb_private::Log *log, const lldb_private::DataExtractor& debug_line_data, const dw_offset_t line_offset, uint32_t flags);
-    static bool ParseStatementTable(const lldb_private::DataExtractor& debug_line_data, uint32_t* offset_ptr, LineTable* line_table);
+    static bool ParseStatementTable(const lldb_private::DataExtractor& debug_line_data, lldb::offset_t *offset_ptr, LineTable* line_table);
     static void Parse(const lldb_private::DataExtractor& debug_line_data, DWARFDebugLine::State::Callback callback, void* userData);
 //  static void AppendLineTableData(const DWARFDebugLine::Prologue* prologue, const DWARFDebugLine::Row::collection& state_coll, const uint32_t addr_size, BinaryStreamBuf &debug_line_data);
 

Modified: lldb/branches/windows/source/Plugins/SymbolFile/DWARF/DWARFDebugMacinfo.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Plugins/SymbolFile/DWARF/DWARFDebugMacinfo.cpp?rev=179679&r1=179678&r2=179679&view=diff
==============================================================================
--- lldb/branches/windows/source/Plugins/SymbolFile/DWARF/DWARFDebugMacinfo.cpp (original)
+++ lldb/branches/windows/source/Plugins/SymbolFile/DWARF/DWARFDebugMacinfo.cpp Wed Apr 17 03:38:48 2013
@@ -26,7 +26,7 @@ DWARFDebugMacinfo::~DWARFDebugMacinfo()
 }
 
 void
-DWARFDebugMacinfo::Dump(Stream *s, const DataExtractor& macinfo_data, dw_offset_t offset)
+DWARFDebugMacinfo::Dump(Stream *s, const DataExtractor& macinfo_data, lldb::offset_t offset)
 {
     DWARFDebugMacinfoEntry maninfo_entry;
     if (macinfo_data.GetByteSize() == 0)
@@ -34,7 +34,7 @@ DWARFDebugMacinfo::Dump(Stream *s, const
         s->PutCString("< EMPTY >\n");
         return;
     }
-    if (offset == DW_INVALID_OFFSET)
+    if (offset == LLDB_INVALID_OFFSET)
     {
         offset = 0;
         while (maninfo_entry.Extract(macinfo_data, &offset))

Modified: lldb/branches/windows/source/Plugins/SymbolFile/DWARF/DWARFDebugMacinfo.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Plugins/SymbolFile/DWARF/DWARFDebugMacinfo.h?rev=179679&r1=179678&r2=179679&view=diff
==============================================================================
--- lldb/branches/windows/source/Plugins/SymbolFile/DWARF/DWARFDebugMacinfo.h (original)
+++ lldb/branches/windows/source/Plugins/SymbolFile/DWARF/DWARFDebugMacinfo.h Wed Apr 17 03:38:48 2013
@@ -7,8 +7,8 @@
 //
 //===----------------------------------------------------------------------===//
 
-#ifndef SymbolFileDWARF_DWARFDebugLine_h_
-#define SymbolFileDWARF_DWARFDebugLine_h_
+#ifndef SymbolFileDWARF_DWARFDebugMacinfo_h_
+#define SymbolFileDWARF_DWARFDebugMacinfo_h_
 
 #include "SymbolFileDWARF.h"
 
@@ -22,8 +22,8 @@ public:
     static void
     Dump (lldb_private::Stream *s,
           const lldb_private::DataExtractor& macinfo_data,
-          dw_offset_t offset = DW_INVALID_OFFSET);
+          lldb::offset_t offset = LLDB_INVALID_OFFSET);
 };
 
 
-#endif  // SymbolFileDWARF_DWARFDebugLine_h_
+#endif  // SymbolFileDWARF_DWARFDebugMacinfo_h_

Modified: lldb/branches/windows/source/Plugins/SymbolFile/DWARF/DWARFDebugMacinfoEntry.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Plugins/SymbolFile/DWARF/DWARFDebugMacinfoEntry.cpp?rev=179679&r1=179678&r2=179679&view=diff
==============================================================================
--- lldb/branches/windows/source/Plugins/SymbolFile/DWARF/DWARFDebugMacinfoEntry.cpp (original)
+++ lldb/branches/windows/source/Plugins/SymbolFile/DWARF/DWARFDebugMacinfoEntry.cpp Wed Apr 17 03:38:48 2013
@@ -80,7 +80,7 @@ DWARFDebugMacinfoEntry::Dump(Stream *s)
 
 
 bool
-DWARFDebugMacinfoEntry::Extract(const DataExtractor& mac_info_data, dw_offset_t* offset_ptr)
+DWARFDebugMacinfoEntry::Extract(const DataExtractor& mac_info_data, lldb::offset_t* offset_ptr)
 {
     if (mac_info_data.ValidOffset(*offset_ptr))
     {

Modified: lldb/branches/windows/source/Plugins/SymbolFile/DWARF/DWARFDebugMacinfoEntry.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Plugins/SymbolFile/DWARF/DWARFDebugMacinfoEntry.h?rev=179679&r1=179678&r2=179679&view=diff
==============================================================================
--- lldb/branches/windows/source/Plugins/SymbolFile/DWARF/DWARFDebugMacinfoEntry.h (original)
+++ lldb/branches/windows/source/Plugins/SymbolFile/DWARF/DWARFDebugMacinfoEntry.h Wed Apr 17 03:38:48 2013
@@ -39,7 +39,7 @@ public:
 
     bool
     Extract(const lldb_private::DataExtractor& mac_info_data,
-            dw_offset_t* offset_ptr);
+            lldb::offset_t* offset_ptr);
 
 protected:
 

Modified: lldb/branches/windows/source/Plugins/SymbolFile/DWARF/DWARFDebugPubnames.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Plugins/SymbolFile/DWARF/DWARFDebugPubnames.cpp?rev=179679&r1=179678&r2=179679&view=diff
==============================================================================
--- lldb/branches/windows/source/Plugins/SymbolFile/DWARF/DWARFDebugPubnames.cpp (original)
+++ lldb/branches/windows/source/Plugins/SymbolFile/DWARF/DWARFDebugPubnames.cpp Wed Apr 17 03:38:48 2013
@@ -34,13 +34,13 @@ DWARFDebugPubnames::Extract(const DataEx
     Timer scoped_timer (__PRETTY_FUNCTION__,
                         "DWARFDebugPubnames::Extract (byte_size = %" PRIu64 ")",
                         (uint64_t)data.GetByteSize());
-    LogSP log (LogChannelDWARF::GetLogIfAll(DWARF_LOG_DEBUG_PUBNAMES));
+    Log *log (LogChannelDWARF::GetLogIfAll(DWARF_LOG_DEBUG_PUBNAMES));
     if (log)
         log->Printf("DWARFDebugPubnames::Extract (byte_size = %" PRIu64 ")", (uint64_t)data.GetByteSize());
 
     if (data.ValidOffset(0))
     {
-        uint32_t offset = 0;
+        lldb::offset_t offset = 0;
 
         DWARFDebugPubnamesSet set;
         while (data.ValidOffset(offset))
@@ -54,7 +54,7 @@ DWARFDebugPubnames::Extract(const DataEx
                 break;
         }
         if (log)
-            Dump (log.get());
+            Dump (log);
         return true;
     }
     return false;
@@ -68,7 +68,7 @@ DWARFDebugPubnames::GeneratePubnames(Sym
                         "DWARFDebugPubnames::GeneratePubnames (data = %p)",
                         dwarf2Data);
 
-    LogSP log (LogChannelDWARF::GetLogIfAll(DWARF_LOG_DEBUG_PUBNAMES));
+    Log *log (LogChannelDWARF::GetLogIfAll(DWARF_LOG_DEBUG_PUBNAMES));
     if (log)
         log->Printf("DWARFDebugPubnames::GeneratePubnames (data = %p)", dwarf2Data);
 
@@ -206,7 +206,7 @@ DWARFDebugPubnames::GeneratePubnames(Sym
     if (m_sets.empty())
         return false;
     if (log)
-        Dump (log.get());
+        Dump (log);
     return true;
 }
 

Modified: lldb/branches/windows/source/Plugins/SymbolFile/DWARF/DWARFDebugPubnamesSet.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Plugins/SymbolFile/DWARF/DWARFDebugPubnamesSet.cpp?rev=179679&r1=179678&r2=179679&view=diff
==============================================================================
--- lldb/branches/windows/source/Plugins/SymbolFile/DWARF/DWARFDebugPubnamesSet.cpp (original)
+++ lldb/branches/windows/source/Plugins/SymbolFile/DWARF/DWARFDebugPubnamesSet.cpp Wed Apr 17 03:38:48 2013
@@ -78,7 +78,7 @@ DWARFDebugPubnamesSet::InitNameIndexes()
 
 
 bool
-DWARFDebugPubnamesSet::Extract(const DataExtractor& data, uint32_t* offset_ptr)
+DWARFDebugPubnamesSet::Extract(const DataExtractor& data, lldb::offset_t *offset_ptr)
 {
     if (data.ValidOffset(*offset_ptr))
     {

Modified: lldb/branches/windows/source/Plugins/SymbolFile/DWARF/DWARFDebugPubnamesSet.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Plugins/SymbolFile/DWARF/DWARFDebugPubnamesSet.h?rev=179679&r1=179678&r2=179679&view=diff
==============================================================================
--- lldb/branches/windows/source/Plugins/SymbolFile/DWARF/DWARFDebugPubnamesSet.h (original)
+++ lldb/branches/windows/source/Plugins/SymbolFile/DWARF/DWARFDebugPubnamesSet.h Wed Apr 17 03:38:48 2013
@@ -74,7 +74,7 @@ public:
     uint32_t    NumDescriptors() const { return m_descriptors.size(); }
     void        AddDescriptor(dw_offset_t cu_rel_offset, const char* name);
     void        Clear();
-    bool        Extract(const lldb_private::DataExtractor& debug_pubnames_data, uint32_t* offset_ptr);
+    bool        Extract(const lldb_private::DataExtractor& debug_pubnames_data, lldb::offset_t *offset_ptr);
     void        Dump(lldb_private::Log *s) const;
     void        InitNameIndexes() const;
     void        Find(const char* name, bool ignore_case, std::vector<dw_offset_t>& die_offset_coll) const;

Modified: lldb/branches/windows/source/Plugins/SymbolFile/DWARF/DWARFDebugRanges.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Plugins/SymbolFile/DWARF/DWARFDebugRanges.cpp?rev=179679&r1=179678&r2=179679&view=diff
==============================================================================
--- lldb/branches/windows/source/Plugins/SymbolFile/DWARF/DWARFDebugRanges.cpp (original)
+++ lldb/branches/windows/source/Plugins/SymbolFile/DWARF/DWARFDebugRanges.cpp Wed Apr 17 03:38:48 2013
@@ -28,7 +28,7 @@ void
 DWARFDebugRanges::Extract(SymbolFileDWARF* dwarf2Data)
 {
     RangeList range_list;
-    dw_offset_t offset = 0;
+    lldb::offset_t offset = 0;
     dw_offset_t debug_ranges_offset = offset;
     while (Extract(dwarf2Data, &offset, range_list))
     {
@@ -82,11 +82,11 @@ DWARFDebugRanges::Extract(SymbolFileDWAR
 //}
 
 bool
-DWARFDebugRanges::Extract(SymbolFileDWARF* dwarf2Data, uint32_t* offset_ptr, RangeList &range_list)
+DWARFDebugRanges::Extract(SymbolFileDWARF* dwarf2Data, lldb::offset_t *offset_ptr, RangeList &range_list)
 {
     range_list.Clear();
 
-    uint32_t range_offset = *offset_ptr;
+    lldb::offset_t range_offset = *offset_ptr;
     const DataExtractor& debug_ranges_data = dwarf2Data->get_debug_ranges_data();
     uint32_t addr_size = debug_ranges_data.GetAddressByteSize();
 
@@ -105,12 +105,12 @@ DWARFDebugRanges::Extract(SymbolFileDWAR
         {
         case 2:
             if (begin == 0xFFFFull)
-                begin = DW_INVALID_ADDRESS;
+                begin = LLDB_INVALID_ADDRESS;
             break;
 
         case 4:
             if (begin == 0xFFFFFFFFull)
-                begin = DW_INVALID_ADDRESS;
+                begin = LLDB_INVALID_ADDRESS;
             break;
 
         case 8:
@@ -130,60 +130,9 @@ DWARFDebugRanges::Extract(SymbolFileDWAR
     return range_offset != *offset_ptr;
 }
 
-//
-//dw_addr_t
-//DWARFDebugRanges::RangeList::LowestAddress(const dw_addr_t cu_base_addr) const
-//{
-//    dw_addr_t addr = DW_INVALID_ADDRESS;
-//    dw_addr_t curr_base_addr = cu_base_addr;
-//    if (!ranges.empty())
-//    {
-//        Range::const_iterator pos = ranges.begin();
-//        Range::const_iterator end_pos = ranges.end();
-//        for (pos = ranges.begin(); pos != end_pos; ++pos)
-//        {
-//            if (pos->begin_offset == DW_INVALID_ADDRESS)
-//                curr_base_addr = pos->end_offset;
-//            else if (curr_base_addr != DW_INVALID_ADDRESS)
-//            {
-//                dw_addr_t curr_addr = curr_base_addr + pos->begin_offset;
-//                if (addr > curr_addr)
-//                    addr = curr_addr;
-//            }
-//        }
-//    }
-//    return addr;
-//}
-//
-//dw_addr_t
-//DWARFDebugRanges::RangeList::HighestAddress(const dw_addr_t cu_base_addr) const
-//{
-//    dw_addr_t addr = 0;
-//    dw_addr_t curr_base_addr = cu_base_addr;
-//    if (!ranges.empty())
-//    {
-//        Range::const_iterator pos = ranges.begin();
-//        Range::const_iterator end_pos = ranges.end();
-//        for (pos = ranges.begin(); pos != end_pos; ++pos)
-//        {
-//            if (pos->begin_offset == DW_INVALID_ADDRESS)
-//                curr_base_addr = pos->end_offset;
-//            else if (curr_base_addr != DW_INVALID_ADDRESS)
-//            {
-//                dw_addr_t curr_addr = curr_base_addr + pos->end_offset;
-//                if (addr < curr_addr)
-//                    addr = curr_addr;
-//            }
-//        }
-//    }
-//    if (addr != 0)
-//        return addr;
-//    return DW_INVALID_ADDRESS;
-//}
-//
 
 void
-DWARFDebugRanges::Dump(Stream &s, const DataExtractor& debug_ranges_data, uint32_t* offset_ptr, dw_addr_t cu_base_addr)
+DWARFDebugRanges::Dump(Stream &s, const DataExtractor& debug_ranges_data, lldb::offset_t *offset_ptr, dw_addr_t cu_base_addr)
 {
     uint32_t addr_size = s.GetAddressByteSize();
     bool verbose = s.GetVerbose();
@@ -196,7 +145,7 @@ DWARFDebugRanges::Dump(Stream &s, const
         // Extend 4 byte addresses that consits of 32 bits of 1's to be 64 bits
         // of ones
         if (begin == 0xFFFFFFFFull && addr_size == 4)
-            begin = DW_INVALID_ADDRESS;
+            begin = LLDB_INVALID_ADDRESS;
 
         s.Indent();
         if (verbose)
@@ -210,7 +159,7 @@ DWARFDebugRanges::Dump(Stream &s, const
             s.PutCString(" End");
             break;
         }
-        else if (begin == DW_INVALID_ADDRESS)
+        else if (begin == LLDB_INVALID_ADDRESS)
         {
             // A base address selection entry
             base_addr = end;

Modified: lldb/branches/windows/source/Plugins/SymbolFile/DWARF/DWARFDebugRanges.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Plugins/SymbolFile/DWARF/DWARFDebugRanges.h?rev=179679&r1=179678&r2=179679&view=diff
==============================================================================
--- lldb/branches/windows/source/Plugins/SymbolFile/DWARF/DWARFDebugRanges.h (original)
+++ lldb/branches/windows/source/Plugins/SymbolFile/DWARF/DWARFDebugRanges.h Wed Apr 17 03:38:48 2013
@@ -26,14 +26,14 @@ public:
     DWARFDebugRanges();
     ~DWARFDebugRanges();
     void Extract(SymbolFileDWARF* dwarf2Data);
-    static void Dump(lldb_private::Stream &s, const lldb_private::DataExtractor& debug_ranges_data, uint32_t* offset_ptr, dw_addr_t cu_base_addr);
+    static void Dump(lldb_private::Stream &s, const lldb_private::DataExtractor& debug_ranges_data, lldb::offset_t *offset_ptr, dw_addr_t cu_base_addr);
     bool FindRanges(dw_offset_t debug_ranges_offset, DWARFDebugRanges::RangeList& range_list) const;
 
 protected:
 
     bool
     Extract (SymbolFileDWARF* dwarf2Data, 
-             uint32_t* offset_ptr, 
+             lldb::offset_t *offset_ptr, 
              RangeList &range_list);
 
     typedef std::map<dw_offset_t, RangeList>    range_map;

Modified: lldb/branches/windows/source/Plugins/SymbolFile/DWARF/DWARFDeclContext.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Plugins/SymbolFile/DWARF/DWARFDeclContext.cpp?rev=179679&r1=179678&r2=179679&view=diff
==============================================================================
--- lldb/branches/windows/source/Plugins/SymbolFile/DWARF/DWARFDeclContext.cpp (original)
+++ lldb/branches/windows/source/Plugins/SymbolFile/DWARF/DWARFDeclContext.cpp Wed Apr 17 03:38:48 2013
@@ -39,7 +39,21 @@ DWARFDeclContext::GetQualifiedName () co
                 {
                     if (pos != begin)
                         m_qualified_name.append("::");
-                    m_qualified_name.append(pos->name);
+                    if (pos->name == NULL)
+                    {
+                        if (pos->tag == DW_TAG_namespace)
+                            m_qualified_name.append ("(anonymous namespace)");
+                        else if (pos->tag == DW_TAG_class_type)
+                            m_qualified_name.append ("(anonymous class)");
+                        else if (pos->tag == DW_TAG_structure_type)
+                            m_qualified_name.append ("(anonymous struct)");
+                        else if (pos->tag == DW_TAG_union_type)
+                            m_qualified_name.append ("(anonymous union)");
+                        else
+                            m_qualified_name.append ("(anonymous)");
+                    }
+                    else
+                        m_qualified_name.append(pos->name);
                 }
             }
         }

Modified: lldb/branches/windows/source/Plugins/SymbolFile/DWARF/DWARFFormValue.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Plugins/SymbolFile/DWARF/DWARFFormValue.cpp?rev=179679&r1=179678&r2=179679&view=diff
==============================================================================
--- lldb/branches/windows/source/Plugins/SymbolFile/DWARF/DWARFFormValue.cpp (original)
+++ lldb/branches/windows/source/Plugins/SymbolFile/DWARF/DWARFFormValue.cpp Wed Apr 17 03:38:48 2013
@@ -38,7 +38,7 @@ static uint8_t g_form_sizes_addr4[] =
     0, // 0x0d DW_FORM_sdata
     4, // 0x0e DW_FORM_strp
     0, // 0x0f DW_FORM_udata
-    4, // 0x10 DW_FORM_ref_addr
+    0, // 0x10 DW_FORM_ref_addr (addr size for DWARF2 and earlier, 4 bytes for DWARF32, 8 bytes for DWARF32 in DWARF 3 and later
     1, // 0x11 DW_FORM_ref1
     2, // 0x12 DW_FORM_ref2
     4, // 0x13 DW_FORM_ref4
@@ -77,7 +77,7 @@ g_form_sizes_addr8[] =
     0, // 0x0d DW_FORM_sdata
     4, // 0x0e DW_FORM_strp
     0, // 0x0f DW_FORM_udata
-    8, // 0x10 DW_FORM_ref_addr
+    0, // 0x10 DW_FORM_ref_addr (addr size for DWARF2 and earlier, 4 bytes for DWARF32, 8 bytes for DWARF32 in DWARF 3 and later
     1, // 0x11 DW_FORM_ref1
     2, // 0x12 DW_FORM_ref2
     4, // 0x13 DW_FORM_ref4
@@ -114,7 +114,7 @@ DWARFFormValue::DWARFFormValue(dw_form_t
 }
 
 bool
-DWARFFormValue::ExtractValue(const DataExtractor& data, uint32_t* offset_ptr, const DWARFCompileUnit* cu)
+DWARFFormValue::ExtractValue(const DataExtractor& data, lldb::offset_t* offset_ptr, const DWARFCompileUnit* cu)
 {
     bool indirect = false;
     bool is_block = false;
@@ -145,7 +145,12 @@ DWARFFormValue::ExtractValue(const DataE
         case DW_FORM_strp:      m_value.value.uval = data.GetU32(offset_ptr);                           break;
     //  case DW_FORM_APPLE_db_str:
         case DW_FORM_udata:     m_value.value.uval = data.GetULEB128(offset_ptr);                       break;
-        case DW_FORM_ref_addr:  m_value.value.uval = data.GetMaxU64(offset_ptr, DWARFCompileUnit::GetAddressByteSize(cu));  break;
+        case DW_FORM_ref_addr:
+            if (cu->GetVersion() <= 2)
+                m_value.value.uval = data.GetMaxU64(offset_ptr, DWARFCompileUnit::GetAddressByteSize(cu));
+            else
+                m_value.value.uval = data.GetU32(offset_ptr); // 4 for DWARF32, 8 for DWARF64, but we don't support DWARF64 yet
+            break;
         case DW_FORM_ref1:      m_value.value.uval = data.GetU8(offset_ptr);                            break;
         case DW_FORM_ref2:      m_value.value.uval = data.GetU16(offset_ptr);                           break;
         case DW_FORM_ref4:      m_value.value.uval = data.GetU32(offset_ptr);                           break;
@@ -178,13 +183,13 @@ DWARFFormValue::ExtractValue(const DataE
 }
 
 bool
-DWARFFormValue::SkipValue(const DataExtractor& debug_info_data, uint32_t* offset_ptr, const DWARFCompileUnit* cu) const
+DWARFFormValue::SkipValue(const DataExtractor& debug_info_data, lldb::offset_t *offset_ptr, const DWARFCompileUnit* cu) const
 {
     return DWARFFormValue::SkipValue(m_form, debug_info_data, offset_ptr, cu);
 }
 
 bool
-DWARFFormValue::SkipValue(dw_form_t form, const DataExtractor& debug_info_data, uint32_t* offset_ptr, const DWARFCompileUnit* cu)
+DWARFFormValue::SkipValue(dw_form_t form, const DataExtractor& debug_info_data, lldb::offset_t *offset_ptr, const DWARFCompileUnit* cu)
 {
     switch (form)
     {
@@ -203,10 +208,16 @@ DWARFFormValue::SkipValue(dw_form_t form
 
     // Compile unit address sized values
     case DW_FORM_addr:
-    case DW_FORM_ref_addr:
         *offset_ptr += DWARFCompileUnit::GetAddressByteSize(cu);
         return true;
 
+    case DW_FORM_ref_addr:
+        if (cu->GetVersion() <= 2)
+            *offset_ptr += DWARFCompileUnit::GetAddressByteSize(cu);
+        else
+            *offset_ptr += 4;// 4 for DWARF32, 8 for DWARF64, but we don't support DWARF64 yet
+        return true;
+
     // 0 bytes values (implied from DW_FORM)
     case DW_FORM_flag_present:
         return true;
@@ -337,7 +348,10 @@ DWARFFormValue::Dump(Stream &s, const Da
 
     case DW_FORM_ref_addr:
     {
-        s.Address(uvalue, sizeof (uint64_t) * 2);
+        if (cu->GetVersion() <= 2)
+            s.Address(uvalue, sizeof (uint64_t) * 2);
+        else
+            s.Address(uvalue, 4 * 2);// 4 for DWARF32, 8 for DWARF64, but we don't support DWARF64 yet
         break;
     }
     case DW_FORM_ref1:      cu_relative_offset = true;  if (verbose) s.Printf("cu + 0x%2.2x", (uint8_t)uvalue); break;

Modified: lldb/branches/windows/source/Plugins/SymbolFile/DWARF/DWARFFormValue.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Plugins/SymbolFile/DWARF/DWARFFormValue.h?rev=179679&r1=179678&r2=179679&view=diff
==============================================================================
--- lldb/branches/windows/source/Plugins/SymbolFile/DWARF/DWARFFormValue.h (original)
+++ lldb/branches/windows/source/Plugins/SymbolFile/DWARF/DWARFFormValue.h Wed Apr 17 03:38:48 2013
@@ -49,20 +49,23 @@ public:
     void                SetForm(dw_form_t form) { m_form = form; }
     const ValueType&    Value() const { return m_value; }
     void                Dump(lldb_private::Stream &s, const lldb_private::DataExtractor* debug_str_data, const DWARFCompileUnit* cu) const;
-    bool                ExtractValue(const lldb_private::DataExtractor& data, uint32_t* offset_ptr, const DWARFCompileUnit* cu);
+    bool                ExtractValue(const lldb_private::DataExtractor& data,
+                                     lldb::offset_t* offset_ptr,
+                                     const DWARFCompileUnit* cu);
     bool                IsInlinedCStr() const { return (m_value.data != NULL) && m_value.data == (uint8_t*)m_value.value.cstr; }
     const uint8_t*      BlockData() const;
     uint64_t            Reference(const DWARFCompileUnit* cu) const;
     uint64_t            Reference (dw_offset_t offset) const;
     bool                ResolveCompileUnitReferences(const DWARFCompileUnit* cu);
+    bool                Boolean() const { return m_value.value.uval != 0; }
     uint64_t            Unsigned() const { return m_value.value.uval; }
     void                SetUnsigned(uint64_t uval) { m_value.value.uval = uval; }
     int64_t             Signed() const { return m_value.value.sval; }
     void                SetSigned(int64_t sval) { m_value.value.sval = sval; }
     const char*         AsCString(const lldb_private::DataExtractor* debug_str_data_ptr) const;
-    bool                SkipValue(const lldb_private::DataExtractor& debug_info_data, uint32_t* offset_ptr, const DWARFCompileUnit* cu) const;
-    static bool         SkipValue(const dw_form_t form, const lldb_private::DataExtractor& debug_info_data, uint32_t* offset_ptr, const DWARFCompileUnit* cu);
-//  static bool         TransferValue(dw_form_t form, const lldb_private::DataExtractor& debug_info_data, uint32_t* offset_ptr, const DWARFCompileUnit* cu, BinaryStreamBuf& out_buff);
+    bool                SkipValue(const lldb_private::DataExtractor& debug_info_data, lldb::offset_t *offset_ptr, const DWARFCompileUnit* cu) const;
+    static bool         SkipValue(const dw_form_t form, const lldb_private::DataExtractor& debug_info_data, lldb::offset_t *offset_ptr, const DWARFCompileUnit* cu);
+//  static bool         TransferValue(dw_form_t form, const lldb_private::DataExtractor& debug_info_data, lldb::offset_t *offset_ptr, const DWARFCompileUnit* cu, BinaryStreamBuf& out_buff);
 //  static bool         TransferValue(const DWARFFormValue& formValue, const DWARFCompileUnit* cu, BinaryStreamBuf& out_buff);
 //  static bool         PutUnsigned(dw_form_t form, dw_offset_t offset, uint64_t value, BinaryStreamBuf& out_buff, const DWARFCompileUnit* cu, bool fixup_cu_relative_refs);
     static bool         IsBlockForm(const dw_form_t form);

Modified: lldb/branches/windows/source/Plugins/SymbolFile/DWARF/DWARFLocationDescription.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Plugins/SymbolFile/DWARF/DWARFLocationDescription.cpp?rev=179679&r1=179678&r2=179679&view=diff
==============================================================================
--- lldb/branches/windows/source/Plugins/SymbolFile/DWARF/DWARFLocationDescription.cpp (original)
+++ lldb/branches/windows/source/Plugins/SymbolFile/DWARF/DWARFLocationDescription.cpp Wed Apr 17 03:38:48 2013
@@ -15,7 +15,7 @@
 
 using namespace lldb_private;
 
-static int print_dwarf_exp_op (Stream &s, const DataExtractor& data, uint32_t* offset_ptr, int address_size, int dwarf_ref_size);
+static int print_dwarf_exp_op (Stream &s, const DataExtractor& data, lldb::offset_t *offset_ptr, int address_size, int dwarf_ref_size);
 
 int
 print_dwarf_expression (Stream &s,
@@ -25,7 +25,7 @@ print_dwarf_expression (Stream &s,
                         bool location_expression)
 {
     int op_count = 0;
-    uint32_t offset = 0;
+    lldb::offset_t offset = 0;
     while (data.ValidOffset(offset))
     {
         if (location_expression && op_count > 0)
@@ -48,7 +48,7 @@ print_dwarf_expression (Stream &s,
 static int
 print_dwarf_exp_op (Stream &s,
                     const DataExtractor& data,
-                    uint32_t* offset_ptr,
+                    lldb::offset_t *offset_ptr,
                     int address_size,
                     int dwarf_ref_size)
 {

Modified: lldb/branches/windows/source/Plugins/SymbolFile/DWARF/DWARFLocationList.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Plugins/SymbolFile/DWARF/DWARFLocationList.cpp?rev=179679&r1=179678&r2=179679&view=diff
==============================================================================
--- lldb/branches/windows/source/Plugins/SymbolFile/DWARF/DWARFLocationList.cpp (original)
+++ lldb/branches/windows/source/Plugins/SymbolFile/DWARF/DWARFLocationList.cpp Wed Apr 17 03:38:48 2013
@@ -18,7 +18,7 @@
 using namespace lldb_private;
 
 dw_offset_t
-DWARFLocationList::Dump(Stream &s, const DWARFCompileUnit* cu, const DataExtractor& debug_loc_data, dw_offset_t offset)
+DWARFLocationList::Dump(Stream &s, const DWARFCompileUnit* cu, const DataExtractor& debug_loc_data, lldb::offset_t offset)
 {
     uint64_t start_addr, end_addr;
     uint32_t addr_size = DWARFCompileUnit::GetAddressByteSize(cu);
@@ -52,7 +52,7 @@ DWARFLocationList::Dump(Stream &s, const
 }
 
 bool
-DWARFLocationList::Extract(const DataExtractor& debug_loc_data, dw_offset_t* offset_ptr, DataExtractor& location_list_data)
+DWARFLocationList::Extract(const DataExtractor& debug_loc_data, lldb::offset_t* offset_ptr, DataExtractor& location_list_data)
 {
     // Initialize with no data just in case we don't find anything
     location_list_data.Clear();
@@ -69,7 +69,7 @@ DWARFLocationList::Extract(const DataExt
 }
 
 size_t
-DWARFLocationList::Size(const DataExtractor& debug_loc_data, dw_offset_t offset)
+DWARFLocationList::Size(const DataExtractor& debug_loc_data, lldb::offset_t offset)
 {
     const dw_offset_t debug_loc_offset = offset;
 

Modified: lldb/branches/windows/source/Plugins/SymbolFile/DWARF/DWARFLocationList.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Plugins/SymbolFile/DWARF/DWARFLocationList.h?rev=179679&r1=179678&r2=179679&view=diff
==============================================================================
--- lldb/branches/windows/source/Plugins/SymbolFile/DWARF/DWARFLocationList.h (original)
+++ lldb/branches/windows/source/Plugins/SymbolFile/DWARF/DWARFLocationList.h Wed Apr 17 03:38:48 2013
@@ -19,16 +19,16 @@ public:
     Dump (lldb_private::Stream &s,
           const DWARFCompileUnit* cu,
           const lldb_private::DataExtractor& debug_loc_data,
-          dw_offset_t offset);
+          lldb::offset_t offset);
 
     static bool
     Extract (const lldb_private::DataExtractor& debug_loc_data,
-             dw_offset_t* offset_ptr,
+             lldb::offset_t* offset_ptr,
              lldb_private::DataExtractor& location_list_data);
 
     static size_t
     Size (const lldb_private::DataExtractor& debug_loc_data,
-          dw_offset_t offset);
+          lldb::offset_t offset);
 
 };
 #endif  // SymbolFileDWARF_DWARFLocationList_h_

Modified: lldb/branches/windows/source/Plugins/SymbolFile/DWARF/HashedNameToDIE.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Plugins/SymbolFile/DWARF/HashedNameToDIE.h?rev=179679&r1=179678&r2=179679&view=diff
==============================================================================
--- lldb/branches/windows/source/Plugins/SymbolFile/DWARF/HashedNameToDIE.h (original)
+++ lldb/branches/windows/source/Plugins/SymbolFile/DWARF/HashedNameToDIE.h Wed Apr 17 03:38:48 2013
@@ -32,18 +32,21 @@ struct DWARFMappedHash
         dw_offset_t offset;  // The DIE offset
         dw_tag_t tag;
         uint32_t type_flags; // Any flags for this DIEInfo
+        uint32_t qualified_name_hash; // A 32 bit hash of the fully qualified name
 
         DIEInfo () :
             offset (DW_INVALID_OFFSET),
             tag (0),
-            type_flags (0)
+            type_flags (0),
+            qualified_name_hash (0)
         {
         }
 
-        DIEInfo (dw_offset_t o, dw_tag_t t, uint32_t f) :
+        DIEInfo (dw_offset_t o, dw_tag_t t, uint32_t f, uint32_t h) :
             offset(o),
             tag (t),
-            type_flags (f)
+            type_flags (f),
+            qualified_name_hash (h)
         {
         }
         
@@ -53,6 +56,7 @@ struct DWARFMappedHash
             offset = DW_INVALID_OFFSET;
             tag = 0;
             type_flags = 0;
+            qualified_name_hash = 0;
         }            
     };
     
@@ -96,6 +100,37 @@ struct DWARFMappedHash
             }
         }
     }
+
+    static void
+    ExtractDIEArray (const DIEInfoArray &die_info_array,
+                     const dw_tag_t tag,
+                     const uint32_t qualified_name_hash,
+                     DIEArray &die_offsets)
+    {
+        if (tag == 0)
+        {
+            ExtractDIEArray (die_info_array, die_offsets);
+        }
+        else
+        {
+            const size_t count = die_info_array.size();
+            for (size_t i=0; i<count; ++i)
+            {
+                if (qualified_name_hash != die_info_array[i].qualified_name_hash)
+                    continue;
+                const dw_tag_t die_tag = die_info_array[i].tag;
+                bool tag_matches = die_tag == 0 || tag == die_tag;
+                if (!tag_matches)
+                {
+                    if (die_tag == DW_TAG_class_type || die_tag == DW_TAG_structure_type)
+                        tag_matches = tag == DW_TAG_structure_type || tag == DW_TAG_class_type;
+                }
+                if (tag_matches)
+                    die_offsets.push_back (die_info_array[i].offset);
+            }
+        }
+    }
+
     enum AtomType
     {
         eAtomTypeNULL       = 0u,
@@ -103,7 +138,11 @@ struct DWARFMappedHash
         eAtomTypeCUOffset   = 2u,   // DIE offset of the compiler unit header that contains the item in question
         eAtomTypeTag        = 3u,   // DW_TAG_xxx value, should be encoded as DW_FORM_data1 (if no tags exceed 255) or DW_FORM_data2
         eAtomTypeNameFlags  = 4u,   // Flags from enum NameFlags
-        eAtomTypeTypeFlags  = 5u    // Flags from enum TypeFlags
+        eAtomTypeTypeFlags  = 5u,   // Flags from enum TypeFlags,
+        eAtomTypeQualNameHash = 6u  // A 32 bit hash of the full qualified name (since all hash entries are basename only)
+                                    // For example a type like "std::vector<int>::iterator" would have a name of "iterator"
+                                    // and a 32 bit hash for "std::vector<int>::iterator" to allow us to not have to pull
+                                    // in debug info for a type when we know the fully qualified name.
     };
     
     // Bit definitions for the eAtomTypeTypeFlags flags
@@ -196,6 +235,7 @@ struct DWARFMappedHash
             case eAtomTypeTag:          return "die-tag";
             case eAtomTypeNameFlags:    return "name-flags";
             case eAtomTypeTypeFlags:    return "type-flags";
+            case eAtomTypeQualNameHash: return "qualified-name-hash";
         }
         return "<invalid>";
     }
@@ -306,8 +346,9 @@ struct DWARFMappedHash
 //        void
 //        Dump (std::ostream* ostrm_ptr);        
         
-        uint32_t
-        Read (const lldb_private::DataExtractor &data, uint32_t offset)
+        lldb::offset_t
+        Read (const lldb_private::DataExtractor &data,
+              lldb::offset_t offset)
         {
             ClearAtoms ();
             
@@ -379,8 +420,8 @@ struct DWARFMappedHash
         //        virtual void
         //        Dump (std::ostream* ostrm_ptr);        
         //        
-        virtual uint32_t
-        Read (lldb_private::DataExtractor &data, uint32_t offset)
+        virtual lldb::offset_t
+        Read (lldb_private::DataExtractor &data, lldb::offset_t offset)
         {
             offset = MappedHash::Header<Prologue>::Read (data, offset);
             if (offset != UINT32_MAX)
@@ -392,7 +433,7 @@ struct DWARFMappedHash
         
         bool
         Read (const lldb_private::DataExtractor &data, 
-              uint32_t *offset_ptr, 
+              lldb::offset_t *offset_ptr, 
               DIEInfo &hash_data) const
         {
             const size_t num_atoms = header_data.atoms.size();
@@ -409,17 +450,22 @@ struct DWARFMappedHash
                 switch (header_data.atoms[i].type)
                 {
                     case eAtomTypeDIEOffset:    // DIE offset, check form for encoding
-                        hash_data.offset = form_value.Reference (header_data.die_base_offset);
+                        hash_data.offset = (dw_offset_t)form_value.Reference (header_data.die_base_offset);
                         break;
 
                     case eAtomTypeTag:          // DW_TAG value for the DIE
-                        hash_data.tag = form_value.Unsigned ();
+                        hash_data.tag = (dw_tag_t)form_value.Unsigned ();
                         
                     case eAtomTypeTypeFlags:    // Flags from enum TypeFlags
-                        hash_data.type_flags = form_value.Unsigned ();
+                        hash_data.type_flags = (uint32_t)form_value.Unsigned ();
+                        break;
+
+                    case eAtomTypeQualNameHash:    // Flags from enum TypeFlags
+                        hash_data.qualified_name_hash = form_value.Unsigned ();
                         break;
+
                     default:
-                        return false;
+                        // We can always skip atomes we don't know about
                         break;
                 }
             }
@@ -462,7 +508,11 @@ struct DWARFMappedHash
                             strm.PutCString (" )");
                         }
                         break;
-                        
+
+                    case eAtomTypeQualNameHash:    // Flags from enum TypeFlags
+                        strm.Printf ("0x%8.8x", hash_data.qualified_name_hash);
+                        break;
+
                     default:
                         strm.Printf ("AtomType(0x%x)", header_data.atoms[i].type);
                         break;
@@ -559,7 +609,7 @@ struct DWARFMappedHash
         
         virtual Result
         GetHashDataForName (const char *name,
-                            uint32_t* hash_data_offset_ptr, 
+                            lldb::offset_t* hash_data_offset_ptr, 
                             Pair &pair) const
         {
             pair.key = m_data.GetU32 (hash_data_offset_ptr);
@@ -580,7 +630,7 @@ struct DWARFMappedHash
             }
 
             const uint32_t count = m_data.GetU32 (hash_data_offset_ptr);
-            const uint32_t min_total_hash_data_size = count * m_header.header_data.GetMinumumHashDataByteSize();
+            const size_t min_total_hash_data_size = count * m_header.header_data.GetMinumumHashDataByteSize();
             if (count > 0 && m_data.ValidOffsetForDataOfSize (*hash_data_offset_ptr, min_total_hash_data_size))
             {
                 // We have at least one HashData entry, and we have enough
@@ -637,7 +687,7 @@ struct DWARFMappedHash
 
         virtual Result
         AppendHashDataForRegularExpression (const lldb_private::RegularExpression& regex,
-                                            uint32_t* hash_data_offset_ptr, 
+                                            lldb::offset_t* hash_data_offset_ptr, 
                                             Pair &pair) const
         {
             pair.key = m_data.GetU32 (hash_data_offset_ptr);
@@ -653,7 +703,7 @@ struct DWARFMappedHash
                 return eResultError;
             
             const uint32_t count = m_data.GetU32 (hash_data_offset_ptr);
-            const uint32_t min_total_hash_data_size = count * m_header.header_data.GetMinumumHashDataByteSize();
+            const size_t min_total_hash_data_size = count * m_header.header_data.GetMinumumHashDataByteSize();
             if (count > 0 && m_data.ValidOffsetForDataOfSize (*hash_data_offset_ptr, min_total_hash_data_size))
             {
                 const bool match = regex.Execute(strp_cstr);
@@ -712,10 +762,10 @@ struct DWARFMappedHash
             Pair pair;
             for (uint32_t offset_idx=0; offset_idx<hash_count; ++offset_idx)
             {
-                uint32_t hash_data_offset = GetHashDataOffset (offset_idx);
+                lldb::offset_t hash_data_offset = GetHashDataOffset (offset_idx);
                 while (hash_data_offset != UINT32_MAX)
                 {
-                    const uint32_t prev_hash_data_offset = hash_data_offset;
+                    const lldb::offset_t prev_hash_data_offset = hash_data_offset;
                     Result hash_result = AppendHashDataForRegularExpression (regex, &hash_data_offset, pair);
                     if (prev_hash_data_offset == hash_data_offset)
                         break;
@@ -749,7 +799,7 @@ struct DWARFMappedHash
             for (uint32_t offset_idx=0; offset_idx<hash_count; ++offset_idx)
             {
                 bool done = false;
-                uint32_t hash_data_offset = GetHashDataOffset (offset_idx);
+                lldb::offset_t hash_data_offset = GetHashDataOffset (offset_idx);
                 while (!done && hash_data_offset != UINT32_MAX)
                 {
                     KeyType key = m_data.GetU32 (&hash_data_offset);
@@ -795,6 +845,18 @@ struct DWARFMappedHash
             return die_info_array.size();
         }
 
+        size_t
+        FindByNameAndTagAndQualifiedNameHash (const char *name,
+                                              const dw_tag_t tag,
+                                              const uint32_t qualified_name_hash,
+                                              DIEArray &die_offsets)
+        {
+            DIEInfoArray die_info_array;
+            if (FindByName(name, die_info_array))
+                DWARFMappedHash::ExtractDIEArray (die_info_array, tag, qualified_name_hash, die_offsets);
+            return die_info_array.size();
+        }
+
         size_t
         FindCompleteObjCClassByName (const char *name, DIEArray &die_offsets, bool must_be_implementation)
         {

Modified: lldb/branches/windows/source/Plugins/SymbolFile/DWARF/LogChannelDWARF.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Plugins/SymbolFile/DWARF/LogChannelDWARF.cpp?rev=179679&r1=179678&r2=179679&view=diff
==============================================================================
--- lldb/branches/windows/source/Plugins/SymbolFile/DWARF/LogChannelDWARF.cpp (original)
+++ lldb/branches/windows/source/Plugins/SymbolFile/DWARF/LogChannelDWARF.cpp Wed Apr 17 03:38:48 2013
@@ -86,18 +86,16 @@ void
 LogChannelDWARF::Delete ()
 {
     g_log_channel = NULL;
-    m_log_sp.reset();
 }
 
 
 void
 LogChannelDWARF::Disable (const char **categories, Stream *feedback_strm)
 {
-    if (!m_log_sp)
+    if (m_log_ap.get() == NULL)
         return;
 
-    g_log_channel = this;
-    uint32_t flag_bits = m_log_sp->GetMask().Get();
+    uint32_t flag_bits = m_log_ap->GetMask().Get();
     for (size_t i = 0; categories[i] != NULL; ++i)
     {
          const char *arg = categories[i];
@@ -122,7 +120,7 @@ LogChannelDWARF::Disable (const char **c
     if (flag_bits == 0)
         Delete ();
     else
-        m_log_sp->GetMask().Reset (flag_bits);
+        m_log_ap->GetMask().Reset (flag_bits);
 
     return;
 }
@@ -138,7 +136,11 @@ LogChannelDWARF::Enable
 {
     Delete ();
 
-    m_log_sp.reset(new Log (log_stream_sp));
+    if (m_log_ap)
+        m_log_ap->SetStream(log_stream_sp);
+    else
+        m_log_ap.reset(new Log (log_stream_sp));
+    
     g_log_channel = this;
     uint32_t flag_bits = 0;
     bool got_unknown_category = false;
@@ -168,9 +170,9 @@ LogChannelDWARF::Enable
     }
     if (flag_bits == 0)
         flag_bits = DWARF_LOG_DEFAULT;
-    m_log_sp->GetMask().Reset(flag_bits);
-    m_log_sp->GetOptions().Reset(log_options);
-    return m_log_sp.get() != NULL;
+    m_log_ap->GetMask().Reset(flag_bits);
+    m_log_ap->GetOptions().Reset(log_options);
+    return m_log_ap.get() != NULL;
 }
 
 void
@@ -182,41 +184,41 @@ LogChannelDWARF::ListCategories (Stream
                   "  line - log the parsing if .debug_line\n"
                   "  pubnames - log the parsing if .debug_pubnames\n"
                   "  pubtypes - log the parsing if .debug_pubtypes\n"
-                  "  lookups - log any lookups that happen by name, regex, or address\n\n"
-                  "  completion - log struct/unions/class type completions\n\n"
-                  "  map - log insertions of object files into DWARF debug maps\n\n",
+                  "  lookups - log any lookups that happen by name, regex, or address\n"
+                  "  completion - log struct/unions/class type completions\n"
+                  "  map - log insertions of object files into DWARF debug maps\n",
                   SymbolFileDWARF::GetPluginNameStatic());
 }
 
-LogSP
+Log *
 LogChannelDWARF::GetLog ()
 {
     if (g_log_channel)
-        return g_log_channel->m_log_sp;
+        return g_log_channel->m_log_ap.get();
 
-    return LogSP();
+    return NULL;
 }
 
-LogSP
+Log *
 LogChannelDWARF::GetLogIfAll (uint32_t mask)
 {
-    if (g_log_channel && g_log_channel->m_log_sp)
+    if (g_log_channel && g_log_channel->m_log_ap.get())
     {
-        if (g_log_channel->m_log_sp->GetMask().AllSet(mask))
-            return g_log_channel->m_log_sp;
+        if (g_log_channel->m_log_ap->GetMask().AllSet(mask))
+            return g_log_channel->m_log_ap.get();
     }
-    return LogSP();
+    return NULL;
 }
 
-LogSP
+Log *
 LogChannelDWARF::GetLogIfAny (uint32_t mask)
 {
-    if (g_log_channel && g_log_channel->m_log_sp)
+    if (g_log_channel && g_log_channel->m_log_ap.get())
     {
-        if (g_log_channel->m_log_sp->GetMask().AnySet(mask))
-            return g_log_channel->m_log_sp;
+        if (g_log_channel->m_log_ap->GetMask().AnySet(mask))
+            return g_log_channel->m_log_ap.get();
     }
-    return LogSP();
+    return NULL;
 }
 
 void
@@ -224,10 +226,13 @@ LogChannelDWARF::LogIf (uint32_t mask, c
 {
     if (g_log_channel)
     {
-        LogSP log_sp(g_log_channel->m_log_sp);
-        va_list args;
-        va_start (args, format);
-        log_sp->VAPrintf (format, args);
-        va_end (args);
+        Log *log = g_log_channel->m_log_ap.get();
+        if (log && log->GetMask().AnySet(mask))
+        {
+            va_list args;
+            va_start (args, format);
+            log->VAPrintf (format, args);
+            va_end (args);
+        }
     }
 }

Modified: lldb/branches/windows/source/Plugins/SymbolFile/DWARF/LogChannelDWARF.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Plugins/SymbolFile/DWARF/LogChannelDWARF.h?rev=179679&r1=179678&r2=179679&view=diff
==============================================================================
--- lldb/branches/windows/source/Plugins/SymbolFile/DWARF/LogChannelDWARF.h (original)
+++ lldb/branches/windows/source/Plugins/SymbolFile/DWARF/LogChannelDWARF.h Wed Apr 17 03:38:48 2013
@@ -76,13 +76,13 @@ public:
     virtual void
     ListCategories (lldb_private::Stream *strm);
 
-    static lldb::LogSP
+    static lldb_private::Log *
     GetLog ();
 
-    static lldb::LogSP
+    static lldb_private::Log *
     GetLogIfAll (uint32_t mask);
     
-    static lldb::LogSP
+    static lldb_private::Log *
     GetLogIfAny (uint32_t mask);
     
     static void

Modified: lldb/branches/windows/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp?rev=179679&r1=179678&r2=179679&view=diff
==============================================================================
--- lldb/branches/windows/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp (original)
+++ lldb/branches/windows/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp Wed Apr 17 03:38:48 2013
@@ -407,7 +407,7 @@ SymbolFileDWARF::InitializeObject()
 bool
 SymbolFileDWARF::SupportedVersion(uint16_t version)
 {
-    return version == 2 || version == 3;
+    return version == 2 || version == 3 || version == 4;
 }
 
 uint32_t
@@ -891,28 +891,40 @@ SymbolFileDWARF::ParseCompileUnitFunctio
 
             assert(func_type == NULL || func_type != DIE_IS_BEING_PARSED);
 
-            func_range.GetBaseAddress().ResolveLinkedAddress();
-
-            const user_id_t func_user_id = MakeUserID(die->GetOffset());
-            func_sp.reset(new Function (sc.comp_unit,
-                                        func_user_id,       // UserID is the DIE offset
-                                        func_user_id,
-                                        func_name,
-                                        func_type,
-                                        func_range));           // first address range
-
-            if (func_sp.get() != NULL)
-            {
-                if (frame_base.IsValid())
-                    func_sp->GetFrameBaseExpression() = frame_base;
-                sc.comp_unit->AddFunction(func_sp);
-                return func_sp.get();
+            if (FixupAddress (func_range.GetBaseAddress()))
+            {
+                const user_id_t func_user_id = MakeUserID(die->GetOffset());
+                func_sp.reset(new Function (sc.comp_unit,
+                                            MakeUserID(func_user_id),       // UserID is the DIE offset
+                                            MakeUserID(func_user_id),
+                                            func_name,
+                                            func_type,
+                                            func_range));           // first address range
+
+                if (func_sp.get() != NULL)
+                {
+                    if (frame_base.IsValid())
+                        func_sp->GetFrameBaseExpression() = frame_base;
+                    sc.comp_unit->AddFunction(func_sp);
+                    return func_sp.get();
+                }
             }
         }
     }
     return NULL;
 }
 
+bool
+SymbolFileDWARF::FixupAddress (Address &addr)
+{
+    SymbolFileDWARFDebugMap * debug_map_symfile = GetDebugMapSymfile ();
+    if (debug_map_symfile)
+    {
+        return debug_map_symfile->LinkOSOAddress(addr);
+    }
+    // This is a normal DWARF file, no address fixups need to happen
+    return true;
+}
 lldb::LanguageType
 SymbolFileDWARF::ParseCompileUnitLanguage (const SymbolContext& sc)
 {
@@ -983,15 +995,7 @@ SymbolFileDWARF::ParseCompileUnitSupport
 struct ParseDWARFLineTableCallbackInfo
 {
     LineTable* line_table;
-    const SectionList *section_list;
-    lldb::addr_t prev_sect_file_base_addr;
-    lldb::addr_t curr_sect_file_base_addr;
-    bool is_oso_for_debug_map;
-    bool prev_in_final_executable;
-    DWARFDebugLine::Row prev_row;
-    SectionSP prev_section_sp;
-    SectionSP curr_section_sp;
-    llvm::OwningPtr<LineSequence> curr_sequence_ap;
+    std::auto_ptr<LineSequence> sequence_ap;
 };
 
 //----------------------------------------------------------------------
@@ -1000,7 +1004,6 @@ struct ParseDWARFLineTableCallbackInfo
 static void
 ParseDWARFLineTableCallback(dw_offset_t offset, const DWARFDebugLine::State& state, void* userData)
 {
-    LineTable* line_table = ((ParseDWARFLineTableCallbackInfo*)userData)->line_table;
     if (state.row == DWARFDebugLine::State::StartParsingLineTable)
     {
         // Just started parsing the line table
@@ -1012,166 +1015,32 @@ ParseDWARFLineTableCallback(dw_offset_t
     else
     {
         ParseDWARFLineTableCallbackInfo* info = (ParseDWARFLineTableCallbackInfo*)userData;
-        // We have a new row, lets append it
-
-        if (info->curr_section_sp.get() == NULL || info->curr_section_sp->ContainsFileAddress(state.address) == false)
-        {
-            info->prev_section_sp = info->curr_section_sp;
-            info->prev_sect_file_base_addr = info->curr_sect_file_base_addr;
-            // If this is an end sequence entry, then we subtract one from the
-            // address to make sure we get an address that is not the end of
-            // a section.
-            if (state.end_sequence && state.address != 0)
-                info->curr_section_sp = info->section_list->FindSectionContainingFileAddress (state.address - 1);
-            else
-                info->curr_section_sp = info->section_list->FindSectionContainingFileAddress (state.address);
-
-            if (info->curr_section_sp.get())
-                info->curr_sect_file_base_addr = info->curr_section_sp->GetFileAddress ();
-            else
-                info->curr_sect_file_base_addr = 0;
-        }
-        if (info->curr_section_sp.get())
-        {
-            lldb::addr_t curr_line_section_offset = state.address - info->curr_sect_file_base_addr;
-            // Check for the fancy section magic to determine if we
-
-            if (info->is_oso_for_debug_map)
-            {
-                // When this is a debug map object file that contains DWARF
-                // (referenced from an N_OSO debug map nlist entry) we will have
-                // a file address in the file range for our section from the
-                // original .o file, and a load address in the executable that
-                // contains the debug map.
-                //
-                // If the sections for the file range and load range are
-                // different, we have a remapped section for the function and
-                // this address is resolved. If they are the same, then the
-                // function for this address didn't make it into the final
-                // executable.
-                bool curr_in_final_executable = (bool) info->curr_section_sp->GetLinkedSection ();
-
-                // If we are doing DWARF with debug map, then we need to carefully
-                // add each line table entry as there may be gaps as functions
-                // get moved around or removed.
-                if (!info->prev_row.end_sequence && info->prev_section_sp.get())
-                {
-                    if (info->prev_in_final_executable)
-                    {
-                        bool terminate_previous_entry = false;
-                        if (!curr_in_final_executable)
-                        {
-                            // Check for the case where the previous line entry
-                            // in a function made it into the final executable,
-                            // yet the current line entry falls in a function
-                            // that didn't. The line table used to be contiguous
-                            // through this address range but now it isn't. We
-                            // need to terminate the previous line entry so
-                            // that we can reconstruct the line range correctly
-                            // for it and to keep the line table correct.
-                            terminate_previous_entry = true;
-                        }
-                        else if (info->curr_section_sp.get() != info->prev_section_sp.get())
-                        {
-                            // Check for cases where the line entries used to be
-                            // contiguous address ranges, but now they aren't.
-                            // This can happen when order files specify the
-                            // ordering of the functions.
-                            lldb::addr_t prev_line_section_offset = info->prev_row.address - info->prev_sect_file_base_addr;
-                            Section *curr_sect = info->curr_section_sp.get();
-                            Section *prev_sect = info->prev_section_sp.get();
-                            assert (curr_sect->GetLinkedSection());
-                            assert (prev_sect->GetLinkedSection());
-                            lldb::addr_t object_file_addr_delta = state.address - info->prev_row.address;
-                            lldb::addr_t curr_linked_file_addr = curr_sect->GetLinkedFileAddress() + curr_line_section_offset;
-                            lldb::addr_t prev_linked_file_addr = prev_sect->GetLinkedFileAddress() + prev_line_section_offset;
-                            lldb::addr_t linked_file_addr_delta = curr_linked_file_addr - prev_linked_file_addr;
-                            if (object_file_addr_delta != linked_file_addr_delta)
-                                terminate_previous_entry = true;
-                        }
-
-                        if (terminate_previous_entry)
-                        {
-                            line_table->InsertLineEntry (info->prev_section_sp,
-                                                         state.address - info->prev_sect_file_base_addr,
-                                                         info->prev_row.line,
-                                                         info->prev_row.column,
-                                                         info->prev_row.file,
-                                                         false,                 // is_stmt
-                                                         false,                 // basic_block
-                                                         false,                 // state.prologue_end
-                                                         false,                 // state.epilogue_begin
-                                                         true);                 // end_sequence);
-                        }
-                    }
-                }
-
-                if (curr_in_final_executable)
-                {
-                    line_table->InsertLineEntry (info->curr_section_sp,
-                                                 curr_line_section_offset,
-                                                 state.line,
-                                                 state.column,
-                                                 state.file,
-                                                 state.is_stmt,
-                                                 state.basic_block,
-                                                 state.prologue_end,
-                                                 state.epilogue_begin,
-                                                 state.end_sequence);
-                    info->prev_section_sp = info->curr_section_sp;
-                }
-                else
-                {
-                    // If the current address didn't make it into the final
-                    // executable, the current section will be the __text
-                    // segment in the .o file, so we need to clear this so
-                    // we can catch the next function that did make it into
-                    // the final executable.
-                    info->prev_section_sp.reset();
-                    info->curr_section_sp.reset();
-                }
+        LineTable* line_table = info->line_table;
 
-                info->prev_in_final_executable = curr_in_final_executable;
-            }
-            else
-            {
-                // We are not in an object file that contains DWARF for an
-                // N_OSO, this is just a normal DWARF file. The DWARF spec
-                // guarantees that the addresses will be in increasing order
-                // for a sequence, but the line table for a single compile unit
-                // may contain multiple sequences so we append entries to the
-                // current sequence until we find its end, then we merge the
-                // sequence into the main line table collection.
-
-                // If this is our first time here, we need to create a 
-                // sequence container.
-                if (!info->curr_sequence_ap)
-                {
-                    info->curr_sequence_ap.reset(line_table->CreateLineSequenceContainer());
-                    assert(info->curr_sequence_ap);
-                }
-                line_table->AppendLineEntryToSequence(info->curr_sequence_ap.get(),
-                                                      info->curr_section_sp,
-                                                      curr_line_section_offset,
-                                                      state.line,
-                                                      state.column,
-                                                      state.file,
-                                                      state.is_stmt,
-                                                      state.basic_block,
-                                                      state.prologue_end,
-                                                      state.epilogue_begin,
-                                                      state.end_sequence);
-                if (state.end_sequence)
-                {
-                    // First, put the current sequence into the line table.
-                    line_table->InsertSequence(info->curr_sequence_ap.get());
-                    // Then, empty it to prepare for the next sequence.
-                    info->curr_sequence_ap->Clear();
-                }
-            }
+        // If this is our first time here, we need to create a
+        // sequence container.
+        if (!info->sequence_ap.get())
+        {
+            info->sequence_ap.reset(line_table->CreateLineSequenceContainer());
+            assert(info->sequence_ap.get());
+        }
+        line_table->AppendLineEntryToSequence (info->sequence_ap.get(),
+                                               state.address,
+                                               state.line,
+                                               state.column,
+                                               state.file,
+                                               state.is_stmt,
+                                               state.basic_block,
+                                               state.prologue_end,
+                                               state.epilogue_begin,
+                                               state.end_sequence);
+        if (state.end_sequence)
+        {
+            // First, put the current sequence into the line table.
+            line_table->InsertSequence(info->sequence_ap.get());
+            // Then, empty it to prepare for the next sequence.
+            info->sequence_ap->Clear();
         }
-
-        info->prev_row = state;
     }
 }
 
@@ -1194,22 +1063,23 @@ SymbolFileDWARF::ParseCompileUnitLineTab
                 std::auto_ptr<LineTable> line_table_ap(new LineTable(sc.comp_unit));
                 if (line_table_ap.get())
                 {
-                    ParseDWARFLineTableCallbackInfo info = { 
-                        line_table_ap.get(), 
-                        m_obj_file->GetSectionList(), 
-                        0, 
-                        0, 
-                        GetDebugMapSymfile () != NULL,
-                        false, 
-                        DWARFDebugLine::Row(), 
-                        SectionSP(), 
-                        SectionSP(),
-                        llvm::OwningPtr<LineSequence>()
-                    };
-                    uint32_t offset = cu_line_offset;
+                    ParseDWARFLineTableCallbackInfo info;
+                    info.line_table = line_table_ap.get();
+                    lldb::offset_t offset = cu_line_offset;
                     DWARFDebugLine::ParseStatementTable(get_debug_line_data(), &offset, ParseDWARFLineTableCallback, &info);
-                    sc.comp_unit->SetLineTable(line_table_ap.release());
-                    return true;
+                    if (m_debug_map_symfile)
+                    {
+                        // We have an object file that has a line table with addresses
+                        // that are not linked. We need to link the line table and convert
+                        // the addresses that are relative to the .o file into addresses
+                        // for the main executable.
+                        sc.comp_unit->SetLineTable (m_debug_map_symfile->LinkOSOLineTable (this, line_table_ap.get()));
+                    }
+                    else
+                    {
+                        sc.comp_unit->SetLineTable(line_table_ap.release());
+                        return true;
+                    }
                 }
             }
         }
@@ -1502,7 +1372,7 @@ public:
         const char             *property_setter_name,
         const char             *property_getter_name,
         uint32_t                property_attributes,
-        const ClangASTMetadata       *metadata
+        const ClangASTMetadata *metadata
     ) :
         m_ast                   (ast),
         m_class_opaque_type     (class_opaque_type),
@@ -1516,7 +1386,7 @@ public:
         if (metadata != NULL)
         {
             m_metadata_ap.reset(new ClangASTMetadata());
-            *(m_metadata_ap.get()) = *metadata;
+            *m_metadata_ap = *metadata;
         }
     }
     
@@ -1539,22 +1409,22 @@ public:
         if (rhs.m_metadata_ap.get())
         {
             m_metadata_ap.reset (new ClangASTMetadata());
-            *(m_metadata_ap.get()) = *(rhs.m_metadata_ap.get());
+            *m_metadata_ap = *rhs.m_metadata_ap;
         }
         return *this;
     }
     
     bool Finalize() const
     {
-        return ClangASTContext::AddObjCClassProperty(m_ast,
-                                                     m_class_opaque_type,
-                                                     m_property_name,
-                                                     m_property_opaque_type,
-                                                     m_ivar_decl,
-                                                     m_property_setter_name,
-                                                     m_property_getter_name,
-                                                     m_property_attributes,
-                                                     m_metadata_ap.get());
+        return ClangASTContext::AddObjCClassProperty (m_ast,
+                                                      m_class_opaque_type,
+                                                      m_property_name,
+                                                      m_property_opaque_type,
+                                                      m_ivar_decl,
+                                                      m_property_setter_name,
+                                                      m_property_getter_name,
+                                                      m_property_attributes,
+                                                      m_metadata_ap.get());
     }
 private:
     clang::ASTContext      *m_ast;
@@ -1565,7 +1435,7 @@ private:
     const char             *m_property_setter_name;
     const char             *m_property_getter_name;
     uint32_t                m_property_attributes;
-    std::auto_ptr<ClangASTMetadata>        m_metadata_ap;
+    std::auto_ptr<ClangASTMetadata> m_metadata_ap;
 };
 
 struct BitfieldInfo
@@ -1586,6 +1456,36 @@ struct BitfieldInfo
     }
 };
 
+
+bool
+SymbolFileDWARF::ClassOrStructIsVirtual (DWARFCompileUnit* dwarf_cu,
+                                         const DWARFDebugInfoEntry *parent_die)
+{
+    if (parent_die)
+    {
+        for (const DWARFDebugInfoEntry *die = parent_die->GetFirstChild(); die != NULL; die = die->GetSibling())
+        {
+            dw_tag_t tag = die->Tag();
+            bool check_virtuality = false;
+            switch (tag)
+            {
+                case DW_TAG_inheritance:
+                case DW_TAG_subprogram:
+                    check_virtuality = true;
+                    break;
+                default:
+                    break;
+            }
+            if (check_virtuality)
+            {
+                if (die->GetAttributeValueAsUnsigned(this, dwarf_cu, DW_AT_virtuality, 0) != 0)
+                    return true;
+            }
+        }
+    }
+    return false;
+}
+
 size_t
 SymbolFileDWARF::ParseChildMembers
 (
@@ -1634,7 +1534,7 @@ SymbolFileDWARF::ParseChildMembers
                     const char *prop_name = NULL;
                     const char *prop_getter_name = NULL;
                     const char *prop_setter_name = NULL;
-                    uint32_t        prop_attributes = 0;
+                    uint32_t prop_attributes = 0;
                     
                     
                     bool is_artificial = false;
@@ -1644,6 +1544,7 @@ SymbolFileDWARF::ParseChildMembers
                     size_t byte_size = 0;
                     size_t bit_offset = 0;
                     size_t bit_size = 0;
+                    bool is_external = false; // On DW_TAG_members, this means the member is static
                     uint32_t i;
                     for (i=0; i<num_attributes && !is_artificial; ++i)
                     {
@@ -1688,11 +1589,12 @@ SymbolFileDWARF::ParseChildMembers
                                 break;
 
                             case DW_AT_accessibility: accessibility = DW_ACCESS_to_AccessType (form_value.Unsigned()); break;
-                            case DW_AT_artificial: is_artificial = form_value.Unsigned() != 0; break;                            
+                            case DW_AT_artificial: is_artificial = form_value.Boolean(); break;
                             case DW_AT_APPLE_property_name:      prop_name = form_value.AsCString(&get_debug_str_data()); break;
                             case DW_AT_APPLE_property_getter:    prop_getter_name = form_value.AsCString(&get_debug_str_data()); break;
                             case DW_AT_APPLE_property_setter:    prop_setter_name = form_value.AsCString(&get_debug_str_data()); break;
                             case DW_AT_APPLE_property_attribute: prop_attributes = form_value.Unsigned(); break;
+                            case DW_AT_external:                 is_external = form_value.Boolean(); break;
 
                             default:
                             case DW_AT_declaration:
@@ -1715,22 +1617,14 @@ SymbolFileDWARF::ParseChildMembers
                         
                         if (prop_getter_name && prop_getter_name[0] == '-')
                         {
-                            ObjCLanguageRuntime::ParseMethodName (prop_getter_name,
-                                                                  NULL,
-                                                                  &fixed_getter,
-                                                                  NULL,
-                                                                  NULL);
-                            prop_getter_name = fixed_getter.GetCString();
+                            ObjCLanguageRuntime::MethodName prop_getter_method(prop_getter_name, true);
+                            prop_getter_name = prop_getter_method.GetSelector().GetCString();
                         }
                         
                         if (prop_setter_name && prop_setter_name[0] == '-')
                         {
-                            ObjCLanguageRuntime::ParseMethodName (prop_setter_name,
-                                                                  NULL,
-                                                                  &fixed_setter,
-                                                                  NULL,
-                                                                  NULL);
-                            prop_setter_name = fixed_setter.GetCString();
+                            ObjCLanguageRuntime::MethodName prop_setter_method(prop_setter_name, true);
+                            prop_setter_name = prop_setter_method.GetSelector().GetCString();
                         }
                         
                         // If the names haven't been provided, they need to be
@@ -1789,6 +1683,21 @@ SymbolFileDWARF::ParseChildMembers
                         is_artificial = true;
                     }
 
+                    // Skip static members
+                    if (is_external && member_byte_offset == UINT32_MAX)
+                    {
+                        Type *var_type = ResolveTypeUID(encoding_uid);
+
+                        if (var_type)
+                        {
+                            GetClangASTContext().AddVariableToRecordType (class_clang_type,
+                                                                          name,
+                                                                          var_type->GetClangLayoutType(),
+                                                                          accessibility);
+                        }
+                        break;
+                    }
+
                     if (is_artificial == false)
                     {
                         Type *member_type = ResolveTypeUID(encoding_uid);
@@ -1939,7 +1848,7 @@ SymbolFileDWARF::ParseChildMembers
                                                                                            MakeUserID(parent_die->GetOffset()));
                                             }
                                             
-                                            member_clang_type = GetClangASTContext().CreateArrayType(member_array_element_type, 0);
+                                            member_clang_type = GetClangASTContext().CreateArrayType(member_array_element_type, 0, false);
                                         }
                                     }
                                 }
@@ -1950,7 +1859,7 @@ SymbolFileDWARF::ParseChildMembers
                                                                                         accessibility, 
                                                                                         bit_size);
                                 
-                                GetClangASTContext().SetMetadataAsUserID ((uintptr_t)field_decl, MakeUserID(die->GetOffset()));
+                                GetClangASTContext().SetMetadataAsUserID (field_decl, MakeUserID(die->GetOffset()));
                                 
                                 if (this_field_info.IsValid())
                                 {
@@ -1995,7 +1904,7 @@ SymbolFileDWARF::ParseChildMembers
                                                                                      &metadata));
                             
                             if (ivar_decl)
-                                GetClangASTContext().SetMetadataAsUserID ((uintptr_t)ivar_decl, MakeUserID(die->GetOffset()));
+                                GetClangASTContext().SetMetadataAsUserID (ivar_decl, MakeUserID(die->GetOffset()));
                         }
                     }
                 }
@@ -2071,7 +1980,7 @@ SymbolFileDWARF::ParseChildMembers
                                 accessibility = DW_ACCESS_to_AccessType(form_value.Unsigned());
                                 break;
 
-                            case DW_AT_virtuality: is_virtual = form_value.Unsigned() != 0; break;
+                            case DW_AT_virtuality: is_virtual = form_value.Boolean(); break;
                             default:
                             case DW_AT_sibling:
                                 break;
@@ -2163,9 +2072,9 @@ SymbolFileDWARF::ResolveTypeUID (DWARFCo
 {    
     if (die != NULL)
     {
-        LogSP log (LogChannelDWARF::GetLogIfAll(DWARF_LOG_DEBUG_INFO));
+        Log *log (LogChannelDWARF::GetLogIfAll(DWARF_LOG_DEBUG_INFO));
         if (log)
-            GetObjectFile()->GetModule()->LogMessage (log.get(), 
+            GetObjectFile()->GetModule()->LogMessage (log,
                                                       "SymbolFileDWARF::ResolveTypeUID (die = 0x%8.8x) %s '%s'", 
                                                       die->GetOffset(), 
                                                       DW_TAG_value_to_name(die->Tag()), 
@@ -2183,7 +2092,7 @@ SymbolFileDWARF::ResolveTypeUID (DWARFCo
             {
                 // Get the type, which could be a forward declaration
                 if (log)
-                    GetObjectFile()->GetModule()->LogMessage (log.get(), 
+                    GetObjectFile()->GetModule()->LogMessage (log,
                                                               "SymbolFileDWARF::ResolveTypeUID (die = 0x%8.8x) %s '%s' resolve parent forward type for 0x%8.8x", 
                                                               die->GetOffset(), 
                                                               DW_TAG_value_to_name(die->Tag()), 
@@ -2194,7 +2103,7 @@ SymbolFileDWARF::ResolveTypeUID (DWARFCo
 //                if (child_requires_parent_class_union_or_struct_to_be_completed(die->Tag()))
 //                {
 //                    if (log)
-//                        GetObjectFile()->GetModule()->LogMessage (log.get(), 
+//                        GetObjectFile()->GetModule()->LogMessage (log,
 //                                                                  "SymbolFileDWARF::ResolveTypeUID (die = 0x%8.8x) %s '%s' resolve parent full type for 0x%8.8x since die is a function", 
 //                                                                  die->GetOffset(), 
 //                                                                  DW_TAG_value_to_name(die->Tag()), 
@@ -2258,10 +2167,10 @@ SymbolFileDWARF::ResolveClangOpaqueTypeD
 
     const dw_tag_t tag = die->Tag();
 
-    LogSP log (LogChannelDWARF::GetLogIfAny(DWARF_LOG_DEBUG_INFO|DWARF_LOG_TYPE_COMPLETION));
+    Log *log (LogChannelDWARF::GetLogIfAny(DWARF_LOG_DEBUG_INFO|DWARF_LOG_TYPE_COMPLETION));
     if (log)
     {
-        GetObjectFile()->GetModule()->LogMessageVerboseBacktrace (log.get(),
+        GetObjectFile()->GetModule()->LogMessageVerboseBacktrace (log,
                                                                   "0x%8.8" PRIx64 ": %s '%s' resolving forward declaration...",
                                                                   MakeUserID(die->GetOffset()),
                                                                   DW_TAG_value_to_name(tag),
@@ -2456,7 +2365,7 @@ SymbolFileDWARF::ResolveClangOpaqueTypeD
                 {
                     if (log)
                     {
-                        GetObjectFile()->GetModule()->LogMessage (log.get(), 
+                        GetObjectFile()->GetModule()->LogMessage (log,
                                                                   "SymbolFileDWARF::ResolveClangOpaqueTypeDefinition (clang_type = %p) caching layout info for record_decl = %p, bit_size = %" PRIu64 ", alignment = %" PRIu64 ", field_offsets[%u], base_offsets[%u], vbase_offsets[%u])",
                                                                   clang_type,
                                                                   record_decl,
@@ -2471,7 +2380,7 @@ SymbolFileDWARF::ResolveClangOpaqueTypeD
                         llvm::DenseMap <const clang::FieldDecl *, uint64_t>::const_iterator pos, end = layout_info.field_offsets.end();
                         for (idx = 0, pos = layout_info.field_offsets.begin(); pos != end; ++pos, ++idx)
                         {
-                            GetObjectFile()->GetModule()->LogMessage (log.get(), 
+                            GetObjectFile()->GetModule()->LogMessage (log,
                                                                       "SymbolFileDWARF::ResolveClangOpaqueTypeDefinition (clang_type = %p) field[%u] = { bit_offset=%u, name='%s' }",
                                                                       clang_type,
                                                                       idx,
@@ -2484,7 +2393,7 @@ SymbolFileDWARF::ResolveClangOpaqueTypeD
                         llvm::DenseMap <const clang::CXXRecordDecl *, clang::CharUnits>::const_iterator base_pos, base_end = layout_info.base_offsets.end();
                         for (idx = 0, base_pos = layout_info.base_offsets.begin(); base_pos != base_end; ++base_pos, ++idx)
                         {
-                            GetObjectFile()->GetModule()->LogMessage (log.get(),
+                            GetObjectFile()->GetModule()->LogMessage (log,
                                                                       "SymbolFileDWARF::ResolveClangOpaqueTypeDefinition (clang_type = %p) base[%u] = { byte_offset=%u, name='%s' }",
                                                                       clang_type,
                                                                       idx,
@@ -2496,7 +2405,7 @@ SymbolFileDWARF::ResolveClangOpaqueTypeD
                         llvm::DenseMap <const clang::CXXRecordDecl *, clang::CharUnits>::const_iterator vbase_pos, vbase_end = layout_info.vbase_offsets.end();
                         for (idx = 0, vbase_pos = layout_info.vbase_offsets.begin(); vbase_pos != vbase_end; ++vbase_pos, ++idx)
                         {
-                            GetObjectFile()->GetModule()->LogMessage (log.get(),
+                            GetObjectFile()->GetModule()->LogMessage (log,
                                                                       "SymbolFileDWARF::ResolveClangOpaqueTypeDefinition (clang_type = %p) vbase[%u] = { byte_offset=%u, name='%s' }",
                                                                       clang_type,
                                                                       idx,
@@ -2517,7 +2426,9 @@ SymbolFileDWARF::ResolveClangOpaqueTypeD
         if (die->HasChildren())
         {
             SymbolContext sc(GetCompUnitForDWARFCompUnit(dwarf_cu));
-            ParseChildEnumerators(sc, clang_type, type->GetByteSize(), dwarf_cu, die);
+            bool is_signed = false;
+            ast.IsIntegerType(clang_type, is_signed);
+            ParseChildEnumerators(sc, clang_type, is_signed, type->GetByteSize(), dwarf_cu, die);
         }
         ast.CompleteTagDeclarationDefinition (clang_type);
         return clang_type;
@@ -2572,7 +2483,7 @@ SymbolFileDWARF::GetCompUnitForDWARFComp
 bool
 SymbolFileDWARF::GetFunction (DWARFCompileUnit* dwarf_cu, const DWARFDebugInfoEntry* func_die, SymbolContext& sc)
 {
-    sc.Clear();
+    sc.Clear(false);
     // Check if the symbol vendor already knows about this compile unit?
     sc.comp_unit = GetCompUnitForDWARFCompUnit(dwarf_cu, UINT32_MAX);
 
@@ -2674,19 +2585,19 @@ SymbolFileDWARF::ResolveSymbolContext (c
                             LineTable *line_table = sc.comp_unit->GetLineTable();
                             if (line_table != NULL)
                             {
-                                if (so_addr.IsLinkedAddress())
+                                // And address that makes it into this function should be in terms
+                                // of this debug file if there is no debug map, or it will be an
+                                // address in the .o file which needs to be fixed up to be in terms
+                                // of the debug map executable. Either way, calling FixupAddress()
+                                // will work for us.
+                                Address exe_so_addr (so_addr);
+                                if (FixupAddress(exe_so_addr))
                                 {
-                                    Address linked_addr (so_addr);
-                                    linked_addr.ResolveLinkedAddress();
-                                    if (line_table->FindLineEntryByAddress (linked_addr, sc.line_entry))
+                                    if (line_table->FindLineEntryByAddress (exe_so_addr, sc.line_entry))
                                     {
                                         resolved |= eSymbolContextLineEntry;
                                     }
                                 }
-                                else if (line_table->FindLineEntryByAddress (so_addr, sc.line_entry))
-                                {
-                                    resolved |= eSymbolContextLineEntry;
-                                }
                             }
                         }
                         
@@ -2913,10 +2824,10 @@ SymbolFileDWARF::NamespaceDeclMatchesThi
         return true;    // The ASTs match, return true
     
     // The namespace AST was valid, and it does not match...
-    LogSP log (LogChannelDWARF::GetLogIfAll(DWARF_LOG_LOOKUPS));
+    Log *log (LogChannelDWARF::GetLogIfAll(DWARF_LOG_LOOKUPS));
 
     if (log)
-        GetObjectFile()->GetModule()->LogMessage(log.get(), "Valid namespace does not match symbol file");
+        GetObjectFile()->GetModule()->LogMessage(log, "Valid namespace does not match symbol file");
     
     return false;
 }
@@ -2930,7 +2841,7 @@ SymbolFileDWARF::DIEIsInNamespace (const
     if (namespace_decl == NULL)
         return true;
     
-    LogSP log (LogChannelDWARF::GetLogIfAll(DWARF_LOG_LOOKUPS));
+    Log *log (LogChannelDWARF::GetLogIfAll(DWARF_LOG_LOOKUPS));
 
     const DWARFDebugInfoEntry *decl_ctx_die = NULL;
     clang::DeclContext *die_clang_decl_ctx = GetClangDeclContextContainingDIE (cu, die, &decl_ctx_die);
@@ -2943,7 +2854,7 @@ SymbolFileDWARF::DIEIsInNamespace (const
             if (decl_ctx_die->Tag() != DW_TAG_namespace)
             {
                 if (log)
-                    GetObjectFile()->GetModule()->LogMessage(log.get(), "Found a match, but its parent is not a namespace");
+                    GetObjectFile()->GetModule()->LogMessage(log, "Found a match, but its parent is not a namespace");
                 return false;
             }
                 
@@ -2964,18 +2875,18 @@ SymbolFileDWARF::DIEIsInNamespace (const
     }
     
     if (log)
-        GetObjectFile()->GetModule()->LogMessage(log.get(), "Found a match, but its parent doesn't exist");
+        GetObjectFile()->GetModule()->LogMessage(log, "Found a match, but its parent doesn't exist");
     
     return false;
 }
 uint32_t
 SymbolFileDWARF::FindGlobalVariables (const ConstString &name, const lldb_private::ClangNamespaceDecl *namespace_decl, bool append, uint32_t max_matches, VariableList& variables)
 {
-    LogSP log (LogChannelDWARF::GetLogIfAll(DWARF_LOG_LOOKUPS));
+    Log *log (LogChannelDWARF::GetLogIfAll(DWARF_LOG_LOOKUPS));
 
     if (log)
     {
-        GetObjectFile()->GetModule()->LogMessage (log.get(), 
+        GetObjectFile()->GetModule()->LogMessage (log,
                                                   "SymbolFileDWARF::FindGlobalVariables (name=\"%s\", namespace_decl=%p, append=%u, max_matches=%u, variables)", 
                                                   name.GetCString(), 
                                                   namespace_decl,
@@ -3080,7 +2991,7 @@ SymbolFileDWARF::FindGlobalVariables (co
     const uint32_t num_matches = variables.GetSize() - original_size;
     if (log && num_matches > 0)
     {
-        GetObjectFile()->GetModule()->LogMessage (log.get(), 
+        GetObjectFile()->GetModule()->LogMessage (log,
                                                   "SymbolFileDWARF::FindGlobalVariables (name=\"%s\", namespace_decl=%p, append=%u, max_matches=%u, variables) => %u",
                                                   name.GetCString(), 
                                                   namespace_decl,
@@ -3094,11 +3005,11 @@ SymbolFileDWARF::FindGlobalVariables (co
 uint32_t
 SymbolFileDWARF::FindGlobalVariables(const RegularExpression& regex, bool append, uint32_t max_matches, VariableList& variables)
 {
-    LogSP log (LogChannelDWARF::GetLogIfAll(DWARF_LOG_LOOKUPS));
+    Log *log (LogChannelDWARF::GetLogIfAll(DWARF_LOG_LOOKUPS));
     
     if (log)
     {
-        GetObjectFile()->GetModule()->LogMessage (log.get(), 
+        GetObjectFile()->GetModule()->LogMessage (log,
                                                   "SymbolFileDWARF::FindGlobalVariables (regex=\"%s\", append=%u, max_matches=%u, variables)", 
                                                   regex.GetText(), 
                                                   append, 
@@ -3422,11 +3333,14 @@ SymbolFileDWARF::FindFunctions (const Co
                         "SymbolFileDWARF::FindFunctions (name = '%s')",
                         name.AsCString());
 
-    LogSP log (LogChannelDWARF::GetLogIfAll(DWARF_LOG_LOOKUPS));
+    // eFunctionNameTypeAuto should be pre-resolved by a call to Module::PrepareForFunctionNameLookup()
+    assert ((name_type_mask & eFunctionNameTypeAuto) == 0);
+
+    Log *log (LogChannelDWARF::GetLogIfAll(DWARF_LOG_LOOKUPS));
     
     if (log)
     {
-        GetObjectFile()->GetModule()->LogMessage (log.get(), 
+        GetObjectFile()->GetModule()->LogMessage (log,
                                                   "SymbolFileDWARF::FindFunctions (name=\"%s\", name_type_mask=0x%x, append=%u, sc_list)", 
                                                   name.GetCString(), 
                                                   name_type_mask, 
@@ -3447,59 +3361,16 @@ SymbolFileDWARF::FindFunctions (const Co
     // Remember how many sc_list are in the list before we search in case
     // we are appending the results to a variable list.
 
-    const uint32_t original_size = sc_list.GetSize();
-
     const char *name_cstr = name.GetCString();
-    uint32_t effective_name_type_mask = eFunctionNameTypeNone;
-    const char *base_name_start = name_cstr;
-    const char *base_name_end = name_cstr + strlen(name_cstr);
-    
-    if (name_type_mask & eFunctionNameTypeAuto)
-    {
-        if (CPPLanguageRuntime::IsCPPMangledName (name_cstr))
-            effective_name_type_mask = eFunctionNameTypeFull;
-        else if (ObjCLanguageRuntime::IsPossibleObjCMethodName (name_cstr))
-            effective_name_type_mask = eFunctionNameTypeFull;
-        else
-        {
-            if (ObjCLanguageRuntime::IsPossibleObjCSelector(name_cstr))
-                effective_name_type_mask |= eFunctionNameTypeSelector;
-                
-            if (CPPLanguageRuntime::IsPossibleCPPCall(name_cstr, base_name_start, base_name_end))
-                effective_name_type_mask |= (eFunctionNameTypeMethod | eFunctionNameTypeBase);
-        }
-    }
-    else
-    {
-        effective_name_type_mask = name_type_mask;
-        if (effective_name_type_mask & eFunctionNameTypeMethod || name_type_mask & eFunctionNameTypeBase)
-        {
-            // If they've asked for a CPP method or function name and it can't be that, we don't
-            // even need to search for CPP methods or names.
-            if (!CPPLanguageRuntime::IsPossibleCPPCall(name_cstr, base_name_start, base_name_end))
-            {
-                effective_name_type_mask &= ~(eFunctionNameTypeMethod | eFunctionNameTypeBase);
-                if (effective_name_type_mask == eFunctionNameTypeNone)
-                    return 0;
-            }
-        }
-        
-        if (effective_name_type_mask & eFunctionNameTypeSelector)
-        {
-            if (!ObjCLanguageRuntime::IsPossibleObjCSelector(name_cstr))
-            {
-                effective_name_type_mask &= ~(eFunctionNameTypeSelector);
-                if (effective_name_type_mask == eFunctionNameTypeNone)
-                    return 0;
-            }
-        }
-    }
-    
+
+    const uint32_t original_size = sc_list.GetSize();
+   
     DWARFDebugInfo* info = DebugInfo();
     if (info == NULL)
         return 0;
 
     DWARFCompileUnit *dwarf_cu = NULL;
+    std::set<const DWARFDebugInfoEntry *> resolved_dies;
     if (m_using_apple_tables)
     {
         if (m_apple_names_ap.get())
@@ -3509,7 +3380,7 @@ SymbolFileDWARF::FindFunctions (const Co
 
             uint32_t num_matches = 0;
                 
-            if (effective_name_type_mask & eFunctionNameTypeFull)
+            if (name_type_mask & eFunctionNameTypeFull)
             {
                 // If they asked for the full name, match what they typed.  At some point we may
                 // want to canonicalize this (strip double spaces, etc.  For now, we just add all the
@@ -3527,7 +3398,11 @@ SymbolFileDWARF::FindFunctions (const Co
                         if (!include_inlines && die->Tag() == DW_TAG_inlined_subroutine)
                             continue;
                         
-                        ResolveFunction (dwarf_cu, die, sc_list);
+                        if (resolved_dies.find(die) == resolved_dies.end())
+                        {
+                            if (ResolveFunction (dwarf_cu, die, sc_list))
+                                resolved_dies.insert(die);
+                        }
                     }
                     else
                     {
@@ -3536,87 +3411,116 @@ SymbolFileDWARF::FindFunctions (const Co
                     }                                    
                 }
             }
-            else
-            {                
-                if (effective_name_type_mask & eFunctionNameTypeSelector)
-                {
-                    if (namespace_decl && *namespace_decl)
-                        return 0; // no selectors in namespaces
-                        
-                    num_matches = m_apple_names_ap->FindByName (name_cstr, die_offsets);
-                    // Now make sure these are actually ObjC methods.  In this case we can simply look up the name,
-                    // and if it is an ObjC method name, we're good.
+
+            if (name_type_mask & eFunctionNameTypeSelector)
+            {
+                if (namespace_decl && *namespace_decl)
+                    return 0; // no selectors in namespaces
                     
-                    for (uint32_t i = 0; i < num_matches; i++)
+                num_matches = m_apple_names_ap->FindByName (name_cstr, die_offsets);
+                // Now make sure these are actually ObjC methods.  In this case we can simply look up the name,
+                // and if it is an ObjC method name, we're good.
+                
+                for (uint32_t i = 0; i < num_matches; i++)
+                {
+                    const dw_offset_t die_offset = die_offsets[i];
+                    const DWARFDebugInfoEntry* die = info->GetDIEPtrWithCompileUnitHint (die_offset, &dwarf_cu);
+                    if (die)
                     {
-                        const dw_offset_t die_offset = die_offsets[i];
-                        const DWARFDebugInfoEntry* die = info->GetDIEPtrWithCompileUnitHint (die_offset, &dwarf_cu);
-                        if (die)
+                        const char *die_name = die->GetName(this, dwarf_cu);
+                        if (ObjCLanguageRuntime::IsPossibleObjCMethodName(die_name))
                         {
-                            const char *die_name = die->GetName(this, dwarf_cu);
-                            if (ObjCLanguageRuntime::IsPossibleObjCMethodName(die_name))
+                            if (!include_inlines && die->Tag() == DW_TAG_inlined_subroutine)
+                                continue;
+                            
+                            if (resolved_dies.find(die) == resolved_dies.end())
                             {
-                                if (!include_inlines && die->Tag() == DW_TAG_inlined_subroutine)
-                                    continue;
-                                
-                                ResolveFunction (dwarf_cu, die, sc_list);
+                                if (ResolveFunction (dwarf_cu, die, sc_list))
+                                    resolved_dies.insert(die);
                             }
                         }
-                        else
-                        {
-                            GetObjectFile()->GetModule()->ReportError ("the DWARF debug information has been modified (.apple_names accelerator table had bad die 0x%8.8x for '%s')",
-                                                                       die_offset, name_cstr);
-                        }                                    
                     }
-                    die_offsets.clear();
+                    else
+                    {
+                        GetObjectFile()->GetModule()->ReportError ("the DWARF debug information has been modified (.apple_names accelerator table had bad die 0x%8.8x for '%s')",
+                                                                   die_offset, name_cstr);
+                    }                                    
                 }
+                die_offsets.clear();
+            }
+            
+            if (((name_type_mask & eFunctionNameTypeMethod) && !namespace_decl) || name_type_mask & eFunctionNameTypeBase)
+            {
+                // The apple_names table stores just the "base name" of C++ methods in the table.  So we have to
+                // extract the base name, look that up, and if there is any other information in the name we were
+                // passed in we have to post-filter based on that.
                 
-                if (effective_name_type_mask & eFunctionNameTypeMethod
-                    || effective_name_type_mask & eFunctionNameTypeBase)
+                // FIXME: Arrange the logic above so that we don't calculate the base name twice:
+                num_matches = m_apple_names_ap->FindByName (name_cstr, die_offsets);
+                
+                for (uint32_t i = 0; i < num_matches; i++)
                 {
-                    if ((effective_name_type_mask & eFunctionNameTypeMethod) &&
-                        (namespace_decl && *namespace_decl))
-                        return 0; // no methods in namespaces
-                    
-                    // The apple_names table stores just the "base name" of C++ methods in the table.  So we have to 
-                    // extract the base name, look that up, and if there is any other information in the name we were
-                    // passed in we have to post-filter based on that.
-                    
-                    // FIXME: Arrange the logic above so that we don't calculate the base name twice:
-                    std::string base_name(base_name_start, base_name_end - base_name_start);
-                    num_matches = m_apple_names_ap->FindByName (base_name.c_str(), die_offsets);
-                    
-                    for (uint32_t i = 0; i < num_matches; i++)
+                    const dw_offset_t die_offset = die_offsets[i];
+                    const DWARFDebugInfoEntry* die = info->GetDIEPtrWithCompileUnitHint (die_offset, &dwarf_cu);
+                    if (die)
                     {
-                        const dw_offset_t die_offset = die_offsets[i];
-                        const DWARFDebugInfoEntry* die = info->GetDIEPtrWithCompileUnitHint (die_offset, &dwarf_cu);
-                        if (die)
+                        if (!include_inlines && die->Tag() == DW_TAG_inlined_subroutine)
+                            continue;
+                        
+                        if (namespace_decl && !DIEIsInNamespace (namespace_decl, dwarf_cu, die))
+                            continue;
+
+                        // If we get to here, the die is good, and we should add it:
+                        if (resolved_dies.find(die) == resolved_dies.end())
+                        if (ResolveFunction (dwarf_cu, die, sc_list))
                         {
-                            if (!include_inlines && die->Tag() == DW_TAG_inlined_subroutine)
-                                continue;
-                            
-                            if (namespace_decl && !DIEIsInNamespace (namespace_decl, dwarf_cu, die))
-                                continue;
-                            
-                            if (!FunctionDieMatchesPartialName(die,
-                                                               dwarf_cu, 
-                                                               effective_name_type_mask,
-                                                               name_cstr, 
-                                                               base_name_start, 
-                                                               base_name_end))
-                                continue;
-                            
-                            // If we get to here, the die is good, and we should add it:
-                            ResolveFunction (dwarf_cu, die, sc_list);
+                            bool keep_die = true;
+                            if ((name_type_mask & (eFunctionNameTypeBase|eFunctionNameTypeMethod)) != (eFunctionNameTypeBase|eFunctionNameTypeMethod))
+                            {
+                                // We are looking for either basenames or methods, so we need to
+                                // trim out the ones we won't want by looking at the type
+                                SymbolContext sc;
+                                if (sc_list.GetLastContext(sc))
+                                {
+                                    if (sc.block)
+                                    {
+                                        // We have an inlined function
+                                    }
+                                    else if (sc.function)
+                                    {
+                                        Type *type = sc.function->GetType();
+                                        
+                                        clang::DeclContext* decl_ctx = GetClangDeclContextContainingTypeUID (type->GetID());
+                                        if (decl_ctx->isRecord())
+                                        {
+                                            if (name_type_mask & eFunctionNameTypeBase)
+                                            {
+                                                sc_list.RemoveContextAtIndex(sc_list.GetSize()-1);
+                                                keep_die = false;
+                                            }
+                                        }
+                                        else
+                                        {
+                                            if (name_type_mask & eFunctionNameTypeMethod)
+                                            {
+                                                sc_list.RemoveContextAtIndex(sc_list.GetSize()-1);
+                                                keep_die = false;
+                                            }
+                                        }
+                                    }
+                                }
+                            }
+                            if (keep_die)
+                                resolved_dies.insert(die);
                         }
-                        else
-                        {
-                            GetObjectFile()->GetModule()->ReportErrorIfModifyDetected ("the DWARF debug information has been modified (.apple_names accelerator table had bad die 0x%8.8x for '%s')",
-                                                                                       die_offset, name_cstr);
-                        }                                    
                     }
-                    die_offsets.clear();
+                    else
+                    {
+                        GetObjectFile()->GetModule()->ReportErrorIfModifyDetected ("the DWARF debug information has been modified (.apple_names accelerator table had bad die 0x%8.8x for '%s')",
+                                                                                   die_offset, name_cstr);
+                    }                                    
                 }
+                die_offsets.clear();
             }
         }
     }
@@ -3630,14 +3534,12 @@ SymbolFileDWARF::FindFunctions (const Co
         if (name_type_mask & eFunctionNameTypeFull)
             FindFunctions (name, m_function_fullname_index, sc_list);
 
-        std::string base_name(base_name_start, base_name_end - base_name_start);
-        ConstString base_name_const(base_name.c_str());
         DIEArray die_offsets;
         DWARFCompileUnit *dwarf_cu = NULL;
         
-        if (effective_name_type_mask & eFunctionNameTypeBase)
+        if (name_type_mask & eFunctionNameTypeBase)
         {
-            uint32_t num_base = m_function_basename_index.Find(base_name_const, die_offsets);
+            uint32_t num_base = m_function_basename_index.Find(name, die_offsets);
             for (uint32_t i = 0; i < num_base; i++)
             {
                 const DWARFDebugInfoEntry* die = info->GetDIEPtrWithCompileUnitHint (die_offsets[i], &dwarf_cu);
@@ -3649,27 +3551,23 @@ SymbolFileDWARF::FindFunctions (const Co
                     if (namespace_decl && !DIEIsInNamespace (namespace_decl, dwarf_cu, die))
                         continue;
                     
-                    if (!FunctionDieMatchesPartialName(die, 
-                                                       dwarf_cu, 
-                                                       eFunctionNameTypeBase, 
-                                                       name_cstr, 
-                                                       base_name_start, 
-                                                       base_name_end))
-                        continue;
-                    
                     // If we get to here, the die is good, and we should add it:
-                    ResolveFunction (dwarf_cu, die, sc_list);
+                    if (resolved_dies.find(die) == resolved_dies.end())
+                    {
+                        if (ResolveFunction (dwarf_cu, die, sc_list))
+                            resolved_dies.insert(die);
+                    }
                 }
             }
             die_offsets.clear();
         }
         
-        if (effective_name_type_mask & eFunctionNameTypeMethod)
+        if (name_type_mask & eFunctionNameTypeMethod)
         {
             if (namespace_decl && *namespace_decl)
                 return 0; // no methods in namespaces
 
-            uint32_t num_base = m_function_method_index.Find(base_name_const, die_offsets);
+            uint32_t num_base = m_function_method_index.Find(name, die_offsets);
             {
                 for (uint32_t i = 0; i < num_base; i++)
                 {
@@ -3679,23 +3577,19 @@ SymbolFileDWARF::FindFunctions (const Co
                         if (!include_inlines && die->Tag() == DW_TAG_inlined_subroutine)
                             continue;
                         
-                        if (!FunctionDieMatchesPartialName(die,
-                                                           dwarf_cu, 
-                                                           eFunctionNameTypeMethod, 
-                                                           name_cstr, 
-                                                           base_name_start, 
-                                                           base_name_end))
-                            continue;
-                        
                         // If we get to here, the die is good, and we should add it:
-                        ResolveFunction (dwarf_cu, die, sc_list);
+                        if (resolved_dies.find(die) == resolved_dies.end())
+                        {
+                            if (ResolveFunction (dwarf_cu, die, sc_list))
+                                resolved_dies.insert(die);
+                        }
                     }
                 }
             }
             die_offsets.clear();
         }
 
-        if ((effective_name_type_mask & eFunctionNameTypeSelector) && (!namespace_decl || !*namespace_decl))
+        if ((name_type_mask & eFunctionNameTypeSelector) && (!namespace_decl || !*namespace_decl))
         {
             FindFunctions (name, m_function_selector_index, sc_list);
         }
@@ -3707,7 +3601,7 @@ SymbolFileDWARF::FindFunctions (const Co
     
     if (log && num_matches > 0)
     {
-        GetObjectFile()->GetModule()->LogMessage (log.get(), 
+        GetObjectFile()->GetModule()->LogMessage (log,
                                                   "SymbolFileDWARF::FindFunctions (name=\"%s\", name_type_mask=0x%x, append=%u, sc_list) => %u",
                                                   name.GetCString(), 
                                                   name_type_mask, 
@@ -3724,11 +3618,11 @@ SymbolFileDWARF::FindFunctions(const Reg
                         "SymbolFileDWARF::FindFunctions (regex = '%s')",
                         regex.GetText());
 
-    LogSP log (LogChannelDWARF::GetLogIfAll(DWARF_LOG_LOOKUPS));
+    Log *log (LogChannelDWARF::GetLogIfAll(DWARF_LOG_LOOKUPS));
     
     if (log)
     {
-        GetObjectFile()->GetModule()->LogMessage (log.get(), 
+        GetObjectFile()->GetModule()->LogMessage (log,
                                                   "SymbolFileDWARF::FindFunctions (regex=\"%s\", append=%u, sc_list)", 
                                                   regex.GetText(), 
                                                   append);
@@ -3775,13 +3669,13 @@ SymbolFileDWARF::FindTypes (const Symbol
     if (info == NULL)
         return 0;
 
-    LogSP log (LogChannelDWARF::GetLogIfAll(DWARF_LOG_LOOKUPS));
+    Log *log (LogChannelDWARF::GetLogIfAll(DWARF_LOG_LOOKUPS));
     
     if (log)
     {
         if (namespace_decl)
         {
-            GetObjectFile()->GetModule()->LogMessage (log.get(),
+            GetObjectFile()->GetModule()->LogMessage (log,
                                                       "SymbolFileDWARF::FindTypes (sc, name=\"%s\", clang::NamespaceDecl(%p) \"%s\", append=%u, max_matches=%u, type_list)", 
                                                       name.GetCString(),
                                                       namespace_decl->GetNamespaceDecl(),
@@ -3791,7 +3685,7 @@ SymbolFileDWARF::FindTypes (const Symbol
         }
         else
         {
-            GetObjectFile()->GetModule()->LogMessage (log.get(),
+            GetObjectFile()->GetModule()->LogMessage (log,
                                                       "SymbolFileDWARF::FindTypes (sc, name=\"%s\", clang::NamespaceDecl(NULL), append=%u, max_matches=%u, type_list)",
                                                       name.GetCString(), 
                                                       append, 
@@ -3866,7 +3760,7 @@ SymbolFileDWARF::FindTypes (const Symbol
         {
             if (namespace_decl)
             {
-                GetObjectFile()->GetModule()->LogMessage (log.get(),
+                GetObjectFile()->GetModule()->LogMessage (log,
                                                           "SymbolFileDWARF::FindTypes (sc, name=\"%s\", clang::NamespaceDecl(%p) \"%s\", append=%u, max_matches=%u, type_list) => %u", 
                                                           name.GetCString(),
                                                           namespace_decl->GetNamespaceDecl(),
@@ -3877,7 +3771,7 @@ SymbolFileDWARF::FindTypes (const Symbol
             }
             else
             {
-                GetObjectFile()->GetModule()->LogMessage (log.get(),
+                GetObjectFile()->GetModule()->LogMessage (log,
                                                           "SymbolFileDWARF::FindTypes (sc, name=\"%s\", clang::NamespaceDecl(NULL), append=%u, max_matches=%u, type_list) => %u",
                                                           name.GetCString(), 
                                                           append, 
@@ -3896,11 +3790,11 @@ SymbolFileDWARF::FindNamespace (const Sy
                                 const ConstString &name,
                                 const lldb_private::ClangNamespaceDecl *parent_namespace_decl)
 {
-    LogSP log (LogChannelDWARF::GetLogIfAll(DWARF_LOG_LOOKUPS));
+    Log *log (LogChannelDWARF::GetLogIfAll(DWARF_LOG_LOOKUPS));
     
     if (log)
     {
-        GetObjectFile()->GetModule()->LogMessage (log.get(), 
+        GetObjectFile()->GetModule()->LogMessage (log,
                                                   "SymbolFileDWARF::FindNamespace (sc, name=\"%s\")", 
                                                   name.GetCString());
     }
@@ -3970,7 +3864,7 @@ SymbolFileDWARF::FindNamespace (const Sy
     }
     if (log && namespace_decl.GetNamespaceDecl())
     {
-        GetObjectFile()->GetModule()->LogMessage (log.get(), 
+        GetObjectFile()->GetModule()->LogMessage (log,
                                                   "SymbolFileDWARF::FindNamespace (sc, name=\"%s\") => clang::NamespaceDecl(%p) \"%s\"",
                                                   name.GetCString(),
                                                   namespace_decl.GetNamespaceDecl(),
@@ -4061,7 +3955,7 @@ SymbolFileDWARF::ParseChildParameters (c
                             case DW_AT_decl_column: decl.SetColumn(form_value.Unsigned()); break;
                             case DW_AT_name:        name = form_value.AsCString(&get_debug_str_data()); break;
                             case DW_AT_type:        param_type_die_offset = form_value.Reference(dwarf_cu); break;
-                            case DW_AT_artificial:  is_artificial = form_value.Unsigned() != 0; break;
+                            case DW_AT_artificial:  is_artificial = form_value.Boolean(); break;
                             case DW_AT_location:
     //                          if (form_value.BlockData())
     //                          {
@@ -4159,7 +4053,7 @@ SymbolFileDWARF::ParseChildParameters (c
                             assert(param_var_decl);
                             function_param_decls.push_back(param_var_decl);
                             
-                            GetClangASTContext().SetMetadataAsUserID ((uintptr_t)param_var_decl, MakeUserID(die->GetOffset()));
+                            GetClangASTContext().SetMetadataAsUserID (param_var_decl, MakeUserID(die->GetOffset()));
                         }
                     }
                 }
@@ -4183,7 +4077,8 @@ size_t
 SymbolFileDWARF::ParseChildEnumerators
 (
     const SymbolContext& sc,
-    clang_type_t  enumerator_clang_type,
+    clang_type_t enumerator_clang_type,
+    bool is_signed,
     uint32_t enumerator_byte_size,
     DWARFCompileUnit* dwarf_cu,
     const DWARFDebugInfoEntry *parent_die
@@ -4221,7 +4116,10 @@ SymbolFileDWARF::ParseChildEnumerators
                         {
                         case DW_AT_const_value:
                             got_value = true;
-                            enum_value = form_value.Unsigned();
+                            if (is_signed)
+                                enum_value = form_value.Signed();
+                            else
+                                enum_value = form_value.Unsigned();
                             break;
 
                         case DW_AT_name:
@@ -4420,12 +4318,12 @@ SymbolFileDWARF::ResolveNamespaceDIE (DW
             const char *namespace_name = die->GetAttributeValueAsString(this, dwarf_cu, DW_AT_name, NULL);
             clang::DeclContext *containing_decl_ctx = GetClangDeclContextContainingDIE (dwarf_cu, die, NULL);
             namespace_decl = GetClangASTContext().GetUniqueNamespaceDeclaration (namespace_name, containing_decl_ctx);
-            LogSP log (LogChannelDWARF::GetLogIfAll(DWARF_LOG_DEBUG_INFO));
+            Log *log (LogChannelDWARF::GetLogIfAll(DWARF_LOG_DEBUG_INFO));
             if (log)
             {
                 if (namespace_name)
                 {
-                    GetObjectFile()->GetModule()->LogMessage (log.get(), 
+                    GetObjectFile()->GetModule()->LogMessage (log,
                                                               "ASTContext => %p: 0x%8.8" PRIx64 ": DW_TAG_namespace with DW_AT_name(\"%s\") => clang::NamespaceDecl *%p (original = %p)",
                                                               GetClangASTContext().getASTContext(),
                                                               MakeUserID(die->GetOffset()),
@@ -4435,7 +4333,7 @@ SymbolFileDWARF::ResolveNamespaceDIE (DW
                 }
                 else
                 {
-                    GetObjectFile()->GetModule()->LogMessage (log.get(),
+                    GetObjectFile()->GetModule()->LogMessage (log,
                                                               "ASTContext => %p: 0x%8.8" PRIx64 ": DW_TAG_namespace (anonymous) => clang::NamespaceDecl *%p (original = %p)",
                                                               GetClangASTContext().getASTContext(),
                                                               MakeUserID(die->GetOffset()),
@@ -4468,9 +4366,9 @@ SymbolFileDWARF::GetClangDeclContextForD
     if (die_offset != DW_INVALID_OFFSET)
         return GetClangDeclContextForDIEOffset (sc, die_offset);
     
-    LogSP log (LogChannelDWARF::GetLogIfAll(DWARF_LOG_DEBUG_INFO));
+    Log *log (LogChannelDWARF::GetLogIfAll(DWARF_LOG_DEBUG_INFO));
     if (log)
-        GetObjectFile()->GetModule()->LogMessage(log.get(), "SymbolFileDWARF::GetClangDeclContextForDIE (die = 0x%8.8x) %s '%s'", die->GetOffset(), DW_TAG_value_to_name(die->Tag()), die->GetName(this, cu));
+        GetObjectFile()->GetModule()->LogMessage(log, "SymbolFileDWARF::GetClangDeclContextForDIE (die = 0x%8.8x) %s '%s'", die->GetOffset(), DW_TAG_value_to_name(die->Tag()), die->GetName(this, cu));
     // This is the DIE we want.  Parse it, then query our map.
     bool assert_not_being_parsed = true;
     ResolveTypeUID (cu, die, assert_not_being_parsed);    
@@ -4863,12 +4761,13 @@ SymbolFileDWARF::FindDefinitionTypeForDI
     if (cu == NULL || die == NULL || !type_name)
         return type_sp;
 
-    LogSP log (LogChannelDWARF::GetLogIfAny(DWARF_LOG_TYPE_COMPLETION|DWARF_LOG_LOOKUPS));
+    std::string qualified_name;
+
+    Log *log (LogChannelDWARF::GetLogIfAny(DWARF_LOG_TYPE_COMPLETION|DWARF_LOG_LOOKUPS));
     if (log)
     {
-        std::string qualified_name;
         die->GetQualifiedName(this, cu, qualified_name);
-        GetObjectFile()->GetModule()->LogMessage (log.get(),
+        GetObjectFile()->GetModule()->LogMessage (log,
                                                   "SymbolFileDWARF::FindDefinitionTypeForDIE(die=0x%8.8x (%s), name='%s')",
                                                   die->GetOffset(),
                                                   qualified_name.c_str(),
@@ -4881,8 +4780,22 @@ SymbolFileDWARF::FindDefinitionTypeForDI
     {
         if (m_apple_types_ap.get())
         {
-            if (m_apple_types_ap->GetHeader().header_data.atoms.size() > 1)
+            const bool has_tag = m_apple_types_ap->GetHeader().header_data.ContainsAtom (DWARFMappedHash::eAtomTypeTag);
+            const bool has_qualified_name_hash = m_apple_types_ap->GetHeader().header_data.ContainsAtom (DWARFMappedHash::eAtomTypeQualNameHash);
+            if (has_tag && has_qualified_name_hash)
             {
+                if (qualified_name.empty())
+                    die->GetQualifiedName(this, cu, qualified_name);
+
+                const uint32_t qualified_name_hash = MappedHash::HashStringUsingDJB (qualified_name.c_str());
+                if (log)
+                    GetObjectFile()->GetModule()->LogMessage (log,"FindByNameAndTagAndQualifiedNameHash()");
+                m_apple_types_ap->FindByNameAndTagAndQualifiedNameHash (type_name.GetCString(), die->Tag(), qualified_name_hash, die_offsets);
+            }
+            else if (has_tag > 1)
+            {
+                if (log)
+                    GetObjectFile()->GetModule()->LogMessage (log,"FindByNameAndTag()");
                 m_apple_types_ap->FindByNameAndTag (type_name.GetCString(), die->Tag(), die_offsets);
             }
             else
@@ -4957,7 +4870,7 @@ SymbolFileDWARF::FindDefinitionTypeForDI
                     {
                         std::string qualified_name;
                         type_die->GetQualifiedName(this, cu, qualified_name);
-                        GetObjectFile()->GetModule()->LogMessage (log.get(),
+                        GetObjectFile()->GetModule()->LogMessage (log,
                                                                   "SymbolFileDWARF::FindDefinitionTypeForDIE(die=0x%8.8x, name='%s') trying die=0x%8.8x (%s)",
                                                                   die->GetOffset(),
                                                                   type_name.GetCString(),
@@ -4990,7 +4903,7 @@ SymbolFileDWARF::FindDefinitionTypeForDI
                     {
                         std::string qualified_name;
                         type_die->GetQualifiedName(this, cu, qualified_name);
-                        GetObjectFile()->GetModule()->LogMessage (log.get(),
+                        GetObjectFile()->GetModule()->LogMessage (log,
                                                                   "SymbolFileDWARF::FindDefinitionTypeForDIE(die=0x%8.8x, name='%s') ignoring die=0x%8.8x (%s)",
                                                                   die->GetOffset(),
                                                                   type_name.GetCString(),
@@ -5026,10 +4939,10 @@ SymbolFileDWARF::FindDefinitionTypeForDW
 
         if (type_name)
         {
-            LogSP log (LogChannelDWARF::GetLogIfAny(DWARF_LOG_TYPE_COMPLETION|DWARF_LOG_LOOKUPS));
+            Log *log (LogChannelDWARF::GetLogIfAny(DWARF_LOG_TYPE_COMPLETION|DWARF_LOG_LOOKUPS));
             if (log)
             {
-                GetObjectFile()->GetModule()->LogMessage (log.get(),
+                GetObjectFile()->GetModule()->LogMessage (log,
                                                           "SymbolFileDWARF::FindDefinitionTypeForDWARFDeclContext(tag=%s, qualified-name='%s')",
                                                           DW_TAG_value_to_name(dwarf_decl_ctx[0].tag),
                                                           dwarf_decl_ctx.GetQualifiedName());
@@ -5041,8 +4954,20 @@ SymbolFileDWARF::FindDefinitionTypeForDW
             {
                 if (m_apple_types_ap.get())
                 {
-                    if (m_apple_types_ap->GetHeader().header_data.atoms.size() > 1)
+                    const bool has_tag = m_apple_types_ap->GetHeader().header_data.ContainsAtom (DWARFMappedHash::eAtomTypeTag);
+                    const bool has_qualified_name_hash = m_apple_types_ap->GetHeader().header_data.ContainsAtom (DWARFMappedHash::eAtomTypeQualNameHash);
+                    if (has_tag && has_qualified_name_hash)
                     {
+                        const char *qualified_name = dwarf_decl_ctx.GetQualifiedName();
+                        const uint32_t qualified_name_hash = MappedHash::HashStringUsingDJB (qualified_name);
+                        if (log)
+                            GetObjectFile()->GetModule()->LogMessage (log,"FindByNameAndTagAndQualifiedNameHash()");
+                        m_apple_types_ap->FindByNameAndTagAndQualifiedNameHash (type_name.GetCString(), tag, qualified_name_hash, die_offsets);
+                    }
+                    else if (has_tag)
+                    {
+                        if (log)
+                            GetObjectFile()->GetModule()->LogMessage (log,"FindByNameAndTag()");
                         m_apple_types_ap->FindByNameAndTag (type_name.GetCString(), tag, die_offsets);
                     }
                     else
@@ -5114,7 +5039,7 @@ SymbolFileDWARF::FindDefinitionTypeForDW
 
                             if (log)
                             {
-                                GetObjectFile()->GetModule()->LogMessage (log.get(),
+                                GetObjectFile()->GetModule()->LogMessage (log,
                                                                           "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(),
@@ -5139,7 +5064,7 @@ SymbolFileDWARF::FindDefinitionTypeForDW
                             {
                                 std::string qualified_name;
                                 type_die->GetQualifiedName(this, type_cu, qualified_name);
-                                GetObjectFile()->GetModule()->LogMessage (log.get(),
+                                GetObjectFile()->GetModule()->LogMessage (log,
                                                                           "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(),
@@ -5165,11 +5090,13 @@ SymbolFileDWARF::FindDefinitionTypeForDW
 }
 
 bool
-SymbolFileDWARF::CopyUniqueClassMethodTypes (Type *class_type,
+SymbolFileDWARF::CopyUniqueClassMethodTypes (SymbolFileDWARF *src_symfile,
+                                             Type *class_type,
                                              DWARFCompileUnit* src_cu,
                                              const DWARFDebugInfoEntry *src_class_die,
                                              DWARFCompileUnit* dst_cu,
-                                             const DWARFDebugInfoEntry *dst_class_die)
+                                             const DWARFDebugInfoEntry *dst_class_die,
+                                             llvm::SmallVectorImpl <const DWARFDebugInfoEntry *> &failures)
 {
     if (!class_type || !src_cu || !src_class_die || !dst_cu || !dst_class_die)
         return false;
@@ -5195,13 +5122,13 @@ SymbolFileDWARF::CopyUniqueClassMethodTy
             // for DW_AT_declaration set to 1. Sometimes concrete function instances
             // are placed inside the class definitions and shouldn't be included in
             // the list of things are are tracking here.
-            if (src_die->GetAttributeValueAsUnsigned(this, src_cu, DW_AT_declaration, 0) == 1)
+            if (src_die->GetAttributeValueAsUnsigned(src_symfile, src_cu, DW_AT_declaration, 0) == 1)
             {
-                const char *src_name = src_die->GetMangledName (this, src_cu);
+                const char *src_name = src_die->GetMangledName (src_symfile, src_cu);
                 if (src_name)
                 {
                     ConstString src_const_name(src_name);
-                    if (src_die->GetAttributeValueAsUnsigned(this, src_cu, DW_AT_artificial, 0))
+                    if (src_die->GetAttributeValueAsUnsigned(src_symfile, src_cu, DW_AT_artificial, 0))
                         src_name_to_die_artificial.Append(src_const_name.GetCString(), src_die);
                     else
                         src_name_to_die.Append(src_const_name.GetCString(), src_die);
@@ -5233,11 +5160,30 @@ SymbolFileDWARF::CopyUniqueClassMethodTy
     }
     const uint32_t src_size = src_name_to_die.GetSize ();
     const uint32_t dst_size = dst_name_to_die.GetSize ();
-    LogSP log (LogChannelDWARF::GetLogIfAny(DWARF_LOG_DEBUG_INFO | DWARF_LOG_TYPE_COMPLETION));
+    Log *log (LogChannelDWARF::GetLogIfAny(DWARF_LOG_DEBUG_INFO | DWARF_LOG_TYPE_COMPLETION));
+
+    // Is everything kosher so we can go through the members at top speed?
+    bool fast_path = true;
+                            
+    if (src_size != dst_size)
+    {
+        if (src_size != 0 && dst_size != 0)
+        {
+            if (log)
+                log->Printf("warning: trying to unique class DIE 0x%8.8x to 0x%8.8x, but they didn't have the same size (src=%d, dst=%d)",
+                            src_class_die->GetOffset(),
+                            dst_class_die->GetOffset(),
+                            src_size,
+                            dst_size);
+        }
+        
+        fast_path = false;
+    }
+
+    uint32_t idx;
     
-    if (src_size == dst_size)
+    if (fast_path)
     {
-        uint32_t idx;
         for (idx = 0; idx < src_size; ++idx)
         {
             src_die = src_name_to_die.GetValueAtIndexUnchecked (idx);
@@ -5253,10 +5199,10 @@ SymbolFileDWARF::CopyUniqueClassMethodTy
                                 DW_TAG_value_to_name(src_die->Tag()),
                                 dst_die->GetOffset(),
                                 DW_TAG_value_to_name(src_die->Tag()));
-                return false;
+                fast_path = false;
             }
             
-            const char *src_name = src_die->GetMangledName (this, src_cu);
+            const char *src_name = src_die->GetMangledName (src_symfile, src_cu);
             const char *dst_name = dst_die->GetMangledName (this, dst_cu);
             
             // Make sure the names match
@@ -5272,15 +5218,21 @@ SymbolFileDWARF::CopyUniqueClassMethodTy
                             dst_die->GetOffset(),
                             dst_name);
             
-            return false;
+            fast_path = false;
         }
+    }
 
+    // Now do the work of linking the DeclContexts and Types.
+    if (fast_path)
+    {
+        // We can do this quickly.  Just run across the tables index-for-index since
+        // we know each node has matching names and tags.
         for (idx = 0; idx < src_size; ++idx)
         {
             src_die = src_name_to_die.GetValueAtIndexUnchecked (idx);
             dst_die = dst_name_to_die.GetValueAtIndexUnchecked (idx);
             
-            clang::DeclContext *src_decl_ctx = m_die_to_decl_ctx[src_die];
+            clang::DeclContext *src_decl_ctx = src_symfile->m_die_to_decl_ctx[src_die];
             if (src_decl_ctx)
             {
                 if (log)
@@ -5306,11 +5258,71 @@ SymbolFileDWARF::CopyUniqueClassMethodTy
                     log->Printf ("warning: tried to unique lldb_private::Type from 0x%8.8x for 0x%8.8x, but none was found", src_die->GetOffset(), dst_die->GetOffset());
             }
         }
+    }
+    else
+    {
+        // We must do this slowly.  For each member of the destination, look
+        // up a member in the source with the same name, check its tag, and
+        // unique them if everything matches up.  Report failures.
         
-        const uint32_t src_size_artificial = src_name_to_die_artificial.GetSize ();
+        if (!src_name_to_die.IsEmpty() && !dst_name_to_die.IsEmpty())
+        {
+            src_name_to_die.Sort();
         
-        UniqueCStringMap<const DWARFDebugInfoEntry *> name_to_die_artificial_not_in_src;
+            for (idx = 0; idx < dst_size; ++idx)
+            {
+                const char *dst_name = dst_name_to_die.GetCStringAtIndex(idx);
+                dst_die = dst_name_to_die.GetValueAtIndexUnchecked(idx);
+                src_die = src_name_to_die.Find(dst_name, NULL);
+                
+                if (src_die && (src_die->Tag() == dst_die->Tag()))
+                {
+                    clang::DeclContext *src_decl_ctx = src_symfile->m_die_to_decl_ctx[src_die];
+                    if (src_decl_ctx)
+                    {
+                        if (log)
+                            log->Printf ("uniquing decl context %p from 0x%8.8x for 0x%8.8x", src_decl_ctx, src_die->GetOffset(), dst_die->GetOffset());
+                        LinkDeclContextToDIE (src_decl_ctx, dst_die);
+                    }
+                    else
+                    {
+                        if (log)
+                            log->Printf ("warning: tried to unique decl context from 0x%8.8x for 0x%8.8x, but none was found", src_die->GetOffset(), dst_die->GetOffset());
+                    }
+                    
+                    Type *src_child_type = m_die_to_type[src_die];
+                    if (src_child_type)
+                    {
+                        if (log)
+                            log->Printf ("uniquing type %p (uid=0x%" PRIx64 ") from 0x%8.8x for 0x%8.8x", src_child_type, src_child_type->GetID(), src_die->GetOffset(), dst_die->GetOffset());
+                        m_die_to_type[dst_die] = src_child_type;
+                    }
+                    else
+                    {
+                        if (log)
+                            log->Printf ("warning: tried to unique lldb_private::Type from 0x%8.8x for 0x%8.8x, but none was found", src_die->GetOffset(), dst_die->GetOffset());
+                    }
+                }
+                else
+                {
+                    if (log)
+                        log->Printf ("warning: couldn't find a match for 0x%8.8x", dst_die->GetOffset());
 
+                    failures.push_back(dst_die);
+                }
+            }
+        }
+    }
+    
+    const uint32_t src_size_artificial = src_name_to_die_artificial.GetSize ();
+    const uint32_t dst_size_artificial = dst_name_to_die_artificial.GetSize ();
+    
+    UniqueCStringMap<const DWARFDebugInfoEntry *> name_to_die_artificial_not_in_src;
+
+    if (src_size_artificial && dst_size_artificial)
+    {
+        dst_name_to_die_artificial.Sort();
+        
         for (idx = 0; idx < src_size_artificial; ++idx)
         {
             const char *src_name_artificial = src_name_to_die_artificial.GetCStringAtIndex(idx);
@@ -5347,30 +5359,22 @@ SymbolFileDWARF::CopyUniqueClassMethodTy
                 }
             }
         }
-        const uint32_t dst_size_artificial = dst_name_to_die_artificial.GetSize ();
+    }
 
-        if (dst_size_artificial)
+    if (dst_size_artificial)
+    {
+        for (idx = 0; idx < dst_size_artificial; ++idx)
         {
-            for (idx = 0; idx < dst_size_artificial; ++idx)
-            {
-                const char *dst_name_artificial = dst_name_to_die_artificial.GetCStringAtIndex(idx);
-                dst_die = dst_name_to_die_artificial.GetValueAtIndexUnchecked (idx);
-                if (log)
-                    log->Printf ("warning: need to create artificial method for 0x%8.8x for method '%s'", dst_die->GetOffset(), dst_name_artificial);
-            }
+            const char *dst_name_artificial = dst_name_to_die_artificial.GetCStringAtIndex(idx);
+            dst_die = dst_name_to_die_artificial.GetValueAtIndexUnchecked (idx);
+            if (log)
+                log->Printf ("warning: need to create artificial method for 0x%8.8x for method '%s'", dst_die->GetOffset(), dst_name_artificial);
+            
+            failures.push_back(dst_die);
         }
-        return true;
-    }
-    else if (src_size != 0 && dst_size != 0)
-    {
-        if (log)
-            log->Printf("warning: tried to unique class DIE 0x%8.8x to 0x%8.8x, but they didn't have the same size (src=%d, dst=%d)",
-                        src_class_die->GetOffset(),
-                        dst_class_die->GetOffset(),
-                        src_size,
-                        dst_size);        
     }
-    return false;
+
+    return (failures.size() != 0);
 }
 
 TypeSP
@@ -5389,13 +5393,13 @@ SymbolFileDWARF::ParseType (const Symbol
     AccessType accessibility = eAccessNone;
     if (die != NULL)
     {
-        LogSP log (LogChannelDWARF::GetLogIfAll(DWARF_LOG_DEBUG_INFO));
+        Log *log (LogChannelDWARF::GetLogIfAll(DWARF_LOG_DEBUG_INFO));
         if (log)
         {
             const DWARFDebugInfoEntry *context_die;
             clang::DeclContext *context = GetClangDeclContextContainingDIE (dwarf_cu, die, &context_die);
             
-            GetObjectFile()->GetModule()->LogMessage (log.get(), "SymbolFileDWARF::ParseType (die = 0x%8.8x, decl_ctx = %p (die 0x%8.8x)) %s name = '%s')", 
+            GetObjectFile()->GetModule()->LogMessage (log, "SymbolFileDWARF::ParseType (die = 0x%8.8x, decl_ctx = %p (die 0x%8.8x)) %s name = '%s')",
                         die->GetOffset(),
                         context,
                         context_die->GetOffset(),
@@ -5404,16 +5408,16 @@ SymbolFileDWARF::ParseType (const Symbol
             
 #if defined(LLDB_CONFIGURATION_DEBUG) or defined(LLDB_CONFIGURATION_RELEASE)
             scoped_die_logger.Push (dwarf_cu, die);
-            g_die_stack.LogDIEs(log.get(), this);
+            g_die_stack.LogDIEs(log, this);
 #endif
         }
 //
-//        LogSP log (LogChannelDWARF::GetLogIfAll(DWARF_LOG_DEBUG_INFO));
+//        Log *log (LogChannelDWARF::GetLogIfAll(DWARF_LOG_DEBUG_INFO));
 //        if (log && dwarf_cu)
 //        {
 //            StreamString s;
 //            die->DumpLocation (this, dwarf_cu, s);
-//            GetObjectFile()->GetModule()->LogMessage (log.get(), "SymbolFileDwarf::%s %s", __FUNCTION__, s.GetData());
+//            GetObjectFile()->GetModule()->LogMessage (log, "SymbolFileDwarf::%s %s", __FUNCTION__, s.GetData());
 //            
 //        }
         
@@ -5432,7 +5436,7 @@ SymbolFileDWARF::ParseType (const Symbol
             const char *type_name_cstr = NULL;
             ConstString type_name_const_str;
             Type::ResolveState resolve_state = Type::eResolveStateUnresolved;
-            size_t byte_size = 0;
+            uint64_t byte_size = 0;
             Declaration decl;
 
             Type::EncodingDataType encoding_data_type = Type::eEncodingIsUID;
@@ -5544,7 +5548,7 @@ SymbolFileDWARF::ParseType (const Symbol
                                 if (type_name_const_str == g_objc_type_name_id)
                                 {
                                     if (log)
-                                        GetObjectFile()->GetModule()->LogMessage (log.get(), "SymbolFileDWARF::ParseType (die = 0x%8.8x) %s '%s' is Objective C 'id' built-in type.", 
+                                        GetObjectFile()->GetModule()->LogMessage (log, "SymbolFileDWARF::ParseType (die = 0x%8.8x) %s '%s' is Objective C 'id' built-in type.",
                                                                                   die->GetOffset(), 
                                                                                   DW_TAG_value_to_name(die->Tag()), 
                                                                                   die->GetName(this, dwarf_cu));
@@ -5557,7 +5561,7 @@ SymbolFileDWARF::ParseType (const Symbol
                                 else if (type_name_const_str == g_objc_type_name_Class)
                                 {
                                     if (log)
-                                        GetObjectFile()->GetModule()->LogMessage (log.get(), "SymbolFileDWARF::ParseType (die = 0x%8.8x) %s '%s' is Objective C 'Class' built-in type.", 
+                                        GetObjectFile()->GetModule()->LogMessage (log, "SymbolFileDWARF::ParseType (die = 0x%8.8x) %s '%s' is Objective C 'Class' built-in type.",
                                                                                   die->GetOffset(), 
                                                                                   DW_TAG_value_to_name(die->Tag()), 
                                                                                   die->GetName(this, dwarf_cu));
@@ -5569,7 +5573,7 @@ SymbolFileDWARF::ParseType (const Symbol
                                 else if (type_name_const_str == g_objc_type_name_selector)
                                 {
                                     if (log)
-                                        GetObjectFile()->GetModule()->LogMessage (log.get(), "SymbolFileDWARF::ParseType (die = 0x%8.8x) %s '%s' is Objective C 'selector' built-in type.", 
+                                        GetObjectFile()->GetModule()->LogMessage (log, "SymbolFileDWARF::ParseType (die = 0x%8.8x) %s '%s' is Objective C 'selector' built-in type.",
                                                                                   die->GetOffset(), 
                                                                                   DW_TAG_value_to_name(die->Tag()), 
                                                                                   die->GetName(this, dwarf_cu));
@@ -5592,7 +5596,7 @@ SymbolFileDWARF::ParseType (const Symbol
                                         if (!strcmp(struct_name, "objc_object"))
                                         {
                                             if (log)
-                                                GetObjectFile()->GetModule()->LogMessage (log.get(), "SymbolFileDWARF::ParseType (die = 0x%8.8x) %s '%s' is 'objc_object*', which we overrode to 'id'.",
+                                                GetObjectFile()->GetModule()->LogMessage (log, "SymbolFileDWARF::ParseType (die = 0x%8.8x) %s '%s' is 'objc_object*', which we overrode to 'id'.",
                                                                                           die->GetOffset(),
                                                                                           DW_TAG_value_to_name(die->Tag()),
                                                                                           die->GetName(this, dwarf_cu));
@@ -5689,7 +5693,7 @@ SymbolFileDWARF::ParseType (const Symbol
                                     break;
 
                                 case DW_AT_declaration: 
-                                    is_forward_declaration = form_value.Unsigned() != 0; 
+                                    is_forward_declaration = form_value.Boolean();
                                     break;
 
                                 case DW_AT_APPLE_runtime_class: 
@@ -5801,7 +5805,7 @@ SymbolFileDWARF::ParseType (const Symbol
                             {
                                 if (log)
                                 {
-                                    GetObjectFile()->GetModule()->LogMessage (log.get(),
+                                    GetObjectFile()->GetModule()->LogMessage (log,
                                                                               "SymbolFileDWARF(%p) - 0x%8.8x: %s type \"%s\" is an incomplete objc type, complete type is 0x%8.8" PRIx64,
                                                                               this,
                                                                               die->GetOffset(), 
@@ -5829,7 +5833,7 @@ SymbolFileDWARF::ParseType (const Symbol
                         // DWARF. If this fails, we need to look elsewhere...
                         if (log)
                         {
-                            GetObjectFile()->GetModule()->LogMessage (log.get(), 
+                            GetObjectFile()->GetModule()->LogMessage (log,
                                                                       "SymbolFileDWARF(%p) - 0x%8.8x: %s type \"%s\" is a forward declaration, trying to find complete type", 
                                                                       this,
                                                                       die->GetOffset(), 
@@ -5855,7 +5859,7 @@ SymbolFileDWARF::ParseType (const Symbol
                         {
                             if (log)
                             {
-                                GetObjectFile()->GetModule()->LogMessage (log.get(),
+                                GetObjectFile()->GetModule()->LogMessage (log,
                                                                           "SymbolFileDWARF(%p) - 0x%8.8x: %s type \"%s\" is a forward declaration, complete type is 0x%8.8" PRIx64,
                                                                           this,
                                                                           die->GetOffset(), 
@@ -5888,6 +5892,10 @@ SymbolFileDWARF::ParseType (const Symbol
                                 accessibility = default_accessibility;
                         }
 
+                        ClangASTMetadata metadata;
+                        metadata.SetUserID(MakeUserID(die->GetOffset()));
+                        metadata.SetIsDynamicCXXType(ClassOrStructIsVirtual (dwarf_cu, die));
+
                         if (type_name_cstr && strchr (type_name_cstr, '<'))
                         {
                             ClangASTContext::TemplateParameterInfos template_param_infos;
@@ -5906,16 +5914,14 @@ SymbolFileDWARF::ParseType (const Symbol
                                 clang_type = ast.CreateClassTemplateSpecializationType (class_specialization_decl);
                                 clang_type_was_created = true;
                                 
-                                GetClangASTContext().SetMetadataAsUserID ((uintptr_t)class_template_decl, MakeUserID(die->GetOffset()));
-                                GetClangASTContext().SetMetadataAsUserID ((uintptr_t)class_specialization_decl, MakeUserID(die->GetOffset()));
+                                GetClangASTContext().SetMetadata (class_template_decl, metadata);
+                                GetClangASTContext().SetMetadata (class_specialization_decl, metadata);
                             }
                         }
 
                         if (!clang_type_was_created)
                         {
                             clang_type_was_created = true;
-                            ClangASTMetadata metadata;
-                            metadata.SetUserID(MakeUserID(die->GetOffset()));
                             clang_type = ast.CreateRecordType (decl_ctx, 
                                                                accessibility, 
                                                                type_name_cstr, 
@@ -6046,7 +6052,7 @@ SymbolFileDWARF::ParseType (const Symbol
                                 case DW_AT_type:            encoding_uid = form_value.Reference(dwarf_cu); break;
                                 case DW_AT_byte_size:       byte_size = form_value.Unsigned(); break;
                                 case DW_AT_accessibility:   break; //accessibility = DW_ACCESS_to_AccessType(form_value.Unsigned()); break;
-                                case DW_AT_declaration:     break; //is_forward_declaration = form_value.Unsigned() != 0; break;
+                                case DW_AT_declaration:     break; //is_forward_declaration = form_value.Boolean(); break;
                                 case DW_AT_allocated:
                                 case DW_AT_associated:
                                 case DW_AT_bit_stride:
@@ -6069,9 +6075,18 @@ SymbolFileDWARF::ParseType (const Symbol
                         clang_type = m_forward_decl_die_to_clang_type.lookup (die);
                         if (clang_type == NULL)
                         {
-                            enumerator_clang_type = ast.GetBuiltinTypeForDWARFEncodingAndBitSize (NULL, 
-                                                                                                  DW_ATE_signed, 
-                                                                                                  byte_size * 8);
+                            if (encoding_uid != DW_INVALID_OFFSET)
+                            {
+                                Type *enumerator_type = ResolveTypeUID(encoding_uid);
+                                if (enumerator_type)
+                                    enumerator_clang_type = enumerator_type->GetClangFullType();
+                            }
+                            
+                            if (enumerator_clang_type == NULL)
+                                enumerator_clang_type = ast.GetBuiltinTypeForDWARFEncodingAndBitSize (NULL,
+                                                                                                      DW_ATE_signed,
+                                                                                                      byte_size * 8);
+                            
                             clang_type = ast.CreateEnumerationType (type_name_cstr, 
                                                                     GetClangDeclContextContainingDIE (dwarf_cu, die, NULL), 
                                                                     decl,
@@ -6080,7 +6095,6 @@ SymbolFileDWARF::ParseType (const Symbol
                         else
                         {
                             enumerator_clang_type = ClangASTContext::GetEnumerationIntegerType (clang_type);
-                            assert (enumerator_clang_type != NULL);
                         }
 
                         LinkDeclContextToDIE(ClangASTContext::GetDeclContextForType(clang_type), die);
@@ -6100,7 +6114,9 @@ SymbolFileDWARF::ParseType (const Symbol
                         if (die->HasChildren())
                         {
                             SymbolContext cu_sc(GetCompUnitForDWARFCompUnit(dwarf_cu));
-                            ParseChildEnumerators(cu_sc, clang_type, type_sp->GetByteSize(), dwarf_cu, die);
+                            bool is_signed = false;
+                            ast.IsIntegerType(enumerator_clang_type, is_signed);
+                            ParseChildEnumerators(cu_sc, clang_type, is_signed, type_sp->GetByteSize(), dwarf_cu, die);
                         }
                         ast.CompleteTagDeclarationDefinition (clang_type);
                     }
@@ -6154,11 +6170,11 @@ SymbolFileDWARF::ParseType (const Symbol
                                 case DW_AT_MIPS_linkage_name:   break; // mangled = form_value.AsCString(&get_debug_str_data()); break;
                                 case DW_AT_type:                type_die_offset = form_value.Reference(dwarf_cu); break;
                                 case DW_AT_accessibility:       accessibility = DW_ACCESS_to_AccessType(form_value.Unsigned()); break;
-                                case DW_AT_declaration:         break; // is_forward_declaration = form_value.Unsigned() != 0; break;
-                                case DW_AT_inline:              is_inline = form_value.Unsigned() != 0; break;
-                                case DW_AT_virtuality:          is_virtual = form_value.Unsigned() != 0;  break;
-                                case DW_AT_explicit:            is_explicit = form_value.Unsigned() != 0;  break; 
-                                case DW_AT_artificial:          is_artificial = form_value.Unsigned() != 0;  break; 
+                                case DW_AT_declaration:         break; // is_forward_declaration = form_value.Boolean(); break;
+                                case DW_AT_inline:              is_inline = form_value.Boolean(); break;
+                                case DW_AT_virtuality:          is_virtual = form_value.Boolean();  break;
+                                case DW_AT_explicit:            is_explicit = form_value.Boolean();  break;
+                                case DW_AT_artificial:          is_artificial = form_value.Boolean();  break;
                                         
 
                                 case DW_AT_external:
@@ -6281,16 +6297,12 @@ SymbolFileDWARF::ParseType (const Symbol
                         bool type_handled = false;
                         if (tag == DW_TAG_subprogram)
                         {
-                            ConstString class_name;
-                            ConstString class_name_no_category;
-                            if (ObjCLanguageRuntime::ParseMethodName (type_name_cstr, &class_name, NULL, NULL, &class_name_no_category))
-                            {
-                                // Use the class name with no category if there is one
-                                if (class_name_no_category)
-                                    class_name = class_name_no_category;
-
+                            ObjCLanguageRuntime::MethodName objc_method (type_name_cstr, true);
+                            if (objc_method.IsValid(true))
+                            {
                                 SymbolContext empty_sc;
                                 clang_type_t class_opaque_type = NULL;
+                                ConstString class_name(objc_method.GetClassName());
                                 if (class_name)
                                 {
                                     TypeList types;
@@ -6314,12 +6326,20 @@ SymbolFileDWARF::ParseType (const Symbol
                                     clang::ObjCMethodDecl *objc_method_decl = ast.AddMethodToObjCObjectType (class_opaque_type, 
                                                                                                              type_name_cstr,
                                                                                                              clang_type,
-                                                                                                             accessibility);
+                                                                                                             accessibility,
+                                                                                                             is_artificial);
                                     type_handled = objc_method_decl != NULL;
                                     if (type_handled)
                                     {
                                         LinkDeclContextToDIE(ClangASTContext::GetAsDeclContext(objc_method_decl), die);
-                                        GetClangASTContext().SetMetadataAsUserID ((uintptr_t)objc_method_decl, MakeUserID(die->GetOffset()));
+                                        GetClangASTContext().SetMetadataAsUserID (objc_method_decl, MakeUserID(die->GetOffset()));
+                                    }
+                                    else
+                                    {
+                                        GetObjectFile()->GetModule()->ReportError ("{0x%8.8x}: invalid Objective-C method 0x%4.4x (%s), please file a bug and attach the file at the start of this error message",
+                                                                                   die->GetOffset(),
+                                                                                   tag,
+                                                                                   DW_TAG_value_to_name(tag));
                                     }
                                 }
                             }
@@ -6336,22 +6356,43 @@ SymbolFileDWARF::ParseType (const Symbol
                                         // We uniqued the parent class of this function to another class
                                         // so we now need to associate all dies under "decl_ctx_die" to
                                         // DIEs in the DIE for "class_type"...
+                                        SymbolFileDWARF *class_symfile = NULL;
                                         DWARFCompileUnitSP class_type_cu_sp;
-                                        const DWARFDebugInfoEntry *class_type_die = DebugInfo()->GetDIEPtr(class_type->GetID(), &class_type_cu_sp);
+                                        const DWARFDebugInfoEntry *class_type_die = NULL;
+                                        
+                                        SymbolFileDWARFDebugMap *debug_map_symfile = GetDebugMapSymfile();
+                                        if (debug_map_symfile)
+                                        {
+                                            class_symfile = debug_map_symfile->GetSymbolFileByOSOIndex(SymbolFileDWARFDebugMap::GetOSOIndexFromUserID(class_type->GetID()));
+                                            class_type_die = class_symfile->DebugInfo()->GetDIEPtr(class_type->GetID(), &class_type_cu_sp);
+                                        }
+                                        else
+                                        {
+                                            class_symfile = this;
+                                            class_type_die = DebugInfo()->GetDIEPtr(class_type->GetID(), &class_type_cu_sp);
+                                        }
                                         if (class_type_die)
                                         {
-                                            if (CopyUniqueClassMethodTypes (class_type,
-                                                                            class_type_cu_sp.get(),
-                                                                            class_type_die,
-                                                                            dwarf_cu,
-                                                                            decl_ctx_die))
+                                            llvm::SmallVector<const DWARFDebugInfoEntry *, 0> failures;
+                                            
+                                            CopyUniqueClassMethodTypes (class_symfile,
+                                                                        class_type,
+                                                                        class_type_cu_sp.get(),
+                                                                        class_type_die,
+                                                                        dwarf_cu,
+                                                                        decl_ctx_die,
+                                                                        failures);
+                                            
+                                            // FIXME do something with these failures that's smarter than
+                                            // just dropping them on the ground.  Unfortunately classes don't
+                                            // like having stuff added to them after their definitions are
+                                            // complete...
+                                            
+                                            type_ptr = m_die_to_type[die];
+                                            if (type_ptr && type_ptr != DIE_IS_BEING_PARSED)
                                             {
-                                                type_ptr = m_die_to_type[die];
-                                                if (type_ptr && type_ptr != DIE_IS_BEING_PARSED)
-                                                {
-                                                    type_sp = type_ptr->shared_from_this();
-                                                    break;
-                                                }
+                                                type_sp = type_ptr->shared_from_this();
+                                                break;
                                             }
                                         }
                                     }
@@ -6462,11 +6503,15 @@ SymbolFileDWARF::ParseType (const Symbol
                                                         {
                                                             metadata.SetObjectPtrName(object_pointer_name.c_str());
                                                             if (log)
-                                                                log->Printf ("Setting object pointer name: %s on method object 0x%ld.\n",
+                                                                log->Printf ("Setting object pointer name: %s on method object %p.\n",
                                                                              object_pointer_name.c_str(),
-                                                                             (uintptr_t) cxx_method_decl);
+                                                                             cxx_method_decl);
                                                         }
-                                                        GetClangASTContext().SetMetadata ((uintptr_t)cxx_method_decl, metadata);
+                                                        GetClangASTContext().SetMetadata (cxx_method_decl, metadata);
+                                                    }
+                                                    else
+                                                    {
+                                                        return TypeSP();
                                                     }
                                                 }
                                             }
@@ -6540,11 +6585,11 @@ SymbolFileDWARF::ParseType (const Symbol
                             {
                                 metadata.SetObjectPtrName(object_pointer_name.c_str());
                                 if (log)
-                                    log->Printf ("Setting object pointer name: %s on function object 0x%ld.\n",
+                                    log->Printf ("Setting object pointer name: %s on function object %p.",
                                                  object_pointer_name.c_str(),
-                                                 (uintptr_t) function_decl);
+                                                function_decl);
                             }
-                            GetClangASTContext().SetMetadata ((uintptr_t)function_decl, metadata);
+                            GetClangASTContext().SetMetadata (function_decl, metadata);
                         }
                     }
                     type_sp.reset( new Type (MakeUserID(die->GetOffset()), 
@@ -6570,6 +6615,7 @@ SymbolFileDWARF::ParseType (const Symbol
                     int64_t first_index = 0;
                     uint32_t byte_stride = 0;
                     uint32_t bit_stride = 0;
+                    bool is_vector = false;
                     const size_t num_attributes = die->GetAttributes(this, dwarf_cu, NULL, attributes);
 
                     if (num_attributes > 0)
@@ -6595,8 +6641,9 @@ SymbolFileDWARF::ParseType (const Symbol
                                 case DW_AT_byte_size:       break; // byte_size = form_value.Unsigned(); break;
                                 case DW_AT_byte_stride:     byte_stride = form_value.Unsigned(); break;
                                 case DW_AT_bit_stride:      bit_stride = form_value.Unsigned(); break;
+                                case DW_AT_GNU_vector:      is_vector = form_value.Boolean(); break;
                                 case DW_AT_accessibility:   break; // accessibility = DW_ACCESS_to_AccessType(form_value.Unsigned()); break;
-                                case DW_AT_declaration:     break; // is_forward_declaration = form_value.Unsigned() != 0; break;
+                                case DW_AT_declaration:     break; // is_forward_declaration = form_value.Boolean(); break;
                                 case DW_AT_allocated:
                                 case DW_AT_associated:
                                 case DW_AT_data_location:
@@ -6631,7 +6678,8 @@ SymbolFileDWARF::ParseType (const Symbol
                             {
                                 num_elements = *pos;
                                 clang_type = ast.CreateArrayType (array_element_type, 
-                                                                  num_elements);
+                                                                  num_elements,
+                                                                  is_vector);
                                 array_element_type = clang_type;
                                 array_element_bit_stride = num_elements ? array_element_bit_stride * num_elements : array_element_bit_stride;
                             }
@@ -6848,18 +6896,17 @@ SymbolFileDWARF::ParseVariablesForContex
         if (info == NULL)
             return 0;
         
-        uint32_t cu_idx = UINT32_MAX;
-        DWARFCompileUnit* dwarf_cu = info->GetCompileUnit(sc.comp_unit->GetID(), &cu_idx).get();
-
-        if (dwarf_cu == NULL)
-            return 0;
-
         if (sc.function)
         {
+            DWARFCompileUnit* dwarf_cu = info->GetCompileUnitContainingDIE(sc.function->GetID()).get();
+            
+            if (dwarf_cu == NULL)
+                return 0;
+            
             const DWARFDebugInfoEntry *function_die = dwarf_cu->GetDIEPtr(sc.function->GetID());
             
-            dw_addr_t func_lo_pc = function_die->GetAttributeValueAsUnsigned (this, dwarf_cu, DW_AT_low_pc, DW_INVALID_ADDRESS);
-            if (func_lo_pc != DW_INVALID_ADDRESS)
+            dw_addr_t func_lo_pc = function_die->GetAttributeValueAsUnsigned (this, dwarf_cu, DW_AT_low_pc, LLDB_INVALID_ADDRESS);
+            if (func_lo_pc != LLDB_INVALID_ADDRESS)
             {
                 const size_t num_variables = ParseVariables(sc, dwarf_cu, func_lo_pc, function_die->GetFirstChild(), true, true);
             
@@ -6870,6 +6917,11 @@ SymbolFileDWARF::ParseVariablesForContex
         }
         else if (sc.comp_unit)
         {
+            DWARFCompileUnit* dwarf_cu = info->GetCompileUnit(sc.comp_unit->GetID()).get();
+
+            if (dwarf_cu == NULL)
+                return 0;
+
             uint32_t vars_added = 0;
             VariableListSP variables (sc.comp_unit->GetVariableList(false));
             
@@ -6974,6 +7026,7 @@ SymbolFileDWARF::ParseVariableDIE
             bool is_external = false;
             bool is_artificial = false;
             bool location_is_const_value_data = false;
+            bool has_explicit_location = false;
             //AccessType accessibility = eAccessNone;
 
             for (i=0; i<num_attributes; ++i)
@@ -6991,12 +7044,53 @@ SymbolFileDWARF::ParseVariableDIE
                     case DW_AT_linkage_name:
                     case DW_AT_MIPS_linkage_name: mangled = form_value.AsCString(&get_debug_str_data()); break;
                     case DW_AT_type:        type_uid = form_value.Reference(dwarf_cu); break;
-                    case DW_AT_external:    is_external = form_value.Unsigned() != 0; break;
+                    case DW_AT_external:    is_external = form_value.Boolean(); break;
                     case DW_AT_const_value:
-                        location_is_const_value_data = true;
-                        // Fall through...
+                        // If we have already found a DW_AT_location attribute, ignore this attribute.
+                        if (!has_explicit_location)
+                        {
+                            location_is_const_value_data = true;
+                            // The constant value will be either a block, a data value or a string.
+                            const DataExtractor& debug_info_data = get_debug_info_data();
+                            if (DWARFFormValue::IsBlockForm(form_value.Form()))
+                            {
+                                // Retrieve the value as a block expression.
+                                uint32_t block_offset = form_value.BlockData() - debug_info_data.GetDataStart();
+                                uint32_t block_length = form_value.Unsigned();
+                                location.CopyOpcodeData(debug_info_data, block_offset, block_length);
+                            }
+                            else if (DWARFFormValue::IsDataForm(form_value.Form()))
+                            {
+                                // Retrieve the value as a data expression.
+                                const uint8_t *fixed_form_sizes = DWARFFormValue::GetFixedFormSizesForAddressSize (dwarf_cu->GetAddressByteSize());
+                                uint32_t data_offset = attributes.DIEOffsetAtIndex(i);
+                                uint32_t data_length = fixed_form_sizes[form_value.Form()];
+                                location.CopyOpcodeData(debug_info_data, data_offset, data_length);
+                            }
+                            else
+                            {
+                                // Retrieve the value as a string expression.
+                                if (form_value.Form() == DW_FORM_strp)
+                                {
+                                    const uint8_t *fixed_form_sizes = DWARFFormValue::GetFixedFormSizesForAddressSize (dwarf_cu->GetAddressByteSize());
+                                    uint32_t data_offset = attributes.DIEOffsetAtIndex(i);
+                                    uint32_t data_length = fixed_form_sizes[form_value.Form()];
+                                    location.CopyOpcodeData(debug_info_data, data_offset, data_length);
+                                }
+                                else
+                                {
+                                    const char *str = form_value.AsCString(&debug_info_data);
+                                    uint32_t string_offset = str - (const char *)debug_info_data.GetDataStart();
+                                    uint32_t string_length = strlen(str) + 1;
+                                    location.CopyOpcodeData(debug_info_data, string_offset, string_length);
+                                }
+                            }
+                        }
+                        break;
                     case DW_AT_location:
                         {
+                            location_is_const_value_data = false;
+                            has_explicit_location = true;
                             if (form_value.BlockData())
                             {
                                 const DataExtractor& debug_info_data = get_debug_info_data();
@@ -7021,7 +7115,7 @@ SymbolFileDWARF::ParseVariableDIE
                         }
                         break;
 
-                    case DW_AT_artificial:      is_artificial = form_value.Unsigned() != 0; break;
+                    case DW_AT_artificial:      is_artificial = form_value.Boolean(); break;
                     case DW_AT_accessibility:   break; //accessibility = DW_ACCESS_to_AccessType(form_value.Unsigned()); break;
                     case DW_AT_declaration:
                     case DW_AT_description:
@@ -7062,10 +7156,10 @@ SymbolFileDWARF::ParseVariableDIE
                 {
                     bool op_error = false;
                     // Check if the location has a DW_OP_addr with any address value...
-                    addr_t location_has_op_addr = false;
+                    lldb::addr_t location_DW_OP_addr = LLDB_INVALID_ADDRESS;
                     if (!location_is_const_value_data)
                     {
-                        location_has_op_addr = location.LocationContains_DW_OP_addr (LLDB_INVALID_ADDRESS, op_error);
+                        location_DW_OP_addr = location.GetLocation_DW_OP_addr (0, op_error);
                         if (op_error)
                         {
                             StreamString strm;
@@ -7074,67 +7168,63 @@ SymbolFileDWARF::ParseVariableDIE
                         }
                     }
 
-                    if (location_has_op_addr)
+                    if (location_DW_OP_addr != LLDB_INVALID_ADDRESS)
                     {
                         if (is_external)
-                        {
                             scope = eValueTypeVariableGlobal;
-
-                            if (GetDebugMapSymfile ())
+                        else
+                            scope = eValueTypeVariableStatic;
+                        
+                        
+                        SymbolFileDWARFDebugMap *debug_map_symfile = GetDebugMapSymfile ();
+                        
+                        if (debug_map_symfile)
+                        {
+                            // When leaving the DWARF in the .o files on darwin,
+                            // when we have a global variable that wasn't initialized,
+                            // the .o file might not have allocated a virtual
+                            // address for the global variable. In this case it will
+                            // have created a symbol for the global variable
+                            // that is undefined/data and external and the value will
+                            // be the byte size of the variable. When we do the
+                            // address map in SymbolFileDWARFDebugMap we rely on
+                            // having an address, we need to do some magic here
+                            // so we can get the correct address for our global
+                            // variable. The address for all of these entries
+                            // will be zero, and there will be an undefined symbol
+                            // in this object file, and the executable will have
+                            // a matching symbol with a good address. So here we
+                            // dig up the correct address and replace it in the
+                            // location for the variable, and set the variable's
+                            // symbol context scope to be that of the main executable
+                            // so the file address will resolve correctly.
+                            bool linked_oso_file_addr = false;
+                            if (is_external && location_DW_OP_addr == 0)
                             {
-                                // When leaving the DWARF in the .o files on darwin,
-                                // when we have a global variable that wasn't initialized,
-                                // the .o file might not have allocated a virtual
-                                // address for the global variable. In this case it will
-                                // have created a symbol for the global variable
-                                // that is undefined and external and the value will
-                                // be the byte size of the variable. When we do the
-                                // address map in SymbolFileDWARFDebugMap we rely on
-                                // having an address, we need to do some magic here
-                                // so we can get the correct address for our global 
-                                // variable. The address for all of these entries
-                                // will be zero, and there will be an undefined symbol
-                                // in this object file, and the executable will have
-                                // a matching symbol with a good address. So here we
-                                // dig up the correct address and replace it in the
-                                // location for the variable, and set the variable's
-                                // symbol context scope to be that of the main executable
-                                // so the file address will resolve correctly.
-                                if (location.LocationContains_DW_OP_addr (0, op_error))
+                                
+                                // we have a possible uninitialized extern global
+                                ConstString const_name(mangled ? mangled : name);
+                                ObjectFile *debug_map_objfile = debug_map_symfile->GetObjectFile();
+                                if (debug_map_objfile)
                                 {
-                                    
-                                    // we have a possible uninitialized extern global
-                                    Symtab *symtab = m_obj_file->GetSymtab();
-                                    if (symtab)
+                                    Symtab *debug_map_symtab = debug_map_objfile->GetSymtab();
+                                    if (debug_map_symtab)
                                     {
-                                        ConstString const_name(name);
-                                        Symbol *undefined_symbol = symtab->FindFirstSymbolWithNameAndType (const_name,
-                                                                                                           eSymbolTypeUndefined, 
-                                                                                                           Symtab::eDebugNo, 
-                                                                                                           Symtab::eVisibilityExtern);
-                                        
-                                        if (undefined_symbol)
+                                        Symbol *exe_symbol = debug_map_symtab->FindFirstSymbolWithNameAndType (const_name,
+                                                                                                               eSymbolTypeData,
+                                                                                                               Symtab::eDebugYes,
+                                                                                                               Symtab::eVisibilityExtern);
+                                        if (exe_symbol)
                                         {
-                                            ObjectFile *debug_map_objfile = m_debug_map_symfile->GetObjectFile();
-                                            if (debug_map_objfile)
+                                            if (exe_symbol->ValueIsAddress())
                                             {
-                                                Symtab *debug_map_symtab = debug_map_objfile->GetSymtab();
-                                                Symbol *defined_symbol = debug_map_symtab->FindFirstSymbolWithNameAndType (const_name,
-                                                                                                                           eSymbolTypeData, 
-                                                                                                                           Symtab::eDebugYes, 
-                                                                                                                           Symtab::eVisibilityExtern);
-                                                if (defined_symbol)
+                                                const addr_t exe_file_addr = exe_symbol->GetAddress().GetFileAddress();
+                                                if (exe_file_addr != LLDB_INVALID_ADDRESS)
                                                 {
-                                                    if (defined_symbol->ValueIsAddress())
+                                                    if (location.Update_DW_OP_addr (exe_file_addr))
                                                     {
-                                                        const addr_t defined_addr = defined_symbol->GetAddress().GetFileAddress();
-                                                        if (defined_addr != LLDB_INVALID_ADDRESS)
-                                                        {
-                                                            if (location.Update_DW_OP_addr (defined_addr))
-                                                            {
-                                                                symbol_context_scope = defined_symbol;
-                                                            }
-                                                        }
+                                                        linked_oso_file_addr = true;
+                                                        symbol_context_scope = exe_symbol;
                                                     }
                                                 }
                                             }
@@ -7142,10 +7232,23 @@ SymbolFileDWARF::ParseVariableDIE
                                     }
                                 }
                             }
-                        }
-                        else  
-                        {
-                            scope = eValueTypeVariableStatic;
+
+                            if (!linked_oso_file_addr)
+                            {
+                                // The DW_OP_addr is not zero, but it contains a .o file address which
+                                // needs to be linked up correctly.
+                                const lldb::addr_t exe_file_addr = debug_map_symfile->LinkOSOFileAddress(this, location_DW_OP_addr);
+                                if (exe_file_addr != LLDB_INVALID_ADDRESS)
+                                {
+                                    // Update the file address for this variable
+                                    location.Update_DW_OP_addr (exe_file_addr);
+                                }
+                                else
+                                {
+                                    // Variable didn't make it into the final executable
+                                    return var_sp;
+                                }
+                            }
                         }
                     }
                     else
@@ -7580,7 +7683,7 @@ SymbolFileDWARF::LayoutRecordType (const
                                    llvm::DenseMap <const clang::CXXRecordDecl *, clang::CharUnits> &base_offsets,
                                    llvm::DenseMap <const clang::CXXRecordDecl *, clang::CharUnits> &vbase_offsets)
 {
-    LogSP log (LogChannelDWARF::GetLogIfAll(DWARF_LOG_DEBUG_INFO));
+    Log *log (LogChannelDWARF::GetLogIfAll(DWARF_LOG_DEBUG_INFO));
     RecordDeclToLayoutMap::iterator pos = m_record_decl_to_layout_map.find (record_decl);
     bool success = false;
     base_offsets.clear();
@@ -7603,7 +7706,7 @@ SymbolFileDWARF::LayoutRecordType (const
     }
     
     if (log)
-        GetObjectFile()->GetModule()->LogMessage (log.get(), 
+        GetObjectFile()->GetModule()->LogMessage (log, 
                                                   "SymbolFileDWARF::LayoutRecordType (record_decl = %p, bit_size = %" PRIu64 ", alignment = %" PRIu64 ", field_offsets[%u],base_offsets[%u], vbase_offsets[%u]) success = %i",
                                                   record_decl,
                                                   bit_size,

Modified: lldb/branches/windows/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h?rev=179679&r1=179678&r2=179679&view=diff
==============================================================================
--- lldb/branches/windows/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h (original)
+++ lldb/branches/windows/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h Wed Apr 17 03:38:48 2013
@@ -22,6 +22,7 @@
 #include "clang/AST/ExternalASTSource.h"
 #include "llvm/ADT/DenseMap.h"
 #include "llvm/ADT/SmallPtrSet.h"
+#include "llvm/ADT/SmallVector.h"
 
 #include "lldb/lldb-private.h"
 #include "lldb/Core/ClangForward.h"
@@ -337,6 +338,10 @@ protected:
     class DelayedAddObjCClassProperty;
     typedef std::vector <DelayedAddObjCClassProperty> DelayedPropertyList;
     
+    bool                    ClassOrStructIsVirtual (
+                                DWARFCompileUnit* dwarf_cu,
+                                const DWARFDebugInfoEntry *parent_die);
+
     size_t                  ParseChildMembers(
                                 const lldb_private::SymbolContext& sc,
                                 DWARFCompileUnit* dwarf_cu,
@@ -367,6 +372,7 @@ protected:
     size_t                  ParseChildEnumerators(
                                 const lldb_private::SymbolContext& sc,
                                 lldb::clang_type_t enumerator_qual_type,
+                                bool is_signed,
                                 uint32_t enumerator_byte_size,
                                 DWARFCompileUnit* dwarf_cu,
                                 const DWARFDebugInfoEntry *enum_die);
@@ -532,11 +538,16 @@ protected:
                            const lldb_private::ConstString &selector);
 
     bool
-    CopyUniqueClassMethodTypes (lldb_private::Type *class_type,
+    CopyUniqueClassMethodTypes (SymbolFileDWARF *class_symfile,
+                                lldb_private::Type *class_type,
                                 DWARFCompileUnit* src_cu,
                                 const DWARFDebugInfoEntry *src_class_die,
                                 DWARFCompileUnit* dst_cu,
-                                const DWARFDebugInfoEntry *dst_class_die);
+                                const DWARFDebugInfoEntry *dst_class_die,
+                                llvm::SmallVectorImpl <const DWARFDebugInfoEntry *> &failures);
+
+    bool
+    FixupAddress (lldb_private::Address &addr);
 
     lldb::ModuleWP                  m_debug_map_module_wp;
     SymbolFileDWARFDebugMap *       m_debug_map_symfile;

Modified: lldb/branches/windows/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp?rev=179679&r1=179678&r2=179679&view=diff
==============================================================================
--- lldb/branches/windows/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp (original)
+++ lldb/branches/windows/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp Wed Apr 17 03:38:48 2013
@@ -14,6 +14,8 @@
 #include "lldb/Core/PluginManager.h"
 #include "lldb/Core/RegularExpression.h"
 #include "lldb/Core/Section.h"
+
+//#define DEBUG_OSO_DMAP // DO NOT CHECKIN WITH THIS NOT COMMENTED OUT
 #if defined(DEBUG_OSO_DMAP)
 #include "lldb/Core/StreamFile.h"
 #endif
@@ -21,6 +23,7 @@
 
 #include "lldb/Symbol/ClangExternalASTSourceCallbacks.h"
 #include "lldb/Symbol/CompileUnit.h"
+#include "lldb/Symbol/LineTable.h"
 #include "lldb/Symbol/ObjectFile.h"
 #include "lldb/Symbol/SymbolVendor.h"
 #include "lldb/Symbol/VariableList.h"
@@ -35,192 +38,163 @@ using namespace lldb_private;
 // (so we can fixup the object file sections) and also for "Module::GetSymbolVendor()"
 // (so we can fixup the symbol file id.
 
-class DebugMapModule : public Module
+
+
+
+const SymbolFileDWARFDebugMap::FileRangeMap &
+SymbolFileDWARFDebugMap::CompileUnitInfo::GetFileRangeMap(SymbolFileDWARFDebugMap *exe_symfile)
 {
-public:
-    DebugMapModule (const ModuleSP &exe_module_sp,
-                    uint32_t cu_idx,
-                    const FileSpec& file_spec,
-                    const ArchSpec& arch,
-                    const ConstString *object_name,
-                    off_t object_offset) :
-        Module (file_spec, arch, object_name, object_offset),
-        m_exe_module_wp (exe_module_sp),
-        m_cu_idx (cu_idx)
-    {
-    }
+    if (file_range_map_valid)
+        return file_range_map;
 
-    virtual
-    ~DebugMapModule ()
+    file_range_map_valid = true;
+
+    Module *oso_module = exe_symfile->GetModuleByCompUnitInfo (this);
+    if (!oso_module)
+        return file_range_map;
+    
+    ObjectFile *oso_objfile = oso_module->GetObjectFile();
+    
+    Log *log (LogChannelDWARF::GetLogIfAll(DWARF_LOG_DEBUG_MAP));
+    if (log)
     {
+        ConstString object_name (oso_module->GetObjectName());
+        log->Printf("%p: SymbolFileDWARFDebugMap::CompileUnitInfo::GetFileRangeMap ('%s/%s%s%s%s')",
+                    this,
+                    oso_module->GetFileSpec().GetDirectory().GetCString(),
+                    oso_module->GetFileSpec().GetFilename().GetCString(),
+                    object_name ? "(" : "",
+                    object_name ? object_name.GetCString() : "",
+                    object_name ? ")" : "");
     }
+    
 
-    virtual ObjectFile *
-    GetObjectFile ()
+    std::vector<SymbolFileDWARFDebugMap::CompileUnitInfo *> cu_infos;
+    if (exe_symfile->GetCompUnitInfosForModule(oso_module, cu_infos))
     {
-        Mutex::Locker locker (m_mutex);
-        if (m_did_load_objfile == false)
+        for (auto comp_unit_info : cu_infos)
         {
-            ModuleSP exe_module_sp (m_exe_module_wp.lock());
-            if (exe_module_sp)
+            Symtab *exe_symtab = exe_symfile->GetObjectFile()->GetSymtab();
+            ModuleSP oso_module_sp (oso_objfile->GetModule());
+            Symtab *oso_symtab = oso_objfile->GetSymtab();
+            
+            ///const uint32_t fun_resolve_flags = SymbolContext::Module | eSymbolContextCompUnit | eSymbolContextFunction;
+            //SectionList *oso_sections = oso_objfile->Sections();
+            // Now we need to make sections that map from zero based object
+            // file addresses to where things eneded up in the main executable.
+            
+            assert (comp_unit_info->first_symbol_index != UINT32_MAX);
+            // End index is one past the last valid symbol index
+            const uint32_t oso_end_idx = comp_unit_info->last_symbol_index + 1;
+            for (uint32_t idx = comp_unit_info->first_symbol_index + 2; // Skip the N_SO and N_OSO
+                 idx < oso_end_idx;
+                 ++idx)
             {
-                ObjectFile *exe_objfile = exe_module_sp->GetObjectFile();
-                ObjectFile *oso_objfile = Module::GetObjectFile();
-                SymbolVendor *exe_sym_vendor = exe_module_sp->GetSymbolVendor();
-
-                if (exe_objfile && oso_objfile && exe_sym_vendor)
+                Symbol *exe_symbol = exe_symtab->SymbolAtIndex(idx);
+                if (exe_symbol)
                 {
-                    SymbolFileDWARFDebugMap *exe_symfile = (SymbolFileDWARFDebugMap *)exe_sym_vendor->GetSymbolFile();
-                    if (exe_symfile)
+                    if (exe_symbol->IsDebug() == false)
+                        continue;
+                    
+                    switch (exe_symbol->GetType())
                     {
-                        SymbolFileDWARFDebugMap::CompileUnitInfo *comp_unit_info = exe_symfile->GetCompUnitInfo (this);
-                        if (comp_unit_info)
+                    default:
+                        break;
+                        
+                    case eSymbolTypeCode:
                         {
-                            // Set the ID of the symbol file DWARF to the index of the OSO
-                            // shifted left by 32 bits to provide a unique prefix for any
-                            // UserID's that get created in the symbol file.
-                            //comp_unit_info->exe_sections_sp.reset(new SectionList);
+                            // For each N_FUN, or function that we run into in the debug map
+                            // we make a new section that we add to the sections found in the
+                            // .o file. This new section has the file address set to what the
+                            // addresses are in the .o file, and the load address is adjusted
+                            // to match where it ended up in the final executable! We do this
+                            // before we parse any dwarf info so that when it goes get parsed
+                            // all section/offset addresses that get registered will resolve
+                            // correctly to the new addresses in the main executable.
                             
-                            Symtab *exe_symtab = exe_objfile->GetSymtab();
-                            ModuleSP oso_module_sp (oso_objfile->GetModule());
-                            Symtab *oso_symtab = oso_objfile->GetSymtab();
-                            //#define DEBUG_OSO_DMAP    // Do not check in with this defined...
-#if defined(DEBUG_OSO_DMAP)
-                            StreamFile s(stdout);
-                            s << "OSO symtab:\n";
-                            oso_symtab->Dump(&s, NULL);
-                            s << "OSO sections before:\n";
-                            oso_objfile->GetSectionList()->Dump(&s, NULL, true);
-#endif
-                    
-                            ///const uint32_t fun_resolve_flags = SymbolContext::Module | eSymbolContextCompUnit | eSymbolContextFunction;
-                            //SectionList *oso_sections = oso_objfile->Sections();
-                            // Now we need to make sections that map from zero based object
-                            // file addresses to where things eneded up in the main executable.
-
-                            assert (comp_unit_info->first_symbol_index != UINT32_MAX);
-                            // End index is one past the last valid symbol index
-                            const uint32_t oso_end_idx = comp_unit_info->last_symbol_index + 1;
-                            uint32_t sect_id = 0x10000;
-                            for (uint32_t idx = comp_unit_info->first_symbol_index + 2; // Skip the N_SO and N_OSO
-                                 idx < oso_end_idx;
-                                 ++idx)
+                            // First we find the original symbol in the .o file's symbol table
+                            Symbol *oso_fun_symbol = oso_symtab->FindFirstSymbolWithNameAndType (exe_symbol->GetMangled().GetName(Mangled::ePreferMangled),
+                                                                                                 eSymbolTypeCode,
+                                                                                                 Symtab::eDebugNo,
+                                                                                                 Symtab::eVisibilityAny);
+                            if (oso_fun_symbol)
                             {
-                                Symbol *exe_symbol = exe_symtab->SymbolAtIndex(idx);
-                                if (exe_symbol)
-                                {
-                                    if (exe_symbol->IsDebug() == false)
-                                        continue;
-                                    
-                                    switch (exe_symbol->GetType())
-                                    {
-                                        default:
-                                            break;
-                                            
-                                        case eSymbolTypeCode:
-                                        {
-                                            // For each N_FUN, or function that we run into in the debug map
-                                            // we make a new section that we add to the sections found in the
-                                            // .o file. This new section has the file address set to what the
-                                            // addresses are in the .o file, and the load address is adjusted
-                                            // to match where it ended up in the final executable! We do this
-                                            // before we parse any dwarf info so that when it goes get parsed
-                                            // all section/offset addresses that get registered will resolve
-                                            // correctly to the new addresses in the main executable.
-                                            
-                                            // First we find the original symbol in the .o file's symbol table
-                                            Symbol *oso_fun_symbol = oso_symtab->FindFirstSymbolWithNameAndType(exe_symbol->GetMangled().GetName(Mangled::ePreferMangled), eSymbolTypeCode, Symtab::eDebugNo, Symtab::eVisibilityAny);
-                                            if (oso_fun_symbol)
-                                            {
-                                                // If we found the symbol, then we
-                                                SectionSP exe_fun_section (exe_symbol->GetAddress().GetSection());
-                                                SectionSP oso_fun_section (oso_fun_symbol->GetAddress().GetSection());
-                                                if (oso_fun_section)
-                                                {
-                                                    // Now we create a section that we will add as a child of the
-                                                    // section in which the .o symbol (the N_FUN) exists.
-                                                    
-                                                    // We use the exe_symbol size because the one in the .o file
-                                                    // will just be a symbol with no size, and the exe_symbol
-                                                    // size will reflect any size changes (ppc has been known to
-                                                    // shrink function sizes when it gets rid of jump islands that
-                                                    // aren't needed anymore).
-                                                    SectionSP oso_fun_section_sp (new Section (oso_fun_symbol->GetAddress().GetSection(),
-                                                                                               oso_module_sp,                         // Module (the .o file)
-                                                                                               sect_id++,                          // Section ID starts at 0x10000 and increments so the section IDs don't overlap with the standard mach IDs
-                                                                                               exe_symbol->GetMangled().GetName(Mangled::ePreferMangled), // Name the section the same as the symbol for which is was generated!
-                                                                                               eSectionTypeDebug,
-                                                                                               oso_fun_symbol->GetAddress().GetOffset(),  // File VM address offset in the current section
-                                                                                               exe_symbol->GetByteSize(),          // File size (we need the size from the executable)
-                                                                                               0, 0, 0));
-                                                    
-                                                    oso_fun_section_sp->SetLinkedLocation (exe_fun_section,
-                                                                                           exe_symbol->GetAddress().GetFileAddress() - exe_fun_section->GetFileAddress());
-                                                    oso_fun_section->GetChildren().AddSection(oso_fun_section_sp);
-                                                }
-                                            }
-                                        }
-                                            break;
-                                            
-                                        case eSymbolTypeData:
-                                        {
-                                            // For each N_GSYM we remap the address for the global by making
-                                            // a new section that we add to the sections found in the .o file.
-                                            // This new section has the file address set to what the
-                                            // addresses are in the .o file, and the load address is adjusted
-                                            // to match where it ended up in the final executable! We do this
-                                            // before we parse any dwarf info so that when it goes get parsed
-                                            // all section/offset addresses that get registered will resolve
-                                            // correctly to the new addresses in the main executable. We
-                                            // initially set the section size to be 1 byte, but will need to
-                                            // fix up these addresses further after all globals have been
-                                            // parsed to span the gaps, or we can find the global variable
-                                            // sizes from the DWARF info as we are parsing.
-                                            
-                                            // Next we find the non-stab entry that corresponds to the N_GSYM in the .o file
-                                            Symbol *oso_gsym_symbol = oso_symtab->FindFirstSymbolWithNameAndType (exe_symbol->GetMangled().GetName(),
-                                                                                                                  eSymbolTypeData,
-                                                                                                                  Symtab::eDebugNo,
-                                                                                                                  Symtab::eVisibilityAny);
-                                            
-                                            if (exe_symbol && oso_gsym_symbol && exe_symbol->ValueIsAddress() && oso_gsym_symbol->ValueIsAddress())
-                                            {
-                                                // If we found the symbol, then we
-                                                SectionSP exe_gsym_section (exe_symbol->GetAddress().GetSection());
-                                                SectionSP oso_gsym_section (oso_gsym_symbol->GetAddress().GetSection());
-                                                if (oso_gsym_section)
-                                                {
-                                                    SectionSP oso_gsym_section_sp (new Section (oso_gsym_symbol->GetAddress().GetSection(),
-                                                                                                oso_module_sp,                         // Module (the .o file)
-                                                                                                sect_id++,                          // Section ID starts at 0x10000 and increments so the section IDs don't overlap with the standard mach IDs
-                                                                                                exe_symbol->GetMangled().GetName(Mangled::ePreferMangled), // Name the section the same as the symbol for which is was generated!
-                                                                                                eSectionTypeDebug,
-                                                                                                oso_gsym_symbol->GetAddress().GetOffset(),  // File VM address offset in the current section
-                                                                                                1,                                   // We don't know the size of the global, just do the main address for now.
-                                                                                                0, 0, 0));
-                                                    
-                                                    oso_gsym_section_sp->SetLinkedLocation (exe_gsym_section,
-                                                                                            exe_symbol->GetAddress().GetFileAddress() - exe_gsym_section->GetFileAddress());
-                                                    oso_gsym_section->GetChildren().AddSection(oso_gsym_section_sp);
-                                                }
-                                            }
-                                        }
-                                            break;
-                                    }
-                                }
+                                // Add the inverse OSO file address to debug map entry mapping
+                                exe_symfile->AddOSOFileRange (this,
+                                                              exe_symbol->GetAddress().GetFileAddress(),
+                                                              oso_fun_symbol->GetAddress().GetFileAddress(),
+                                                              std::min<addr_t>(exe_symbol->GetByteSize(), oso_fun_symbol->GetByteSize()));
+                                
                             }
-                            oso_objfile->GetSectionList()->Finalize(); // Now that we're done adding sections, finalize to build fast-lookup caches
-#if defined(DEBUG_OSO_DMAP)
-                            s << "OSO sections after:\n";
-                            oso_objfile->GetSectionList()->Dump(&s, NULL, true);
-#endif
                         }
+                        break;
+                        
+                    case eSymbolTypeData:
+                        {
+                            // For each N_GSYM we remap the address for the global by making
+                            // a new section that we add to the sections found in the .o file.
+                            // This new section has the file address set to what the
+                            // addresses are in the .o file, and the load address is adjusted
+                            // to match where it ended up in the final executable! We do this
+                            // before we parse any dwarf info so that when it goes get parsed
+                            // all section/offset addresses that get registered will resolve
+                            // correctly to the new addresses in the main executable. We
+                            // initially set the section size to be 1 byte, but will need to
+                            // fix up these addresses further after all globals have been
+                            // parsed to span the gaps, or we can find the global variable
+                            // sizes from the DWARF info as we are parsing.
+                            
+                            // Next we find the non-stab entry that corresponds to the N_GSYM in the .o file
+                            Symbol *oso_gsym_symbol = oso_symtab->FindFirstSymbolWithNameAndType (exe_symbol->GetMangled().GetName(Mangled::ePreferMangled),
+                                                                                                  eSymbolTypeData,
+                                                                                                  Symtab::eDebugNo,
+                                                                                                  Symtab::eVisibilityAny);
+                            
+                            if (exe_symbol && oso_gsym_symbol &&
+                                exe_symbol->ValueIsAddress() &&
+                                oso_gsym_symbol->ValueIsAddress())
+                            {
+                                // Add the inverse OSO file address to debug map entry mapping
+                                exe_symfile->AddOSOFileRange (this,
+                                                              exe_symbol->GetAddress().GetFileAddress(),
+                                                              oso_gsym_symbol->GetAddress().GetFileAddress(),
+                                                              std::min<addr_t>(exe_symbol->GetByteSize(), oso_gsym_symbol->GetByteSize()));
+                            }
+                        }
+                        break;
                     }
                 }
             }
+            
+            exe_symfile->FinalizeOSOFileRanges (this);
+            // We don't need the symbols anymore for the .o files
+            oso_objfile->ClearSymtab();
         }
-        return m_objfile_sp.get();
     }
+    return file_range_map;
+}
+
+
+class DebugMapModule : public Module
+{
+public:
+    DebugMapModule (const ModuleSP &exe_module_sp,
+                    uint32_t cu_idx,
+                    const FileSpec& file_spec,
+                    const ArchSpec& arch,
+                    const ConstString *object_name,
+                    off_t object_offset) :
+        Module (file_spec, arch, object_name, object_offset),
+        m_exe_module_wp (exe_module_sp),
+        m_cu_idx (cu_idx)
+    {
+    }
+
+    virtual
+    ~DebugMapModule ()
+    {
+    }
+
     
     virtual SymbolVendor*
     GetSymbolVendor(bool can_create = true, lldb_private::Stream *feedback_strm = NULL)
@@ -341,14 +315,12 @@ SymbolFileDWARFDebugMap::InitializeObjec
     GetClangASTContext().SetExternalSource (ast_source_ap);
 }
 
-
-
 void
 SymbolFileDWARFDebugMap::InitOSO()
 {
     if (m_flags.test(kHaveInitializedOSOs))
         return;
-
+    
     m_flags.set(kHaveInitializedOSOs);
     // In order to get the abilities of this plug-in, we look at the list of
     // N_OSO entries (object files) from the symbol table and make sure that
@@ -358,13 +330,9 @@ SymbolFileDWARFDebugMap::InitOSO()
     Symtab* symtab = m_obj_file->GetSymtab();
     if (symtab)
     {
-        LogSP log (LogChannelDWARF::GetLogIfAll(DWARF_LOG_DEBUG_MAP));
+        Log *log (LogChannelDWARF::GetLogIfAll(DWARF_LOG_DEBUG_MAP));
 
         std::vector<uint32_t> oso_indexes;
-#if defined(DEBUG_OSO_DMAP)
-//      StreamFile s(stdout);
-//      symtab->Dump(&s, NULL, eSortOrderNone);
-#endif
         // When a mach-o symbol is encoded, the n_type field is encoded in bits
         // 23:16, and the n_desc field is encoded in bits 15:0.
         // 
@@ -384,36 +352,67 @@ SymbolFileDWARFDebugMap::InitOSO()
             symtab->SortSymbolIndexesByValue(m_func_indexes, true);
             symtab->SortSymbolIndexesByValue(m_glob_indexes, true);
 
+            for (uint32_t sym_idx : m_func_indexes)
+            {
+                const Symbol *symbol = symtab->SymbolAtIndex(sym_idx);
+                lldb::addr_t file_addr = symbol->GetAddress().GetFileAddress();
+                lldb::addr_t byte_size = symbol->GetByteSize();
+                DebugMap::Entry debug_map_entry(file_addr, byte_size, OSOEntry(sym_idx, LLDB_INVALID_ADDRESS));
+                m_debug_map.Append(debug_map_entry);
+            }
+            for (uint32_t sym_idx : m_glob_indexes)
+            {
+                const Symbol *symbol = symtab->SymbolAtIndex(sym_idx);
+                lldb::addr_t file_addr = symbol->GetAddress().GetFileAddress();
+                lldb::addr_t byte_size = symbol->GetByteSize();
+                DebugMap::Entry debug_map_entry(file_addr, byte_size, OSOEntry(sym_idx, LLDB_INVALID_ADDRESS));
+                m_debug_map.Append(debug_map_entry);
+            }
+            m_debug_map.Sort();
+
             m_compile_unit_infos.resize(oso_index_count);
-//          s.Printf("%s N_OSO symbols:\n", __PRETTY_FUNCTION__);
-//          symtab->Dump(&s, oso_indexes);
 
             for (uint32_t i=0; i<oso_index_count; ++i)
             {
-                const Symbol *so_symbol = symtab->SymbolAtIndex(oso_indexes[i] - 1);
-                const Symbol *oso_symbol = symtab->SymbolAtIndex(oso_indexes[i]);
-                assert (so_symbol);
-                assert (oso_symbol);
-                assert (so_symbol->GetType() == eSymbolTypeSourceFile);
-                assert (oso_symbol->GetType() == eSymbolTypeObjectFile);
-                m_compile_unit_infos[i].so_file.SetFile(so_symbol->GetName().AsCString(), true);
-                m_compile_unit_infos[i].oso_file.SetFile(oso_symbol->GetName().AsCString(), true);
-                uint32_t sibling_idx = so_symbol->GetSiblingIndex();
-                // The sibling index can't be less that or equal to the current index "i"
-                if (sibling_idx <= i)
+                const uint32_t so_idx = oso_indexes[i] - 1;
+                const uint32_t oso_idx = oso_indexes[i];
+                const Symbol *so_symbol = symtab->SymbolAtIndex(so_idx);
+                const Symbol *oso_symbol = symtab->SymbolAtIndex(oso_idx);
+                if (so_symbol &&
+                    oso_symbol &&
+                    so_symbol->GetType() == eSymbolTypeSourceFile &&
+                    oso_symbol->GetType() == eSymbolTypeObjectFile)
                 {
-                    m_obj_file->GetModule()->ReportError ("N_SO in symbol with UID %u has invalid sibling in debug map, please file a bug and attach the binary listed in this error", so_symbol->GetID());
+                    m_compile_unit_infos[i].so_file.SetFile(so_symbol->GetName().AsCString(), false);
+                    m_compile_unit_infos[i].oso_path = oso_symbol->GetName();
+                    uint32_t sibling_idx = so_symbol->GetSiblingIndex();
+                    // The sibling index can't be less that or equal to the current index "i"
+                    if (sibling_idx <= i)
+                    {
+                        m_obj_file->GetModule()->ReportError ("N_SO in symbol with UID %u has invalid sibling in debug map, please file a bug and attach the binary listed in this error", so_symbol->GetID());
+                    }
+                    else
+                    {
+                        const Symbol* last_symbol = symtab->SymbolAtIndex (sibling_idx - 1);
+                        m_compile_unit_infos[i].first_symbol_index = so_idx;
+                        m_compile_unit_infos[i].last_symbol_index = sibling_idx - 1;
+                        m_compile_unit_infos[i].first_symbol_id = so_symbol->GetID();
+                        m_compile_unit_infos[i].last_symbol_id = last_symbol->GetID();
+                        
+                        if (log)
+                            log->Printf("Initialized OSO 0x%8.8x: file=%s", i, oso_symbol->GetName().GetCString());
+                    }
                 }
                 else
                 {
-                    const Symbol* last_symbol = symtab->SymbolAtIndex (sibling_idx - 1);
-                    m_compile_unit_infos[i].first_symbol_index = symtab->GetIndexForSymbol(so_symbol);
-                    m_compile_unit_infos[i].last_symbol_index = symtab->GetIndexForSymbol(last_symbol);
-                    m_compile_unit_infos[i].first_symbol_id = so_symbol->GetID();
-                    m_compile_unit_infos[i].last_symbol_id = last_symbol->GetID();
-                    
-                    if (log)
-                        log->Printf("Initialized OSO 0x%8.8x: file=%s", i, oso_symbol->GetName().GetCString());
+                    if (oso_symbol == NULL)
+                        m_obj_file->GetModule()->ReportError ("N_OSO symbol[%u] can't be found, please file a bug and attach the binary listed in this error", oso_idx);
+                    else if (so_symbol == NULL)
+                        m_obj_file->GetModule()->ReportError ("N_SO not found for N_OSO symbol[%u], please file a bug and attach the binary listed in this error", oso_idx);
+                    else if (so_symbol->GetType() != eSymbolTypeSourceFile)
+                        m_obj_file->GetModule()->ReportError ("N_SO has incorrect symbol type (%u) for N_OSO symbol[%u], please file a bug and attach the binary listed in this error", so_symbol->GetType(), oso_idx);
+                    else if (oso_symbol->GetType() != eSymbolTypeSourceFile)
+                        m_obj_file->GetModule()->ReportError ("N_OSO has incorrect symbol type (%u) for N_OSO symbol[%u], please file a bug and attach the binary listed in this error", oso_symbol->GetType(), oso_idx);
                 }
             }
         }
@@ -432,37 +431,48 @@ SymbolFileDWARFDebugMap::GetModuleByOSOI
 Module *
 SymbolFileDWARFDebugMap::GetModuleByCompUnitInfo (CompileUnitInfo *comp_unit_info)
 {
-    if (comp_unit_info->oso_module_sp.get() == NULL && comp_unit_info->symbol_file_supported)
+    if (!comp_unit_info->oso_sp)
     {
-        if (!comp_unit_info->oso_file.Exists())
+        auto pos = m_oso_map.find (comp_unit_info->oso_path);
+        if (pos != m_oso_map.end())
         {
-            char path[PATH_MAX*2];
-            comp_unit_info->oso_file.GetPath(path, sizeof(path));
-            if (ObjectFile::SplitArchivePathWithObject (path,
-                                                        comp_unit_info->oso_file,
-                                                        comp_unit_info->oso_object))
-            {
-                comp_unit_info->oso_file.GetPath(path, sizeof(path));
-                //printf ("resolved archive '%s' and object '%s'\n", path, comp_unit_info->oso_object.GetCString());
-            }
-            else
+            comp_unit_info->oso_sp = pos->second;
+        }
+        else
+        {
+            comp_unit_info->oso_sp.reset (new OSOInfo());
+            m_oso_map[comp_unit_info->oso_path] = comp_unit_info->oso_sp;
+            const char *oso_path = comp_unit_info->oso_path.GetCString();
+            FileSpec oso_file (oso_path, false);
+            ConstString oso_object;
+            if (!oso_file.Exists())
             {
-                comp_unit_info->symbol_file_supported = false;
-                return NULL;
+                const bool must_exist = true;
+
+                if (!ObjectFile::SplitArchivePathWithObject (oso_path,
+                                                             oso_file,
+                                                             oso_object,
+                                                             must_exist))
+                {
+                    comp_unit_info->oso_sp->symbol_file_supported = false;
+                    return NULL;
+                }
             }
+            // Always create a new module for .o files. Why? Because we
+            // use the debug map, to add new sections to each .o file and
+            // even though a .o file might not have changed, the sections
+            // that get added to the .o file can change.
+            comp_unit_info->oso_sp->module_sp.reset (new DebugMapModule (GetObjectFile()->GetModule(),
+                                                                         GetCompUnitInfoIndex(comp_unit_info),
+                                                                         oso_file,
+                                                                         m_obj_file->GetModule()->GetArchitecture(),
+                                                                         oso_object ? &oso_object : NULL,
+                                                                         0));
         }
-        // Always create a new module for .o files. Why? Because we
-        // use the debug map, to add new sections to each .o file and
-        // even though a .o file might not have changed, the sections
-        // that get added to the .o file can change.
-        comp_unit_info->oso_module_sp.reset (new DebugMapModule (GetObjectFile()->GetModule(),
-                                                                 GetCompUnitInfoIndex(comp_unit_info),
-                                                                 comp_unit_info->oso_file,
-                                                                 m_obj_file->GetModule()->GetArchitecture(),
-                                                                 comp_unit_info->oso_object ? &comp_unit_info->oso_object : NULL,
-                                                                 0));
     }
-    return comp_unit_info->oso_module_sp.get();
+    if (comp_unit_info->oso_sp)
+        return comp_unit_info->oso_sp->module_sp.get();
+    return NULL;
 }
 
 
@@ -596,44 +606,30 @@ SymbolFileDWARFDebugMap::ParseCompileUni
 
     if (cu_idx < cu_count)
     {
-        if (m_compile_unit_infos[cu_idx].oso_compile_unit_sp.get() == NULL &&
-            m_compile_unit_infos[cu_idx].symbol_file_supported)
+        Module *oso_module = GetModuleByCompUnitInfo (&m_compile_unit_infos[cu_idx]);
+        if (oso_module)
         {
             FileSpec so_file_spec;
             if (GetFileSpecForSO (cu_idx, so_file_spec))
             {
-                Module *oso_module = GetModuleByOSOIndex (cu_idx);
-                if (oso_module)
-                {
-                     // User zero as the ID to match the compile unit at offset
-                     // zero in each .o file since each .o file can only have
-                     // one compile unit for now.
-                    lldb::user_id_t cu_id = 0;
-                    m_compile_unit_infos[cu_idx].oso_compile_unit_sp.reset (new CompileUnit (oso_module->shared_from_this(),
-                                                                                             NULL,
-                                                                                             so_file_spec,
-                                                                                             cu_id,
-                                                                                             eLanguageTypeUnknown));
-                }
-
-                if (!m_compile_unit_infos[cu_idx].oso_compile_unit_sp)
-                {
-                    m_compile_unit_infos[cu_idx].oso_compile_unit_sp.reset(new CompileUnit (m_obj_file->GetModule(),
-                                                                                            NULL,
-                                                                                            so_file_spec,
-                                                                                            cu_idx,
-                                                                                            eLanguageTypeUnknown));
-                }
+                // User zero as the ID to match the compile unit at offset
+                // zero in each .o file since each .o file can only have
+                // one compile unit for now.
+                lldb::user_id_t cu_id = 0;
+                m_compile_unit_infos[cu_idx].compile_unit_sp.reset(new CompileUnit (m_obj_file->GetModule(),
+                                                                                    NULL,
+                                                                                    so_file_spec,
+                                                                                    cu_id,
+                                                                                    eLanguageTypeUnknown));
             
-                if (m_compile_unit_infos[cu_idx].oso_compile_unit_sp)
+                if (m_compile_unit_infos[cu_idx].compile_unit_sp)
                 {
                     // Let our symbol vendor know about this compile unit
-                    m_obj_file->GetModule()->GetSymbolVendor()->SetCompileUnitAtIndex (cu_idx,
-                                                                                       m_compile_unit_infos[cu_idx].oso_compile_unit_sp);
+                    m_obj_file->GetModule()->GetSymbolVendor()->SetCompileUnitAtIndex (cu_idx, m_compile_unit_infos[cu_idx].compile_unit_sp);
                 }
             }
         }
-        comp_unit_sp = m_compile_unit_infos[cu_idx].oso_compile_unit_sp;
+        comp_unit_sp = m_compile_unit_infos[cu_idx].compile_unit_sp;
     }
 
     return comp_unit_sp;
@@ -645,23 +641,23 @@ SymbolFileDWARFDebugMap::GetCompUnitInfo
     const uint32_t cu_count = GetNumCompileUnits();
     for (uint32_t i=0; i<cu_count; ++i)
     {
-        if (sc.comp_unit == m_compile_unit_infos[i].oso_compile_unit_sp.get())
+        if (sc.comp_unit == m_compile_unit_infos[i].compile_unit_sp.get())
             return &m_compile_unit_infos[i];
     }
     return NULL;
 }
 
 
-SymbolFileDWARFDebugMap::CompileUnitInfo *
-SymbolFileDWARFDebugMap::GetCompUnitInfo (const lldb_private::Module *module)
+size_t
+SymbolFileDWARFDebugMap::GetCompUnitInfosForModule (const lldb_private::Module *module, std::vector<CompileUnitInfo *>& cu_infos)
 {
     const uint32_t cu_count = GetNumCompileUnits();
     for (uint32_t i=0; i<cu_count; ++i)
     {
-        if (module == m_compile_unit_infos[i].oso_module_sp.get())
-            return &m_compile_unit_infos[i];
+        if (module == GetModuleByCompUnitInfo (&m_compile_unit_infos[i]))
+            cu_infos.push_back (&m_compile_unit_infos[i]);
     }
-    return NULL;
+    return cu_infos.size();
 }
 
 lldb::LanguageType
@@ -738,7 +734,7 @@ SymbolFileDWARFDebugMap::ResolveTypeUID(
     const uint64_t oso_idx = GetOSOIndexFromUserID (type_uid);
     SymbolFileDWARF *oso_dwarf = GetSymbolFileByOSOIndex (oso_idx);
     if (oso_dwarf)
-        oso_dwarf->ResolveTypeUID (type_uid);
+        return oso_dwarf->ResolveTypeUID (type_uid);
     return NULL;
 }
 
@@ -757,30 +753,31 @@ SymbolFileDWARFDebugMap::ResolveSymbolCo
     if (symtab)
     {
         const addr_t exe_file_addr = exe_so_addr.GetFileAddress();
-        sc.symbol = symtab->FindSymbolContainingFileAddress (exe_file_addr, &m_func_indexes[0], m_func_indexes.size());
 
-        if (sc.symbol != NULL)
+        const DebugMap::Entry *debug_map_entry = m_debug_map.FindEntryThatContains (exe_file_addr);
+        if (debug_map_entry)
         {
-            resolved_flags |= eSymbolContextSymbol;
 
-            uint32_t oso_idx = 0;
-            CompileUnitInfo* comp_unit_info = GetCompileUnitInfoForSymbolWithID (sc.symbol->GetID(), &oso_idx);
-            if (comp_unit_info)
-            {
-                SymbolFileDWARF *oso_dwarf = GetSymbolFileByOSOIndex (oso_idx);
-                ObjectFile *oso_objfile = GetObjectFileByOSOIndex (oso_idx);
-                if (oso_dwarf && oso_objfile)
-                {
-                    SectionList *oso_section_list = oso_objfile->GetSectionList();
+            sc.symbol = symtab->SymbolAtIndex(debug_map_entry->data.GetExeSymbolIndex());
 
-                    SectionSP oso_symbol_section_sp (oso_section_list->FindSectionContainingLinkedFileAddress (exe_file_addr, UINT32_MAX));
+            if (sc.symbol != NULL)
+            {
+                resolved_flags |= eSymbolContextSymbol;
 
-                    if (oso_symbol_section_sp)
+                uint32_t oso_idx = 0;
+                CompileUnitInfo* comp_unit_info = GetCompileUnitInfoForSymbolWithID (sc.symbol->GetID(), &oso_idx);
+                if (comp_unit_info)
+                {
+                    comp_unit_info->GetFileRangeMap(this);
+                    Module *oso_module = GetModuleByCompUnitInfo (comp_unit_info);
+                    if (oso_module)
                     {
-                        const addr_t linked_file_addr = oso_symbol_section_sp->GetLinkedFileAddress();
-                        Address oso_so_addr (oso_symbol_section_sp, exe_file_addr - linked_file_addr);
-                        if (oso_so_addr.IsSectionOffset())
-                            resolved_flags |= oso_dwarf->ResolveSymbolContext (oso_so_addr, resolve_scope, sc);
+                        lldb::addr_t oso_file_addr = exe_file_addr - debug_map_entry->GetRangeBase() + debug_map_entry->data.GetOSOFileAddress();
+                        Address oso_so_addr;
+                        if (oso_module->ResolveFileAddress(oso_file_addr, oso_so_addr))
+                        {
+                            resolved_flags |= oso_module->GetSymbolVendor()->ResolveSymbolContext (oso_so_addr, resolve_scope, sc);
+                        }
                     }
                 }
             }
@@ -1255,10 +1252,10 @@ SymbolFileDWARFDebugMap::GetCompileUnit
             SymbolFileDWARF *oso_symfile = GetSymbolFileByCompUnitInfo (&m_compile_unit_infos[cu_idx]);
             if (oso_symfile == oso_dwarf)
             {
-                if (!m_compile_unit_infos[cu_idx].oso_compile_unit_sp)
-                    m_compile_unit_infos[cu_idx].oso_compile_unit_sp = ParseCompileUnitAtIndex (cu_idx);
+                if (!m_compile_unit_infos[cu_idx].compile_unit_sp)
+                    m_compile_unit_infos[cu_idx].compile_unit_sp = ParseCompileUnitAtIndex (cu_idx);
 
-                return m_compile_unit_infos[cu_idx].oso_compile_unit_sp;
+                return m_compile_unit_infos[cu_idx].compile_unit_sp;
             }
         }
     }
@@ -1266,6 +1263,24 @@ SymbolFileDWARFDebugMap::GetCompileUnit
     return lldb::CompUnitSP();
 }
 
+SymbolFileDWARFDebugMap::CompileUnitInfo *
+SymbolFileDWARFDebugMap::GetCompileUnitInfo (SymbolFileDWARF *oso_dwarf)
+{
+    if (oso_dwarf)
+    {
+        const uint32_t cu_count = GetNumCompileUnits();
+        for (uint32_t cu_idx=0; cu_idx<cu_count; ++cu_idx)
+        {
+            SymbolFileDWARF *oso_symfile = GetSymbolFileByCompUnitInfo (&m_compile_unit_infos[cu_idx]);
+            if (oso_symfile == oso_dwarf)
+            {
+                return &m_compile_unit_infos[cu_idx];
+            }
+        }
+    }
+    return NULL;
+}
+
 
 void
 SymbolFileDWARFDebugMap::SetCompileUnit (SymbolFileDWARF *oso_dwarf, const CompUnitSP &cu_sp)
@@ -1278,13 +1293,13 @@ SymbolFileDWARFDebugMap::SetCompileUnit
             SymbolFileDWARF *oso_symfile = GetSymbolFileByCompUnitInfo (&m_compile_unit_infos[cu_idx]);
             if (oso_symfile == oso_dwarf)
             {
-                if (m_compile_unit_infos[cu_idx].oso_compile_unit_sp)
+                if (m_compile_unit_infos[cu_idx].compile_unit_sp)
                 {
-                    assert (m_compile_unit_infos[cu_idx].oso_compile_unit_sp.get() == cu_sp.get());
+                    assert (m_compile_unit_infos[cu_idx].compile_unit_sp.get() == cu_sp.get());
                 }
                 else
                 {
-                    m_compile_unit_infos[cu_idx].oso_compile_unit_sp = cu_sp;
+                    m_compile_unit_infos[cu_idx].compile_unit_sp = cu_sp;
                     m_obj_file->GetModule()->GetSymbolVendor()->SetCompileUnitAtIndex(cu_idx, cu_sp);
                 }
             }
@@ -1374,4 +1389,102 @@ SymbolFileDWARFDebugMap::GetClangDeclCon
     return NULL;
 }
 
+bool
+SymbolFileDWARFDebugMap::AddOSOFileRange (CompileUnitInfo *cu_info,
+                                          lldb::addr_t exe_file_addr,
+                                          lldb::addr_t oso_file_addr,
+                                          lldb::addr_t oso_byte_size)
+{
+    assert (cu_info);// REMOVE THIS PRIOR TO CHECKIN
+    const uint32_t debug_map_idx = m_debug_map.FindEntryIndexThatContains(exe_file_addr);
+    if (debug_map_idx != UINT32_MAX)
+    {
+        DebugMap::Entry *debug_map_entry = m_debug_map.FindEntryThatContains(exe_file_addr);
+        assert (debug_map_entry);// REMOVE THIS PRIOR TO CHECKIN
+        debug_map_entry->data.SetOSOFileAddress(oso_file_addr);
+        cu_info->file_range_map.Append(FileRangeMap::Entry(oso_file_addr, oso_byte_size, exe_file_addr));
+        return true;
+    }
+    return false;
+}
+
+void
+SymbolFileDWARFDebugMap::FinalizeOSOFileRanges (CompileUnitInfo *cu_info)
+{
+    cu_info->file_range_map.Sort();
+#if defined(DEBUG_OSO_DMAP)
+    const FileRangeMap &oso_file_range_map = cu_info->GetFileRangeMap(this);
+    const size_t n = oso_file_range_map.GetSize();
+    printf ("SymbolFileDWARFDebugMap::FinalizeOSOFileRanges (cu_info = %p) %s/%s\n",
+            cu_info,
+            cu_info->oso_sp->module_sp->GetFileSpec().GetDirectory().GetCString(),
+            cu_info->oso_sp->module_sp->GetFileSpec().GetFilename().GetCString());
+    for (size_t i=0; i<n; ++i)
+    {
+        const FileRangeMap::Entry &entry = oso_file_range_map.GetEntryRef(i);
+        printf ("oso [0x%16.16" PRIx64 " - 0x%16.16" PRIx64 ") ==> exe [0x%16.16" PRIx64 " - 0x%16.16" PRIx64 ")\n",
+                entry.GetRangeBase(), entry.GetRangeEnd(),
+                entry.data, entry.data + entry.GetByteSize());
+    }
+#endif
+}
+
+lldb::addr_t
+SymbolFileDWARFDebugMap::LinkOSOFileAddress (SymbolFileDWARF *oso_symfile, lldb::addr_t oso_file_addr)
+{
+    CompileUnitInfo *cu_info = GetCompileUnitInfo (oso_symfile);
+    if (cu_info)
+    {
+        const FileRangeMap::Entry *oso_range_entry = cu_info->GetFileRangeMap(this).FindEntryThatContains(oso_file_addr);
+        if (oso_range_entry)
+        {
+            const DebugMap::Entry *debug_map_entry = m_debug_map.FindEntryThatContains(oso_range_entry->data);
+            if (debug_map_entry)
+            {
+                const lldb::addr_t offset = oso_file_addr - oso_range_entry->GetRangeBase();
+                const lldb::addr_t exe_file_addr = debug_map_entry->GetRangeBase() + offset;
+                return exe_file_addr;
+            }
+        }
+    }
+    return LLDB_INVALID_ADDRESS;
+}
+
+bool
+SymbolFileDWARFDebugMap::LinkOSOAddress (Address &addr)
+{
+    // Make sure this address hasn't been fixed already
+    Module *exe_module = GetObjectFile()->GetModule().get();
+    Module *addr_module = addr.GetModule().get();
+    if (addr_module == exe_module)
+        return true; // Address is already in terms of the main executable module
+
+    CompileUnitInfo *cu_info = GetCompileUnitInfo ((SymbolFileDWARF *)addr_module->GetSymbolVendor()->GetSymbolFile());
+    if (cu_info)
+    {
+        const lldb::addr_t oso_file_addr = addr.GetFileAddress();
+        const FileRangeMap::Entry *oso_range_entry = cu_info->GetFileRangeMap(this).FindEntryThatContains(oso_file_addr);
+        if (oso_range_entry)
+        {
+            const DebugMap::Entry *debug_map_entry = m_debug_map.FindEntryThatContains(oso_range_entry->data);
+            if (debug_map_entry)
+            {
+                const lldb::addr_t offset = oso_file_addr - oso_range_entry->GetRangeBase();
+                const lldb::addr_t exe_file_addr = debug_map_entry->GetRangeBase() + offset;
+                return exe_module->ResolveFileAddress(exe_file_addr, addr);
+            }
+        }
+    }
+    return true;
+}
+
+LineTable *
+SymbolFileDWARFDebugMap::LinkOSOLineTable (SymbolFileDWARF *oso_dwarf, LineTable *line_table)
+{
+    CompileUnitInfo *cu_info = GetCompileUnitInfo (oso_dwarf);
+    if (cu_info)
+        return line_table->LinkLineTable(cu_info->GetFileRangeMap(this));
+    return NULL;
+}
+
 

Modified: lldb/branches/windows/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.h?rev=179679&r1=179678&r2=179679&view=diff
==============================================================================
--- lldb/branches/windows/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.h (original)
+++ lldb/branches/windows/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.h Wed Apr 17 03:38:48 2013
@@ -16,6 +16,7 @@
 
 #include "clang/AST/CharUnits.h"
 
+#include "lldb/Core/RangeMap.h"
 #include "lldb/Symbol/SymbolFile.h"
 
 #include "UniqueDWARFASTType.h"
@@ -129,43 +130,55 @@ protected:
 
     friend class SymbolFileDWARF;
     friend class DebugMapModule;
+    struct OSOInfo
+    {
+        lldb::ModuleSP module_sp;
+        bool symbol_file_supported;
+        
+        OSOInfo() :
+            module_sp (),
+            symbol_file_supported (true)
+        {
+        }
+    };
+    
+    typedef STD_SHARED_PTR(OSOInfo) OSOInfoSP;
+
+    typedef lldb_private::RangeDataVector<lldb::addr_t, lldb::addr_t, lldb::addr_t> FileRangeMap;
+
     //------------------------------------------------------------------
     // Class specific types
     //------------------------------------------------------------------
     struct CompileUnitInfo
     {
         lldb_private::FileSpec so_file;
-        lldb_private::FileSpec oso_file;
-        lldb_private::ConstString oso_object; // for archives this will be the .o file in the "oso_file"
-//        lldb_private::Symbol *so_symbol;
-//        lldb_private::Symbol *oso_symbol;
-//        lldb_private::Symbol *last_symbol;
+        lldb_private::ConstString oso_path;
+        OSOInfoSP oso_sp;
+        lldb::CompUnitSP compile_unit_sp;
         uint32_t first_symbol_index;
         uint32_t last_symbol_index;
         uint32_t first_symbol_id;
         uint32_t last_symbol_id;
-        lldb::ModuleSP oso_module_sp;
-        lldb::CompUnitSP oso_compile_unit_sp;
-//        SymbolFileDWARF *oso_symfile;
-        bool symbol_file_supported;
+        FileRangeMap file_range_map;
+        bool file_range_map_valid;
+        
 
         CompileUnitInfo() :
             so_file (),
-            oso_file (),
-            oso_object (),
-//            so_symbol (NULL),
-//            oso_symbol (NULL),
-//            last_symbol (NULL),
+            oso_path (),
+            oso_sp (),
+            compile_unit_sp (),
             first_symbol_index (UINT32_MAX),
             last_symbol_index (UINT32_MAX),
             first_symbol_id (UINT32_MAX),
             last_symbol_id (UINT32_MAX),
-            oso_module_sp (),
-            oso_compile_unit_sp (),
-//            oso_symfile (NULL),
-            symbol_file_supported (true)
+            file_range_map (),
+            file_range_map_valid (false)
         {
         }
+        
+        const FileRangeMap &
+        GetFileRangeMap(SymbolFileDWARFDebugMap *exe_symfile);
     };
 
     //------------------------------------------------------------------
@@ -185,8 +198,9 @@ protected:
     CompileUnitInfo *
     GetCompUnitInfo (const lldb_private::SymbolContext& sc);
 
-    CompileUnitInfo *
-    GetCompUnitInfo (const lldb_private::Module *oso_module);
+    size_t
+    GetCompUnitInfosForModule (const lldb_private::Module *oso_module,
+                               std::vector<CompileUnitInfo *>& cu_infos);
     
     lldb_private::Module *
     GetModuleByCompUnitInfo (CompileUnitInfo *comp_unit_info);
@@ -237,6 +251,9 @@ protected:
 
     lldb::CompUnitSP
     GetCompileUnit (SymbolFileDWARF *oso_dwarf);
+    
+    CompileUnitInfo *
+    GetCompileUnitInfo (SymbolFileDWARF *oso_dwarf);
 
     lldb::TypeSP
     FindDefinitionTypeForDWARFDeclContext (const DWARFDeclContext &die_decl_ctx);    
@@ -255,6 +272,58 @@ protected:
     {
         return m_unique_ast_type_map;
     }
+    
+    
+    //------------------------------------------------------------------
+    // OSOEntry
+    //------------------------------------------------------------------
+    class OSOEntry
+    {
+    public:
+        
+        OSOEntry () :
+        m_exe_sym_idx (UINT32_MAX),
+        m_oso_file_addr (LLDB_INVALID_ADDRESS)
+        {
+        }
+        
+        OSOEntry (uint32_t exe_sym_idx,
+                  lldb::addr_t oso_file_addr) :
+        m_exe_sym_idx (exe_sym_idx),
+        m_oso_file_addr (oso_file_addr)
+        {
+        }
+        
+        uint32_t
+        GetExeSymbolIndex () const
+        {
+            return m_exe_sym_idx;
+        }
+        
+        bool
+        operator < (const OSOEntry &rhs) const
+        {
+            return m_exe_sym_idx < rhs.m_exe_sym_idx;
+        }
+        
+        lldb::addr_t
+        GetOSOFileAddress () const
+        {
+            return m_oso_file_addr;
+        }
+        
+        void
+        SetOSOFileAddress (lldb::addr_t oso_file_addr)
+        {
+            m_oso_file_addr = oso_file_addr;
+        }
+    protected:
+        uint32_t m_exe_sym_idx;
+        lldb::addr_t m_oso_file_addr;
+    };
+
+    typedef lldb_private::RangeDataVector<lldb::addr_t, lldb::addr_t, OSOEntry> DebugMap;
+
     //------------------------------------------------------------------
     // Member Variables
     //------------------------------------------------------------------
@@ -262,8 +331,80 @@ protected:
     std::vector<CompileUnitInfo> m_compile_unit_infos;
     std::vector<uint32_t> m_func_indexes;   // Sorted by address
     std::vector<uint32_t> m_glob_indexes;
+    std::map<lldb_private::ConstString, OSOInfoSP> m_oso_map;
     UniqueDWARFASTTypeMap m_unique_ast_type_map;
     lldb_private::LazyBool m_supports_DW_AT_APPLE_objc_complete_type;
+    DebugMap m_debug_map;
+    
+    //------------------------------------------------------------------
+    // When an object file from the debug map gets parsed in
+    // SymbolFileDWARF, it needs to tell the debug map about the object
+    // files addresses by calling this function once for each N_FUN,
+    // N_GSYM and N_STSYM and after all entries in the debug map have
+    // been matched up, FinalizeOSOFileRanges() should be called.
+    //------------------------------------------------------------------
+    bool
+    AddOSOFileRange (CompileUnitInfo *cu_info,
+                     lldb::addr_t exe_file_addr,
+                     lldb::addr_t oso_file_addr,
+                     lldb::addr_t oso_byte_size);
+    
+    //------------------------------------------------------------------
+    // Called after calling AddOSOFileRange() for each object file debug
+    // map entry to finalize the info for the unlinked compile unit.
+    //------------------------------------------------------------------
+    void
+    FinalizeOSOFileRanges (CompileUnitInfo *cu_info);
+
+    //------------------------------------------------------------------
+    /// Convert \a addr from a .o file address, to an executable address.
+    ///
+    /// @param[in] addr
+    ///     A section offset address from a .o file
+    ///
+    /// @return
+    ///     Returns true if \a addr was converted to be an executable
+    ///     section/offset address, false otherwise.
+    //------------------------------------------------------------------
+    bool
+    LinkOSOAddress (lldb_private::Address &addr);
+    
+    //------------------------------------------------------------------
+    /// Convert a .o file "file address" to an executable "file address".
+    ///
+    /// @param[in] oso_symfile
+    ///     The DWARF symbol file that contains \a oso_file_addr
+    ///
+    /// @param[in] oso_file_addr
+    ///     A .o file "file address" to convert.
+    ///
+    /// @return
+    ///     LLDB_INVALID_ADDRESS if \a oso_file_addr is not in the
+    ///     linked executable, otherwise a valid "file address" from the
+    ///     linked executable that contains the debug map.
+    //------------------------------------------------------------------
+    lldb::addr_t
+    LinkOSOFileAddress (SymbolFileDWARF *oso_symfile, lldb::addr_t oso_file_addr);
+            
+    //------------------------------------------------------------------
+    /// Given a line table full of lines with "file adresses" that are
+    /// for a .o file represented by \a oso_symfile, link a new line table
+    /// and return it.
+    ///
+    /// @param[in] oso_symfile
+    ///     The DWARF symbol file that produced the \a line_table
+    ///
+    /// @param[in] addr
+    ///     A section offset address from a .o file
+    ///
+    /// @return
+    ///     Returns a valid line table full of linked addresses, or NULL
+    ///     if none of the line table adresses exist in the main
+    ///     executable.
+    //------------------------------------------------------------------
+    lldb_private::LineTable *
+    LinkOSOLineTable (SymbolFileDWARF *oso_symfile,
+                      lldb_private::LineTable *line_table);
 };
 
 #endif // #ifndef SymbolFileDWARF_SymbolFileDWARFDebugMap_h_

Modified: lldb/branches/windows/source/Plugins/SymbolVendor/MacOSX/SymbolVendorMacOSX.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Plugins/SymbolVendor/MacOSX/SymbolVendorMacOSX.cpp?rev=179679&r1=179678&r2=179679&view=diff
==============================================================================
--- lldb/branches/windows/source/Plugins/SymbolVendor/MacOSX/SymbolVendorMacOSX.cpp (original)
+++ lldb/branches/windows/source/Plugins/SymbolVendor/MacOSX/SymbolVendorMacOSX.cpp Wed Apr 17 03:38:48 2013
@@ -202,7 +202,8 @@ SymbolVendorMacOSX::CreateInstance (cons
             if (dsym_fspec)
             {
                 DataBufferSP dsym_file_data_sp;
-                dsym_objfile_sp = ObjectFile::FindPlugin(module_sp, &dsym_fspec, 0, dsym_fspec.GetByteSize(), dsym_file_data_sp);
+                lldb::offset_t dsym_file_data_offset = 0;
+                dsym_objfile_sp = ObjectFile::FindPlugin(module_sp, &dsym_fspec, 0, dsym_fspec.GetByteSize(), dsym_file_data_sp, dsym_file_data_offset);
                 if (UUIDsMatch(module_sp.get(), dsym_objfile_sp.get(), feedback_strm))
                 {
                     char dsym_path[PATH_MAX];

Modified: lldb/branches/windows/source/Plugins/UnwindAssembly/InstEmulation/UnwindAssemblyInstEmulation.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Plugins/UnwindAssembly/InstEmulation/UnwindAssemblyInstEmulation.cpp?rev=179679&r1=179678&r2=179679&view=diff
==============================================================================
--- lldb/branches/windows/source/Plugins/UnwindAssembly/InstEmulation/UnwindAssemblyInstEmulation.cpp (original)
+++ lldb/branches/windows/source/Plugins/UnwindAssembly/InstEmulation/UnwindAssemblyInstEmulation.cpp Wed Apr 17 03:38:48 2013
@@ -55,10 +55,11 @@ UnwindAssemblyInstEmulation::GetNonCallS
         thread.CalculateExecutionContext(exe_ctx);
         DisassemblerSP disasm_sp (Disassembler::DisassembleRange (m_arch,
                                                                   NULL,
+                                                                  NULL,
                                                                   exe_ctx,
                                                                   range));
         
-        LogSP log(GetLogIfAllCategoriesSet (LIBLLDB_LOG_UNWIND));
+        Log *log(GetLogIfAllCategoriesSet (LIBLLDB_LOG_UNWIND));
 
         if (disasm_sp)
         {
@@ -396,7 +397,7 @@ UnwindAssemblyInstEmulation::ReadMemory
                                          void *dst,
                                          size_t dst_len)
 {
-    LogSP log(GetLogIfAllCategoriesSet (LIBLLDB_LOG_UNWIND));
+    Log *log(GetLogIfAllCategoriesSet (LIBLLDB_LOG_UNWIND));
 
     if (log && log->GetVerbose ())
     {
@@ -437,7 +438,7 @@ UnwindAssemblyInstEmulation::WriteMemory
                         instruction->GetArchitecture ().GetByteOrder(), 
                         instruction->GetArchitecture ().GetAddressByteSize());
 
-    LogSP log(GetLogIfAllCategoriesSet (LIBLLDB_LOG_UNWIND));
+    Log *log(GetLogIfAllCategoriesSet (LIBLLDB_LOG_UNWIND));
 
     if (log && log->GetVerbose ())
     {
@@ -544,7 +545,7 @@ UnwindAssemblyInstEmulation::ReadRegiste
 {
     bool synthetic = GetRegisterValue (*reg_info, reg_value);
 
-    LogSP log(GetLogIfAllCategoriesSet (LIBLLDB_LOG_UNWIND));
+    Log *log(GetLogIfAllCategoriesSet (LIBLLDB_LOG_UNWIND));
     
     if (log && log->GetVerbose ())
     {
@@ -574,7 +575,7 @@ UnwindAssemblyInstEmulation::WriteRegist
                                             const RegisterInfo *reg_info,
                                             const RegisterValue &reg_value)
 {
-    LogSP log(GetLogIfAllCategoriesSet (LIBLLDB_LOG_UNWIND));
+    Log *log(GetLogIfAllCategoriesSet (LIBLLDB_LOG_UNWIND));
 
     if (log && log->GetVerbose ())
     {

Modified: lldb/branches/windows/source/Symbol/Block.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Symbol/Block.cpp?rev=179679&r1=179678&r2=179679&view=diff
==============================================================================
--- lldb/branches/windows/source/Symbol/Block.cpp (original)
+++ lldb/branches/windows/source/Symbol/Block.cpp Wed Apr 17 03:38:48 2013
@@ -395,7 +395,7 @@ Block::AddRange (const Range& range)
     Block *parent_block = GetParent ();
     if (parent_block && !parent_block->Contains(range))
     {
-        LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_SYMBOLS));
+        Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_SYMBOLS));
         if (log)
         {
             ModuleSP module_sp (m_parent_scope->CalculateSymbolContextModule());

Modified: lldb/branches/windows/source/Symbol/ClangASTContext.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Symbol/ClangASTContext.cpp?rev=179679&r1=179678&r2=179679&view=diff
==============================================================================
--- lldb/branches/windows/source/Symbol/ClangASTContext.cpp (original)
+++ lldb/branches/windows/source/Symbol/ClangASTContext.cpp Wed Apr 17 03:38:48 2013
@@ -267,6 +267,8 @@ ParseLangArgs
     Opts.GNUInline = !Std.isC99();
     Opts.HexFloats = Std.hasHexFloats();
     Opts.ImplicitInt = Std.hasImplicitInt();
+    
+    Opts.WChar = true;
 
     // OpenCL has some additional defaults.
     if (LangStd == LangStandard::lang_opencl) {
@@ -299,7 +301,7 @@ ParseLangArgs
 //    llvm::StringRef Vis = getLastArgValue(Args, OPT_fvisibility,
 //                                          "default");
 //    if (Vis == "default")
-        Opts.setVisibilityMode(DefaultVisibility);
+        Opts.setValueVisibilityMode(DefaultVisibility);
 //    else if (Vis == "hidden")
 //        Opts.setVisibilityMode(LangOptions::Hidden);
 //    else if (Vis == "protected")
@@ -595,7 +597,7 @@ public:
         return new NullDiagnosticConsumer ();
     }
 private:
-    LogSP m_log;
+    Log * m_log;
 };
 
 DiagnosticConsumer *
@@ -943,6 +945,12 @@ ClangASTContext::GetBuiltInType_objc_id(
     return getASTContext()->getObjCIdType().getAsOpaquePtr();
 }
 
+lldb::clang_type_t
+ClangASTContext::GetBuiltInType_objc_id(clang::ASTContext *ast)
+{
+    return ast->getObjCIdType().getAsOpaquePtr();
+}
+
 clang_type_t
 ClangASTContext::GetBuiltInType_objc_Class()
 {
@@ -1125,7 +1133,12 @@ ClangASTContext::GetTypeForDecl (ObjCInt
 #pragma mark Structure, Unions, Classes
 
 clang_type_t
-ClangASTContext::CreateRecordType (DeclContext *decl_ctx, AccessType access_type, const char *name, int kind, LanguageType language, ClangASTMetadata *metadata)
+ClangASTContext::CreateRecordType (DeclContext *decl_ctx,
+                                   AccessType access_type,
+                                   const char *name,
+                                   int kind,
+                                   LanguageType language,
+                                   ClangASTMetadata *metadata)
 {
     ASTContext *ast = getASTContext();
     assert (ast != NULL);
@@ -1153,16 +1166,20 @@ ClangASTContext::CreateRecordType (DeclC
                                                  SourceLocation(),
                                                  name && name[0] ? &ast->Idents.get(name) : NULL);
     
-    if (decl && metadata)
-        SetMetadata(ast, (uintptr_t)decl, *metadata);
-    
-    if (decl_ctx)
+    if (decl)
     {
+        if (metadata)
+            SetMetadata(ast, decl, *metadata);
+
         if (access_type != eAccessNone)
             decl->setAccess (ConvertAccessTypeToAccessSpecifier (access_type));
+    
+        if (decl_ctx)
         decl_ctx->addDecl (decl);
+
+        return ast->getTagDeclType(decl).getAsOpaquePtr();
     }
-    return ast->getTagDeclType(decl).getAsOpaquePtr();
+    return NULL;
 }
 
 static TemplateParameterList *
@@ -1309,8 +1326,8 @@ ClangASTContext::CreateClassTemplateDecl
 
     // With templated classes, we say that a class is templated with
     // specializations, but that the bare class has no functions.
-    template_cxx_decl->startDefinition();
-    template_cxx_decl->completeDefinition();
+    //template_cxx_decl->startDefinition();
+    //template_cxx_decl->completeDefinition();
     
     class_template_decl = ClassTemplateDecl::Create (*ast,
                                                      decl_ctx,  // What decl context do we use here? TU? The actual decl context?
@@ -1356,6 +1373,8 @@ ClangASTContext::CreateClassTemplateSpec
                                                                                                                    template_param_infos.args.size(),
                                                                                                                    NULL);
     
+    class_template_specialization_decl->setSpecializationKind(TSK_ExplicitSpecialization);
+    
     return class_template_specialization_decl;
 }
 
@@ -1760,6 +1779,9 @@ ClangASTContext::AddMethodToCXXRecordTyp
     }
     else if (decl_name == cxx_record_decl->getDeclName())
     {
+       if (is_artificial && method_function_prototype->getNumArgs() == 1)
+          return NULL; // skip artificial copy constructors
+        
        cxx_ctor_decl = CXXConstructorDecl::Create (*ast,
                                                    cxx_record_decl,
                                                    SourceLocation(),
@@ -1793,7 +1815,6 @@ ClangASTContext::AddMethodToCXXRecordTyp
                                                          DeclarationNameInfo (ast->DeclarationNames.getCXXOperatorName (op_kind), SourceLocation()),
                                                          method_qual_type,
                                                          NULL, // TypeSourceInfo *
-                                                         is_static,
                                                          SC_None,
                                                          is_inline,
                                                          false /*is_constexpr*/,
@@ -1823,7 +1844,6 @@ ClangASTContext::AddMethodToCXXRecordTyp
                                                      DeclarationNameInfo (decl_name, SourceLocation()),
                                                      method_qual_type,
                                                      NULL, // TypeSourceInfo *
-                                                     is_static,
                                                      SC_None,
                                                      is_inline,
                                                      false /*is_constexpr*/,
@@ -1855,7 +1875,6 @@ ClangASTContext::AddMethodToCXXRecordTyp
                                                method_function_prototype->getArgType(param_index), 
                                                NULL,
                                                SC_None,
-                                               SC_None,
                                                NULL));
     }
     
@@ -1973,10 +1992,10 @@ ClangASTContext::AddFieldToRecordType
                 }
             }
 
-            field->setAccess (ConvertAccessTypeToAccessSpecifier (access));
-
             if (field)
             {
+                field->setAccess (ConvertAccessTypeToAccessSpecifier (access));
+                
                 record_decl->addDecl(field);
                 
 #ifdef LLDB_CONFIGURATION_DEBUG
@@ -2003,6 +2022,51 @@ ClangASTContext::AddFieldToRecordType
     return field;
 }
 
+clang::VarDecl *
+ClangASTContext::AddVariableToRecordType (clang::ASTContext *ast,
+                                          lldb::clang_type_t record_opaque_type,
+                                          const char *name,
+                                          lldb::clang_type_t var_type,
+                                          AccessType access)
+{
+    clang::VarDecl *var_decl = NULL;
+
+    if (record_opaque_type == NULL || var_type == NULL)
+        return NULL;
+    
+    IdentifierTable *identifier_table = &ast->Idents;
+    
+    assert (ast != NULL);
+    assert (identifier_table != NULL);
+    
+    const RecordType *record_type = dyn_cast<RecordType>(QualType::getFromOpaquePtr(record_opaque_type).getTypePtr());
+    
+    if (record_type)
+    {
+        RecordDecl *record_decl = record_type->getDecl();
+        
+        var_decl = VarDecl::Create (*ast,                                       // ASTContext &
+                                    record_decl,                                // DeclContext *
+                                    SourceLocation(),                           // SourceLocation StartLoc
+                                    SourceLocation(),                           // SourceLocation IdLoc
+                                    name ? &identifier_table->get(name) : NULL, // IdentifierInfo *
+                                    QualType::getFromOpaquePtr(var_type),       // Variable QualType
+                                    NULL,                                       // TypeSourceInfo *
+                                    SC_Static);                                 // StorageClass
+        if (var_decl)
+        {
+            var_decl->setAccess(ConvertAccessTypeToAccessSpecifier (access));
+            record_decl->addDecl(var_decl);
+                
+#ifdef LLDB_CONFIGURATION_DEBUG
+            VerifyDecl(var_decl);
+#endif
+        }
+    }
+    return var_decl;
+}
+
+
 static clang::AccessSpecifier UnifyAccessSpecifiers (clang::AccessSpecifier lhs,
                                                      clang::AccessSpecifier rhs)
 {
@@ -2233,7 +2297,7 @@ ClangASTContext::CreateBaseClassSpecifie
                                      is_virtual, 
                                      base_of_class, 
                                      ConvertAccessTypeToAccessSpecifier (access), 
-                                     getASTContext()->CreateTypeSourceInfo (QualType::getFromOpaquePtr(base_class_type)),
+                                     getASTContext()->getTrivialTypeSourceInfo (QualType::getFromOpaquePtr(base_class_type)),
                                      SourceLocation());
     return NULL;
 }
@@ -2295,7 +2359,7 @@ ClangASTContext::CreateObjCClass
                                                          isInternal);
     
     if (decl && metadata)
-        SetMetadata(ast, (uintptr_t)decl, *metadata);
+        SetMetadata(ast, decl, *metadata);
     
     return ast->getObjCInterfaceType(decl).getAsOpaquePtr();
 }
@@ -2441,9 +2505,9 @@ ClangASTContext::AddObjCClassProperty
             {
                 clang::TypeSourceInfo *prop_type_source;
                 if (ivar_decl)
-                    prop_type_source = ast->CreateTypeSourceInfo (ivar_decl->getType());
+                    prop_type_source = ast->getTrivialTypeSourceInfo (ivar_decl->getType());
                 else
-                    prop_type_source = ast->CreateTypeSourceInfo (QualType::getFromOpaquePtr(property_opaque_type));
+                    prop_type_source = ast->getTrivialTypeSourceInfo (QualType::getFromOpaquePtr(property_opaque_type));
                 
                 ObjCPropertyDecl *property_decl = ObjCPropertyDecl::Create(*ast, 
                                                                            class_interface_decl, 
@@ -2457,7 +2521,7 @@ ClangASTContext::AddObjCClassProperty
                 if (property_decl)
                 {
                     if (metadata)
-                        SetMetadata(ast, (uintptr_t)property_decl, *metadata);
+                        SetMetadata(ast, property_decl, *metadata);
                     
                     class_interface_decl->addDecl (property_decl);
                     
@@ -2537,7 +2601,7 @@ ClangASTContext::AddObjCClassProperty
                                                                         HasRelatedResultType);
                         
                         if (getter && metadata)
-                            SetMetadata(ast, (uintptr_t)getter, *metadata);
+                            SetMetadata(ast, getter, *metadata);
                                                 
                         getter->setMethodParams(*ast, ArrayRef<ParmVarDecl*>(), ArrayRef<SourceLocation>());
                         
@@ -2572,7 +2636,7 @@ ClangASTContext::AddObjCClassProperty
                                                                         HasRelatedResultType);
                         
                         if (setter && metadata)
-                            SetMetadata(ast, (uintptr_t)setter, *metadata);
+                            SetMetadata(ast, setter, *metadata);
                         
                         llvm::SmallVector<ParmVarDecl *, 1> params;
 
@@ -2583,7 +2647,6 @@ ClangASTContext::AddObjCClassProperty
                                                                NULL, // anonymous
                                                                QualType::getFromOpaquePtr(property_opaque_type_to_access), 
                                                                NULL,
-                                                               SC_Auto, 
                                                                SC_Auto,
                                                                NULL));
                         
@@ -2633,14 +2696,12 @@ ClangASTContext::ObjCDeclHasIVars (ObjCI
 }
 
 ObjCMethodDecl *
-ClangASTContext::AddMethodToObjCObjectType
-(
-    ASTContext *ast,
-    clang_type_t class_opaque_type, 
+ClangASTContext::AddMethodToObjCObjectType (ASTContext *ast,
+                                            clang_type_t class_opaque_type,
     const char *name,  // the full symbol name as seen in the symbol table ("-[NString stringWithCString:]")
     clang_type_t method_opaque_type,
-    lldb::AccessType access
-)
+                                            lldb::AccessType access,
+                                            bool is_artificial)
 {
     if (class_opaque_type == NULL || method_opaque_type == NULL)
         return NULL;
@@ -2671,8 +2732,6 @@ ClangASTContext::AddMethodToObjCObjectTy
         return NULL;
     
     selector_start++;
-    if (!(::isalpha (selector_start[0]) || selector_start[0] == '_'))
-        return NULL;
     llvm::SmallVector<IdentifierInfo *, 12> selector_idents;
 
     size_t len = 0;
@@ -2720,6 +2779,9 @@ ClangASTContext::AddMethodToObjCObjectTy
     ObjCMethodDecl::ImplementationControl imp_control = ObjCMethodDecl::None;
 
     const unsigned num_args = method_function_prototype->getNumArgs();
+    
+    if (num_args != num_selectors_with_args)
+        return NULL; // some debug information is corrupt.  We are not going to deal with it.
 
     ObjCMethodDecl *objc_method_decl = ObjCMethodDecl::Create (*ast,
                                                                SourceLocation(), // beginLoc,
@@ -2731,7 +2793,7 @@ ClangASTContext::AddMethodToObjCObjectTy
                                                                name[0] == '-',
                                                                is_variadic,
                                                                is_synthesized,
-                                                               true, // is_implicitly_declared
+                                                               true, // is_implicitly_declared; we force this to true because we don't have source locations
                                                                is_defined,
                                                                imp_control,
                                                                false /*has_related_result_type*/);
@@ -2753,7 +2815,6 @@ ClangASTContext::AddMethodToObjCObjectTy
                                                    NULL, // anonymous
                                                    method_function_prototype->getArgType(param_index), 
                                                    NULL,
-                                                   SC_Auto, 
                                                    SC_Auto,
                                                    NULL));
         }
@@ -2904,14 +2965,20 @@ ClangASTContext::GetTypeInfo
     switch (type_class)
     {
     case clang::Type::Builtin:
-        switch (cast<clang::BuiltinType>(qual_type)->getKind())
         {
+            const BuiltinType *builtin_type = dyn_cast<BuiltinType>(qual_type->getCanonicalTypeInternal());
+
+            uint32_t builtin_type_flags = eTypeIsBuiltIn | eTypeHasValue;
+            switch (builtin_type->getKind())
+            {
         case clang::BuiltinType::ObjCId:
         case clang::BuiltinType::ObjCClass:
             if (ast && pointee_or_element_clang_type)
                 *pointee_or_element_clang_type = ast->ObjCBuiltinClassTy.getAsOpaquePtr();
-            return eTypeIsBuiltIn | eTypeIsPointer | eTypeHasValue;
+                builtin_type_flags |= eTypeIsPointer | eTypeIsObjC;
                 break;
+
+            case clang::BuiltinType::ObjCSel:
         case clang::BuiltinType::Bool:
         case clang::BuiltinType::Char_U:
         case clang::BuiltinType::UChar:
@@ -2934,18 +3001,42 @@ ClangASTContext::GetTypeInfo
         case clang::BuiltinType::Float:
         case clang::BuiltinType::Double:
         case clang::BuiltinType::LongDouble:
-                return eTypeIsBuiltIn | eTypeHasValue | eTypeIsScalar;
-        default: 
+                builtin_type_flags |= eTypeIsScalar;
+                if (builtin_type->isInteger())
+                {
+                    builtin_type_flags |= eTypeIsInteger;
+                    if (builtin_type->isSignedInteger())
+                        builtin_type_flags |= eTypeIsSigned;
+                }
+                else if (builtin_type->isFloatingPoint())
+                    builtin_type_flags |= eTypeIsFloat;
             break;
+            default:
+                break;
+        }
+            return builtin_type_flags;
         }
-        return eTypeIsBuiltIn | eTypeHasValue;
 
-    case clang::Type::BlockPointer:                     
+    case clang::Type::BlockPointer:
         if (pointee_or_element_clang_type)
             *pointee_or_element_clang_type = qual_type->getPointeeType().getAsOpaquePtr();
         return eTypeIsPointer | eTypeHasChildren | eTypeIsBlock;
 
-    case clang::Type::Complex:                          return eTypeIsBuiltIn | eTypeHasValue;
+    case clang::Type::Complex:
+        {
+            uint32_t complex_type_flags = eTypeIsBuiltIn | eTypeHasValue | eTypeIsComplex;
+            const ComplexType *complex_type = dyn_cast<ComplexType>(qual_type->getCanonicalTypeInternal());
+            if (complex_type)
+            {
+                QualType complex_element_type (complex_type->getElementType());
+                if (complex_element_type->isIntegerType())
+                    complex_type_flags |= eTypeIsFloat;
+                else if (complex_element_type->isFloatingType())
+                    complex_type_flags |= eTypeIsInteger;
+            }
+            return complex_type_flags;
+        }
+        break;
 
     case clang::Type::ConstantArray:
     case clang::Type::DependentSizedArray:
@@ -2969,7 +3060,6 @@ ClangASTContext::GetTypeInfo
         return ClangASTContext::GetTypeInfo (cast<ElaboratedType>(qual_type)->getNamedType().getAsOpaquePtr(),
                                              ast, 
                                              pointee_or_element_clang_type);
-    case clang::Type::ExtVector:                        return eTypeHasChildren | eTypeIsVector;
     case clang::Type::FunctionProto:                    return eTypeIsFuncPrototype | eTypeHasValue;
     case clang::Type::FunctionNoProto:                  return eTypeIsFuncPrototype | eTypeHasValue;
     case clang::Type::InjectedClassName:                return 0;
@@ -3013,7 +3103,21 @@ ClangASTContext::GetTypeInfo
     case clang::Type::TypeOfExpr:                       return 0;
     case clang::Type::TypeOf:                           return 0;
     case clang::Type::UnresolvedUsing:                  return 0;
-    case clang::Type::Vector:                           return eTypeHasChildren | eTypeIsVector;
+
+    case clang::Type::ExtVector:
+    case clang::Type::Vector:
+        {
+            uint32_t vector_type_flags = eTypeHasChildren | eTypeIsVector;
+            const VectorType *vector_type = dyn_cast<VectorType>(qual_type->getCanonicalTypeInternal());
+            if (vector_type)
+            {
+                if (vector_type->isIntegerType())
+                    vector_type_flags |= eTypeIsFloat;
+                else if (vector_type->isFloatingType())
+                    vector_type_flags |= eTypeIsInteger;
+            }
+            return vector_type_flags;
+        }
     default:                                            return 0;
     }
     return 0;
@@ -3168,6 +3272,11 @@ ClangASTContext::GetNumChildren (clang::
         }
         break;
 
+    case clang::Type::Vector:
+    case clang::Type::ExtVector:
+        num_children = cast<VectorType>(qual_type.getTypePtr())->getNumElements();
+        break;
+
     case clang::Type::ConstantArray:
         num_children = cast<ConstantArrayType>(qual_type.getTypePtr())->getSize().getLimitedValue();
         break;
@@ -3372,7 +3481,7 @@ ClangASTContext::GetNumFields (clang::AS
 clang_type_t
 ClangASTContext::GetDirectBaseClassAtIndex (clang::ASTContext *ast, 
                                             clang_type_t clang_type,
-                                            uint32_t idx, 
+                                            size_t idx, 
                                             uint32_t *bit_offset_ptr)
 {
     if (clang_type == NULL)
@@ -3457,7 +3566,7 @@ ClangASTContext::GetDirectBaseClassAtInd
 clang_type_t
 ClangASTContext::GetVirtualBaseClassAtIndex (clang::ASTContext *ast, 
                                              clang_type_t clang_type,
-                                             uint32_t idx, 
+                                             size_t idx, 
                                              uint32_t *bit_offset_ptr)
 {
     if (clang_type == NULL)
@@ -3516,7 +3625,7 @@ ClangASTContext::GetVirtualBaseClassAtIn
 clang_type_t
 ClangASTContext::GetFieldAtIndex (clang::ASTContext *ast, 
                                   clang_type_t clang_type,
-                                  uint32_t idx, 
+                                  size_t idx, 
                                   std::string& name,
                                   uint64_t *bit_offset_ptr,
                                   uint32_t *bitfield_bit_size_ptr,
@@ -3663,6 +3772,31 @@ ClangASTContext::GetFieldAtIndex (clang:
     return NULL;
 }
 
+size_t
+ClangASTContext::GetIndexOfFieldWithName (clang::ASTContext *ast,
+                                          lldb::clang_type_t clang_type,
+                                          const char* name,
+                                          lldb::clang_type_t* field_clang_type,
+                                          uint64_t *bit_offset_ptr,
+                                          uint32_t *bitfield_bit_size_ptr,
+                                          bool *is_bitfield_ptr)
+{
+    auto count = ClangASTContext::GetNumFields(ast, clang_type);
+    lldb::clang_type_t field_clang_type_internal;
+    std::string field_name;
+    for (auto index = 0; index < count; index++)
+    {
+        field_clang_type_internal = ClangASTContext::GetFieldAtIndex(ast, clang_type, index, field_name, bit_offset_ptr, bitfield_bit_size_ptr, is_bitfield_ptr);
+        if ( strcmp(field_name.c_str(), name) == 0 )
+        {
+            if (field_clang_type)
+                *field_clang_type = field_clang_type_internal;
+            return index;
+        }
+    }
+    return UINT32_MAX;
+}
+
 lldb::BasicType
 ClangASTContext::GetLLDBBasicTypeEnumeration (clang_type_t clang_type)
 {
@@ -3711,6 +3845,14 @@ ClangASTContext::GetLLDBBasicTypeEnumera
             case clang::BuiltinType::UnknownAny:
             case clang::BuiltinType::BuiltinFn:
             case clang::BuiltinType::ARCUnbridgedCast:
+            case clang::BuiltinType::OCLEvent:
+            case clang::BuiltinType::OCLImage1d:
+            case clang::BuiltinType::OCLImage1dArray:
+            case clang::BuiltinType::OCLImage1dBuffer:
+            case clang::BuiltinType::OCLImage2d:
+            case clang::BuiltinType::OCLImage2dArray:
+            case clang::BuiltinType::OCLImage3d:
+            case clang::BuiltinType::OCLSampler:
                 return eBasicTypeOther;
             }
         }
@@ -3742,6 +3884,14 @@ ClangASTContext::GetNumPointeeChildren (
         case clang::BuiltinType::UnknownAny:
         case clang::BuiltinType::Void:
         case clang::BuiltinType::NullPtr:  
+        case clang::BuiltinType::OCLEvent:
+        case clang::BuiltinType::OCLImage1d:
+        case clang::BuiltinType::OCLImage1dArray:
+        case clang::BuiltinType::OCLImage1dBuffer:
+        case clang::BuiltinType::OCLImage2d:
+        case clang::BuiltinType::OCLImage2dArray:
+        case clang::BuiltinType::OCLImage3d:
+        case clang::BuiltinType::OCLSampler:
             return 0;
         case clang::BuiltinType::Bool:
         case clang::BuiltinType::Char_U:
@@ -3824,7 +3974,7 @@ ClangASTContext::GetChildClangTypeAtInde
     ExecutionContext *exe_ctx,
     const char *parent_name,
     clang_type_t parent_clang_type,
-    uint32_t idx,
+    size_t idx,
     bool transparent_pointers,
     bool omit_empty_base_classes,
     bool ignore_array_bounds,
@@ -3864,7 +4014,7 @@ ClangASTContext::GetChildClangTypeAtInde
     ASTContext *ast,
     const char *parent_name,
     clang_type_t parent_clang_type,
-    uint32_t idx,
+    size_t idx,
     bool transparent_pointers,
     bool omit_empty_base_classes,
     bool ignore_array_bounds,
@@ -4156,6 +4306,30 @@ ClangASTContext::GetChildClangTypeAtInde
         }
         break;
 
+        case clang::Type::Vector:
+        case clang::Type::ExtVector:
+            if (idx_is_valid)
+            {
+                const VectorType *array = cast<VectorType>(parent_qual_type.getTypePtr());
+                if (array)
+                {
+                    if (GetCompleteQualType (ast, array->getElementType()))
+                    {
+                        std::pair<uint64_t, unsigned> field_type_info = ast->getTypeInfo(array->getElementType());
+                        
+                        char element_name[64];
+                        ::snprintf (element_name, sizeof (element_name), "[%zu]", idx);
+                        
+                        child_name.assign(element_name);
+                        assert(field_type_info.first % 8 == 0);
+                        child_byte_size = field_type_info.first / 8;
+                        child_byte_offset = (int32_t)idx * (int32_t)child_byte_size;
+                        return array->getElementType().getAsOpaquePtr();
+                    }
+                }
+            }
+            break;
+
         case clang::Type::ConstantArray:
         case clang::Type::IncompleteArray:
             if (ignore_array_bounds || idx_is_valid)
@@ -4168,7 +4342,7 @@ ClangASTContext::GetChildClangTypeAtInde
                         std::pair<uint64_t, unsigned> field_type_info = ast->getTypeInfo(array->getElementType());
                         
                         char element_name[64];
-                        ::snprintf (element_name, sizeof (element_name), "[%u]", idx);
+                        ::snprintf (element_name, sizeof (element_name), "[%zu]", idx);
                         
                         child_name.assign(element_name);
                         assert(field_type_info.first % 8 == 0);
@@ -5249,9 +5423,8 @@ ClangASTContext::CreateFunctionType (AST
     proto_info.Exceptions = NULL;
     
     return ast->getFunctionType (QualType::getFromOpaquePtr(result_type),
-                                 qual_type_args.empty() ? NULL : &qual_type_args.front(),
-                                 qual_type_args.size(),
-                                 proto_info).getAsOpaquePtr();    // NoReturn);
+                                 qual_type_args,
+                                 proto_info).getAsOpaquePtr();
 }
 
 ParmVarDecl *
@@ -5267,7 +5440,6 @@ ClangASTContext::CreateParameterDeclarat
                                 QualType::getFromOpaquePtr(param_type),
                                 NULL,
                                 (VarDecl::StorageClass)storage,
-                                (VarDecl::StorageClass)storage,
                                 0);
 }
 
@@ -5282,28 +5454,41 @@ ClangASTContext::SetFunctionParameters (
 #pragma mark Array Types
 
 clang_type_t
-ClangASTContext::CreateArrayType (clang_type_t element_type, size_t element_count)
+ClangASTContext::CreateArrayType (clang_type_t element_type,
+                                  size_t element_count,
+                                  bool is_vector)
 {
     if (element_type)
     {
         ASTContext *ast = getASTContext();
         assert (ast != NULL);
+
+        QualType element_qual_type(QualType::getFromOpaquePtr(element_type));
+
+        if (is_vector)
+        {
+            return ast->getExtVectorType(element_qual_type, element_count).getAsOpaquePtr();
+        }
+        else
+        {
+        
         llvm::APInt ap_element_count (64, element_count);
         if (element_count == 0)
         {
-            return ast->getIncompleteArrayType(QualType::getFromOpaquePtr(element_type),
+                return ast->getIncompleteArrayType(element_qual_type,
                                                ArrayType::Normal,
                                                0).getAsOpaquePtr();
 
         }
         else
         {
-            return ast->getConstantArrayType(QualType::getFromOpaquePtr(element_type),
+                return ast->getConstantArrayType(element_qual_type,
                                                      ap_element_count,
                                                      ArrayType::Normal,
                                                      0).getAsOpaquePtr(); // ElemQuals
         }
     }
+    }
     return NULL;
 }
 
@@ -5481,6 +5666,8 @@ ClangASTContext::AddEnumerationValueToEn
         assert (identifier_table != NULL);
         QualType enum_qual_type (QualType::getFromOpaquePtr(enum_clang_type));
 
+        bool is_signed = false;
+        IsIntegerType (enumerator_clang_type, is_signed);
         const clang::Type *clang_type = enum_qual_type.getTypePtr();
         if (clang_type)
         {
@@ -5488,7 +5675,7 @@ ClangASTContext::AddEnumerationValueToEn
 
             if (enum_type)
             {
-                llvm::APSInt enum_llvm_apsint(enum_value_bit_size, false);
+                llvm::APSInt enum_llvm_apsint(enum_value_bit_size, is_signed);
                 enum_llvm_apsint = enum_value;
                 EnumConstantDecl *enumerator_decl =
                     EnumConstantDecl::Create (*ast,
@@ -5571,7 +5758,7 @@ ClangASTContext::CreateMemberPointerType
     return NULL;
 }
 
-uint32_t
+uint64_t
 ClangASTContext::GetPointerBitSize ()
 {
     ASTContext *ast = getASTContext();
@@ -5690,6 +5877,14 @@ ClangASTContext::IsPossibleDynamicType (
                         case clang::BuiltinType::ARCUnbridgedCast:          
                         case clang::BuiltinType::PseudoObject:
                         case clang::BuiltinType::BuiltinFn:
+                        case clang::BuiltinType::OCLEvent:
+                        case clang::BuiltinType::OCLImage1d:
+                        case clang::BuiltinType::OCLImage1dArray:
+                        case clang::BuiltinType::OCLImage1dBuffer:
+                        case clang::BuiltinType::OCLImage2d:
+                        case clang::BuiltinType::OCLImage2dArray:
+                        case clang::BuiltinType::OCLImage3d:
+                        case clang::BuiltinType::OCLSampler:
                             break;
                     }
                     break;
@@ -5701,17 +5896,23 @@ ClangASTContext::IsPossibleDynamicType (
                         if (cxx_record_decl)
                         {
                             bool is_complete = cxx_record_decl->isCompleteDefinition();
-                            if (!is_complete)
-                                is_complete = ClangASTContext::GetCompleteType (ast, pointee_qual_type.getAsOpaquePtr());
-
+                            
                             if (is_complete)
-                            {
                                 success = cxx_record_decl->isDynamicClass();
-                            }
                             else
                             {
+                                ClangASTMetadata *metadata = GetMetadata (ast, cxx_record_decl);
+                                if (metadata)
+                                    success = metadata->GetIsDynamicCXXType();
+                                else
+                                {
+                                is_complete = ClangASTContext::GetCompleteType (ast, pointee_qual_type.getAsOpaquePtr());
+                            if (is_complete)
+                                success = cxx_record_decl->isDynamicClass();
+                            else
                                 success = false;
                             }
+                            }
 
                             if (success)
                             {
@@ -6273,7 +6474,7 @@ ClangASTContext::CreateTypedefType (cons
                                                  SourceLocation(),
                                                  SourceLocation(),
                                                  name ? &identifier_table->get(name) : NULL, // Identifier
-                                                 ast->CreateTypeSourceInfo(qual_type));
+                                                 ast->getTrivialTypeSourceInfo(qual_type));
         
         //decl_ctx->addDecl (decl);
 
@@ -6450,7 +6651,7 @@ ClangASTContext::GetCompleteDecl (clang:
 }
 
 void
-ClangASTContext::SetMetadataAsUserID (uintptr_t object,
+ClangASTContext::SetMetadataAsUserID (const void *object,
                                       user_id_t user_id)
 {
     ClangASTMetadata meta_data;
@@ -6460,7 +6661,7 @@ ClangASTContext::SetMetadataAsUserID (ui
 
 void
 ClangASTContext::SetMetadata (clang::ASTContext *ast,
-                              uintptr_t object,
+                              const void *object,
                               ClangASTMetadata &metadata)
 {
     ClangExternalASTSourceCommon *external_source =
@@ -6472,7 +6673,7 @@ ClangASTContext::SetMetadata (clang::AST
 
 ClangASTMetadata *
 ClangASTContext::GetMetadata (clang::ASTContext *ast,
-                              uintptr_t object)
+                              const void *object)
 {
     ClangExternalASTSourceCommon *external_source =
         static_cast<ClangExternalASTSourceCommon*>(ast->getExternalSource());
@@ -6539,7 +6740,7 @@ ClangASTContext::GetClassMethodInfoForDe
         }
         else if (clang::FunctionDecl *function_decl = llvm::dyn_cast<clang::FunctionDecl>(decl_ctx))
         {
-            ClangASTMetadata *metadata = GetMetadata (&decl_ctx->getParentASTContext(), (uintptr_t) function_decl);
+            ClangASTMetadata *metadata = GetMetadata (&decl_ctx->getParentASTContext(), function_decl);
             if (metadata && metadata->HasObjectPtr())
             {
                 language_object_name.SetCString (metadata->GetObjectPtrName());

Modified: lldb/branches/windows/source/Symbol/ClangASTImporter.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Symbol/ClangASTImporter.cpp?rev=179679&r1=179678&r2=179679&view=diff
==============================================================================
--- lldb/branches/windows/source/Symbol/ClangASTImporter.cpp (original)
+++ lldb/branches/windows/source/Symbol/ClangASTImporter.cpp Wed Apr 17 03:38:48 2013
@@ -21,7 +21,32 @@
 using namespace lldb_private;
 using namespace clang;
 
-clang::QualType 
+ClangASTMetrics::Counters ClangASTMetrics::global_counters = { 0, 0, 0, 0, 0, 0 };
+ClangASTMetrics::Counters ClangASTMetrics::local_counters = { 0, 0, 0, 0, 0, 0 };
+
+void ClangASTMetrics::DumpCounters (Log *log, ClangASTMetrics::Counters &counters)
+{
+    log->Printf("  Number of visible Decl queries by name     : %" PRIu64, counters.m_visible_query_count);
+    log->Printf("  Number of lexical Decl queries             : %" PRIu64, counters.m_lexical_query_count);
+    log->Printf("  Number of imports initiated by LLDB        : %" PRIu64, counters.m_lldb_import_count);
+    log->Printf("  Number of imports conducted by Clang       : %" PRIu64, counters.m_clang_import_count);
+    log->Printf("  Number of Decls completed                  : %" PRIu64, counters.m_decls_completed_count);
+    log->Printf("  Number of records laid out                 : %" PRIu64, counters.m_record_layout_count);
+}
+
+void ClangASTMetrics::DumpCounters (Log *log)
+{
+    if (!log)
+        return;
+    
+    log->Printf("== ClangASTMetrics output ==");
+    log->Printf("-- Global metrics --");
+    DumpCounters (log, global_counters);
+    log->Printf("-- Local metrics --");
+    DumpCounters (log, local_counters);
+}
+
+clang::QualType
 ClangASTImporter::CopyType (clang::ASTContext *dst_ast,
                             clang::ASTContext *src_ast,
                             clang::QualType type)
@@ -57,7 +82,7 @@ ClangASTImporter::CopyDecl (clang::ASTCo
         
         if (!result)
         {
-            lldb::LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EXPRESSIONS));
+            Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EXPRESSIONS));
 
             if (log)
             {
@@ -88,37 +113,27 @@ lldb::clang_type_t
 ClangASTImporter::DeportType (clang::ASTContext *dst_ctx,
                               clang::ASTContext *src_ctx,
                               lldb::clang_type_t type)
-{
-    lldb::clang_type_t result = CopyType(dst_ctx, src_ctx, type);
+{    
+    MinionSP minion_sp (GetMinion (dst_ctx, src_ctx));
     
-    if (!result)
+    if (!minion_sp)
         return NULL;
     
-    QualType qual_type = QualType::getFromOpaquePtr(type);
+    std::set<NamedDecl *> decls_to_deport;
+    std::set<NamedDecl *> decls_already_deported;
     
-    if (const TagType *tag_type = qual_type->getAs<TagType>())
-    {
-        TagDecl *tag_decl = tag_type->getDecl();
-        const TagType *result_tag_type = QualType::getFromOpaquePtr(result)->getAs<TagType>();
-        TagDecl *result_tag_decl = result_tag_type->getDecl();
-        
-        if (tag_decl)
-        {
-            MinionSP minion_sp (GetMinion (dst_ctx, src_ctx));
-
-            minion_sp->ImportDefinitionTo(result_tag_decl, tag_decl);
-            
-            ASTContextMetadataSP to_context_md = GetContextMetadata(dst_ctx);
-            
-            OriginMap::iterator oi = to_context_md->m_origins.find(result_tag_decl);
-            
-            if (oi != to_context_md->m_origins.end() &&
-                oi->second.ctx == src_ctx)
-                to_context_md->m_origins.erase(oi);
-        }
-    }
+    minion_sp->InitDeportWorkQueues(&decls_to_deport,
+                                    &decls_already_deported);
+    
+    lldb::clang_type_t result = CopyType(dst_ctx, src_ctx, type);
+    
+    minion_sp->ExecuteDeportWorkQueues();
+    
+    if (!result)
+        return NULL;
     
     return result;
+
 }
 
 clang::Decl *
@@ -126,25 +141,39 @@ ClangASTImporter::DeportDecl (clang::AST
                               clang::ASTContext *src_ctx,
                               clang::Decl *decl)
 {
-    clang::Decl *result = CopyDecl(dst_ctx, src_ctx, decl);
+    Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EXPRESSIONS));
     
-    if (!result)
-        return NULL;
+    if (log)
+        log->Printf("    [ClangASTImporter] DeportDecl called on (%sDecl*)%p from (ASTContext*)%p to (ASTContex*)%p",
+                    decl->getDeclKindName(),
+                    decl,
+                    src_ctx,
+                    dst_ctx);
     
-    ClangASTContext::GetCompleteDecl (src_ctx, decl);
-
     MinionSP minion_sp (GetMinion (dst_ctx, src_ctx));
     
-    if (minion_sp && isa<TagDecl>(decl))
-        minion_sp->ImportDefinitionTo(result, decl);
+    if (!minion_sp)
+        return NULL;
+    
+    std::set<NamedDecl *> decls_to_deport;
+    std::set<NamedDecl *> decls_already_deported;
     
-    ASTContextMetadataSP to_context_md = GetContextMetadata(dst_ctx);
+    minion_sp->InitDeportWorkQueues(&decls_to_deport,
+                                    &decls_already_deported);
+    
+    clang::Decl *result = CopyDecl(dst_ctx, src_ctx, decl);
 
-    OriginMap::iterator oi = to_context_md->m_origins.find(decl);
+    minion_sp->ExecuteDeportWorkQueues();
+    
+    if (!result)
+        return NULL;
     
-    if (oi != to_context_md->m_origins.end() &&
-        oi->second.ctx == src_ctx)
-        to_context_md->m_origins.erase(oi);
+    if (log)
+        log->Printf("    [ClangASTImporter] DeportDecl deported (%sDecl*)%p to (%sDecl*)%p",
+                    decl->getDeclKindName(),
+                    decl,
+                    result->getDeclKindName(),
+                    result);
     
     return result;
 }
@@ -152,7 +181,7 @@ ClangASTImporter::DeportDecl (clang::AST
 void
 ClangASTImporter::CompleteDecl (clang::Decl *decl)
 {
-    lldb::LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EXPRESSIONS));
+    Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EXPRESSIONS));
 
     if (log)    
         log->Printf("    [ClangASTImporter] CompleteDecl called on (%sDecl*)%p",
@@ -189,7 +218,9 @@ ClangASTImporter::CompleteDecl (clang::D
 
 bool
 ClangASTImporter::CompleteTagDecl (clang::TagDecl *decl)
-{   
+{
+    ClangASTMetrics::RegisterDeclCompletion();
+    
     DeclOrigin decl_origin = GetDeclOrigin(decl);
     
     if (!decl_origin.Valid())
@@ -209,6 +240,8 @@ ClangASTImporter::CompleteTagDecl (clang
 bool
 ClangASTImporter::CompleteTagDeclWithOrigin(clang::TagDecl *decl, clang::TagDecl *origin_decl)
 {
+    ClangASTMetrics::RegisterDeclCompletion();
+
     clang::ASTContext *origin_ast_ctx = &origin_decl->getASTContext();
         
     if (!ClangASTContext::GetCompleteDecl(origin_ast_ctx, origin_decl))
@@ -231,7 +264,7 @@ ClangASTImporter::CompleteTagDeclWithOri
 bool
 ClangASTImporter::CompleteObjCInterfaceDecl (clang::ObjCInterfaceDecl *interface_decl)
 {
-    lldb::LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EXPRESSIONS));
+    ClangASTMetrics::RegisterDeclCompletion();
     
     DeclOrigin decl_origin = GetDeclOrigin(interface_decl);
     
@@ -249,15 +282,44 @@ ClangASTImporter::CompleteObjCInterfaceD
     return true;
 }
 
+bool
+ClangASTImporter::RequireCompleteType (clang::QualType type)
+{
+    if (type.isNull())
+        return false;
+    
+    if (const TagType *tag_type = type->getAs<TagType>())
+    {
+        return CompleteTagDecl(tag_type->getDecl());
+    }
+    if (const ObjCObjectType *objc_object_type = type->getAs<ObjCObjectType>())
+    {
+        if (ObjCInterfaceDecl *objc_interface_decl = objc_object_type->getInterface())
+            return CompleteObjCInterfaceDecl(objc_interface_decl);
+        else
+            return false;
+    }
+    if (const ArrayType *array_type = type->getAsArrayTypeUnsafe())
+    {
+        return RequireCompleteType(array_type->getElementType());
+    }
+    if (const AtomicType *atomic_type = type->getAs<AtomicType>())
+    {
+        return RequireCompleteType(atomic_type->getPointeeType());
+    }
+    
+    return true;
+}
+
 ClangASTMetadata *
 ClangASTImporter::GetDeclMetadata (const clang::Decl *decl)
 {
     DeclOrigin decl_origin = GetDeclOrigin(decl);
     
     if (decl_origin.Valid())
-        return ClangASTContext::GetMetadata(decl_origin.ctx, (uintptr_t)decl_origin.decl);
+        return ClangASTContext::GetMetadata(decl_origin.ctx, decl_origin.decl);
     else
-        return ClangASTContext::GetMetadata(&decl->getASTContext(), (uintptr_t)decl);
+        return ClangASTContext::GetMetadata(&decl->getASTContext(), decl);
 }
 
 ClangASTImporter::DeclOrigin
@@ -349,7 +411,7 @@ ClangASTImporter::BuildNamespaceMap(cons
 void 
 ClangASTImporter::ForgetDestination (clang::ASTContext *dst_ast)
 {
-    lldb::LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EXPRESSIONS));
+    Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EXPRESSIONS));
     
     if (log)
         log->Printf("    [ClangASTImporter] Forgetting destination (ASTContext*)%p", dst_ast); 
@@ -362,7 +424,7 @@ ClangASTImporter::ForgetSource (clang::A
 {
     ASTContextMetadataSP md = MaybeGetContextMetadata (dst_ast);
     
-    lldb::LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EXPRESSIONS));
+    Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EXPRESSIONS));
     
     if (log)
         log->Printf("    [ClangASTImporter] Forgetting source->dest (ASTContext*)%p->(ASTContext*)%p", src_ast, dst_ast); 
@@ -389,6 +451,63 @@ ClangASTImporter::MapCompleter::~MapComp
 }
 
 void
+ClangASTImporter::Minion::InitDeportWorkQueues (std::set<clang::NamedDecl *> *decls_to_deport,
+                                                std::set<clang::NamedDecl *> *decls_already_deported)
+{
+    assert(!m_decls_to_deport); // TODO make debug only
+    assert(!m_decls_already_deported);
+    
+    m_decls_to_deport = decls_to_deport;
+    m_decls_already_deported = decls_already_deported;
+}
+
+void
+ClangASTImporter::Minion::ExecuteDeportWorkQueues ()
+{
+    assert(m_decls_to_deport); // TODO make debug only
+    assert(m_decls_already_deported);
+    
+    ASTContextMetadataSP to_context_md = m_master.GetContextMetadata(&getToContext());
+        
+    while (!m_decls_to_deport->empty())
+    {
+        NamedDecl *decl = *m_decls_to_deport->begin();
+        
+        m_decls_already_deported->insert(decl);
+        m_decls_to_deport->erase(decl);
+        
+        DeclOrigin &origin = to_context_md->m_origins[decl];
+        
+        assert (origin.ctx == m_source_ctx);    // otherwise we should never have added this
+                                                // because it doesn't need to be deported
+        
+        Decl *original_decl = to_context_md->m_origins[decl].decl;
+        
+        ClangASTContext::GetCompleteDecl (m_source_ctx, original_decl);
+        
+        if (TagDecl *tag_decl = dyn_cast<TagDecl>(decl))
+        {
+            if (TagDecl *original_tag_decl = dyn_cast<TagDecl>(original_decl))
+                if (original_tag_decl->isCompleteDefinition())
+                    ImportDefinitionTo(tag_decl, original_tag_decl);
+            
+            tag_decl->setHasExternalLexicalStorage(false);
+            tag_decl->setHasExternalVisibleStorage(false);
+        }
+        else if (ObjCInterfaceDecl *interface_decl = dyn_cast<ObjCInterfaceDecl>(decl))
+        {
+            interface_decl->setHasExternalLexicalStorage(false);
+            interface_decl->setHasExternalVisibleStorage(false);
+        }
+        
+        to_context_md->m_origins.erase(decl);
+    }
+    
+    m_decls_to_deport = NULL;
+    m_decls_already_deported = NULL;
+}
+
+void
 ClangASTImporter::Minion::ImportDefinitionTo (clang::Decl *to, clang::Decl *from)
 {
     ASTImporter::Imported(from, to);
@@ -452,7 +571,9 @@ ClangASTImporter::Minion::ImportDefiniti
 clang::Decl 
 *ClangASTImporter::Minion::Imported (clang::Decl *from, clang::Decl *to)
 {
-    lldb::LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EXPRESSIONS));
+    ClangASTMetrics::RegisterClangImport();
+    
+    Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EXPRESSIONS));
         
     if (log)
     {
@@ -512,6 +633,17 @@ clang::Decl
         }
         else
         {
+            if (m_decls_to_deport && m_decls_already_deported)
+            {
+                if (isa<TagDecl>(to) || isa<ObjCInterfaceDecl>(to))
+                {
+                    NamedDecl *to_named_decl = dyn_cast<NamedDecl>(to);
+                    
+                    if (!m_decls_already_deported->count(to_named_decl))
+                        m_decls_to_deport->insert(to_named_decl);
+                }
+
+            }
             to_context_md->m_origins[to] = DeclOrigin(m_source_ctx, from);
             
             if (log)
@@ -548,15 +680,13 @@ clang::Decl
         
         to_tag_decl->setHasExternalLexicalStorage();
         to_tag_decl->setMustBuildLookupTable();
-                                
+        
         if (log)
             log->Printf("    [ClangASTImporter] To is a TagDecl - attributes %s%s [%s->%s]",
                         (to_tag_decl->hasExternalLexicalStorage() ? " Lexical" : ""),
                         (to_tag_decl->hasExternalVisibleStorage() ? " Visible" : ""),
                         (from_tag_decl->isCompleteDefinition() ? "complete" : "incomplete"),
                         (to_tag_decl->isCompleteDefinition() ? "complete" : "incomplete"));
-        
-        to_tag_decl = NULL;
     }
     
     if (isa<NamespaceDecl>(from))
@@ -574,7 +704,7 @@ clang::Decl
                 
         to_interface_decl->setHasExternalLexicalStorage();
         to_interface_decl->setHasExternalVisibleStorage();
-                 
+        
         /*to_interface_decl->setExternallyCompleted();*/
                 
         if (log)

Modified: lldb/branches/windows/source/Symbol/ClangASTType.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Symbol/ClangASTType.cpp?rev=179679&r1=179678&r2=179679&view=diff
==============================================================================
--- lldb/branches/windows/source/Symbol/ClangASTType.cpp (original)
+++ lldb/branches/windows/source/Symbol/ClangASTType.cpp Wed Apr 17 03:38:48 2013
@@ -39,6 +39,7 @@
 #include "lldb/Core/StreamString.h"
 #include "lldb/Core/UniqueCStringMap.h"
 #include "lldb/Symbol/ClangASTContext.h"
+#include "lldb/Symbol/ClangExternalASTSourceCommon.h"
 #include "lldb/Target/ExecutionContext.h"
 #include "lldb/Target/Process.h"
 
@@ -57,6 +58,7 @@ ClangASTType::GetTypeNameForQualType (cl
     
     clang::PrintingPolicy printing_policy (ast->getPrintingPolicy());
     printing_policy.SuppressTagKeyword = true;
+    printing_policy.LangOpts.WChar = true;
     const clang::TypedefType *typedef_type = qual_type->getAs<clang::TypedefType>();
     if (typedef_type)
     {
@@ -139,7 +141,7 @@ ClangASTType::GetPointeeType (clang_type
 }
 
 lldb::clang_type_t
-ClangASTType::GetArrayElementType (uint32_t& stride)
+ClangASTType::GetArrayElementType (uint64_t& stride)
 {
     return GetArrayElementType(m_ast, m_type, stride);
 }
@@ -147,7 +149,7 @@ ClangASTType::GetArrayElementType (uint3
 lldb::clang_type_t
 ClangASTType::GetArrayElementType (clang::ASTContext* ast,
                                    lldb::clang_type_t opaque_clang_qual_type,
-                                   uint32_t& stride)
+                                   uint64_t& stride)
 {
     if (opaque_clang_qual_type)
     {
@@ -185,7 +187,7 @@ ClangASTType::GetPointerType (clang::AST
 }
 
 lldb::Encoding
-ClangASTType::GetEncoding (uint32_t &count)
+ClangASTType::GetEncoding (uint64_t &count)
 {
     return GetEncoding(m_type, count);
 }
@@ -361,7 +363,7 @@ ClangASTType::GetMinimumLanguage (clang:
 }
 
 lldb::Encoding
-ClangASTType::GetEncoding (clang_type_t clang_type, uint32_t &count)
+ClangASTType::GetEncoding (clang_type_t clang_type, uint64_t &count)
 {
     count = 1;
     clang::QualType qual_type(clang::QualType::getFromOpaquePtr(clang_type));
@@ -563,6 +565,14 @@ ClangASTType::GetFormat (clang_type_t cl
         case clang::BuiltinType::ARCUnbridgedCast:          
         case clang::BuiltinType::PseudoObject:
         case clang::BuiltinType::BuiltinFn:
+        case clang::BuiltinType::OCLEvent:
+        case clang::BuiltinType::OCLImage1d:
+        case clang::BuiltinType::OCLImage1dArray:
+        case clang::BuiltinType::OCLImage1dBuffer:
+        case clang::BuiltinType::OCLImage2d:
+        case clang::BuiltinType::OCLImage2dArray:
+        case clang::BuiltinType::OCLImage3d:
+        case clang::BuiltinType::OCLSampler:
             return lldb::eFormatHex;
         }
         break;
@@ -621,7 +631,7 @@ ClangASTType::DumpValue
     Stream *s,
     lldb::Format format,
     const lldb_private::DataExtractor &data,
-    uint32_t data_byte_offset,
+    lldb::offset_t data_byte_offset,
     size_t data_byte_size,
     uint32_t bitfield_bit_size,
     uint32_t bitfield_bit_offset,
@@ -657,7 +667,7 @@ ClangASTType::DumpValue
     Stream *s,
     lldb::Format format,
     const lldb_private::DataExtractor &data,
-    uint32_t data_byte_offset,
+    lldb::offset_t data_byte_offset,
     size_t data_byte_size,
     uint32_t bitfield_bit_size,
     uint32_t bitfield_bit_offset,
@@ -806,7 +816,7 @@ ClangASTType::DumpValue
             const clang::EnumDecl *enum_decl = enum_type->getDecl();
             assert(enum_decl);
             clang::EnumDecl::enumerator_iterator enum_pos, enum_end_pos;
-            uint32_t offset = data_byte_offset;
+            lldb::offset_t offset = data_byte_offset;
             const int64_t enum_value = data.GetMaxU64Bitfield(&offset, data_byte_size, bitfield_bit_size, bitfield_bit_offset);
             for (enum_pos = enum_decl->enumerator_begin(), enum_end_pos = enum_decl->enumerator_end(); enum_pos != enum_end_pos; ++enum_pos)
             {
@@ -955,7 +965,7 @@ bool
 ClangASTType::DumpTypeValue (Stream *s,
                              lldb::Format format,
                              const lldb_private::DataExtractor &data,
-                             uint32_t byte_offset,
+                             lldb::offset_t byte_offset,
                              size_t byte_size,
                              uint32_t bitfield_bit_size,
                              uint32_t bitfield_bit_offset,
@@ -980,7 +990,7 @@ ClangASTType::DumpTypeValue (clang::ASTC
                              Stream *s,
                              lldb::Format format,
                              const lldb_private::DataExtractor &data,
-                             uint32_t byte_offset,
+                             lldb::offset_t byte_offset,
                              size_t byte_size,
                              uint32_t bitfield_bit_size,
                              uint32_t bitfield_bit_offset,
@@ -1027,20 +1037,38 @@ ClangASTType::DumpTypeValue (clang::ASTC
                 const clang::EnumDecl *enum_decl = enum_type->getDecl();
                 assert(enum_decl);
                 clang::EnumDecl::enumerator_iterator enum_pos, enum_end_pos;
-                uint32_t offset = byte_offset;
-                const int64_t enum_value = data.GetMaxU64Bitfield (&offset, byte_size, bitfield_bit_size, bitfield_bit_offset);
+                const bool is_signed = qual_type->isSignedIntegerOrEnumerationType();
+                lldb::offset_t offset = byte_offset;
+                if (is_signed)
+                {
+                    const int64_t enum_svalue = data.GetMaxS64Bitfield (&offset, byte_size, bitfield_bit_size, bitfield_bit_offset);
                 for (enum_pos = enum_decl->enumerator_begin(), enum_end_pos = enum_decl->enumerator_end(); enum_pos != enum_end_pos; ++enum_pos)
                 {
-                    if (enum_pos->getInitVal() == enum_value)
+                        if (enum_pos->getInitVal().getSExtValue() == enum_svalue)
                     {
                         s->PutCString (enum_pos->getNameAsString().c_str());
                         return true;
                     }
                 }
                 // If we have gotten here we didn't get find the enumerator in the
+                    // enum decl, so just print the integer.                    
+                    s->Printf("%" PRIi64, enum_svalue);
+                }
+                else
+                {
+                    const uint64_t enum_uvalue = data.GetMaxU64Bitfield (&offset, byte_size, bitfield_bit_size, bitfield_bit_offset);
+                    for (enum_pos = enum_decl->enumerator_begin(), enum_end_pos = enum_decl->enumerator_end(); enum_pos != enum_end_pos; ++enum_pos)
+                    {
+                        if (enum_pos->getInitVal().getZExtValue() == enum_uvalue)
+                        {
+                            s->PutCString (enum_pos->getNameAsString().c_str());
+                            return true;
+                        }
+                    }
+                    // If we have gotten here we didn't get find the enumerator in the
                 // enum decl, so just print the integer.
-                
-                s->Printf("%" PRIi64, enum_value);
+                    s->Printf("%" PRIu64, enum_uvalue);
+                }
                 return true;
             }
             // format was not enum, just fall through and dump the value as requested....
@@ -1125,7 +1153,7 @@ ClangASTType::DumpSummary
     ExecutionContext *exe_ctx,
     Stream *s,
     const lldb_private::DataExtractor &data,
-    uint32_t data_byte_offset,
+    lldb::offset_t data_byte_offset,
     size_t data_byte_size
 )
 {
@@ -1146,7 +1174,7 @@ ClangASTType::DumpSummary
     ExecutionContext *exe_ctx,
     Stream *s,
     const lldb_private::DataExtractor &data,
-    uint32_t data_byte_offset,
+    lldb::offset_t data_byte_offset,
     size_t data_byte_size
 )
 {
@@ -1158,7 +1186,7 @@ ClangASTType::DumpSummary
             Process *process = exe_ctx->GetProcessPtr();
             if (process)
             {
-                uint32_t offset = data_byte_offset;
+                lldb::offset_t offset = data_byte_offset;
                 lldb::addr_t pointer_addresss = data.GetMaxU64(&offset, data_byte_size);
                 std::vector<uint8_t> buf;
                 if (length > 0)
@@ -1191,13 +1219,25 @@ ClangASTType::DumpSummary
     }
 }
 
-uint32_t
+uint64_t
+ClangASTType::GetClangTypeByteSize ()
+{
+    return (GetClangTypeBitWidth (m_ast, m_type) + 7) / 8;
+}
+
+uint64_t
+ClangASTType::GetClangTypeByteSize (clang::ASTContext *ast_context, clang_type_t clang_type)
+{
+    return (GetClangTypeBitWidth (ast_context, clang_type) + 7) / 8;
+}
+
+uint64_t
 ClangASTType::GetClangTypeBitWidth ()
 {
     return GetClangTypeBitWidth (m_ast, m_type);
 }
 
-uint32_t
+uint64_t
 ClangASTType::GetClangTypeBitWidth (clang::ASTContext *ast_context, clang_type_t clang_type)
 {
     if (ClangASTContext::GetCompleteType (ast_context, clang_type))
@@ -1276,6 +1316,18 @@ ClangASTType::IsConst (lldb::clang_type_
 }
 
 void
+ClangASTType::DumpTypeDescription ()
+{
+    StreamFile s (stdout, false);
+    DumpTypeDescription (&s);
+    ClangASTMetadata *metadata = ClangASTContext::GetMetadata (m_ast, m_type);
+    if (metadata)
+    {
+        metadata->Dump (&s);
+    }
+}
+
+void
 ClangASTType::DumpTypeDescription (Stream *s)
 {
     return DumpTypeDescription (m_ast, m_type, s);
@@ -1298,8 +1350,9 @@ ClangASTType::DumpTypeDescription (clang
         {
         case clang::Type::ObjCObject:
         case clang::Type::ObjCInterface:
-            if (ClangASTContext::GetCompleteType (ast_context, clang_type))
             {
+                ClangASTContext::GetCompleteType (ast_context, clang_type);
+                
                 const clang::ObjCObjectType *objc_class_type = llvm::dyn_cast<clang::ObjCObjectType>(qual_type.getTypePtr());
                 assert (objc_class_type);
                 if (objc_class_type)
@@ -1339,8 +1392,9 @@ ClangASTType::DumpTypeDescription (clang
             return;
 
         case clang::Type::Record:
-            if (ClangASTContext::GetCompleteType (ast_context, clang_type))
             {
+                ClangASTContext::GetCompleteType (ast_context, clang_type);
+                
                 const clang::RecordType *record_type = llvm::cast<clang::RecordType>(qual_type.getTypePtr());
                 const clang::RecordDecl *record_decl = record_type->getDecl();
                 const clang::CXXRecordDecl *cxx_record_decl = llvm::dyn_cast<clang::CXXRecordDecl>(record_decl);
@@ -1378,25 +1432,11 @@ ClangASTType::DumpTypeDescription (clang
     }
 }
 
-void
-ClangASTType::DumpTypeCode (Stream *s)
-{
-    DumpTypeCode(m_type, s);
-}
-
-void
-ClangASTType::DumpTypeCode (void *type, 
-                            Stream *s)
-{
-    clang::QualType qual_type(clang::QualType::getFromOpaquePtr(type));
-    s->PutCString(qual_type.getAsString().c_str());
-}
-
 bool
 ClangASTType::GetValueAsScalar
 (
     const lldb_private::DataExtractor &data,
-    uint32_t data_byte_offset,
+    lldb::offset_t data_byte_offset,
     size_t data_byte_size,
     Scalar &value
 )
@@ -1415,7 +1455,7 @@ ClangASTType::GetValueAsScalar
     clang::ASTContext *ast_context,
     clang_type_t clang_type,
     const lldb_private::DataExtractor &data,
-    uint32_t data_byte_offset,
+    lldb::offset_t data_byte_offset,
     size_t data_byte_size,
     Scalar &value
 )
@@ -1428,15 +1468,15 @@ ClangASTType::GetValueAsScalar
     }
     else
     {
-        uint32_t count = 0;
+        uint64_t count = 0;
         lldb::Encoding encoding = GetEncoding (clang_type, count);
 
         if (encoding == lldb::eEncodingInvalid || count != 1)
             return false;
 
         uint64_t bit_width = ast_context->getTypeSize(qual_type);
-        uint32_t byte_size = (bit_width + 7 ) / 8;
-        uint32_t offset = data_byte_offset;
+        uint64_t byte_size = (bit_width + 7 ) / 8;
+        lldb::offset_t offset = data_byte_offset;
         switch (encoding)
         {
         case lldb::eEncodingInvalid:
@@ -1571,18 +1611,18 @@ ClangASTType::SetValueFromScalar
     if (!ClangASTContext::IsAggregateType (clang_type))
     {
         strm.GetFlags().Set(Stream::eBinary);
-        uint32_t count = 0;
+        uint64_t count = 0;
         lldb::Encoding encoding = GetEncoding (clang_type, count);
 
         if (encoding == lldb::eEncodingInvalid || count != 1)
             return false;
 
-        uint64_t bit_width = ast_context->getTypeSize(qual_type);
+        const uint64_t bit_width = ast_context->getTypeSize(qual_type);
         // This function doesn't currently handle non-byte aligned assignments
         if ((bit_width % 8) != 0)
             return false;
 
-        uint32_t byte_size = (bit_width + 7 ) / 8;
+        const uint64_t byte_size = (bit_width + 7 ) / 8;
         switch (encoding)
         {
         case lldb::eEncodingInvalid:
@@ -1641,13 +1681,10 @@ ClangASTType::SetValueFromScalar
 }
 
 bool
-ClangASTType::ReadFromMemory
-(
-    lldb_private::ExecutionContext *exe_ctx,
+ClangASTType::ReadFromMemory (lldb_private::ExecutionContext *exe_ctx,
     lldb::addr_t addr,
     AddressType address_type,
-    lldb_private::DataExtractor &data
-)
+                              lldb_private::DataExtractor &data)
 {
     return ReadFromMemory (m_ast,
                            m_type,
@@ -1657,24 +1694,21 @@ ClangASTType::ReadFromMemory
                            data);
 }
 
-uint32_t
+uint64_t
 ClangASTType::GetTypeByteSize() const
 {
-    return GetTypeByteSize(m_ast,
-                           m_type);
+    return GetTypeByteSize (m_ast, m_type);
 }
 
-uint32_t
-ClangASTType::GetTypeByteSize(
-                clang::ASTContext *ast_context,
-                lldb::clang_type_t opaque_clang_qual_type)
+uint64_t
+ClangASTType::GetTypeByteSize(clang::ASTContext *ast_context, lldb::clang_type_t opaque_clang_qual_type)
 {
     
     if (ClangASTContext::GetCompleteType (ast_context, opaque_clang_qual_type))
     {
         clang::QualType qual_type(clang::QualType::getFromOpaquePtr(opaque_clang_qual_type));
         
-        uint32_t byte_size = (ast_context->getTypeSize (qual_type) + 7) / 8;
+        uint64_t byte_size = (ast_context->getTypeSize (qual_type) + (uint64_t)7) / (uint64_t)8;
         
         if (ClangASTContext::IsObjCClassType(opaque_clang_qual_type))
             byte_size += ast_context->getTypeSize(ast_context->ObjCBuiltinClassTy) / 8; // isa
@@ -1686,15 +1720,12 @@ ClangASTType::GetTypeByteSize(
 
 
 bool
-ClangASTType::ReadFromMemory
-(
-    clang::ASTContext *ast_context,
+ClangASTType::ReadFromMemory (clang::ASTContext *ast_context,
     clang_type_t clang_type,
     lldb_private::ExecutionContext *exe_ctx,
     lldb::addr_t addr,
     AddressType address_type,
-    lldb_private::DataExtractor &data
-)
+                              lldb_private::DataExtractor &data)
 {
     if (address_type == eAddressTypeFile)
     {
@@ -1708,7 +1739,7 @@ ClangASTType::ReadFromMemory
     
     clang::QualType qual_type(clang::QualType::getFromOpaquePtr(clang_type));
     
-    const uint32_t byte_size = (ast_context->getTypeSize (qual_type) + 7) / 8;
+    const uint64_t byte_size = (ast_context->getTypeSize (qual_type) + 7) / 8;
     if (data.GetByteSize() < byte_size)
     {
         lldb::DataBufferSP data_sp(new DataBufferHeap (byte_size, '\0'));
@@ -1720,6 +1751,8 @@ ClangASTType::ReadFromMemory
     {
         if (address_type == eAddressTypeHost)
         {
+            if (addr == 0)
+                return false;
             // The address is an address in this process, so just copy it
             memcpy (dst, (uint8_t*)NULL + addr, byte_size);
             return true;
@@ -1774,7 +1807,7 @@ ClangASTType::WriteToMemory
         return false;
     }
     clang::QualType qual_type(clang::QualType::getFromOpaquePtr(clang_type));
-    const uint32_t byte_size = (ast_context->getTypeSize (qual_type) + 7) / 8;
+    const uint64_t byte_size = (ast_context->getTypeSize (qual_type) + 7) / 8;
 
     if (byte_size > 0)
     {

Modified: lldb/branches/windows/source/Symbol/ClangExternalASTSourceCallbacks.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Symbol/ClangExternalASTSourceCallbacks.cpp?rev=179679&r1=179678&r2=179679&view=diff
==============================================================================
--- lldb/branches/windows/source/Symbol/ClangExternalASTSourceCallbacks.cpp (original)
+++ lldb/branches/windows/source/Symbol/ClangExternalASTSourceCallbacks.cpp Wed Apr 17 03:38:48 2013
@@ -45,7 +45,7 @@
 using namespace clang;
 using namespace lldb_private;
 
-clang::DeclContextLookupResult 
+bool
 ClangExternalASTSourceCallbacks::FindExternalVisibleDeclsByName 
 (
     const clang::DeclContext *decl_ctx,
@@ -58,9 +58,9 @@ ClangExternalASTSourceCallbacks::FindExt
         
         m_callback_find_by_name (m_callback_baton, decl_ctx, clang_decl_name, &results);
         
-        DeclContextLookupResult lookup_result (SetExternalVisibleDeclsForName(decl_ctx, clang_decl_name, results));
+        SetExternalVisibleDeclsForName(decl_ctx, clang_decl_name, results);
         
-        return lookup_result;
+        return (results.size() != 0);
     }
         
     std::string decl_name (clang_decl_name.getAsString());
@@ -70,55 +70,61 @@ ClangExternalASTSourceCallbacks::FindExt
     case clang::DeclarationName::Identifier:
         //printf ("ClangExternalASTSourceCallbacks::FindExternalVisibleDeclsByName(decl_ctx = %p, decl_name = { kind = \"Identifier\", name = \"%s\")\n", decl_ctx, decl_name.c_str());
         if (clang_decl_name.getAsIdentifierInfo()->getBuiltinID() != 0)
-            return SetNoExternalVisibleDeclsForName(decl_ctx, clang_decl_name);
+        {
+            SetNoExternalVisibleDeclsForName(decl_ctx, clang_decl_name);
+            return false;
+        }
         break;
 
     case clang::DeclarationName::ObjCZeroArgSelector:
         //printf ("ClangExternalASTSourceCallbacks::FindExternalVisibleDeclsByName(decl_ctx = %p, decl_name = { kind = \"ObjCZeroArgSelector\", name = \"%s\")\n", decl_ctx, decl_name.c_str());
-        return DeclContext::lookup_result();
-        break;
+        SetNoExternalVisibleDeclsForName(decl_ctx, clang_decl_name);
+        return false;
 
     case clang::DeclarationName::ObjCOneArgSelector:
         //printf ("ClangExternalASTSourceCallbacks::FindExternalVisibleDeclsByName(decl_ctx = %p, decl_name = { kind = \"ObjCOneArgSelector\", name = \"%s\")\n", decl_ctx, decl_name.c_str());
-        return DeclContext::lookup_result();
-        break;
+        SetNoExternalVisibleDeclsForName(decl_ctx, clang_decl_name);
+        return false;
 
     case clang::DeclarationName::ObjCMultiArgSelector:
         //printf ("ClangExternalASTSourceCallbacks::FindExternalVisibleDeclsByName(decl_ctx = %p, decl_name = { kind = \"ObjCMultiArgSelector\", name = \"%s\")\n", decl_ctx, decl_name.c_str());
-        return DeclContext::lookup_result();
-        break;
+        SetNoExternalVisibleDeclsForName(decl_ctx, clang_decl_name);
+        return false;
 
     case clang::DeclarationName::CXXConstructorName:
         //printf ("ClangExternalASTSourceCallbacks::FindExternalVisibleDeclsByName(decl_ctx = %p, decl_name = { kind = \"CXXConstructorName\", name = \"%s\")\n", decl_ctx, decl_name.c_str());
-        return DeclContext::lookup_result();
-        break;
+        SetNoExternalVisibleDeclsForName(decl_ctx, clang_decl_name);
+        return false;
+
 
     case clang::DeclarationName::CXXDestructorName:
         //printf ("ClangExternalASTSourceCallbacks::FindExternalVisibleDeclsByName(decl_ctx = %p, decl_name = { kind = \"CXXDestructorName\", name = \"%s\")\n", decl_ctx, decl_name.c_str());
-        return DeclContext::lookup_result();
-        break;
+        SetNoExternalVisibleDeclsForName(decl_ctx, clang_decl_name);
+        return false;
 
     case clang::DeclarationName::CXXConversionFunctionName:
         //printf ("ClangExternalASTSourceCallbacks::FindExternalVisibleDeclsByName(decl_ctx = %p, decl_name = { kind = \"CXXConversionFunctionName\", name = \"%s\")\n", decl_ctx, decl_name.c_str());
-        return DeclContext::lookup_result();
-        break;
+        SetNoExternalVisibleDeclsForName(decl_ctx, clang_decl_name);
+        return false;
 
     case clang::DeclarationName::CXXOperatorName:
         //printf ("ClangExternalASTSourceCallbacks::FindExternalVisibleDeclsByName(decl_ctx = %p, decl_name = { kind = \"CXXOperatorName\", name = \"%s\")\n", decl_ctx, decl_name.c_str());
-        return DeclContext::lookup_result();
-        break;
+        SetNoExternalVisibleDeclsForName(decl_ctx, clang_decl_name);
+        return false;
 
     case clang::DeclarationName::CXXLiteralOperatorName:
         //printf ("ClangExternalASTSourceCallbacks::FindExternalVisibleDeclsByName(decl_ctx = %p, decl_name = { kind = \"CXXLiteralOperatorName\", name = \"%s\")\n", decl_ctx, decl_name.c_str());
-        return DeclContext::lookup_result();
-        break;
+        SetNoExternalVisibleDeclsForName(decl_ctx, clang_decl_name);
+        return false;
 
     case clang::DeclarationName::CXXUsingDirective:
         //printf ("ClangExternalASTSourceCallbacks::FindExternalVisibleDeclsByName(decl_ctx = %p, decl_name = { kind = \"CXXUsingDirective\", name = \"%s\")\n", decl_ctx, decl_name.c_str());
-        return SetNoExternalVisibleDeclsForName(decl_ctx, clang_decl_name);
+        SetNoExternalVisibleDeclsForName(decl_ctx, clang_decl_name);
+        return false;
     }
 
-    return DeclContext::lookup_result();
+    SetNoExternalVisibleDeclsForName(decl_ctx, clang_decl_name);
+    return false;
 }
 
 void

Modified: lldb/branches/windows/source/Symbol/ClangExternalASTSourceCommon.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Symbol/ClangExternalASTSourceCommon.cpp?rev=179679&r1=179678&r2=179679&view=diff
==============================================================================
--- lldb/branches/windows/source/Symbol/ClangExternalASTSourceCommon.cpp (original)
+++ lldb/branches/windows/source/Symbol/ClangExternalASTSourceCommon.cpp Wed Apr 17 03:38:48 2013
@@ -8,6 +8,7 @@
 //===----------------------------------------------------------------------===//
 
 #include "lldb/Symbol/ClangExternalASTSourceCommon.h"
+#include "lldb/Core/Stream.h"
 
 using namespace lldb_private;
 
@@ -28,7 +29,7 @@ ClangExternalASTSourceCommon::~ClangExte
 }
 
 ClangASTMetadata *
-ClangExternalASTSourceCommon::GetMetadata (uintptr_t object)
+ClangExternalASTSourceCommon::GetMetadata (const void *object)
 {
     assert (m_magic == ClangExternalASTSourceCommon_MAGIC);
     
@@ -39,7 +40,7 @@ ClangExternalASTSourceCommon::GetMetadat
 }
 
 void
-ClangExternalASTSourceCommon::SetMetadata (uintptr_t object, ClangASTMetadata &metadata)
+ClangExternalASTSourceCommon::SetMetadata (const void *object, ClangASTMetadata &metadata)
 {
     assert (m_magic == ClangExternalASTSourceCommon_MAGIC);
     
@@ -50,9 +51,39 @@ ClangExternalASTSourceCommon::SetMetadat
 }
 
 bool
-ClangExternalASTSourceCommon::HasMetadata (uintptr_t object)
+ClangExternalASTSourceCommon::HasMetadata (const void *object)
 {
     assert (m_magic == ClangExternalASTSourceCommon_MAGIC);
 
     return m_metadata.find(object) != m_metadata.end();
 }
+
+void
+ClangASTMetadata::Dump (Stream *s)
+{
+    lldb::user_id_t uid = GetUserID ();
+    
+    if (uid != LLDB_INVALID_UID)
+    {
+        s->Printf ("uid=0x%" PRIx64, uid);
+    }
+    
+    uint64_t isa_ptr = GetISAPtr ();
+    if (isa_ptr != 0)
+    {
+        s->Printf ("isa_ptr=0x%" PRIx64, isa_ptr);
+    }
+    
+    const char *obj_ptr_name = GetObjectPtrName();
+    if (obj_ptr_name)
+    {
+        s->Printf ("obj_ptr_name=\"%s\" ", obj_ptr_name);
+    }
+    
+    if (m_is_dynamic_cxx)
+    {
+        s->Printf ("is_dynamic_cxx=%i ", m_is_dynamic_cxx);
+    }
+    s->EOL();
+}
+

Modified: lldb/branches/windows/source/Symbol/DWARFCallFrameInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Symbol/DWARFCallFrameInfo.cpp?rev=179679&r1=179678&r2=179679&view=diff
==============================================================================
--- lldb/branches/windows/source/Symbol/DWARFCallFrameInfo.cpp (original)
+++ lldb/branches/windows/source/Symbol/DWARFCallFrameInfo.cpp Wed Apr 17 03:38:48 2013
@@ -17,6 +17,7 @@
 #include "lldb/Core/ArchSpec.h"
 #include "lldb/Core/Module.h"
 #include "lldb/Core/Section.h"
+#include "lldb/Core/Timer.h"
 #include "lldb/Host/Host.h"
 #include "lldb/Symbol/DWARFCallFrameInfo.h"
 #include "lldb/Symbol/ObjectFile.h"
@@ -47,54 +48,79 @@ DWARFCallFrameInfo::~DWARFCallFrameInfo(
 
 
 bool
-DWARFCallFrameInfo::GetAddressRange (Address addr, AddressRange &range)
+DWARFCallFrameInfo::GetUnwindPlan (Address addr, UnwindPlan& unwind_plan)
 {
-    FDEEntry fde_entry;
-    if (GetFDEEntryByAddress (addr, fde_entry) == false)
+    FDEEntryMap::Entry fde_entry;
+
+    // Make sure that the Address we're searching for is the same object file
+    // as this DWARFCallFrameInfo, we only store File offsets in m_fde_index.
+    ModuleSP module_sp = addr.GetModule();
+    if (module_sp.get() == NULL || module_sp->GetObjectFile() == NULL || module_sp->GetObjectFile() != &m_objfile)
         return false;
-    range = fde_entry.bounds;
-    return true;
+
+    if (GetFDEEntryByFileAddress (addr.GetFileAddress(), fde_entry) == false)
+        return false;
+    return FDEToUnwindPlan (fde_entry.data, addr, unwind_plan);
 }
 
 bool
-DWARFCallFrameInfo::GetUnwindPlan (Address addr, UnwindPlan& unwind_plan)
+DWARFCallFrameInfo::GetAddressRange (Address addr, AddressRange &range)
 {
-    FDEEntry fde_entry;
-    if (GetFDEEntryByAddress (addr, fde_entry) == false)
+
+    // Make sure that the Address we're searching for is the same object file
+    // as this DWARFCallFrameInfo, we only store File offsets in m_fde_index.
+    ModuleSP module_sp = addr.GetModule();
+    if (module_sp.get() == NULL || module_sp->GetObjectFile() == NULL || module_sp->GetObjectFile() != &m_objfile)
         return false;
-    return FDEToUnwindPlan (fde_entry.offset, addr, unwind_plan);
+
+    if (m_section_sp.get() == NULL || m_section_sp->IsEncrypted())
+        return false;
+    GetFDEIndex();
+    FDEEntryMap::Entry *fde_entry = m_fde_index.FindEntryThatContains (addr.GetFileAddress());
+    if (!fde_entry)
+        return false;
+
+    range = AddressRange(fde_entry->base, fde_entry->size, m_objfile.GetSectionList());
+    return true;
 }
 
 bool
-DWARFCallFrameInfo::GetFDEEntryByAddress (Address addr, FDEEntry& fde_entry)
+DWARFCallFrameInfo::GetFDEEntryByFileAddress (addr_t file_addr, FDEEntryMap::Entry &fde_entry)
 {
     if (m_section_sp.get() == NULL || m_section_sp->IsEncrypted())
         return false;
+
     GetFDEIndex();
 
-    struct FDEEntry searchfde;
-    searchfde.bounds = AddressRange (addr, 1);
+    if (m_fde_index.IsEmpty())
+        return false;
+
+    FDEEntryMap::Entry *fde = m_fde_index.FindEntryThatContains (file_addr);
 
-    std::vector<FDEEntry>::const_iterator idx;
-    if (m_fde_index.size() == 0)
+    if (fde == NULL)
         return false;
 
-    idx = std::lower_bound (m_fde_index.begin(), m_fde_index.end(), searchfde);
-    if (idx == m_fde_index.end())
-    {
-        --idx;
-    }
-    if (idx != m_fde_index.begin() && idx->bounds.GetBaseAddress().GetOffset() != addr.GetOffset())
-    {
-       --idx;
-    }
-    if (idx->bounds.ContainsFileAddress (addr))
+    fde_entry = *fde;
+    return true;
+}
+
+void
+DWARFCallFrameInfo::GetFunctionAddressAndSizeVector (FunctionAddressAndSizeVector &function_info)
+{
+    GetFDEIndex();
+    const size_t count = m_fde_index.GetSize();
+    function_info.Clear();
+    if (count > 0)
+        function_info.Reserve(count);
+    for (size_t i = 0; i < count; ++i)
     {
-        fde_entry = *idx;
-        return true;
+        const FDEEntryMap::Entry *func_offset_data_entry = m_fde_index.GetEntryAtIndex (i);
+        if (func_offset_data_entry)
+        {
+            FunctionAddressAndSizeVector::Entry function_offset_entry (func_offset_data_entry->base, func_offset_data_entry->size);
+            function_info.Append (function_offset_entry);
+        }
     }
-
-    return false;
 }
 
 const DWARFCallFrameInfo::CIE*
@@ -117,13 +143,13 @@ DWARFCallFrameInfo::CIESP
 DWARFCallFrameInfo::ParseCIE (const dw_offset_t cie_offset)
 {
     CIESP cie_sp(new CIE(cie_offset));
-    dw_offset_t offset = cie_offset;
+    lldb::offset_t offset = cie_offset;
     if (m_cfi_data_initialized == false)
         GetCFIData();
     const uint32_t length = m_cfi_data.GetU32(&offset);
     const dw_offset_t cie_id = m_cfi_data.GetU32(&offset);
     const dw_offset_t end_offset = cie_offset + length + 4;
-    if (length > 0 && ((!m_is_eh_frame && cie_id == 0xfffffffful) || (m_is_eh_frame && cie_id == 0ul)))
+    if (length > 0 && ((!m_is_eh_frame && cie_id == UINT32_MAX) || (m_is_eh_frame && cie_id == 0ul)))
     {
         size_t i;
         //    cie.offset = cie_offset;
@@ -277,9 +303,9 @@ DWARFCallFrameInfo::GetCFIData()
 {
     if (m_cfi_data_initialized == false)
     {
-        LogSP log(GetLogIfAllCategoriesSet (LIBLLDB_LOG_UNWIND));
+        Log *log(GetLogIfAllCategoriesSet (LIBLLDB_LOG_UNWIND));
         if (log)
-            m_objfile.GetModule()->LogMessage(log.get(), "Reading EH frame info");
+            m_objfile.GetModule()->LogMessage(log, "Reading EH frame info");
         m_objfile.ReadSectionData (m_section_sp.get(), m_cfi_data);
         m_cfi_data_initialized = true;
     }
@@ -302,7 +328,9 @@ DWARFCallFrameInfo::GetFDEIndex ()
     if (m_fde_index_initialized) // if two threads hit the locker
         return;
 
-    dw_offset_t offset = 0;
+    Timer scoped_timer (__PRETTY_FUNCTION__, "%s - %s", __PRETTY_FUNCTION__, m_objfile.GetFileSpec().GetFilename().AsCString(""));
+
+    lldb::offset_t offset = 0;
     if (m_cfi_data_initialized == false)
         GetCFIData();
     while (m_cfi_data.ValidOffsetForDataOfSize (offset, 8))
@@ -329,10 +357,8 @@ DWARFCallFrameInfo::GetFDEIndex ()
 
             lldb::addr_t addr = m_cfi_data.GetGNUEHPointer(&offset, cie->ptr_encoding, pc_rel_addr, text_addr, data_addr);
             lldb::addr_t length = m_cfi_data.GetGNUEHPointer(&offset, cie->ptr_encoding & DW_EH_PE_MASK_ENCODING, pc_rel_addr, text_addr, data_addr);
-            FDEEntry fde;
-            fde.bounds = AddressRange (addr, length, m_objfile.GetSectionList());
-            fde.offset = current_entry;
-            m_fde_index.push_back(fde);
+            FDEEntryMap::Entry fde (addr, length, current_entry);
+            m_fde_index.Append(fde);
         }
         else
         {
@@ -344,14 +370,15 @@ DWARFCallFrameInfo::GetFDEIndex ()
         }
         offset = next_entry;
     }
-    std::sort (m_fde_index.begin(), m_fde_index.end());
+    m_fde_index.Sort();
     m_fde_index_initialized = true;
 }
 
 bool
-DWARFCallFrameInfo::FDEToUnwindPlan (dw_offset_t offset, Address startaddr, UnwindPlan& unwind_plan)
+DWARFCallFrameInfo::FDEToUnwindPlan (dw_offset_t dwarf_offset, Address startaddr, UnwindPlan& unwind_plan)
 {
-    dw_offset_t current_entry = offset;
+    lldb::offset_t offset = dwarf_offset;
+    lldb::offset_t current_entry = offset;
 
     if (m_section_sp.get() == NULL || m_section_sp->IsEncrypted())
         return false;

Modified: lldb/branches/windows/source/Symbol/Function.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Symbol/Function.cpp?rev=179679&r1=179678&r2=179679&view=diff
==============================================================================
--- lldb/branches/windows/source/Symbol/Function.cpp (original)
+++ lldb/branches/windows/source/Symbol/Function.cpp Wed Apr 17 03:38:48 2013
@@ -392,13 +392,7 @@ Function::CalculateSymbolContextModule (
 {
     SectionSP section_sp (m_range.GetBaseAddress().GetSection());
     if (section_sp)
-    {
-        SectionSP linked_section_sp (section_sp->GetLinkedSection());
-        if (linked_section_sp)
-            return linked_section_sp->GetModule();
-        else
-            return section_sp->GetModule();
-    }
+        return section_sp->GetModule();
     
     return this->GetCompileUnit()->GetModule();
 }

Modified: lldb/branches/windows/source/Symbol/LineTable.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Symbol/LineTable.cpp?rev=179679&r1=179678&r2=179679&view=diff
==============================================================================
--- lldb/branches/windows/source/Symbol/LineTable.cpp (original)
+++ lldb/branches/windows/source/Symbol/LineTable.cpp Wed Apr 17 03:38:48 2013
@@ -8,6 +8,7 @@
 //===----------------------------------------------------------------------===//
 
 #include "lldb/Core/Address.h"
+#include "lldb/Core/Module.h"
 #include "lldb/Core/Section.h"
 #include "lldb/Core/Stream.h"
 #include "lldb/Symbol/CompileUnit.h"
@@ -22,7 +23,6 @@ using namespace lldb_private;
 //----------------------------------------------------------------------
 LineTable::LineTable(CompileUnit* comp_unit) :
     m_comp_unit(comp_unit),
-    m_section_list(),
     m_entries()
 {
 }
@@ -37,8 +37,7 @@ LineTable::~LineTable()
 void
 LineTable::InsertLineEntry
 (
-    const SectionSP& section_sp,
-    lldb::addr_t section_offset,
+    lldb::addr_t file_addr,
     uint32_t line,
     uint16_t column,
     uint16_t file_idx,
@@ -49,21 +48,7 @@ LineTable::InsertLineEntry
     bool is_terminal_entry
 )
 {
-    SectionSP line_section_sp;
-    SectionSP linked_section_sp (section_sp->GetLinkedSection());
-    if (linked_section_sp)
-    {
-        section_offset += section_sp->GetLinkedOffset();
-        line_section_sp = linked_section_sp;
-    }
-    else
-    {
-        line_section_sp = section_sp;
-    }
-    assert(line_section_sp.get());
-
-    uint32_t sect_idx = m_section_list.AddUniqueSection (line_section_sp);
-    Entry entry(sect_idx, section_offset, line, column, file_idx, is_start_of_statement, is_start_of_basic_block, is_prologue_end, is_epilogue_begin, is_terminal_entry);
+    Entry entry(file_addr, line, column, file_idx, is_start_of_statement, is_start_of_basic_block, is_prologue_end, is_epilogue_begin, is_terminal_entry);
 
     entry_collection::iterator begin_pos = m_entries.begin();
     entry_collection::iterator end_pos = m_entries.end();
@@ -85,7 +70,7 @@ LineSequence::LineSequence()
 void
 LineTable::LineSequenceImpl::Clear()
 { 
-    m_seq_entries.clear();
+    m_entries.clear();
 }
 
 LineSequence* LineTable::CreateLineSequenceContainer ()
@@ -97,8 +82,7 @@ void
 LineTable::AppendLineEntryToSequence
 (
     LineSequence* sequence,
-    const SectionSP& section_sp,
-    lldb::addr_t section_offset,
+    lldb::addr_t file_addr,
     uint32_t line,
     uint16_t column,
     uint16_t file_idx,
@@ -111,9 +95,8 @@ LineTable::AppendLineEntryToSequence
 {
     assert(sequence != NULL);
     LineSequenceImpl* seq = reinterpret_cast<LineSequenceImpl*>(sequence);
-    uint32_t sect_idx = m_section_list.AddUniqueSection (section_sp);
-    Entry entry(sect_idx, section_offset, line, column, file_idx, is_start_of_statement, is_start_of_basic_block, is_prologue_end, is_epilogue_begin, is_terminal_entry);
-    seq->m_seq_entries.push_back (entry);
+    Entry entry(file_addr, line, column, file_idx, is_start_of_statement, is_start_of_basic_block, is_prologue_end, is_epilogue_begin, is_terminal_entry);
+    seq->m_entries.push_back (entry);
 }
 
 void
@@ -121,17 +104,17 @@ LineTable::InsertSequence (LineSequence*
 {
     assert(sequence != NULL);
     LineSequenceImpl* seq = reinterpret_cast<LineSequenceImpl*>(sequence);
-    if (seq->m_seq_entries.empty())
+    if (seq->m_entries.empty())
         return;
-    Entry& entry = seq->m_seq_entries.front();
-
+    Entry& entry = seq->m_entries.front();
+    
     // If the first entry address in this sequence is greater than or equal to
     // the address of the last item in our entry collection, just append.
     if (m_entries.empty() || !Entry::EntryAddressLessThan(entry, m_entries.back()))
     {
         m_entries.insert(m_entries.end(),
-                         seq->m_seq_entries.begin(),
-                         seq->m_seq_entries.end());
+                         seq->m_entries.begin(),
+                         seq->m_entries.end());
         return;
     }
 
@@ -149,7 +132,7 @@ LineTable::InsertSequence (LineSequence*
         assert(prev_pos->is_terminal_entry);
     }
 #endif
-    m_entries.insert(pos, seq->m_seq_entries.begin(), seq->m_seq_entries.end());
+    m_entries.insert(pos, seq->m_entries.begin(), seq->m_entries.end());
 }
 
 //----------------------------------------------------------------------
@@ -161,37 +144,23 @@ LineTable::Entry::LessThanBinaryPredicat
 bool
 LineTable::Entry::LessThanBinaryPredicate::operator() (const LineTable::Entry& a, const LineTable::Entry& b) const
 {
-    if (a.sect_idx == b.sect_idx)
-    {
-        #define LT_COMPARE(a,b) if (a != b) return a < b
-        LT_COMPARE (a.sect_offset, b.sect_offset);
-        // b and a reversed on purpose below.
-        LT_COMPARE (b.is_terminal_entry, a.is_terminal_entry);
-        LT_COMPARE (a.line, b.line);
-        LT_COMPARE (a.column, b.column);
-        LT_COMPARE (a.is_start_of_statement, b.is_start_of_statement);
-        LT_COMPARE (a.is_start_of_basic_block, b.is_start_of_basic_block);
-        // b and a reversed on purpose below.
-        LT_COMPARE (b.is_prologue_end, a.is_prologue_end);
-        LT_COMPARE (a.is_epilogue_begin, b.is_epilogue_begin);
-        LT_COMPARE (a.file_idx, b.file_idx);
-        return false;
-        #undef LT_COMPARE
-    }
-
-    const Section *a_section = m_line_table->GetSectionForEntryIndex (a.sect_idx);
-    const Section *b_section = m_line_table->GetSectionForEntryIndex (b.sect_idx);
-    return Section::Compare(*a_section, *b_section) < 0;
+    #define LT_COMPARE(a,b) if (a != b) return a < b
+    LT_COMPARE (a.file_addr, b.file_addr);
+    // b and a reversed on purpose below.
+    LT_COMPARE (b.is_terminal_entry, a.is_terminal_entry);
+    LT_COMPARE (a.line, b.line);
+    LT_COMPARE (a.column, b.column);
+    LT_COMPARE (a.is_start_of_statement, b.is_start_of_statement);
+    LT_COMPARE (a.is_start_of_basic_block, b.is_start_of_basic_block);
+    // b and a reversed on purpose below.
+    LT_COMPARE (b.is_prologue_end, a.is_prologue_end);
+    LT_COMPARE (a.is_epilogue_begin, b.is_epilogue_begin);
+    LT_COMPARE (a.file_idx, b.file_idx);
+    return false;
+    #undef LT_COMPARE
 }
 
 
-Section *
-LineTable::GetSectionForEntryIndex (uint32_t idx)
-{
-    if (idx < m_section_list.GetSize())
-        return m_section_list.GetSectionAtIndex(idx).get();
-    return NULL;
-}
 
 uint32_t
 LineTable::GetSize() const
@@ -218,69 +187,69 @@ LineTable::FindLineEntryByAddress (const
         *index_ptr = UINT32_MAX;
 
     bool success = false;
-    uint32_t sect_idx = m_section_list.FindSectionIndex (so_addr.GetSection().get());
-    if (sect_idx != UINT32_MAX)
+
+    if (so_addr.GetModule().get() == m_comp_unit->GetModule().get())
     {
         Entry search_entry;
-        search_entry.sect_idx = sect_idx;
-        search_entry.sect_offset = so_addr.GetOffset();
-
-        entry_collection::const_iterator begin_pos = m_entries.begin();
-        entry_collection::const_iterator end_pos = m_entries.end();
-        entry_collection::const_iterator pos = lower_bound(begin_pos, end_pos, search_entry, Entry::EntryAddressLessThan);
-        if (pos != end_pos)
+        search_entry.file_addr = so_addr.GetFileAddress();
+        if (search_entry.file_addr != LLDB_INVALID_ADDRESS)
         {
-            if (pos != begin_pos)
+            entry_collection::const_iterator begin_pos = m_entries.begin();
+            entry_collection::const_iterator end_pos = m_entries.end();
+            entry_collection::const_iterator pos = lower_bound(begin_pos, end_pos, search_entry, Entry::EntryAddressLessThan);
+            if (pos != end_pos)
             {
-                if (pos->sect_offset != search_entry.sect_offset)
-                    --pos;
-                else if (pos->sect_offset == search_entry.sect_offset)
+                if (pos != begin_pos)
                 {
-                    // If this is a termination entry, it should't match since
-                    // entries with the "is_terminal_entry" member set to true 
-                    // are termination entries that define the range for the 
-                    // previous entry.
-                    if (pos->is_terminal_entry)
+                    if (pos->file_addr != search_entry.file_addr)
+                        --pos;
+                    else if (pos->file_addr == search_entry.file_addr)
                     {
-                        // The matching entry is a terminal entry, so we skip
-                        // ahead to the next entry to see if there is another
-                        // entry following this one whose section/offset matches.
-                        ++pos;
-                        if (pos != end_pos)
+                        // If this is a termination entry, it should't match since
+                        // entries with the "is_terminal_entry" member set to true 
+                        // are termination entries that define the range for the 
+                        // previous entry.
+                        if (pos->is_terminal_entry)
                         {
-                            if (pos->sect_offset != search_entry.sect_offset)
-                                pos = end_pos;
+                            // The matching entry is a terminal entry, so we skip
+                            // ahead to the next entry to see if there is another
+                            // entry following this one whose section/offset matches.
+                            ++pos;
+                            if (pos != end_pos)
+                            {
+                                if (pos->file_addr != search_entry.file_addr)
+                                    pos = end_pos;
+                            }
                         }
-                    }
-                    
-                    if (pos != end_pos)
-                    {
-                        // While in the same section/offset backup to find the first
-                        // line entry that matches the address in case there are 
-                        // multiple
-                        while (pos != begin_pos)
+                        
+                        if (pos != end_pos)
                         {
-                            entry_collection::const_iterator prev_pos = pos - 1;
-                            if (prev_pos->sect_idx    == search_entry.sect_idx &&
-                                prev_pos->sect_offset == search_entry.sect_offset &&
-                                prev_pos->is_terminal_entry == false)
-                                --pos;
-                            else
-                                break;
+                            // While in the same section/offset backup to find the first
+                            // line entry that matches the address in case there are 
+                            // multiple
+                            while (pos != begin_pos)
+                            {
+                                entry_collection::const_iterator prev_pos = pos - 1;
+                                if (prev_pos->file_addr == search_entry.file_addr &&
+                                    prev_pos->is_terminal_entry == false)
+                                    --pos;
+                                else
+                                    break;
+                            }
                         }
                     }
-                }
 
-            }
-            
-            // Make sure we have a valid match and that the match isn't a terminating
-            // entry for a previous line...
-            if (pos != end_pos && pos->is_terminal_entry == false)
-            {
-                uint32_t match_idx = std::distance (begin_pos, pos);
-                success = ConvertEntryAtIndexToLineEntry(match_idx, line_entry);
-                if (index_ptr != NULL && success)
-                    *index_ptr = match_idx;
+                }
+                
+                // Make sure we have a valid match and that the match isn't a terminating
+                // entry for a previous line...
+                if (pos != end_pos && pos->is_terminal_entry == false)
+                {
+                    uint32_t match_idx = std::distance (begin_pos, pos);
+                    success = ConvertEntryAtIndexToLineEntry(match_idx, line_entry);
+                    if (index_ptr != NULL && success)
+                        *index_ptr = match_idx;
+                }
             }
         }
     }
@@ -294,32 +263,24 @@ LineTable::ConvertEntryAtIndexToLineEntr
     if (idx < m_entries.size())
     {
         const Entry& entry = m_entries[idx];
-        line_entry.range.GetBaseAddress().SetSection(m_section_list.GetSectionAtIndex (entry.sect_idx));
-        line_entry.range.GetBaseAddress().SetOffset(entry.sect_offset);
-        if (!entry.is_terminal_entry && idx + 1 < m_entries.size())
+        ModuleSP module_sp (m_comp_unit->GetModule());
+        if (module_sp && module_sp->ResolveFileAddress(entry.file_addr, line_entry.range.GetBaseAddress()))
         {
-            const Entry& next_entry = m_entries[idx+1];
-            if (next_entry.sect_idx == entry.sect_idx)
-            {
-                line_entry.range.SetByteSize(next_entry.sect_offset - entry.sect_offset);
-            }
+            if (!entry.is_terminal_entry && idx + 1 < m_entries.size())
+                line_entry.range.SetByteSize(m_entries[idx+1].file_addr - entry.file_addr);
             else
-            {
-                Address next_line_addr(m_section_list.GetSectionAtIndex (next_entry.sect_idx), next_entry.sect_offset);
-                line_entry.range.SetByteSize(next_line_addr.GetFileAddress() - line_entry.range.GetBaseAddress().GetFileAddress());
-            }
+                line_entry.range.SetByteSize(0);
+
+            line_entry.file = m_comp_unit->GetSupportFiles().GetFileSpecAtIndex (entry.file_idx);
+            line_entry.line = entry.line;
+            line_entry.column = entry.column;
+            line_entry.is_start_of_statement = entry.is_start_of_statement;
+            line_entry.is_start_of_basic_block = entry.is_start_of_basic_block;
+            line_entry.is_prologue_end = entry.is_prologue_end;
+            line_entry.is_epilogue_begin = entry.is_epilogue_begin;
+            line_entry.is_terminal_entry = entry.is_terminal_entry;
+            return true;
         }
-        else
-            line_entry.range.SetByteSize(0);
-        line_entry.file = m_comp_unit->GetSupportFiles().GetFileSpecAtIndex (entry.file_idx);
-        line_entry.line = entry.line;
-        line_entry.column = entry.column;
-        line_entry.is_start_of_statement = entry.is_start_of_statement;
-        line_entry.is_start_of_basic_block = entry.is_start_of_basic_block;
-        line_entry.is_prologue_end = entry.is_prologue_end;
-        line_entry.is_epilogue_begin = entry.is_epilogue_begin;
-        line_entry.is_terminal_entry = entry.is_terminal_entry;
-        return true;
     }
     return false;
 }
@@ -503,7 +464,6 @@ LineTable::GetContiguousFileAddressRange
     
     const size_t count = m_entries.size();
     LineEntry line_entry;
-    std::vector<addr_t> section_base_file_addrs (m_section_list.GetSize(), LLDB_INVALID_ADDRESS);
     FileAddressRanges::Entry range (LLDB_INVALID_ADDRESS, 0);
     for (size_t idx = 0; idx < count; ++idx)
     {
@@ -513,23 +473,116 @@ LineTable::GetContiguousFileAddressRange
         {
             if (range.GetRangeBase() != LLDB_INVALID_ADDRESS)
             {
-                if (section_base_file_addrs[entry.sect_idx] == LLDB_INVALID_ADDRESS)
-                    section_base_file_addrs[entry.sect_idx] = m_section_list.GetSectionAtIndex (entry.sect_idx)->GetFileAddress();
-                range.SetRangeEnd(section_base_file_addrs[entry.sect_idx] + entry.sect_offset);
+                range.SetRangeEnd(entry.file_addr);
                 file_ranges.Append(range);
                 range.Clear(LLDB_INVALID_ADDRESS);
             }
         }
         else if (range.GetRangeBase() == LLDB_INVALID_ADDRESS)
         {
-            if (section_base_file_addrs[entry.sect_idx] == LLDB_INVALID_ADDRESS)
-                section_base_file_addrs[entry.sect_idx] = m_section_list.GetSectionAtIndex (entry.sect_idx)->GetFileAddress();
-            range.SetRangeBase(section_base_file_addrs[entry.sect_idx] + entry.sect_offset);
+            range.SetRangeBase(entry.file_addr);
         }
     }
     return file_ranges.GetSize() - initial_count;
 }
 
+LineTable *
+LineTable::LinkLineTable (const FileRangeMap &file_range_map)
+{
+    std::auto_ptr<LineTable> line_table_ap (new LineTable (m_comp_unit));
+    LineSequenceImpl sequence;
+    const size_t count = m_entries.size();
+    LineEntry line_entry;
+    const FileRangeMap::Entry *file_range_entry = NULL;
+    const FileRangeMap::Entry *prev_file_range_entry = NULL;
+    lldb::addr_t prev_file_addr = LLDB_INVALID_ADDRESS;
+    bool prev_entry_was_linked = false;
+    bool range_changed = false;
+    for (size_t idx = 0; idx < count; ++idx)
+    {
+        const Entry& entry = m_entries[idx];
+        
+        const bool end_sequence = entry.is_terminal_entry;
+        const lldb::addr_t lookup_file_addr = entry.file_addr - (end_sequence ? 1 : 0);
+        if (file_range_entry == NULL || !file_range_entry->Contains(lookup_file_addr))
+        {
+            prev_file_range_entry = file_range_entry;
+            file_range_entry = file_range_map.FindEntryThatContains(lookup_file_addr);
+            range_changed = true;
+        }
+
+        lldb::addr_t prev_end_entry_linked_file_addr = LLDB_INVALID_ADDRESS;
+        lldb::addr_t entry_linked_file_addr = LLDB_INVALID_ADDRESS;
+
+        bool terminate_previous_entry = false;
+        if (file_range_entry)
+        {
+            entry_linked_file_addr = entry.file_addr - file_range_entry->GetRangeBase() + file_range_entry->data;
+            // Determine if we need to terminate the previous entry when the previous
+            // entry was not contguous with this one after being linked.
+            if (range_changed && prev_file_range_entry)
+            {
+                prev_end_entry_linked_file_addr = std::min<lldb::addr_t>(entry.file_addr, prev_file_range_entry->GetRangeEnd()) - prev_file_range_entry->GetRangeBase() + prev_file_range_entry->data;
+                if (prev_end_entry_linked_file_addr != entry_linked_file_addr)
+                    terminate_previous_entry = prev_entry_was_linked;                
+            }
+        }
+        else if (prev_entry_was_linked)
+        {
+            // This entry doesn't have a remapping and it needs to be removed.
+            // Watch out in case we need to terminate a previous entry needs to
+            // be terminated now that one line entry in a sequence is not longer valid.
+            if (!entry.is_terminal_entry &&
+                !sequence.m_entries.empty() &&
+                !sequence.m_entries.back().is_terminal_entry)
+            {
+                terminate_previous_entry = true;
+            }
+        }
+        
+        if (terminate_previous_entry && !sequence.m_entries.empty())
+        {
+            assert (prev_file_addr != LLDB_INVALID_ADDRESS);
+            sequence.m_entries.push_back(sequence.m_entries.back());
+            if (prev_end_entry_linked_file_addr == LLDB_INVALID_ADDRESS)
+                prev_end_entry_linked_file_addr = std::min<lldb::addr_t>(entry.file_addr,prev_file_range_entry->GetRangeEnd()) - prev_file_range_entry->GetRangeBase() + prev_file_range_entry->data;
+            sequence.m_entries.back().file_addr = prev_end_entry_linked_file_addr;
+            sequence.m_entries.back().is_terminal_entry = true;
+
+            // Append the sequence since we just terminated the previous one
+            line_table_ap->InsertSequence (&sequence);
+            sequence.Clear();
+            prev_entry_was_linked = false;
+        }
+        
+        // Now link the current entry
+        if (file_range_entry)
+        {
+            // This entry has an address remapping and it needs to have its address relinked
+            sequence.m_entries.push_back(entry);
+            sequence.m_entries.back().file_addr = entry_linked_file_addr;
+        }
+
+        // If we have items in the sequence and the last entry is a terminal entry,
+        // insert this sequence into our new line table.
+        if (!sequence.m_entries.empty() && sequence.m_entries.back().is_terminal_entry)
+        {
+            line_table_ap->InsertSequence (&sequence);
+            sequence.Clear();
+            prev_entry_was_linked = false;
+        }
+        else
+        {
+            prev_entry_was_linked = file_range_entry != NULL;
+        }
+        prev_file_addr = entry.file_addr;
+        range_changed = false;
+    }
+    if (line_table_ap->m_entries.empty())
+        return NULL;
+    return line_table_ap.release();
+}
+
 
 
 

Modified: lldb/branches/windows/source/Symbol/ObjectFile.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Symbol/ObjectFile.cpp?rev=179679&r1=179678&r2=179679&view=diff
==============================================================================
--- lldb/branches/windows/source/Symbol/ObjectFile.cpp (original)
+++ lldb/branches/windows/source/Symbol/ObjectFile.cpp Wed Apr 17 03:38:48 2013
@@ -27,7 +27,12 @@ using namespace lldb;
 using namespace lldb_private;
 
 ObjectFileSP
-ObjectFile::FindPlugin (const lldb::ModuleSP &module_sp, const FileSpec* file, addr_t file_offset, addr_t file_size, DataBufferSP &file_data_sp)
+ObjectFile::FindPlugin (const lldb::ModuleSP &module_sp,
+                        const FileSpec* file,
+                        lldb::offset_t file_offset,
+                        lldb::offset_t file_size,
+                        DataBufferSP &data_sp,
+                        lldb::offset_t &data_offset)
 {
     ObjectFileSP object_file_sp;
 
@@ -40,42 +45,85 @@ ObjectFile::FindPlugin (const lldb::Modu
                             file, (uint64_t) file_offset, (uint64_t) file_size);
         if (file)
         {
-            // Memory map the entire file contents
-            if (!file_data_sp && file_size > 0)
+            FileSpec archive_file;
+            ObjectContainerCreateInstance create_object_container_callback;
+
+            const bool file_exists = file->Exists();
+            if (!data_sp)
             {
-                assert (file_offset == 0);
-                file_data_sp = file->MemoryMapFileContents(file_offset, file_size);
+                // We have an object name which most likely means we have
+                // a .o file in a static archive (.a file). Try and see if
+                // we have a cached archive first without reading any data
+                // first
+                if (file_exists && module_sp->GetObjectName())
+                {
+                    for (uint32_t idx = 0; (create_object_container_callback = PluginManager::GetObjectContainerCreateCallbackAtIndex(idx)) != NULL; ++idx)
+                    {
+                        std::auto_ptr<ObjectContainer> object_container_ap(create_object_container_callback(module_sp, data_sp, data_offset, file, file_offset, file_size));
+                        
+                        if (object_container_ap.get())
+                            object_file_sp = object_container_ap->GetObjectFile(file);
+                        
+                        if (object_file_sp.get())
+                            return object_file_sp;
+            }
+                }
+                // Ok, we didn't find any containers that have a named object, now
+                // lets read the first 512 bytes from the file so the object file
+                // and object container plug-ins can use these bytes to see if they
+                // can parse this file.
+                if (file_size > 0)
+                {
+                    data_sp = file->ReadFileContents(file_offset, std::min<size_t>(512, file_size));
+                    data_offset = 0;
+                }
             }
 
-            if (!file_data_sp || file_data_sp->GetByteSize() == 0)
+            if (!data_sp || data_sp->GetByteSize() == 0)
             {
                 // Check for archive file with format "/path/to/archive.a(object.o)"
                 char path_with_object[PATH_MAX*2];
                 module_sp->GetFileSpec().GetPath(path_with_object, sizeof(path_with_object));
 
-                FileSpec archive_file;
                 ConstString archive_object;
-                if (ObjectFile::SplitArchivePathWithObject (path_with_object, archive_file, archive_object))
+                const bool must_exist = true;
+                if (ObjectFile::SplitArchivePathWithObject (path_with_object, archive_file, archive_object, must_exist))
                 {
                     file_size = archive_file.GetByteSize();
                     if (file_size > 0)
                     {
+                        file = &archive_file;
                         module_sp->SetFileSpecAndObjectName (archive_file, archive_object);
-                        file_data_sp = archive_file.MemoryMapFileContents(file_offset, file_size);
+                        // Check if this is a object container by iterating through all object
+                        // container plugin instances and then trying to get an object file
+                        // from the container plugins since we had a name. Also, don't read
+                        // ANY data in case there is data cached in the container plug-ins
+                        // (like BSD archives caching the contained objects within an file).
+                        for (uint32_t idx = 0; (create_object_container_callback = PluginManager::GetObjectContainerCreateCallbackAtIndex(idx)) != NULL; ++idx)
+                        {
+                            std::auto_ptr<ObjectContainer> object_container_ap(create_object_container_callback(module_sp, data_sp, data_offset, file, file_offset, file_size));
+                            
+                            if (object_container_ap.get())
+                                object_file_sp = object_container_ap->GetObjectFile(file);
+                            
+                            if (object_file_sp.get())
+                                return object_file_sp;
                     }
+                        // We failed to find any cached object files in the container
+                        // plug-ins, so lets read the first 512 bytes and try again below...
+                        data_sp = archive_file.ReadFileContents(file_offset, 512);
                 }
             }
+            }
 
-            if (file_data_sp && file_data_sp->GetByteSize() > 0)
+            if (data_sp && data_sp->GetByteSize() > 0)
             {
-                uint32_t idx;
-
                 // Check if this is a normal object file by iterating through
                 // all object file plugin instances.
                 ObjectFileCreateInstance create_object_file_callback;
-                for (idx = 0; (create_object_file_callback = PluginManager::GetObjectFileCreateCallbackAtIndex(idx)) != NULL; ++idx)
+                for (uint32_t idx = 0; (create_object_file_callback = PluginManager::GetObjectFileCreateCallbackAtIndex(idx)) != NULL; ++idx)
                 {
-                    object_file_sp.reset (create_object_file_callback(module_sp, file_data_sp, file, file_offset, file_size));
+                    object_file_sp.reset (create_object_file_callback(module_sp, data_sp, data_offset, file, file_offset, file_size));
                     if (object_file_sp.get())
                         return object_file_sp;
                 }
@@ -83,10 +131,9 @@ ObjectFile::FindPlugin (const lldb::Modu
                 // Check if this is a object container by iterating through
                 // all object container plugin instances and then trying to get
                 // an object file from the container.
-                ObjectContainerCreateInstance create_object_container_callback;
-                for (idx = 0; (create_object_container_callback = PluginManager::GetObjectContainerCreateCallbackAtIndex(idx)) != NULL; ++idx)
+                for (uint32_t idx = 0; (create_object_container_callback = PluginManager::GetObjectContainerCreateCallbackAtIndex(idx)) != NULL; ++idx)
                 {
-                    std::auto_ptr<ObjectContainer> object_container_ap(create_object_container_callback(module_sp, file_data_sp, file, file_offset, file_size));
+                    std::auto_ptr<ObjectContainer> object_container_ap(create_object_container_callback(module_sp, data_sp, data_offset, file, file_offset, file_size));
 
                     if (object_container_ap.get())
                         object_file_sp = object_container_ap->GetObjectFile(file);
@@ -107,7 +154,7 @@ ObjectFileSP
 ObjectFile::FindPlugin (const lldb::ModuleSP &module_sp, 
                         const ProcessSP &process_sp,
                         lldb::addr_t header_addr,
-                        DataBufferSP &file_data_sp)
+                        DataBufferSP &data_sp)
 {
     ObjectFileSP object_file_sp;
     
@@ -125,7 +172,7 @@ ObjectFile::FindPlugin (const lldb::Modu
         ObjectFileCreateMemoryInstance create_callback;
         for (idx = 0; (create_callback = PluginManager::GetObjectFileCreateMemoryCallbackAtIndex(idx)) != NULL; ++idx)
         {
-            object_file_sp.reset (create_callback(module_sp, file_data_sp, process_sp, header_addr));
+            object_file_sp.reset (create_callback(module_sp, data_sp, process_sp, header_addr));
             if (object_file_sp.get())
                 return object_file_sp;
         }
@@ -139,45 +186,56 @@ ObjectFile::FindPlugin (const lldb::Modu
 
 ObjectFile::ObjectFile (const lldb::ModuleSP &module_sp, 
                         const FileSpec *file_spec_ptr, 
-                        addr_t file_offset, 
-                        addr_t file_size, 
-                        DataBufferSP& file_data_sp) :
+                        lldb::offset_t file_offset,
+                        lldb::offset_t length,
+                        lldb::DataBufferSP& data_sp,
+                        lldb::offset_t data_offset
+) :
     ModuleChild (module_sp),
     m_file (),  // This file could be different from the original module's file
     m_type (eTypeInvalid),
     m_strata (eStrataInvalid),
-    m_offset (file_offset),
-    m_length (file_size),
+    m_file_offset (file_offset),
+    m_length (length),
     m_data (),
     m_unwind_table (*this),
     m_process_wp(),
-    m_memory_addr (LLDB_INVALID_ADDRESS)
-{    
+    m_memory_addr (LLDB_INVALID_ADDRESS),
+    m_sections_ap (),
+    m_symtab_ap ()
+{
     if (file_spec_ptr)
         m_file = *file_spec_ptr;
-    if (file_data_sp)
-        m_data.SetData (file_data_sp, file_offset, file_size);
-    LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_OBJECT));
+    if (data_sp)
+        m_data.SetData (data_sp, data_offset, length);
+    Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_OBJECT));
     if (log)
     {
+        const ConstString object_name (module_sp->GetObjectName());
         if (m_file)
         {
-            log->Printf ("%p ObjectFile::ObjectFile () module = %s/%s, file = %s/%s, offset = 0x%8.8" PRIx64 ", size = %" PRIu64 "\n",
+            log->Printf ("%p ObjectFile::ObjectFile() module = %p (%s%s%s%s), file = %s/%s, file_offset = 0x%8.8" PRIx64 ", size = %" PRIu64,
                          this,
-                         module_sp->GetFileSpec().GetDirectory().AsCString(),
+                         module_sp.get(),
                          module_sp->GetFileSpec().GetFilename().AsCString(),
+                         object_name ? "(" : "",
+                         object_name ? object_name.GetCString() : "",
+                         object_name ? ")" : "",
                          m_file.GetDirectory().AsCString(),
                          m_file.GetFilename().AsCString(),
-                         m_offset,
+                         m_file_offset,
                          m_length);
         }
         else
         {
-            log->Printf ("%p ObjectFile::ObjectFile () module = %s/%s, file = <NULL>, offset = 0x%8.8" PRIx64 ", size = %" PRIu64 "\n",
+            log->Printf ("%p ObjectFile::ObjectFile() module = %p (%s%s%s%s), file = <NULL>, file_offset = 0x%8.8" PRIx64 ", size = %" PRIu64,
                          this,
-                         module_sp->GetFileSpec().GetDirectory().AsCString(),
+                         module_sp.get(),
                          module_sp->GetFileSpec().GetFilename().AsCString(),
-                         m_offset,
+                         object_name ? "(" : "",
+                         object_name ? object_name.GetCString() : "",
+                         object_name ? ")" : "",
+                         m_file_offset,
                          m_length);
         }
     }
@@ -192,31 +250,37 @@ ObjectFile::ObjectFile (const lldb::Modu
     m_file (),
     m_type (eTypeInvalid),
     m_strata (eStrataInvalid),
-    m_offset (header_addr),
+    m_file_offset (0),
     m_length (0),
     m_data (),
     m_unwind_table (*this),
     m_process_wp (process_sp),
-    m_memory_addr (header_addr)
-{    
+    m_memory_addr (header_addr),
+    m_sections_ap (),
+    m_symtab_ap ()
+{
     if (header_data_sp)
         m_data.SetData (header_data_sp, 0, header_data_sp->GetByteSize());
-    LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_OBJECT));
+    Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_OBJECT));
     if (log)
     {
-        log->Printf ("%p ObjectFile::ObjectFile () module = %s/%s, process = %p, header_addr = 0x%" PRIx64 "\n",
+        const ConstString object_name (module_sp->GetObjectName());
+        log->Printf ("%p ObjectFile::ObjectFile() module = %p (%s%s%s%s), process = %p, header_addr = 0x%" PRIx64,
                      this,
-                     module_sp->GetFileSpec().GetDirectory().AsCString(),
+                     module_sp.get(),
                      module_sp->GetFileSpec().GetFilename().AsCString(),
+                     object_name ? "(" : "",
+                     object_name ? object_name.GetCString() : "",
+                     object_name ? ")" : "",
                      process_sp.get(),
-                     m_offset);
+                     m_memory_addr);
     }
 }
 
 
 ObjectFile::~ObjectFile()
 {
-    LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_OBJECT));
+    Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_OBJECT));
     if (log)
         log->Printf ("%p ObjectFile::~ObjectFile ()\n", this);
 }
@@ -292,6 +356,7 @@ ObjectFile::GetAddressClass (addr_t file
             case eSymbolTypeAbsolute:       return eAddressClassUnknown;
             case eSymbolTypeCode:           return eAddressClassCode;
             case eSymbolTypeTrampoline:     return eAddressClassCode;
+            case eSymbolTypeResolver:       return eAddressClassCode;
             case eSymbolTypeData:           return eAddressClassData;
             case eSymbolTypeRuntime:        return eAddressClassRuntime;
             case eSymbolTypeException:      return eAddressClassRuntime;
@@ -364,7 +429,9 @@ ObjectFile::ReadSectionData (const Secti
         if (process_sp)
         {
             Error error;
-            return process_sp->ReadMemory (section->GetLoadBaseAddress (&process_sp->GetTarget()) + section_offset, dst, dst_len, error);
+            const addr_t base_load_addr = section->GetLoadBaseAddress (&process_sp->GetTarget());
+            if (base_load_addr != LLDB_INVALID_ADDRESS)
+                return process_sp->ReadMemory (base_load_addr + section_offset, dst, dst_len, error);
         }
     }
     else
@@ -406,7 +473,10 @@ ObjectFile::ReadSectionData (const Secti
         ProcessSP process_sp (m_process_wp.lock());
         if (process_sp)
         {
-            DataBufferSP data_sp (ReadMemory (process_sp, section->GetLoadBaseAddress (&process_sp->GetTarget()), section->GetByteSize()));
+            const addr_t base_load_addr = section->GetLoadBaseAddress (&process_sp->GetTarget());
+            if (base_load_addr != LLDB_INVALID_ADDRESS)
+            {
+                DataBufferSP data_sp (ReadMemory (process_sp, base_load_addr, section->GetByteSize()));
             if (data_sp)
             {
                 section_data.SetData (data_sp, 0, data_sp->GetByteSize());
@@ -416,6 +486,7 @@ ObjectFile::ReadSectionData (const Secti
             }
         }
     }
+    }
     else
     {
         // The object file now contains a full mmap'ed copy of the object file data, so just use this
@@ -443,21 +514,41 @@ ObjectFile::MemoryMapSectionData (const
 
 
 bool
-ObjectFile::SplitArchivePathWithObject (const char *path_with_object, FileSpec &archive_file, ConstString &archive_object)
+ObjectFile::SplitArchivePathWithObject (const char *path_with_object, FileSpec &archive_file, ConstString &archive_object, bool must_exist)
 {
     RegularExpression g_object_regex("(.*)\\(([^\\)]+)\\)$");
-    if (g_object_regex.Execute (path_with_object, 2))
+    RegularExpression::Match regex_match(2);
+    if (g_object_regex.Execute (path_with_object, &regex_match))
     {
         std::string path;
         std::string obj;
-        if (g_object_regex.GetMatchAtIndex (path_with_object, 1, path) &&
-            g_object_regex.GetMatchAtIndex (path_with_object, 2, obj))
+        if (regex_match.GetMatchAtIndex (path_with_object, 1, path) &&
+            regex_match.GetMatchAtIndex (path_with_object, 2, obj))
         {
             archive_file.SetFile (path.c_str(), false);
             archive_object.SetCString(obj.c_str());
+            if (must_exist && !archive_file.Exists())
+                return false;
             return true;
         }
     }
     return false;
 }
 
+void
+ObjectFile::ClearSymtab ()
+{
+    ModuleSP module_sp(GetModule());
+    if (module_sp)
+    {
+        lldb_private::Mutex::Locker locker(module_sp->GetMutex());
+        Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_OBJECT));
+        if (log)
+        {
+            log->Printf ("%p ObjectFile::ClearSymtab () symtab = %p",
+                         this,
+                         m_symtab_ap.get());
+        }
+        m_symtab_ap.reset();
+    }
+}

Modified: lldb/branches/windows/source/Symbol/Symbol.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Symbol/Symbol.cpp?rev=179679&r1=179678&r2=179679&view=diff
==============================================================================
--- lldb/branches/windows/source/Symbol/Symbol.cpp (original)
+++ lldb/branches/windows/source/Symbol/Symbol.cpp Wed Apr 17 03:38:48 2013
@@ -52,7 +52,8 @@ Symbol::Symbol
     bool is_artificial,
     const lldb::SectionSP &section_sp,
     addr_t offset,
-    uint32_t size,
+    addr_t size,
+    bool size_is_valid,
     uint32_t flags
 ) :
     SymbolContextScope (),
@@ -65,7 +66,7 @@ Symbol::Symbol
     m_is_external (external),
     m_size_is_sibling (false),
     m_size_is_synthesized (false),
-    m_calculated_size (size > 0),
+    m_calculated_size (size_is_valid || size > 0),
     m_demangled_is_synthesized (false),
     m_type (type),
     m_flags (flags),
@@ -84,6 +85,7 @@ Symbol::Symbol
     bool is_trampoline,
     bool is_artificial,
     const AddressRange &range,
+    bool size_is_valid,
     uint32_t flags
 ) :
     SymbolContextScope (),
@@ -96,7 +98,7 @@ Symbol::Symbol
     m_is_external (external),
     m_size_is_sibling (false),
     m_size_is_synthesized (false),
-    m_calculated_size (range.GetByteSize() > 0),
+    m_calculated_size (size_is_valid || range.GetByteSize() > 0),
     m_demangled_is_synthesized (false),
     m_type (type),
     m_flags (flags),
@@ -184,6 +186,12 @@ Symbol::IsTrampoline () const
     return m_type == eSymbolTypeTrampoline;
 }
 
+bool
+Symbol::IsIndirect () const
+{
+    return m_type == eSymbolTypeResolver;
+}
+
 void
 Symbol::GetDescription (Stream *s, lldb::DescriptionLevel level, Target *target) const
 {
@@ -273,7 +281,7 @@ Symbol::Dump(Stream *s, Target *target,
 uint32_t
 Symbol::GetPrologueByteSize ()
 {
-    if (m_type == eSymbolTypeCode)
+    if (m_type == eSymbolTypeCode || m_type == eSymbolTypeResolver)
     {
         if (!m_type_data_resolved)
         {

Modified: lldb/branches/windows/source/Symbol/SymbolContext.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Symbol/SymbolContext.cpp?rev=179679&r1=179678&r2=179679&view=diff
==============================================================================
--- lldb/branches/windows/source/Symbol/SymbolContext.cpp (original)
+++ lldb/branches/windows/source/Symbol/SymbolContext.cpp Wed Apr 17 03:38:48 2013
@@ -108,9 +108,10 @@ SymbolContext::operator= (const SymbolCo
 }
 
 void
-SymbolContext::Clear()
+SymbolContext::Clear(bool clear_target)
 {
-    target_sp.reset();
+    if (clear_target)
+        target_sp.reset();
     module_sp.reset();
     comp_unit   = NULL;
     function    = NULL;
@@ -453,7 +454,7 @@ SymbolContext::GetParentOfInlinedScope (
                                         SymbolContext &next_frame_sc, 
                                         Address &next_frame_pc) const
 {
-    next_frame_sc.Clear();
+    next_frame_sc.Clear(false);
     next_frame_pc.Clear();
 
     if (block)
@@ -492,7 +493,7 @@ SymbolContext::GetParentOfInlinedScope (
             }
             else
             {
-                LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_SYMBOLS));
+                Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_SYMBOLS));
 
                 if (log)
                 {
@@ -1044,7 +1045,7 @@ SymbolContextList::Dump(Stream *s, Targe
 }
 
 bool
-SymbolContextList::GetContextAtIndex(uint32_t idx, SymbolContext& sc) const
+SymbolContextList::GetContextAtIndex(size_t idx, SymbolContext& sc) const
 {
     if (idx < m_symbol_contexts.size())
     {
@@ -1055,7 +1056,18 @@ SymbolContextList::GetContextAtIndex(uin
 }
 
 bool
-SymbolContextList::RemoveContextAtIndex (uint32_t idx)
+SymbolContextList::GetLastContext(SymbolContext& sc) const
+{
+    if (!m_symbol_contexts.empty())
+    {
+        sc = m_symbol_contexts.back();
+        return true;
+    }
+    return false;
+}
+
+bool
+SymbolContextList::RemoveContextAtIndex (size_t idx)
 {
     if (idx < m_symbol_contexts.size())
     {
@@ -1075,8 +1087,8 @@ uint32_t
 SymbolContextList::NumLineEntriesWithLine (uint32_t line) const
 {
     uint32_t match_count = 0;
-    const uint32_t size = m_symbol_contexts.size();
-    for (uint32_t idx = 0; idx<size; ++idx)
+    const size_t size = m_symbol_contexts.size();
+    for (size_t idx = 0; idx<size; ++idx)
     {
         if (m_symbol_contexts[idx].line_entry.line == line)
             ++match_count;
@@ -1089,8 +1101,8 @@ SymbolContextList::GetDescription(Stream
                                   lldb::DescriptionLevel level, 
                                   Target *target) const
 {
-    const uint32_t size = m_symbol_contexts.size();
-    for (uint32_t idx = 0; idx<size; ++idx)
+    const size_t size = m_symbol_contexts.size();
+    for (size_t idx = 0; idx<size; ++idx)
         m_symbol_contexts[idx].GetDescription (s, level, target);
 }
 

Modified: lldb/branches/windows/source/Symbol/SymbolVendor.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Symbol/SymbolVendor.cpp?rev=179679&r1=179678&r2=179679&view=diff
==============================================================================
--- lldb/branches/windows/source/Symbol/SymbolVendor.cpp (original)
+++ lldb/branches/windows/source/Symbol/SymbolVendor.cpp Wed Apr 17 03:38:48 2013
@@ -39,7 +39,7 @@ SymbolVendor::FindPlugin (const lldb::Mo
     // We currently only have one debug symbol parser...
     //----------------------------------------------------------------------
     SymbolVendorCreateInstance create_callback;
-    for (uint32_t idx = 0; (create_callback = PluginManager::GetSymbolVendorCreateCallbackAtIndex(idx)) != NULL; ++idx)
+    for (size_t idx = 0; (create_callback = PluginManager::GetSymbolVendorCreateCallbackAtIndex(idx)) != NULL; ++idx)
     {
         instance_ap.reset(create_callback(module_sp, feedback_strm));
 
@@ -102,13 +102,13 @@ SymbolVendor::AddSymbolFileRepresentatio
 }
 
 bool
-SymbolVendor::SetCompileUnitAtIndex (uint32_t idx, const CompUnitSP &cu_sp)
+SymbolVendor::SetCompileUnitAtIndex (size_t idx, const CompUnitSP &cu_sp)
 {
     ModuleSP module_sp(GetModule());
     if (module_sp)
     {
         lldb_private::Mutex::Locker locker(module_sp->GetMutex());
-        const uint32_t num_compile_units = GetNumCompileUnits();
+        const size_t num_compile_units = GetNumCompileUnits();
         if (idx < num_compile_units)
         {
             // Fire off an assertion if this compile unit already exists for now.
@@ -130,7 +130,7 @@ SymbolVendor::SetCompileUnitAtIndex (uin
     return false;
 }
 
-uint32_t
+size_t
 SymbolVendor::GetNumCompileUnits()
 {
     ModuleSP module_sp(GetModule());
@@ -284,8 +284,8 @@ SymbolVendor::ResolveSymbolContext (cons
     return 0;
 }
 
-uint32_t
-SymbolVendor::FindGlobalVariables (const ConstString &name, const ClangNamespaceDecl *namespace_decl, bool append, uint32_t max_matches, VariableList& variables)
+size_t
+SymbolVendor::FindGlobalVariables (const ConstString &name, const ClangNamespaceDecl *namespace_decl, bool append, size_t max_matches, VariableList& variables)
 {
     ModuleSP module_sp(GetModule());
     if (module_sp)
@@ -297,8 +297,8 @@ SymbolVendor::FindGlobalVariables (const
     return 0;
 }
 
-uint32_t
-SymbolVendor::FindGlobalVariables (const RegularExpression& regex, bool append, uint32_t max_matches, VariableList& variables)
+size_t
+SymbolVendor::FindGlobalVariables (const RegularExpression& regex, bool append, size_t max_matches, VariableList& variables)
 {
     ModuleSP module_sp(GetModule());
     if (module_sp)
@@ -310,7 +310,7 @@ SymbolVendor::FindGlobalVariables (const
     return 0;
 }
 
-uint32_t
+size_t
 SymbolVendor::FindFunctions(const ConstString &name, const ClangNamespaceDecl *namespace_decl, uint32_t name_type_mask, bool include_inlines, bool append, SymbolContextList& sc_list)
 {
     ModuleSP module_sp(GetModule());
@@ -323,7 +323,7 @@ SymbolVendor::FindFunctions(const ConstS
     return 0;
 }
 
-uint32_t
+size_t
 SymbolVendor::FindFunctions(const RegularExpression& regex, bool include_inlines, bool append, SymbolContextList& sc_list)
 {
     ModuleSP module_sp(GetModule());
@@ -337,8 +337,8 @@ SymbolVendor::FindFunctions(const Regula
 }
 
 
-uint32_t
-SymbolVendor::FindTypes (const SymbolContext& sc, const ConstString &name, const ClangNamespaceDecl *namespace_decl, bool append, uint32_t max_matches, TypeList& types)
+size_t
+SymbolVendor::FindTypes (const SymbolContext& sc, const ConstString &name, const ClangNamespaceDecl *namespace_decl, bool append, size_t max_matches, TypeList& types)
 {
     ModuleSP module_sp(GetModule());
     if (module_sp)
@@ -409,13 +409,13 @@ SymbolVendor::Dump(Stream *s)
 }
 
 CompUnitSP
-SymbolVendor::GetCompileUnitAtIndex(uint32_t idx)
+SymbolVendor::GetCompileUnitAtIndex(size_t idx)
 {
     CompUnitSP cu_sp;
     ModuleSP module_sp(GetModule());
     if (module_sp)
     {
-        const uint32_t num_compile_units = GetNumCompileUnits();
+        const size_t num_compile_units = GetNumCompileUnits();
         if (idx < num_compile_units)
         {
             cu_sp = m_compile_units[idx];

Modified: lldb/branches/windows/source/Symbol/Symtab.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Symbol/Symtab.cpp?rev=179679&r1=179678&r2=179679&view=diff
==============================================================================
--- lldb/branches/windows/source/Symbol/Symtab.cpp (original)
+++ lldb/branches/windows/source/Symbol/Symtab.cpp Wed Apr 17 03:38:48 2013
@@ -11,10 +11,12 @@
 
 #include "lldb/Core/Module.h"
 #include "lldb/Core/RegularExpression.h"
+#include "lldb/Core/Section.h"
 #include "lldb/Core/Timer.h"
 #include "lldb/Symbol/ObjectFile.h"
 #include "lldb/Symbol/SymbolContext.h"
 #include "lldb/Symbol/Symtab.h"
+#include "lldb/Target/CPPLanguageRuntime.h"
 #include "lldb/Target/ObjCLanguageRuntime.h"
 
 using namespace lldb;
@@ -38,7 +40,7 @@ Symtab::~Symtab()
 }
 
 void
-Symtab::Reserve(uint32_t count)
+Symtab::Reserve(size_t count)
 {
     // Clients should grab the mutex from this symbol table and lock it manually
     // when calling this function to avoid performance issues.
@@ -46,7 +48,7 @@ Symtab::Reserve(uint32_t count)
 }
 
 Symbol *
-Symtab::Resize(uint32_t count)
+Symtab::Resize(size_t count)
 {
     // Clients should grab the mutex from this symbol table and lock it manually
     // when calling this function to avoid performance issues.
@@ -150,7 +152,7 @@ Symtab::Dump (Stream *s, Target *target,
             std::vector<uint32_t>::const_iterator end = m_addr_indexes.end();
             for (pos = m_addr_indexes.begin(); pos != end; ++pos)
             {
-                uint32_t idx = *pos;
+                size_t idx = *pos;
                 if (idx < num_symbols)
                 {
                     s->Indent();
@@ -180,7 +182,7 @@ Symtab::Dump(Stream *s, Target *target,
         DumpSymbolHeader (s);
         for (pos = indexes.begin(); pos != end; ++pos)
         {
-            uint32_t idx = *pos;
+            size_t idx = *pos;
             if (idx < num_symbols)
             {
                 s->Indent();
@@ -230,7 +232,7 @@ Symtab::FindSymbolByID (lldb::user_id_t
 
 
 Symbol *
-Symtab::SymbolAtIndex(uint32_t idx)
+Symtab::SymbolAtIndex(size_t idx)
 {
     // Clients should grab the mutex from this symbol table and lock it manually
     // when calling this function to avoid performance issues.
@@ -241,7 +243,7 @@ Symtab::SymbolAtIndex(uint32_t idx)
 
 
 const Symbol *
-Symtab::SymbolAtIndex(uint32_t idx) const
+Symtab::SymbolAtIndex(size_t idx) const
 {
     // Clients should grab the mutex from this symbol table and lock it manually
     // when calling this function to avoid performance issues.
@@ -262,9 +264,9 @@ Symtab::InitNameIndexes()
         m_name_indexes_computed = true;
         Timer scoped_timer (__PRETTY_FUNCTION__, "%s", __PRETTY_FUNCTION__);
         // Create the name index vector to be able to quickly search by name
-        const size_t count = m_symbols.size();
+        const size_t num_symbols = m_symbols.size();
 #if 1
-        m_name_to_index.Reserve (count);
+        m_name_to_index.Reserve (num_symbols);
 #else
         // TODO: benchmark this to see if we save any memory. Otherwise we
         // will always keep the memory reserved in the vector unless we pull
@@ -287,7 +289,12 @@ Symtab::InitNameIndexes()
 
         NameToIndexMap::Entry entry;
 
-        for (entry.value = 0; entry.value < count; ++entry.value)
+        // The "const char *" in "class_contexts" must come from a ConstString::GetCString()
+        std::set<const char *> class_contexts;
+        UniqueCStringMap<uint32_t> mangled_name_to_index;
+        std::vector<const char *> symbol_contexts(num_symbols, NULL);
+
+        for (entry.value = 0; entry.value<num_symbols; ++entry.value)
         {
             const Symbol *symbol = &m_symbols[entry.value];
 
@@ -302,38 +309,145 @@ Symtab::InitNameIndexes()
             const Mangled &mangled = symbol->GetMangled();
             entry.cstring = mangled.GetMangledName().GetCString();
             if (entry.cstring && entry.cstring[0])
+            {
                 m_name_to_index.Append (entry);
-
+                
+                const SymbolType symbol_type = symbol->GetType();
+                if (symbol_type == eSymbolTypeCode || symbol_type == eSymbolTypeResolver)
+                {
+                    if (entry.cstring[0] == '_' && entry.cstring[1] == 'Z' &&
+                        (entry.cstring[2] != 'T' && // avoid virtual table, VTT structure, typeinfo structure, and typeinfo name
+                         entry.cstring[2] != 'G' && // avoid guard variables
+                         entry.cstring[2] != 'Z'))  // named local entities (if we eventually handle eSymbolTypeData, we will want this back)
+                    {
+                        CPPLanguageRuntime::MethodName cxx_method (mangled.GetDemangledName());
+                        entry.cstring = cxx_method.GetBasename ().GetCString();
+                        if (entry.cstring && entry.cstring[0])
+                        {
+                            // ConstString objects permanently store the string in the pool so calling
+                            // GetCString() on the value gets us a const char * that will never go away
+                            const char *const_context = ConstString(cxx_method.GetContext()).GetCString();
+
+                            if (entry.cstring[0] == '~' || !cxx_method.GetQualifiers().empty())
+                            {
+                                // The first character of the demangled basename is '~' which
+                                // means we have a class destructor. We can use this information
+                                // to help us know what is a class and what isn't.
+                                if (class_contexts.find(const_context) == class_contexts.end())
+                                    class_contexts.insert(const_context);
+                                m_method_to_index.Append (entry);
+                            }
+                            else
+                            {
+                                if (const_context && const_context[0])
+                                {
+                                    if (class_contexts.find(const_context) != class_contexts.end())
+                                    {
+                                        // The current decl context is in our "class_contexts" which means
+                                        // this is a method on a class
+                                        m_method_to_index.Append (entry);
+                                    }
+                                    else
+                                    {
+                                        // We don't know if this is a function basename or a method,
+                                        // so put it into a temporary collection so once we are done
+                                        // we can look in class_contexts to see if each entry is a class
+                                        // or just a function and will put any remaining items into
+                                        // m_method_to_index or m_basename_to_index as needed
+                                        mangled_name_to_index.Append (entry);
+                                        symbol_contexts[entry.value] = const_context;
+                                    }
+                                }
+                                else
+                                {
+                                    // No context for this function so this has to be a basename
+                                    m_basename_to_index.Append(entry);
+                                }
+                            }
+                        }
+                    }
+                }
+            }
+            
             entry.cstring = mangled.GetDemangledName().GetCString();
             if (entry.cstring && entry.cstring[0])
                 m_name_to_index.Append (entry);
                 
             // If the demangled name turns out to be an ObjC name, and
             // is a category name, add the version without categories to the index too.
-            ConstString objc_selector_name;
-            ConstString objc_base_name;
-            if (ObjCLanguageRuntime::ParseMethodName (entry.cstring,
-                                                      NULL,
-                                                      &objc_selector_name,
-                                                      &objc_base_name,
-                                                      NULL))
+            ObjCLanguageRuntime::MethodName objc_method (entry.cstring, true);
+            if (objc_method.IsValid(true))
             {
-                entry.cstring = objc_base_name.GetCString();
-                m_name_to_index.Append (entry);
-                entry.cstring = objc_selector_name.GetCString();
+                entry.cstring = objc_method.GetSelector().GetCString();
                 m_selector_to_index.Append (entry);
+                
+                ConstString objc_method_no_category (objc_method.GetFullNameWithoutCategory(true));
+                if (objc_method_no_category)
+                {
+                    entry.cstring = objc_method_no_category.GetCString();
+                m_name_to_index.Append (entry);
+            }
             }
                                                         
         }
+        
+        size_t count;
+        if (!mangled_name_to_index.IsEmpty())
+        {
+            count = mangled_name_to_index.GetSize();
+            for (size_t i=0; i<count; ++i)
+            {
+                if (mangled_name_to_index.GetValueAtIndex(i, entry.value))
+                {
+                    entry.cstring = mangled_name_to_index.GetCStringAtIndex(i);
+                    if (symbol_contexts[entry.value] && class_contexts.find(symbol_contexts[entry.value]) != class_contexts.end())
+                    {
+                        m_method_to_index.Append (entry);
+                    }
+                    else
+                    {
+                        // If we got here, we have something that had a context (was inside a namespace or class)
+                        // yet we don't know if the entry
+                        m_method_to_index.Append (entry);
+                        m_basename_to_index.Append (entry);
+                    }
+                }
+            }
+        }
         m_name_to_index.Sort();
         m_name_to_index.SizeToFit();
         m_selector_to_index.Sort();
         m_selector_to_index.SizeToFit();
+        m_basename_to_index.Sort();
+        m_basename_to_index.SizeToFit();
+        m_method_to_index.Sort();
+        m_method_to_index.SizeToFit();
+    
+//        static StreamFile a ("/tmp/a.txt");
+//
+//        count = m_basename_to_index.GetSize();
+//        if (count)
+//        {
+//            for (size_t i=0; i<count; ++i)
+//            {
+//                if (m_basename_to_index.GetValueAtIndex(i, entry.value))
+//                    a.Printf ("%s BASENAME\n", m_symbols[entry.value].GetMangled().GetName().GetCString());
+//            }
+//        }
+//        count = m_method_to_index.GetSize();
+//        if (count)
+//        {
+//            for (size_t i=0; i<count; ++i)
+//            {
+//                if (m_method_to_index.GetValueAtIndex(i, entry.value))
+//                    a.Printf ("%s METHOD\n", m_symbols[entry.value].GetMangled().GetName().GetCString());
+//            }
+//        }
     }
 }
 
 void
-Symtab::AppendSymbolNamesToMap (const IndexCollection &indexes, 
+Symtab::AppendSymbolNamesToMap (const IndexCollection &indexes,
                                 bool add_demangled,
                                 bool add_mangled,
                                 NameToIndexMap &name_to_index_map) const
@@ -651,7 +765,7 @@ Symtab::FindSymbolWithType (SymbolType s
     Mutex::Locker locker (m_mutex);
 
     const size_t count = m_symbols.size();
-    for (uint32_t idx = start_idx; idx < count; ++idx)
+    for (size_t idx = start_idx; idx < count; ++idx)
     {
         if (symbol_type == eSymbolTypeAny || m_symbols[idx].GetType() == symbol_type)
         {
@@ -827,14 +941,7 @@ Symtab::InitAddressIndexes()
     if (!m_addr_indexes_computed && !m_symbols.empty())
     {
         m_addr_indexes_computed = true;
-#if 0
-        // The old was to add only code, trampoline or data symbols...
-        AppendSymbolIndexesWithType (eSymbolTypeCode, m_addr_indexes);
-        AppendSymbolIndexesWithType (eSymbolTypeTrampoline, m_addr_indexes);
-        AppendSymbolIndexesWithType (eSymbolTypeData, m_addr_indexes);
-#else
-        // The new way adds all symbols with valid addresses that are section
-        // offset.
+
         const_iterator begin = m_symbols.begin();
         const_iterator end = m_symbols.end();
         for (const_iterator pos = m_symbols.begin(); pos != end; ++pos)
@@ -842,7 +949,7 @@ Symtab::InitAddressIndexes()
             if (pos->ValueIsAddress())
                 m_addr_indexes.push_back (std::distance(begin, pos));
         }
-#endif
+
         SortSymbolIndexesByValue (m_addr_indexes, false);
         m_addr_indexes.push_back (UINT32_MAX);   // Terminator for bsearch since we might need to look at the next symbol
     }
@@ -876,13 +983,13 @@ Symtab::CalculateSymbolSize (Symbol *sym
         if (!m_addr_indexes_computed)
             InitAddressIndexes();
         const size_t num_addr_indexes = m_addr_indexes.size();
+        const lldb::addr_t symbol_file_addr = symbol->GetAddress().GetFileAddress();
         SymbolSearchInfo info = FindIndexPtrForSymbolContainingAddress (this,
-                                                                        symbol->GetAddress().GetFileAddress(),
+                                                                        symbol_file_addr,
                                                                         &m_addr_indexes.front(),
                                                                         num_addr_indexes);
         if (info.match_index_ptr != NULL)
         {
-            const lldb::addr_t curr_file_addr = symbol->GetAddress().GetFileAddress();
             // We can figure out the address range of all symbols except the
             // last one by taking the delta between the current symbol and
             // the next symbol
@@ -893,12 +1000,28 @@ Symtab::CalculateSymbolSize (Symbol *sym
             {
                 Symbol *next_symbol = SymbolAtIndex(m_addr_indexes[addr_index]);
                 if (next_symbol == NULL)
+                {
+                    // No next symbol take the size to be the remaining bytes in the section
+                    // in which the symbol resides
+                    SectionSP section_sp (m_objfile->GetSectionList()->FindSectionContainingFileAddress (symbol_file_addr));
+                    if (section_sp)
+                    {
+                        const lldb::addr_t end_section_file_addr = section_sp->GetFileAddress() + section_sp->GetByteSize();
+                        if (end_section_file_addr > symbol_file_addr)
+                        {
+                            byte_size = end_section_file_addr - symbol_file_addr;
+                            symbol->SetByteSize(byte_size);
+                            symbol->SetSizeIsSynthesized(true);
                     break;
-
+                        }
+                    }
+                }
+                else
+                {
                 const lldb::addr_t next_file_addr = next_symbol->GetAddress().GetFileAddress();
-                if (next_file_addr > curr_file_addr)
+                    if (next_file_addr > symbol_file_addr)
                 {
-                    byte_size = next_file_addr - curr_file_addr;
+                        byte_size = next_file_addr - symbol_file_addr;
                     symbol->SetByteSize(byte_size);
                     symbol->SetSizeIsSynthesized(true);
                     break;
@@ -906,31 +1029,11 @@ Symtab::CalculateSymbolSize (Symbol *sym
             }
         }
     }
+    }
     return byte_size;
 }
 
 Symbol *
-Symtab::FindSymbolWithFileAddress (addr_t file_addr)
-{
-    Mutex::Locker locker (m_mutex);
-
-    if (!m_addr_indexes_computed)
-        InitAddressIndexes();
-
-    SymbolSearchInfo info = { this, file_addr, NULL, NULL, 0 };
-
-    uint32_t* match = (uint32_t*)::bsearch (&info, 
-                                            &m_addr_indexes[0], 
-                                            m_addr_indexes.size(), 
-                                            sizeof(uint32_t), 
-                                            (ComparisonFunction)SymbolWithFileAddress);
-    if (match)
-        return SymbolAtIndex (*match);
-    return NULL;
-}
-
-
-Symbol *
 Symtab::FindSymbolContainingFileAddress (addr_t file_addr, const uint32_t* indexes, uint32_t num_indexes)
 {
     Mutex::Locker locker (m_mutex);
@@ -985,6 +1088,7 @@ Symtab::SymbolIndicesToSymbolContextList
     // No need to protect this call using m_mutex all other method calls are
     // already thread safe.
     
+    const bool merge_symbol_into_function = true;
     size_t num_indices = symbol_indexes.size();
     if (num_indices > 0)
     {
@@ -994,7 +1098,7 @@ Symtab::SymbolIndicesToSymbolContextList
         {
             sc.symbol = SymbolAtIndex (symbol_indexes[i]);
             if (sc.symbol)
-                sc_list.Append (sc);
+                sc_list.AppendIfUnique(sc, merge_symbol_into_function);
         }
     }
 }
@@ -1007,11 +1111,53 @@ Symtab::FindFunctionSymbols (const Const
 {
     size_t count = 0;
     std::vector<uint32_t> symbol_indexes;
-    if (name_type_mask & (eFunctionNameTypeBase | eFunctionNameTypeFull | eFunctionNameTypeAuto))
+    
+    const char *name_cstr = name.GetCString();
+    
+    // eFunctionNameTypeAuto should be pre-resolved by a call to Module::PrepareForFunctionNameLookup()
+    assert ((name_type_mask & eFunctionNameTypeAuto) == 0);
+
+    if (name_type_mask & (eFunctionNameTypeBase | eFunctionNameTypeFull))
     {
         FindAllSymbolsWithNameAndType (name, eSymbolTypeCode, symbol_indexes);
     }
     
+    if (name_type_mask & eFunctionNameTypeBase)
+    {
+        // From mangled names we can't tell what is a basename and what
+        // is a method name, so we just treat them the same
+        if (!m_name_indexes_computed)
+            InitNameIndexes();
+
+        if (!m_basename_to_index.IsEmpty())
+        {
+            const UniqueCStringMap<uint32_t>::Entry *match;
+            for (match = m_basename_to_index.FindFirstValueForName(name_cstr);
+                 match != NULL;
+                 match = m_basename_to_index.FindNextValueForName(match))
+            {
+                symbol_indexes.push_back(match->value);
+            }
+        }
+    }
+    
+    if (name_type_mask & eFunctionNameTypeMethod)
+    {
+        if (!m_name_indexes_computed)
+            InitNameIndexes();
+        
+        if (!m_method_to_index.IsEmpty())
+        {
+            const UniqueCStringMap<uint32_t>::Entry *match;
+            for (match = m_method_to_index.FindFirstValueForName(name_cstr);
+                 match != NULL;
+                 match = m_method_to_index.FindNextValueForName(match))
+            {
+                symbol_indexes.push_back(match->value);
+            }
+        }
+    }
+
     if (name_type_mask & eFunctionNameTypeSelector)
     {
         if (!m_name_indexes_computed)
@@ -1020,7 +1166,7 @@ Symtab::FindFunctionSymbols (const Const
         if (!m_selector_to_index.IsEmpty())
         {
             const UniqueCStringMap<uint32_t>::Entry *match;
-            for (match = m_selector_to_index.FindFirstValueForName(name.AsCString());
+            for (match = m_selector_to_index.FindFirstValueForName(name_cstr);
                  match != NULL;
                  match = m_selector_to_index.FindNextValueForName(match))
             {

Modified: lldb/branches/windows/source/Symbol/Type.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Symbol/Type.cpp?rev=179679&r1=179678&r2=179679&view=diff
==============================================================================
--- lldb/branches/windows/source/Symbol/Type.cpp (original)
+++ lldb/branches/windows/source/Symbol/Type.cpp Wed Apr 17 03:38:48 2013
@@ -51,7 +51,7 @@ Type::Type
     lldb::user_id_t uid,
     SymbolFile* symbol_file,
     const ConstString &name,
-    uint32_t byte_size,
+    uint64_t byte_size,
     SymbolContextScope *context,
     user_id_t encoding_uid,
     EncodingDataType encoding_uid_type,
@@ -138,7 +138,7 @@ Type::GetDescription (Stream *s, lldb::D
 
     // Call the get byte size accesor so we resolve our byte size
     if (GetByteSize())
-        s->Printf(", byte-size = %u", m_byte_size);
+        s->Printf(", byte-size = %" PRIu64, m_byte_size);
     bool show_fullpaths = (level == lldb::eDescriptionLevelVerbose);
     m_decl.Dump(s, show_fullpaths);
 
@@ -178,7 +178,7 @@ Type::Dump (Stream *s, bool show_context
         *s << ", name = \"" << m_name << "\"";
 
     if (m_byte_size != 0)
-        s->Printf(", size = %u", m_byte_size);
+        s->Printf(", size = %" PRIu64, m_byte_size);
 
     if (show_context && m_context != NULL)
     {
@@ -289,7 +289,7 @@ Type::GetEncodingType ()
     
 
 
-uint32_t
+uint64_t
 Type::GetByteSize()
 {
     if (m_byte_size == 0)
@@ -375,7 +375,7 @@ Type::GetFormat ()
 
 
 lldb::Encoding
-Type::GetEncoding (uint32_t &count)
+Type::GetEncoding (uint64_t &count)
 {
     // Make sure we resolve our type if it already hasn't been.
     if (!ResolveClangType(eResolveStateForward))
@@ -426,7 +426,7 @@ Type::ReadFromMemory (ExecutionContext *
         return false;
     }
 
-    const uint32_t byte_size = GetByteSize();
+    const uint64_t byte_size = GetByteSize();
     if (data.GetByteSize() < byte_size)
     {
         lldb::DataBufferSP data_sp(new DataBufferHeap (byte_size, '\0'));
@@ -439,6 +439,8 @@ Type::ReadFromMemory (ExecutionContext *
         if (address_type == eAddressTypeHost)
         {
             // The address is an address in this process, so just copy it
+            if (addr == 0)
+                return false;
             memcpy (dst, (uint8_t*)NULL + addr, byte_size);
             return true;
         }
@@ -828,6 +830,26 @@ TypeAndOrName::operator= (const TypeAndO
     return *this;
 }
 
+bool
+TypeAndOrName::operator==(const TypeAndOrName &other) const
+{
+    if (m_type_sp != other.m_type_sp)
+        return false;
+    if (m_type_name != other.m_type_name)
+        return false;
+    return true;
+}
+
+bool
+TypeAndOrName::operator!=(const TypeAndOrName &other) const
+{
+    if (m_type_sp != other.m_type_sp)
+        return true;
+    if (m_type_name != other.m_type_name)
+        return true;
+    return false;
+}
+
 ConstString
 TypeAndOrName::GetName () const
 {    
@@ -866,6 +888,25 @@ TypeAndOrName::IsEmpty()
         return true;
 }
 
+void
+TypeAndOrName::Clear ()
+{
+    m_type_name.Clear();
+    m_type_sp.reset();
+}
+
+bool
+TypeAndOrName::HasName ()
+{
+    return (bool)m_type_name;
+}
+
+bool
+TypeAndOrName::HasTypeSP ()
+{
+    return m_type_sp.get() != NULL;
+}
+
 TypeImpl::TypeImpl(const lldb_private::ClangASTType& clang_ast_type) :
     m_clang_ast_type(clang_ast_type.GetASTContext(), clang_ast_type.GetOpaqueQualType()),
     m_type_sp()

Modified: lldb/branches/windows/source/Symbol/Variable.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Symbol/Variable.cpp?rev=179679&r1=179678&r2=179679&view=diff
==============================================================================
--- lldb/branches/windows/source/Symbol/Variable.cpp (original)
+++ lldb/branches/windows/source/Symbol/Variable.cpp Wed Apr 17 03:38:48 2013
@@ -203,7 +203,7 @@ Variable::CalculateSymbolContext (Symbol
     if (m_owner_scope)
         m_owner_scope->CalculateSymbolContext(sc);
     else
-        sc->Clear();
+        sc->Clear(false);
 }
 
 bool
@@ -396,11 +396,12 @@ Variable::GetValuesForVariableExpression
             
         default:
             {
-                RegularExpression regex ("^([A-Za-z_:][A-Za-z_0-9:]*)(.*)");
-                if (regex.Execute(variable_expr_path, 1))
+                static RegularExpression g_regex ("^([A-Za-z_:][A-Za-z_0-9:]*)(.*)");
+                RegularExpression::Match regex_match(1);
+                if (g_regex.Execute(variable_expr_path, &regex_match))
                 {
                     std::string variable_name;
-                    if (regex.GetMatchAtIndex(variable_expr_path, 1, variable_name))
+                    if (regex_match.GetMatchAtIndex(variable_expr_path, 1, variable_name))
                     {
                         variable_list.Clear();
                         if (callback (baton, variable_name.c_str(), variable_list))

Modified: lldb/branches/windows/source/Symbol/VariableList.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Symbol/VariableList.cpp?rev=179679&r1=179678&r2=179679&view=diff
==============================================================================
--- lldb/branches/windows/source/Symbol/VariableList.cpp (original)
+++ lldb/branches/windows/source/Symbol/VariableList.cpp Wed Apr 17 03:38:48 2013
@@ -67,7 +67,7 @@ VariableList::Clear()
 }
 
 VariableSP
-VariableList::GetVariableAtIndex(uint32_t idx) const
+VariableList::GetVariableAtIndex(size_t idx) const
 {
     VariableSP var_sp;
     if (idx < m_variables.size())
@@ -76,7 +76,7 @@ VariableList::GetVariableAtIndex(uint32_
 }
 
 VariableSP
-VariableList::RemoveVariableAtIndex(uint32_t idx)
+VariableList::RemoveVariableAtIndex(size_t idx)
 {
     VariableSP var_sp;
     if (idx < m_variables.size())

Modified: lldb/branches/windows/source/Target/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Target/CMakeLists.txt?rev=179679&r1=179678&r2=179679&view=diff
==============================================================================
--- lldb/branches/windows/source/Target/CMakeLists.txt (original)
+++ lldb/branches/windows/source/Target/CMakeLists.txt Wed Apr 17 03:38:48 2013
@@ -1,5 +1,7 @@
 set(LLVM_NO_RTTI 1)
 
+include_directories(../Plugins/Process/Utility)
+
 add_lldb_library(lldbTarget
   ABI.cpp
   CPPLanguageRuntime.cpp

Modified: lldb/branches/windows/source/Target/CPPLanguageRuntime.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Target/CPPLanguageRuntime.cpp?rev=179679&r1=179678&r2=179679&view=diff
==============================================================================
--- lldb/branches/windows/source/Target/CPPLanguageRuntime.cpp (original)
+++ lldb/branches/windows/source/Target/CPPLanguageRuntime.cpp Wed Apr 17 03:38:48 2013
@@ -190,65 +190,65 @@ CPPLanguageRuntime::IsCPPMangledName (co
 bool
 CPPLanguageRuntime::StripNamespacesFromVariableName (const char *name, const char *&base_name_start, const char *&base_name_end)
 {
-  if (base_name_end == NULL)
-    base_name_end = name + strlen (name);
+    if (base_name_end == NULL)
+        base_name_end = name + strlen (name);
     
-  const char *last_colon = NULL;
-  for (const char *ptr = base_name_end; ptr != name; ptr--)
+    const char *last_colon = NULL;
+    for (const char *ptr = base_name_end; ptr != name; ptr--)
     {
-      if (*ptr == ':')
+        if (*ptr == ':')
         {
-          last_colon = ptr;
-          break;
+            last_colon = ptr;
+            break;
         }
     }
-
-  if (last_colon == NULL)
+    
+    if (last_colon == NULL)
     {
-      base_name_start = name;
-      return true;
+        base_name_start = name;
+        return true;
     }
-
-  // Can't have a C++ name that begins with a single ':', nor contains an internal single ':'
-  if (last_colon == name)
-    return false;
-  else if (last_colon[-1] != ':')
-    return false;
-  else
+    
+    // Can't have a C++ name that begins with a single ':', nor contains an internal single ':'
+    if (last_colon == name)
+        return false;
+    else if (last_colon[-1] != ':')
+        return false;
+    else
     {
-      // FIXME: should check if there is
-      base_name_start = last_colon + 1;
-      return true;
+        // FIXME: should check if there is
+        base_name_start = last_colon + 1;
+        return true;
     }
 }
 bool
 CPPLanguageRuntime::IsPossibleCPPCall (const char *name, const char *&base_name_start, const char *&base_name_end)
 {
     if (!name)
-      return false;
+        return false;
     // For now, I really can't handle taking template names apart, so if you
     // have < or > I'll say "could be CPP but leave the base_name empty which
     // means I couldn't figure out what to use for that.
     // FIXME: Do I need to do more sanity checking here?
-
+    
     if (strchr(name, '>') != NULL || strchr (name, '>') != NULL)
-      return true;
-
+        return true;
+    
     size_t name_len = strlen (name);
-
+    
     if (name[name_len - 1] == ')')
     {
         // We've got arguments.
         base_name_end = strchr (name, '(');
         if (base_name_end == NULL)
-          return false;
-
+            return false;
+        
         // FIXME: should check that this parenthesis isn't a template specialized
         // on a function type or something gross like that...
     }
     else
         base_name_end = name + strlen (name);
-
+    
     return StripNamespacesFromVariableName (name, base_name_start, base_name_end);
 }
 
@@ -267,3 +267,156 @@ CPPLanguageRuntime::FindEquivalentNames(
     
     return count;
 }
+
+void
+CPPLanguageRuntime::MethodName::Clear()
+{
+    m_full.Clear();
+    m_basename.Clear();
+    m_context = llvm::StringRef();
+    m_arguments = llvm::StringRef();
+    m_qualifiers = llvm::StringRef();
+    m_type = eTypeInvalid;
+    m_parsed = false;
+    m_parse_error = false;
+}
+
+bool
+ReverseFindMatchingChars (const llvm::StringRef &s,
+                          const llvm::StringRef &left_right_chars,
+                          size_t &left_pos,
+                          size_t &right_pos,
+                          size_t pos = llvm::StringRef::npos)
+{
+    assert (left_right_chars.size() == 2);
+    left_pos = llvm::StringRef::npos;
+    const char left_char = left_right_chars[0];
+    const char right_char = left_right_chars[1];
+    pos = s.find_last_of(left_right_chars, pos);
+    if (pos == llvm::StringRef::npos || s[pos] == left_char)
+        return false;
+    right_pos = pos;
+    uint32_t depth = 1;
+    while (pos > 0 && depth > 0)
+    {
+        pos = s.find_last_of(left_right_chars, pos);
+        if (pos == llvm::StringRef::npos)
+            return false;
+        if (s[pos] == left_char)
+        {
+            if (--depth == 0)
+            {
+                left_pos = pos;
+                return left_pos < right_pos;
+            }            
+        }
+        else if (s[pos] == right_char)
+        {
+            ++depth;
+        }
+    }
+    return false;
+}
+
+void
+CPPLanguageRuntime::MethodName::Parse()
+{
+    if (!m_parsed && m_full)
+    {
+//        ConstString mangled;
+//        m_full.GetMangledCounterpart(mangled);
+//        printf ("\n   parsing = '%s'\n", m_full.GetCString());
+//        if (mangled)
+//            printf ("   mangled = '%s'\n", mangled.GetCString());
+        m_parse_error = false;
+        m_parsed = true;
+        llvm::StringRef full (m_full.GetCString());
+        
+        size_t arg_start, arg_end;
+        llvm::StringRef parens("()", 2);
+        if (ReverseFindMatchingChars (full, parens, arg_start, arg_end))
+        {
+            m_arguments = full.substr(arg_start, arg_end - arg_start + 1);
+            if (arg_end + 1 < full.size())
+                m_qualifiers = full.substr(arg_end + 1);
+            if (arg_start > 0)
+            {
+                size_t basename_end = arg_start;
+                size_t context_end = llvm::StringRef::npos;
+                if (basename_end > 0 && full[basename_end-1] == '>')
+                {
+                    // TODO: handle template junk...
+                    // Templated function
+                    size_t template_start, template_end;
+                    llvm::StringRef lt_gt("<>", 2);
+                    if (ReverseFindMatchingChars (full, lt_gt, template_start, template_end, basename_end))
+                        context_end = full.rfind(':', template_start);
+                }
+                if (context_end == llvm::StringRef::npos)
+                    context_end = full.rfind(':', basename_end);
+
+                if (context_end == llvm::StringRef::npos)
+                    m_basename.SetString(full.substr(0, basename_end));
+                else
+                {
+                    m_context = full.substr(0, context_end - 1);
+                    const size_t basename_begin = context_end + 1;
+                    m_basename.SetString(full.substr(basename_begin, basename_end - basename_begin));
+                }
+                m_type = eTypeUnknownMethod;
+            }
+            else
+            {
+                m_parse_error = true;
+                return;
+            }
+        
+//            if (!m_context.empty())
+//                printf ("   context = '%s'\n", m_context.str().c_str());
+//            if (m_basename)
+//                printf ("  basename = '%s'\n", m_basename.GetCString());
+//            if (!m_arguments.empty())
+//                printf (" arguments = '%s'\n", m_arguments.str().c_str());
+//            if (!m_qualifiers.empty())
+//                printf ("qualifiers = '%s'\n", m_qualifiers.str().c_str());
+        }
+        else
+        {
+            m_parse_error = true;
+//            printf ("error: didn't find matching parens for arguments\n");
+        }
+    }
+}
+
+const ConstString &
+CPPLanguageRuntime::MethodName::GetBasename ()
+{
+    if (!m_parsed)
+        Parse();
+    return m_basename;
+}
+
+llvm::StringRef
+CPPLanguageRuntime::MethodName::GetContext ()
+{
+    if (!m_parsed)
+        Parse();
+    return m_context;
+}
+
+llvm::StringRef
+CPPLanguageRuntime::MethodName::GetArguments ()
+{
+    if (!m_parsed)
+        Parse();
+    return m_arguments;
+}
+
+llvm::StringRef
+CPPLanguageRuntime::MethodName::GetQualifiers ()
+{
+    if (!m_parsed)
+        Parse();
+    return m_qualifiers;
+}
+

Modified: lldb/branches/windows/source/Target/ExecutionContext.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Target/ExecutionContext.cpp?rev=179679&r1=179678&r2=179679&view=diff
==============================================================================
--- lldb/branches/windows/source/Target/ExecutionContext.cpp (original)
+++ lldb/branches/windows/source/Target/ExecutionContext.cpp Wed Apr 17 03:38:48 2013
@@ -524,8 +524,7 @@ ExecutionContextRef::ExecutionContextRef
     m_target_wp (),
     m_process_wp (),
     m_thread_wp (),
-    m_frame_wp (),
-    m_tid(LLDB_INVALID_THREAD_ID),  
+    m_tid(LLDB_INVALID_THREAD_ID),
     m_stack_id ()
 {
 }
@@ -534,8 +533,7 @@ ExecutionContextRef::ExecutionContextRef
     m_target_wp (),
     m_process_wp (),
     m_thread_wp (),
-    m_frame_wp (),
-    m_tid(LLDB_INVALID_THREAD_ID),  
+    m_tid(LLDB_INVALID_THREAD_ID),
     m_stack_id ()
 {
     if (exe_ctx)
@@ -546,8 +544,7 @@ ExecutionContextRef::ExecutionContextRef
     m_target_wp (),
     m_process_wp (),
     m_thread_wp (),
-    m_frame_wp (),
-    m_tid(LLDB_INVALID_THREAD_ID),  
+    m_tid(LLDB_INVALID_THREAD_ID),
     m_stack_id ()
 {
     *this = exe_ctx;
@@ -558,8 +555,7 @@ ExecutionContextRef::ExecutionContextRef
     m_target_wp(),
     m_process_wp(),
     m_thread_wp(),
-    m_frame_wp(),
-    m_tid(LLDB_INVALID_THREAD_ID),  
+    m_tid(LLDB_INVALID_THREAD_ID),
     m_stack_id ()
 {
     SetTargetPtr (target, adopt_selected);
@@ -572,7 +568,6 @@ ExecutionContextRef::ExecutionContextRef
     m_target_wp (rhs.m_target_wp),
     m_process_wp(rhs.m_process_wp),
     m_thread_wp (rhs.m_thread_wp),
-    m_frame_wp  (rhs.m_frame_wp),
     m_tid       (rhs.m_tid),
     m_stack_id  (rhs.m_stack_id)
 {
@@ -586,7 +581,6 @@ ExecutionContextRef::operator =(const Ex
         m_target_wp  = rhs.m_target_wp;
         m_process_wp = rhs.m_process_wp;
         m_thread_wp  = rhs.m_thread_wp;
-        m_frame_wp   = rhs.m_frame_wp;
         m_tid        = rhs.m_tid;
         m_stack_id   = rhs.m_stack_id;
     }
@@ -605,7 +599,6 @@ ExecutionContextRef::operator =(const Ex
     else
         m_tid = LLDB_INVALID_THREAD_ID;
     lldb::StackFrameSP frame_sp (exe_ctx.GetFrameSP());
-    m_frame_wp = frame_sp;
     if (frame_sp)
         m_stack_id = frame_sp->GetStackID();
     else
@@ -669,7 +662,6 @@ ExecutionContextRef::SetFrameSP (const l
 {
     if (frame_sp)
     {
-        m_frame_wp = frame_sp;
         m_stack_id = frame_sp->GetStackID();
         SetThreadSP (frame_sp->GetThread());
     }
@@ -814,23 +806,10 @@ ExecutionContextRef::GetThreadSP () cons
 lldb::StackFrameSP
 ExecutionContextRef::GetFrameSP () const
 {
-    lldb::StackFrameSP frame_sp (m_frame_wp.lock());
-    if (!frame_sp && m_stack_id.IsValid())
-    {
-        lldb::ThreadSP thread_sp (GetThreadSP());
-        if (thread_sp)
-        {
-            frame_sp = thread_sp->GetFrameWithStackID (m_stack_id);
-            m_frame_wp = frame_sp;
-        }
-        else
-        {
-            // If the thread that this frame was supposed to belong to is not valid, then
-            // return a NULL frame_sp.
-            frame_sp.reset();
-        }
-    }
-    return frame_sp;
+    lldb::ThreadSP thread_sp (GetThreadSP());
+    if (thread_sp)
+        return thread_sp->GetFrameWithStackID (m_stack_id);
+    return lldb::StackFrameSP();
 }
 
 ExecutionContext

Modified: lldb/branches/windows/source/Target/LanguageRuntime.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Target/LanguageRuntime.cpp?rev=179679&r1=179678&r2=179679&view=diff
==============================================================================
--- lldb/branches/windows/source/Target/LanguageRuntime.cpp (original)
+++ lldb/branches/windows/source/Target/LanguageRuntime.cpp Wed Apr 17 03:38:48 2013
@@ -14,6 +14,217 @@
 using namespace lldb;
 using namespace lldb_private;
 
+
+class ExceptionSearchFilter : public SearchFilter
+{
+public:
+    ExceptionSearchFilter (const lldb::TargetSP &target_sp,
+                           lldb::LanguageType language) :
+        SearchFilter (target_sp),
+        m_language (language),
+        m_language_runtime (NULL),
+        m_filter_sp ()
+    {
+        UpdateModuleListIfNeeded ();
+    }
+    
+    virtual bool
+    ModulePasses (const lldb::ModuleSP &module_sp)
+    {
+        UpdateModuleListIfNeeded ();
+        if (m_filter_sp)
+            return m_filter_sp->ModulePasses (module_sp);
+        return false;
+    }
+    
+    virtual bool
+    ModulePasses (const FileSpec &spec)
+    {
+        UpdateModuleListIfNeeded ();
+        if (m_filter_sp)
+            return m_filter_sp->ModulePasses (spec);
+        return false;
+        
+    }
+    
+    virtual void
+    Search (Searcher &searcher)
+    {
+        UpdateModuleListIfNeeded ();
+        if (m_filter_sp)
+            m_filter_sp->Search (searcher);
+    }
+
+    virtual void
+    GetDescription (Stream *s)
+    {
+        UpdateModuleListIfNeeded ();
+        if (m_filter_sp)
+            m_filter_sp->GetDescription (s);
+    }
+    
+protected:
+    LanguageType m_language;
+    LanguageRuntime *m_language_runtime;
+    SearchFilterSP m_filter_sp;
+
+    void
+    UpdateModuleListIfNeeded ()
+    {
+        ProcessSP process_sp (m_target_sp->GetProcessSP());
+        if (process_sp)
+        {
+            bool refreash_filter = !m_filter_sp;
+            if (m_language_runtime == NULL)
+            {
+                m_language_runtime = process_sp->GetLanguageRuntime(m_language);
+                refreash_filter = true;
+            }
+            else
+            {
+                LanguageRuntime *language_runtime = process_sp->GetLanguageRuntime(m_language);
+                if (m_language_runtime != language_runtime)
+                {
+                    m_language_runtime = language_runtime;
+                    refreash_filter = true;
+                }
+            }
+            
+            if (refreash_filter && m_language_runtime)
+            {
+                m_filter_sp = m_language_runtime->CreateExceptionSearchFilter ();
+            }
+        }
+        else
+        {
+            m_filter_sp.reset();
+            m_language_runtime = NULL;
+        }
+    }
+};
+
+// The Target is the one that knows how to create breakpoints, so this function
+// is meant to be used either by the target or internally in Set/ClearExceptionBreakpoints.
+class ExceptionBreakpointResolver : public BreakpointResolver
+{
+public:
+    ExceptionBreakpointResolver (lldb::LanguageType language,
+                                 bool catch_bp,
+                                 bool throw_bp) :
+        BreakpointResolver (NULL, BreakpointResolver::ExceptionResolver),
+        m_language (language),
+        m_language_runtime (NULL),
+        m_catch_bp (catch_bp),
+        m_throw_bp (throw_bp)
+    {
+    }
+
+    virtual
+    ~ExceptionBreakpointResolver()
+    {
+    }
+    
+    virtual Searcher::CallbackReturn
+    SearchCallback (SearchFilter &filter,
+                    SymbolContext &context,
+                    Address *addr,
+                    bool containing)
+    {
+        
+        if (SetActualResolver())
+            return m_actual_resolver_sp->SearchCallback (filter, context, addr, containing);
+        else
+            return eCallbackReturnStop;
+    }
+    
+    virtual Searcher::Depth
+    GetDepth ()
+    {
+        if (SetActualResolver())
+            return m_actual_resolver_sp->GetDepth();
+        else
+            return eDepthTarget;
+    }
+    
+    virtual void
+    GetDescription (Stream *s)
+    {
+        s->Printf ("Exception breakpoint (catch: %s throw: %s)",
+                   m_catch_bp ? "on" : "off",
+                   m_throw_bp ? "on" : "off");
+        
+        SetActualResolver();
+        if (m_actual_resolver_sp)
+        {
+            s->Printf (" using: ");
+            m_actual_resolver_sp->GetDescription (s);
+        }
+        else
+            s->Printf (" the correct runtime exception handler will be determined when you run");
+    }
+
+    virtual void
+    Dump (Stream *s) const
+    {
+    }
+    
+    /// Methods for support type inquiry through isa, cast, and dyn_cast:
+    static inline bool classof(const BreakpointResolverName *) { return true; }
+    static inline bool classof(const BreakpointResolver *V) {
+        return V->getResolverID() == BreakpointResolver::ExceptionResolver;
+    }
+protected:
+    bool
+    SetActualResolver()
+    {
+        ProcessSP process_sp;
+        if (m_breakpoint)
+        {
+            process_sp = m_breakpoint->GetTarget().GetProcessSP();
+            if (process_sp)
+            {
+                bool refreash_resolver = !m_actual_resolver_sp;
+                if (m_language_runtime == NULL)
+                {
+                    m_language_runtime = process_sp->GetLanguageRuntime(m_language);
+                    refreash_resolver = true;
+                }
+                else
+                {
+                    LanguageRuntime *language_runtime = process_sp->GetLanguageRuntime(m_language);
+                    if (m_language_runtime != language_runtime)
+                    {
+                        m_language_runtime = language_runtime;
+                        refreash_resolver = true;
+                    }
+                }
+                
+                if (refreash_resolver && m_language_runtime)
+                {
+                    m_actual_resolver_sp = m_language_runtime->CreateExceptionResolver (m_breakpoint, m_catch_bp, m_throw_bp);
+                }
+            }
+            else
+            {
+                m_actual_resolver_sp.reset();
+                m_language_runtime = NULL;
+            }
+        }
+        else
+        {
+            m_actual_resolver_sp.reset();
+            m_language_runtime = NULL;
+        }
+        return (bool)m_actual_resolver_sp;
+    }
+    lldb::BreakpointResolverSP m_actual_resolver_sp;
+    lldb::LanguageType m_language;
+    LanguageRuntime *m_language_runtime;
+    bool m_catch_bp;
+    bool m_throw_bp;
+};
+
+
 LanguageRuntime*
 LanguageRuntime::FindPlugin (Process *process, lldb::LanguageType language)
 {
@@ -49,146 +260,22 @@ LanguageRuntime::~LanguageRuntime()
 }
 
 BreakpointSP
-LanguageRuntime::CreateExceptionBreakpoint(
-    Target &target, 
-    lldb::LanguageType language, 
-    bool catch_bp, 
-    bool throw_bp, 
-    bool is_internal)
-{
-    BreakpointSP exc_breakpt_sp;
-    BreakpointResolverSP resolver_sp(new ExceptionBreakpointResolver(NULL, language, catch_bp, throw_bp));
-    SearchFilterSP filter_sp(target.GetSearchFilterForModule(NULL));
-    
-    exc_breakpt_sp = target.CreateBreakpoint (filter_sp, resolver_sp, is_internal);
-    
-    return exc_breakpt_sp;
-}
-
-LanguageRuntime::ExceptionBreakpointResolver::ExceptionBreakpointResolver (Breakpoint *bkpt,
-                        LanguageType language,
-                        bool catch_bp,
-                        bool throw_bp) :
-    BreakpointResolver (bkpt, BreakpointResolver::ExceptionResolver),
-    m_language (language),
-    m_catch_bp (catch_bp),
-    m_throw_bp (throw_bp)
-
+LanguageRuntime::CreateExceptionBreakpoint (Target &target,
+                                            lldb::LanguageType language,
+                                            bool catch_bp,
+                                            bool throw_bp,
+                                            bool is_internal)
 {
-}
-                        
-void
-LanguageRuntime::ExceptionBreakpointResolver::GetDescription (Stream *s)
-{
-    s->Printf ("Exception breakpoint (catch: %s throw: %s)", 
-           m_catch_bp ? "on" : "off",
-           m_throw_bp ? "on" : "off");
-       
-    SetActualResolver();
-    if (m_actual_resolver_sp)
-    {
-        s->Printf (" using: ");
-        m_actual_resolver_sp->GetDescription (s);
-    }
-    else
-        s->Printf (" the correct runtime exception handler will be determined when you run");
-}
-
-bool
-LanguageRuntime::ExceptionBreakpointResolver::SetActualResolver()
-{
-    ProcessSP process_sp = m_process_wp.lock();
+    BreakpointResolverSP resolver_sp(new ExceptionBreakpointResolver(language, catch_bp, throw_bp));
+    SearchFilterSP filter_sp(new ExceptionSearchFilter(target.shared_from_this(), language));
     
-    // See if our process weak pointer is still good:
-    if (!process_sp)
-    {
-        // If not, our resolver is no good, so chuck that.  Then see if we can get the 
-        // target's new process.
-        m_actual_resolver_sp.reset();
-        if (m_breakpoint)
-        {
-            Target &target = m_breakpoint->GetTarget();
-            process_sp = target.GetProcessSP();
-            if (process_sp)
-            {
-                m_process_wp = process_sp;
-                process_sp = m_process_wp.lock();
-            }
-        }
-    }
+    BreakpointSP exc_breakpt_sp (target.CreateBreakpoint (filter_sp, resolver_sp, is_internal));
+    if (is_internal)
+        exc_breakpt_sp->SetBreakpointKind("exception");
     
-    if (process_sp)
-    {
-        if (m_actual_resolver_sp)
-            return true;
-        else
-        {
-            // If we have a process but not a resolver, set one now.
-            LanguageRuntime *runtime = process_sp->GetLanguageRuntime(m_language);
-            if (runtime)
-            {
-                m_actual_resolver_sp = runtime->CreateExceptionResolver (m_breakpoint, m_catch_bp, m_throw_bp);
-                return (bool) m_actual_resolver_sp;
-            }
-            else
-                return false;
-        }
-    }
-    else
-        return false;
-}
-
-Searcher::CallbackReturn
-LanguageRuntime::ExceptionBreakpointResolver::SearchCallback (SearchFilter &filter,
-                SymbolContext &context,
-                Address *addr,
-                bool containing)
-{
-    
-    if (!SetActualResolver())
-    {
-        return eCallbackReturnStop;
-    }
-    else
-        return m_actual_resolver_sp->SearchCallback (filter, context, addr, containing);
-}
-
-Searcher::Depth
-LanguageRuntime::ExceptionBreakpointResolver::GetDepth ()
-{
-    if (!SetActualResolver())
-        return eDepthTarget;
-    else
-        return m_actual_resolver_sp->GetDepth();
+    return exc_breakpt_sp;
 }
 
-/*
-typedef enum LanguageType
-{
-    eLanguageTypeUnknown         = 0x0000,   ///< Unknown or invalid language value.
-    eLanguageTypeC89             = 0x0001,   ///< ISO C:1989.
-    eLanguageTypeC               = 0x0002,   ///< Non-standardized C, such as K&R.
-    eLanguageTypeAda83           = 0x0003,   ///< ISO Ada:1983.
-    eLanguageTypeC_plus_plus     = 0x0004,   ///< ISO C++:1998.
-    eLanguageTypeCobol74         = 0x0005,   ///< ISO Cobol:1974.
-    eLanguageTypeCobol85         = 0x0006,   ///< ISO Cobol:1985.
-    eLanguageTypeFortran77       = 0x0007,   ///< ISO Fortran 77.
-    eLanguageTypeFortran90       = 0x0008,   ///< ISO Fortran 90.
-    eLanguageTypePascal83        = 0x0009,   ///< ISO Pascal:1983.
-    eLanguageTypeModula2         = 0x000a,   ///< ISO Modula-2:1996.
-    eLanguageTypeJava            = 0x000b,   ///< Java.
-    eLanguageTypeC99             = 0x000c,   ///< ISO C:1999.
-    eLanguageTypeAda95           = 0x000d,   ///< ISO Ada:1995.
-    eLanguageTypeFortran95       = 0x000e,   ///< ISO Fortran 95.
-    eLanguageTypePLI             = 0x000f,   ///< ANSI PL/I:1976.
-    eLanguageTypeObjC            = 0x0010,   ///< Objective-C.
-    eLanguageTypeObjC_plus_plus  = 0x0011,   ///< Objective-C++.
-    eLanguageTypeUPC             = 0x0012,   ///< Unified Parallel C.
-    eLanguageTypeD               = 0x0013,   ///< D.
-    eLanguageTypePython          = 0x0014    ///< Python.
-} LanguageType;
- */
-
 struct language_name_pair {
     const char *name;
     LanguageType type;
@@ -245,4 +332,12 @@ LanguageRuntime::GetNameForLanguageType
     else
         return language_names[eLanguageTypeUnknown].name;
 }
-        
+
+lldb::SearchFilterSP
+LanguageRuntime::CreateExceptionSearchFilter ()
+{
+    return m_process->GetTarget().GetSearchFilterForModule(NULL);
+}
+
+
+

Modified: lldb/branches/windows/source/Target/Memory.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Target/Memory.cpp?rev=179679&r1=179678&r2=179679&view=diff
==============================================================================
--- lldb/branches/windows/source/Target/Memory.cpp (original)
+++ lldb/branches/windows/source/Target/Memory.cpp Wed Apr 17 03:38:48 2013
@@ -225,7 +225,7 @@ AllocatedBlock::ReserveBlock (uint32_t s
     if (size <= m_byte_size)
     {
         const uint32_t needed_chunks = CalculateChunksNeededForSize (size);
-        LogSP log (GetLogIfAllCategoriesSet (LIBLLDB_LOG_PROCESS | LIBLLDB_LOG_VERBOSE));
+        Log *log (GetLogIfAllCategoriesSet (LIBLLDB_LOG_PROCESS | LIBLLDB_LOG_VERBOSE));
 
         if (m_offset_to_chunk_size.empty())
         {
@@ -324,7 +324,7 @@ AllocatedBlock::ReserveBlock (uint32_t s
 //            return m_addr + m_chunk_size * first_chunk_idx;
 //        }
     }
-    LogSP log (GetLogIfAllCategoriesSet (LIBLLDB_LOG_PROCESS | LIBLLDB_LOG_VERBOSE));
+    Log *log (GetLogIfAllCategoriesSet (LIBLLDB_LOG_PROCESS | LIBLLDB_LOG_VERBOSE));
     if (log)
         log->Printf ("AllocatedBlock::ReserveBlock (size = %u (0x%x)) => 0x%16.16" PRIx64, size, size, (uint64_t)addr);
     return addr;
@@ -341,7 +341,7 @@ AllocatedBlock::FreeBlock (addr_t addr)
         m_offset_to_chunk_size.erase (pos);
         success = true;
     }
-    LogSP log (GetLogIfAllCategoriesSet (LIBLLDB_LOG_PROCESS | LIBLLDB_LOG_VERBOSE));
+    Log *log (GetLogIfAllCategoriesSet (LIBLLDB_LOG_PROCESS | LIBLLDB_LOG_VERBOSE));
     if (log)
         log->Printf ("AllocatedBlock::FreeBlock (addr = 0x%16.16" PRIx64 ") => %i", (uint64_t)addr, success);
     return success;
@@ -387,7 +387,7 @@ AllocatedMemoryCache::AllocatePage (uint
 
     addr_t addr = m_process.DoAllocateMemory(page_byte_size, permissions, error);
 
-    LogSP log (GetLogIfAllCategoriesSet (LIBLLDB_LOG_PROCESS));
+    Log *log (GetLogIfAllCategoriesSet (LIBLLDB_LOG_PROCESS));
     if (log)
     {
         log->Printf ("Process::DoAllocateMemory (byte_size = 0x%8.8zx, permissions = %s) => 0x%16.16" PRIx64,
@@ -426,7 +426,7 @@ AllocatedMemoryCache::AllocateMemory (si
         if (block_sp)
             addr = block_sp->ReserveBlock (byte_size);
     }
-    LogSP log (GetLogIfAllCategoriesSet (LIBLLDB_LOG_PROCESS));
+    Log *log (GetLogIfAllCategoriesSet (LIBLLDB_LOG_PROCESS));
     if (log)
         log->Printf ("AllocatedMemoryCache::AllocateMemory (byte_size = 0x%8.8zx, permissions = %s) => 0x%16.16" PRIx64, byte_size, GetPermissionsAsCString(permissions), (uint64_t)addr);
     return addr;
@@ -447,7 +447,7 @@ AllocatedMemoryCache::DeallocateMemory (
             break;
         }
     }
-    LogSP log (GetLogIfAllCategoriesSet (LIBLLDB_LOG_PROCESS));
+    Log *log (GetLogIfAllCategoriesSet (LIBLLDB_LOG_PROCESS));
     if (log)
         log->Printf("AllocatedMemoryCache::DeallocateMemory (addr = 0x%16.16" PRIx64 ") => %i", (uint64_t)addr, success);
     return success;

Modified: lldb/branches/windows/source/Target/ObjCLanguageRuntime.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Target/ObjCLanguageRuntime.cpp?rev=179679&r1=179678&r2=179679&view=diff
==============================================================================
--- lldb/branches/windows/source/Target/ObjCLanguageRuntime.cpp (original)
+++ lldb/branches/windows/source/Target/ObjCLanguageRuntime.cpp Wed Apr 17 03:38:48 2013
@@ -9,8 +9,10 @@
 #include "clang/AST/Type.h"
 
 #include "lldb/Core/Log.h"
+#include "lldb/Core/MappedHash.h"
 #include "lldb/Core/Module.h"
 #include "lldb/Core/PluginManager.h"
+#include "lldb/Core/Timer.h"
 #include "lldb/Core/ValueObject.h"
 #include "lldb/Symbol/ClangASTContext.h"
 #include "lldb/Symbol/Type.h"
@@ -18,6 +20,8 @@
 #include "lldb/Target/ObjCLanguageRuntime.h"
 #include "lldb/Target/Target.h"
 
+#include "llvm/ADT/StringRef.h"
+
 using namespace lldb;
 using namespace lldb_private;
 
@@ -31,16 +35,29 @@ ObjCLanguageRuntime::~ObjCLanguageRuntim
 ObjCLanguageRuntime::ObjCLanguageRuntime (Process *process) :
     LanguageRuntime (process),
     m_has_new_literals_and_indexing (eLazyBoolCalculate),
-    m_isa_to_descriptor_cache(),
-    m_isa_to_descriptor_cache_stop_id (UINT32_MAX)
+    m_isa_to_descriptor(),
+    m_isa_to_descriptor_stop_id (UINT32_MAX)
 {
 
 }
 
+bool
+ObjCLanguageRuntime::AddClass (ObjCISA isa, const ClassDescriptorSP &descriptor_sp, const char *class_name)
+{
+    if (isa != 0)
+    {
+        m_isa_to_descriptor[isa] = descriptor_sp;
+        // class_name is assumed to be valid
+        m_hash_to_isa_map.insert(std::make_pair(MappedHash::HashStringUsingDJB(class_name), isa));
+        return true;
+    }
+    return false;
+}
+
 void
 ObjCLanguageRuntime::AddToMethodCache (lldb::addr_t class_addr, lldb::addr_t selector, lldb::addr_t impl_addr)
 {
-    LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP));
+    Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP));
     if (log)
     {
         log->Printf ("Caching: class 0x%" PRIx64 " selector 0x%" PRIx64 " implementation 0x%" PRIx64 ".", class_addr, selector, impl_addr);
@@ -75,6 +92,9 @@ ObjCLanguageRuntime::LookupInCompleteCla
             m_complete_class_cache.erase(name);
     }
     
+    if (m_negative_complete_class_cache.count(name) > 0)
+        return TypeSP();
+    
     const ModuleList &modules = m_process->GetTarget().GetImages();
 
     SymbolContextList sc_list;
@@ -122,6 +142,7 @@ ObjCLanguageRuntime::LookupInCompleteCla
             }
         }
     }
+    m_negative_complete_class_cache.insert(name);
     return TypeSP();
 }
 
@@ -131,89 +152,283 @@ ObjCLanguageRuntime::GetByteOffsetForIva
     return LLDB_INVALID_IVAR_OFFSET;
 }
 
+void
+ObjCLanguageRuntime::MethodName::Clear()
+{
+    m_full.Clear();
+    m_class.Clear();
+    m_category.Clear();
+    m_selector.Clear();
+    m_type = eTypeUnspecified;
+    m_category_is_valid = false;
+}
+
+//bool
+//ObjCLanguageRuntime::MethodName::SetName (const char *name, bool strict)
+//{
+//    Clear();
+//    if (name && name[0])
+//    {
+//        // If "strict" is true. then the method must be specified with a
+//        // '+' or '-' at the beginning. If "strict" is false, then the '+'
+//        // or '-' can be omitted
+//        bool valid_prefix = false;
+//        
+//        if (name[0] == '+' || name[0] == '-')
+//        {
+//            valid_prefix = name[1] == '[';
+//        }
+//        else if (!strict)
+//        {
+//            // "strict" is false, the name just needs to start with '['
+//            valid_prefix = name[0] == '[';
+//        }
+//
+//        if (valid_prefix)
+//        {
+//            static RegularExpression g_regex("^([-+]?)\\[([A-Za-z_][A-Za-z_0-9]*)(\\([A-Za-z_][A-Za-z_0-9]*\\))? ([A-Za-z_][A-Za-z_0-9:]*)\\]$");
+//            llvm::StringRef matches[4];
+//            // Since we are using a global regular expression, we must use the threadsafe version of execute
+//            if (g_regex.ExecuteThreadSafe(name, matches, 4))
+//            {
+//                m_full.SetCString(name);
+//                if (matches[0].empty())
+//                    m_type = eTypeUnspecified;
+//                else if (matches[0][0] == '+')
+//                    m_type = eTypeClassMethod;
+//                else
+//                    m_type = eTypeInstanceMethod;
+//                m_class.SetString(matches[1]);
+//                m_selector.SetString(matches[3]);
+//                if (!matches[2].empty())
+//                    m_category.SetString(matches[2]);
+//            }
+//        }
+//    }
+//    return IsValid(strict);
+//}
 
-uint32_t
-ObjCLanguageRuntime::ParseMethodName (const char *name, 
-                                      ConstString *class_name,              // Class name (with category if any)
-                                      ConstString *selector_name,           // selector on its own
-                                      ConstString *name_sans_category,      // Full function prototype with no category
-                                      ConstString *class_name_sans_category)// Class name with no category (or empty if no category as answer will be in "class_name"
-{
-    if (class_name)
-        class_name->Clear();
-    if (selector_name)
-        selector_name->Clear();
-    if (name_sans_category)
-        name_sans_category->Clear();
-    if (class_name_sans_category)
-        class_name_sans_category->Clear();
-    
-    uint32_t result = 0;
+bool
+ObjCLanguageRuntime::MethodName::SetName (const char *name, bool strict)
+{
+    Clear();
+    if (name && name[0])
+    {
+        // If "strict" is true. then the method must be specified with a
+        // '+' or '-' at the beginning. If "strict" is false, then the '+'
+        // or '-' can be omitted
+        bool valid_prefix = false;
+        
+        if (name[0] == '+' || name[0] == '-')
+        {
+            valid_prefix = name[1] == '[';
+            if (name[0] == '+')
+                m_type = eTypeClassMethod;
+            else
+                m_type = eTypeInstanceMethod;
+        }
+        else if (!strict)
+        {
+            // "strict" is false, the name just needs to start with '['
+            valid_prefix = name[0] == '[';
+        }
+        
+        if (valid_prefix)
+        {
+            int name_len = strlen (name);
+            // Objective C methods must have at least:
+            //      "-[" or "+[" prefix
+            //      One character for a class name
+            //      One character for the space between the class name
+            //      One character for the method name
+            //      "]" suffix
+            if (name_len >= (5 + (strict ? 1 : 0)) && name[name_len - 1] == ']')
+            {
+                m_full.SetCStringWithLength(name, name_len);
+            }
+        }
+    }
+    return IsValid(strict);
+}
 
-    if (IsPossibleObjCMethodName (name))
+const ConstString &
+ObjCLanguageRuntime::MethodName::GetClassName ()
+{
+    if (!m_class)
     {
-        int name_len = strlen (name);
-        // Objective C methods must have at least:
-        //      "-[" or "+[" prefix
-        //      One character for a class name
-        //      One character for the space between the class name
-        //      One character for the method name
-        //      "]" suffix
-        if (name_len >= 6 && name[name_len - 1] == ']')
+        if (IsValid(false))
         {
-            const char *selector_name_ptr = strchr (name, ' ');
-            if (selector_name_ptr)
+            const char *full = m_full.GetCString();
+            const char *class_start = (full[0] == '[' ? full + 1 : full + 2);
+            const char *paren_pos = strchr (class_start, '(');
+            if (paren_pos)
             {
-                if (class_name)
-                {
-                    class_name->SetCStringWithLength (name + 2, selector_name_ptr - name - 2);
-                    ++result;
-                }    
-                
-                // Skip the space
-                ++selector_name_ptr;
-                // Extract the objective C basename and add it to the
-                // accelerator tables
-                size_t selector_name_len = name_len - (selector_name_ptr - name) - 1;
-                if (selector_name)
-                {
-                    selector_name->SetCStringWithLength (selector_name_ptr, selector_name_len);                                
-                    ++result;
-                }
-                
-                // Also see if this is a "category" on our class.  If so strip off the category name,
-                // and add the class name without it to the basename table. 
-                
-                if (name_sans_category || class_name_sans_category)
+                m_class.SetCStringWithLength (class_start, paren_pos - class_start);
+            }
+            else
+            {
+                // No '(' was found in the full name, we can definitively say
+                // that our category was valid (and empty).
+                m_category_is_valid = true;
+                const char *space_pos = strchr (full, ' ');
+                if (space_pos)
                 {
-                    const char *open_paren = strchr (name, '(');
-                    if (open_paren)
+                    m_class.SetCStringWithLength (class_start, space_pos - class_start);
+                    if (!m_class_category)
                     {
-                        if (class_name_sans_category)
-                        {
-                            class_name_sans_category->SetCStringWithLength (name + 2, open_paren - name - 2);
-                            ++result;
-                        }
-                        
-                        if (name_sans_category)
-                        {
-                            const char *close_paren = strchr (open_paren, ')');
-                            if (open_paren < close_paren)
-                            {
-                                std::string buffer (name, open_paren - name);
-                                buffer.append (close_paren + 1);
-                                name_sans_category->SetCString (buffer.c_str());
-                                ++result;
-                            }
-                        }
+                        // No category in name, so we can also fill in the m_class_category
+                        m_class_category = m_class;
                     }
                 }
             }
         }
     }
-    return result;
+    return m_class;
+}
+
+const ConstString &
+ObjCLanguageRuntime::MethodName::GetClassNameWithCategory () 
+{
+    if (!m_class_category)
+    {
+        if (IsValid(false))
+        {
+            const char *full = m_full.GetCString();
+            const char *class_start = (full[0] == '[' ? full + 1 : full + 2);
+            const char *space_pos = strchr (full, ' ');
+            if (space_pos)
+            {
+                m_class_category.SetCStringWithLength (class_start, space_pos - class_start);
+                // If m_class hasn't been filled in and the class with category doesn't
+                // contain a '(', then we can also fill in the m_class
+                if (!m_class && strchr (m_class_category.GetCString(), '(') == NULL)
+                {
+                    m_class = m_class_category;
+                    // No '(' was found in the full name, we can definitively say
+                    // that our category was valid (and empty).
+                    m_category_is_valid = true;
+
+                }
+            }
+        }
+    }
+    return m_class_category;
+}
+
+const ConstString &
+ObjCLanguageRuntime::MethodName::GetSelector ()
+{
+    if (!m_selector)
+    {
+        if (IsValid(false))
+        {
+            const char *full = m_full.GetCString();
+            const char *space_pos = strchr (full, ' ');
+            if (space_pos)
+            {
+                ++space_pos; // skip the space
+                m_selector.SetCStringWithLength (space_pos, m_full.GetLength() - (space_pos - full) - 1);
+            }
+        }
+    }
+    return m_selector;
+}
+
+const ConstString &
+ObjCLanguageRuntime::MethodName::GetCategory ()
+{
+    if (!m_category_is_valid && !m_category)
+    {
+        if (IsValid(false))
+        {
+            m_category_is_valid = true;
+            const char *full = m_full.GetCString();
+            const char *class_start = (full[0] == '[' ? full + 1 : full + 2);
+            const char *open_paren_pos = strchr (class_start, '(');
+            if (open_paren_pos)
+            {
+                ++open_paren_pos; // Skip the open paren
+                const char *close_paren_pos = strchr (open_paren_pos, ')');
+                if (close_paren_pos)
+                    m_category.SetCStringWithLength (open_paren_pos, close_paren_pos - open_paren_pos);
+            }
+        }
+    }
+    return m_category;
+}
+
+ConstString
+ObjCLanguageRuntime::MethodName::GetFullNameWithoutCategory (bool empty_if_no_category)
+{
+    if (IsValid(false))
+    {
+        if (HasCategory())
+        {
+            StreamString strm;
+            if (m_type == eTypeClassMethod)
+                strm.PutChar('+');
+            else if (m_type == eTypeInstanceMethod)
+                strm.PutChar('-');
+            strm.Printf("[%s %s]", GetClassName().GetCString(), GetSelector().GetCString());
+            return ConstString(strm.GetString().c_str());
+        }
+        
+        if (!empty_if_no_category)
+        {
+            // Just return the full name since it doesn't have a category
+            return GetFullName();
+        }
+    }
+    return ConstString();
+}
+
+size_t
+ObjCLanguageRuntime::MethodName::GetFullNames (std::vector<ConstString> &names, bool append)
+{
+    if (!append)
+        names.clear();
+    if (IsValid(false))
+    {
+        StreamString strm;
+        const bool is_class_method = m_type == eTypeClassMethod;
+        const bool is_instance_method = m_type == eTypeInstanceMethod;
+        const ConstString &category = GetCategory();
+        if (is_class_method || is_instance_method)
+        {
+            names.push_back (m_full);
+            if (category)
+            {
+                strm.Printf("%c[%s %s]",
+                            is_class_method ? '+' : '-',
+                            GetClassName().GetCString(),
+                            GetSelector().GetCString());
+                names.push_back(ConstString(strm.GetString().c_str()));
+            }
+        }
+        else
+        {
+            const ConstString &class_name = GetClassName();
+            const ConstString &selector = GetSelector();
+            strm.Printf("+[%s %s]", class_name.GetCString(), selector.GetCString());
+            names.push_back(ConstString(strm.GetString().c_str()));
+            strm.Clear();
+            strm.Printf("-[%s %s]", class_name.GetCString(), selector.GetCString());
+            names.push_back(ConstString(strm.GetString().c_str()));
+            strm.Clear();
+            if (category)
+            {
+                strm.Printf("+[%s(%s) %s]", class_name.GetCString(), category.GetCString(), selector.GetCString());
+                names.push_back(ConstString(strm.GetString().c_str()));
+                strm.Clear();
+                strm.Printf("-[%s(%s) %s]", class_name.GetCString(), category.GetCString(), selector.GetCString());
+                names.push_back(ConstString(strm.GetString().c_str()));
+            }
+        }
+    }
+    return names.size();
 }
 
+
 bool
 ObjCLanguageRuntime::ClassDescriptor::IsPointerValid (lldb::addr_t value,
                                                       uint32_t ptr_size,
@@ -234,15 +449,51 @@ ObjCLanguageRuntime::ClassDescriptor::Is
 ObjCLanguageRuntime::ObjCISA
 ObjCLanguageRuntime::GetISA(const ConstString &name)
 {
+    ISAToDescriptorIterator pos = GetDescriptorIterator (name);
+    if (pos != m_isa_to_descriptor.end())
+        return pos->first;
 
-    UpdateISAToDescriptorMap();
-    for (std::map<ObjCISA, ClassDescriptorSP>::iterator it = 
-        m_isa_to_descriptor_cache.begin(); it != m_isa_to_descriptor_cache.end(); ++it)
-        if (it->second && it->second->GetClassName() == name)
-            return it->first;
-    return 0;
+	return 0;
 }
 
+ObjCLanguageRuntime::ISAToDescriptorIterator
+ObjCLanguageRuntime::GetDescriptorIterator (const ConstString &name)
+{
+    ISAToDescriptorIterator end = m_isa_to_descriptor.end();
+
+    if (name)
+    {
+        UpdateISAToDescriptorMap();
+        if (m_hash_to_isa_map.empty())
+        {
+            // No name hashes were provided, we need to just linearly power through the
+            // names and find a match
+            for (ISAToDescriptorIterator pos = m_isa_to_descriptor.begin(); pos != end; ++pos)
+            {
+                if (pos->second->GetClassName() == name)
+                    return pos;
+            }
+        }
+        else
+        {
+            // Name hashes were provided, so use them to efficiently lookup name to isa/descriptor
+            const uint32_t name_hash = MappedHash::HashStringUsingDJB (name.GetCString());
+            std::pair <HashToISAIterator, HashToISAIterator> range = m_hash_to_isa_map.equal_range(name_hash);
+            for (HashToISAIterator range_pos = range.first; range_pos != range.second; ++range_pos)
+            {
+                ISAToDescriptorIterator pos = m_isa_to_descriptor.find (range_pos->second);
+                if (pos != m_isa_to_descriptor.end())
+                {
+                    if (pos->second->GetClassName() == name)
+                        return pos;
+                }
+            }
+        }
+    }
+    return end;
+}
+
+
 ObjCLanguageRuntime::ObjCISA
 ObjCLanguageRuntime::GetParentClass(ObjCLanguageRuntime::ObjCISA isa)
 {
@@ -268,12 +519,11 @@ ObjCLanguageRuntime::GetActualTypeName(O
 ObjCLanguageRuntime::ClassDescriptorSP
 ObjCLanguageRuntime::GetClassDescriptor (const ConstString &class_name)
 {
-    UpdateISAToDescriptorMap();
-    for (std::map<ObjCISA, ClassDescriptorSP>::iterator it = 
-        m_isa_to_descriptor_cache.begin(); it != m_isa_to_descriptor_cache.end(); ++it)
-        if (it->second && it->second->GetClassName() == class_name)
-            return it->second;
-    return ClassDescriptorSP();
+    ISAToDescriptorIterator pos = GetDescriptorIterator (class_name);
+    if (pos != m_isa_to_descriptor.end())
+        return pos->second;
+
+	return ClassDescriptorSP();
 
 }
 
@@ -327,8 +577,8 @@ ObjCLanguageRuntime::GetClassDescriptor
     if (isa)
     {
         UpdateISAToDescriptorMap();
-        ObjCLanguageRuntime::ISAToDescriptorIterator pos = m_isa_to_descriptor_cache.find(isa);    
-        if (pos != m_isa_to_descriptor_cache.end())
+        ObjCLanguageRuntime::ISAToDescriptorIterator pos = m_isa_to_descriptor.find(isa);    
+        if (pos != m_isa_to_descriptor.end())
             return pos->second;
     }
     return ClassDescriptorSP();

Modified: lldb/branches/windows/source/Target/PathMappingList.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Target/PathMappingList.cpp?rev=179679&r1=179678&r2=179679&view=diff
==============================================================================
--- lldb/branches/windows/source/Target/PathMappingList.cpp (original)
+++ lldb/branches/windows/source/Target/PathMappingList.cpp Wed Apr 17 03:38:48 2013
@@ -28,18 +28,17 @@ using namespace lldb_private;
 PathMappingList::PathMappingList () :
     m_pairs (),
     m_callback (NULL),
-    m_callback_baton (NULL)
+    m_callback_baton (NULL),
+    m_mod_id (0)
 {
 }
 
-PathMappingList::PathMappingList 
-(
-    ChangedCallback callback,
-    void *callback_baton
-) :
+PathMappingList::PathMappingList (ChangedCallback callback,
+                                  void *callback_baton) :
     m_pairs (),
     m_callback (callback),
-    m_callback_baton (callback_baton)
+    m_callback_baton (callback_baton),
+    m_mod_id (0)
 {
 }
 
@@ -47,7 +46,8 @@ PathMappingList::PathMappingList
 PathMappingList::PathMappingList (const PathMappingList &rhs) :
     m_pairs (rhs.m_pairs),
     m_callback (NULL),
-    m_callback_baton (NULL)
+    m_callback_baton (NULL),
+    m_mod_id (0)
 {
     
 }
@@ -60,6 +60,7 @@ PathMappingList::operator =(const PathMa
         m_pairs = rhs.m_pairs;
         m_callback = NULL;
         m_callback_baton = NULL;
+        m_mod_id = rhs.m_mod_id;
     }
     return *this;
 }
@@ -77,6 +78,7 @@ PathMappingList::Append (const ConstStri
                          const ConstString &replacement,
                          bool notify)
 {
+    ++m_mod_id;
     m_pairs.push_back(pair(path, replacement));
     if (notify && m_callback)
         m_callback (*this, m_callback_baton);
@@ -85,6 +87,7 @@ PathMappingList::Append (const ConstStri
 void
 PathMappingList::Append (const PathMappingList &rhs, bool notify)
 {
+    ++m_mod_id;
     if (!rhs.m_pairs.empty())
     {
         const_iterator pos, end = rhs.m_pairs.end();
@@ -101,6 +104,7 @@ PathMappingList::Insert (const ConstStri
                          uint32_t index,
                          bool notify)
 {
+    ++m_mod_id;
     iterator insert_iter;
     if (index >= m_pairs.size())
         insert_iter = m_pairs.end();
@@ -120,6 +124,7 @@ PathMappingList::Replace (const ConstStr
     iterator insert_iter;
     if (index >= m_pairs.size())
         return false;
+    ++m_mod_id;
     m_pairs[index] = pair(path, replacement);
     if (notify && m_callback)
         m_callback (*this, m_callback_baton);
@@ -132,6 +137,7 @@ PathMappingList::Remove (off_t index, bo
     if (index >= m_pairs.size())
         return false;
 
+    ++m_mod_id;
     iterator iter = m_pairs.begin() + index;
     m_pairs.erase(iter);
     if (notify && m_callback)
@@ -164,6 +170,8 @@ PathMappingList::Dump (Stream *s, int pa
 void
 PathMappingList::Clear (bool notify)
 {
+    if (!m_pairs.empty())
+        ++m_mod_id;
     m_pairs.clear();
     if (notify && m_callback)
         m_callback (*this, m_callback_baton);
@@ -255,6 +263,7 @@ PathMappingList::Replace (const ConstStr
     uint32_t idx = FindIndexForPath (path);
     if (idx < m_pairs.size())
     {
+        ++m_mod_id;
         m_pairs[idx].second = new_path;
         if (notify && m_callback)
             m_callback (*this, m_callback_baton);
@@ -269,6 +278,7 @@ PathMappingList::Remove (const ConstStri
     iterator pos = FindIteratorForPath (path);
     if (pos != m_pairs.end())
     {
+        ++m_mod_id;
         m_pairs.erase (pos);
         if (notify && m_callback)
             m_callback (*this, m_callback_baton);

Modified: lldb/branches/windows/source/Target/Platform.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Target/Platform.cpp?rev=179679&r1=179678&r2=179679&view=diff
==============================================================================
--- lldb/branches/windows/source/Target/Platform.cpp (original)
+++ lldb/branches/windows/source/Target/Platform.cpp Wed Apr 17 03:38:48 2013
@@ -89,10 +89,41 @@ Platform::GetFile (const FileSpec &platf
     return Error();
 }
 
-FileSpec
-Platform::LocateExecutableScriptingResource (const ModuleSpec &module_spec)
+FileSpecList
+Platform::LocateExecutableScriptingResources (Target *target, Module &module)
 {
-    return FileSpec();
+    return FileSpecList();
+}
+
+Platform*
+Platform::FindPlugin (Process *process, const char *plugin_name)
+{
+    PlatformCreateInstance create_callback = NULL;
+    if (plugin_name)
+    {
+        create_callback  = PluginManager::GetPlatformCreateCallbackForPluginName (plugin_name);
+        if (create_callback)
+        {
+            ArchSpec arch;
+            if (process)
+            {
+                arch = process->GetTarget().GetArchitecture();
+            }
+            std::auto_ptr<Platform> instance_ap(create_callback(process, &arch));
+            if (instance_ap.get())
+                return instance_ap.release();
+        }
+    }
+    else
+    {
+        for (uint32_t idx = 0; (create_callback = PluginManager::GetPlatformCreateCallbackAtIndex(idx)) != NULL; ++idx)
+        {
+            std::auto_ptr<Platform> instance_ap(create_callback(process, false));
+            if (instance_ap.get())
+                return instance_ap.release();
+        }
+    }
+    return NULL;
 }
 
 Error
@@ -145,12 +176,27 @@ Platform::Create (const ArchSpec &arch,
     {
         uint32_t idx;
         PlatformCreateInstance create_callback;
+        // First try exact arch matches across all platform plug-ins
+        bool exact = true;
+        for (idx = 0; (create_callback = PluginManager::GetPlatformCreateCallbackAtIndex (idx)); ++idx)
+        {
+            if (create_callback)
+            {
+                platform_sp.reset(create_callback(false, &arch));
+                if (platform_sp && platform_sp->IsCompatibleArchitecture(arch, exact, platform_arch_ptr))
+                    return platform_sp;
+            }
+        }
+        // Next try compatible arch matches across all platform plug-ins
+        exact = false;
         for (idx = 0; (create_callback = PluginManager::GetPlatformCreateCallbackAtIndex (idx)); ++idx)
         {
             if (create_callback)
+            {
                 platform_sp.reset(create_callback(false, &arch));
-            if (platform_sp && platform_sp->IsCompatibleArchitecture(arch, platform_arch_ptr))
-                return platform_sp;
+                if (platform_sp && platform_sp->IsCompatibleArchitecture(arch, exact, platform_arch_ptr))
+                    return platform_sp;
+            }
         }
     }
     else
@@ -202,7 +248,7 @@ Platform::Platform (bool is_host) :
     m_max_uid_name_len (0),
     m_max_gid_name_len (0)
 {
-    LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_OBJECT));
+    Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_OBJECT));
     if (log)
         log->Printf ("%p Platform::Platform()", this);
 }
@@ -215,7 +261,7 @@ Platform::Platform (bool is_host) :
 //------------------------------------------------------------------
 Platform::~Platform()
 {
-    LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_OBJECT));
+    Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_OBJECT));
     if (log)
         log->Printf ("%p Platform::~Platform()", this);
 }
@@ -680,19 +726,35 @@ Platform::GetPlatformForArchitecture (co
 /// architecture and the target triple contained within.
 //------------------------------------------------------------------
 bool
-Platform::IsCompatibleArchitecture (const ArchSpec &arch, ArchSpec *compatible_arch_ptr)
+Platform::IsCompatibleArchitecture (const ArchSpec &arch, bool exact_arch_match, ArchSpec *compatible_arch_ptr)
 {
     // If the architecture is invalid, we must answer true...
     if (arch.IsValid())
     {
         ArchSpec platform_arch;
-        for (uint32_t arch_idx=0; GetSupportedArchitectureAtIndex (arch_idx, platform_arch); ++arch_idx)
+        // Try for an exact architecture match first.
+        if (exact_arch_match)
+        {
+            for (uint32_t arch_idx=0; GetSupportedArchitectureAtIndex (arch_idx, platform_arch); ++arch_idx)
+            {
+                if (arch.IsExactMatch(platform_arch))
+                {
+                    if (compatible_arch_ptr)
+                        *compatible_arch_ptr = platform_arch;
+                    return true;
+                }
+            }
+        }
+        else
         {
-            if (arch.IsCompatibleMatch(platform_arch))
+            for (uint32_t arch_idx=0; GetSupportedArchitectureAtIndex (arch_idx, platform_arch); ++arch_idx)
             {
-                if (compatible_arch_ptr)
-                    *compatible_arch_ptr = platform_arch;
-                return true;
+                if (arch.IsCompatibleMatch(platform_arch))
+                {
+                    if (compatible_arch_ptr)
+                        *compatible_arch_ptr = platform_arch;
+                    return true;
+                }
             }
         }
     }
@@ -702,6 +764,7 @@ Platform::IsCompatibleArchitecture (cons
     
 }
 
+
 lldb::BreakpointSP
 Platform::SetThreadCreationBreakpoint (lldb_private::Target &target)
 {

Modified: lldb/branches/windows/source/Target/Process.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Target/Process.cpp?rev=179679&r1=179678&r2=179679&view=diff
==============================================================================
--- lldb/branches/windows/source/Target/Process.cpp (original)
+++ lldb/branches/windows/source/Target/Process.cpp Wed Apr 17 03:38:48 2013
@@ -97,14 +97,20 @@ g_properties[] =
     { "disable-memory-cache" , OptionValue::eTypeBoolean, false, DISABLE_MEM_CACHE_DEFAULT, NULL, NULL, "Disable reading and caching of memory in fixed-size units." },
     { "extra-startup-command", OptionValue::eTypeArray  , false, OptionValue::eTypeString, NULL, NULL, "A list containing extra commands understood by the particular process plugin used.  "
                                                                                                        "For instance, to turn on debugserver logging set this to \"QSetLogging:bitmask=LOG_DEFAULT;\"" },
+    { "ignore-breakpoints-in-expressions", OptionValue::eTypeBoolean, true, true, NULL, NULL, "If true, breakpoints will be ignored during expression evaluation." },
+    { "unwind-on-error-in-expressions", OptionValue::eTypeBoolean, true, true, NULL, NULL, "If true, errors in expression evaluation will unwind the stack back to the state before the call." },
     { "python-os-plugin-path", OptionValue::eTypeFileSpec, false, true, NULL, NULL, "A path to a python OS plug-in module file that contains a OperatingSystemPlugIn class." },
+    { "stop-on-sharedlibrary-events" , OptionValue::eTypeBoolean, true, false, NULL, NULL, "If true, stop when a shared library is loaded or unloaded." },
     {  NULL                  , OptionValue::eTypeInvalid, false, 0, NULL, NULL, NULL  }
 };
 
 enum {
     ePropertyDisableMemCache,
     ePropertyExtraStartCommand,
-    ePropertyPythonOSPluginPath
+    ePropertyIgnoreBreakpointsInExpressions,
+    ePropertyUnwindOnErrorInExpressions,
+    ePropertyPythonOSPluginPath,
+    ePropertyStopOnSharedLibraryEvents
 };
 
 ProcessProperties::ProcessProperties (bool is_global) :
@@ -115,7 +121,7 @@ ProcessProperties::ProcessProperties (bo
         m_collection_sp.reset (new ProcessOptionValueProperties(ConstString("process")));
         m_collection_sp->Initialize(g_properties);
         m_collection_sp->AppendProperty(ConstString("thread"),
-                                        ConstString("Settings specify to threads."),
+                                        ConstString("Settings specific to threads."),
                                         true,
                                         Thread::GetGlobalProperties()->GetValueProperties());
     }
@@ -164,6 +170,49 @@ ProcessProperties::SetPythonOSPluginPath
     m_collection_sp->SetPropertyAtIndexAsFileSpec(NULL, idx, file);
 }
 
+
+bool
+ProcessProperties::GetIgnoreBreakpointsInExpressions () const
+{
+    const uint32_t idx = ePropertyIgnoreBreakpointsInExpressions;
+    return m_collection_sp->GetPropertyAtIndexAsBoolean(NULL, idx, g_properties[idx].default_uint_value != 0);
+}
+    
+void
+ProcessProperties::SetIgnoreBreakpointsInExpressions (bool ignore)
+{
+    const uint32_t idx = ePropertyIgnoreBreakpointsInExpressions;
+    m_collection_sp->SetPropertyAtIndexAsBoolean(NULL, idx, ignore);
+}
+
+bool
+ProcessProperties::GetUnwindOnErrorInExpressions () const
+{
+    const uint32_t idx = ePropertyUnwindOnErrorInExpressions;
+    return m_collection_sp->GetPropertyAtIndexAsBoolean(NULL, idx, g_properties[idx].default_uint_value != 0);
+}
+    
+void
+ProcessProperties::SetUnwindOnErrorInExpressions (bool ignore)
+{
+    const uint32_t idx = ePropertyUnwindOnErrorInExpressions;
+    m_collection_sp->SetPropertyAtIndexAsBoolean(NULL, idx, ignore);
+}
+
+bool
+ProcessProperties::GetStopOnSharedLibraryEvents () const
+{
+    const uint32_t idx = ePropertyStopOnSharedLibraryEvents;
+    return m_collection_sp->GetPropertyAtIndexAsBoolean(NULL, idx, g_properties[idx].default_uint_value != 0);
+}
+    
+void
+ProcessProperties::SetStopOnSharedLibraryEvents (bool stop)
+{
+    const uint32_t idx = ePropertyStopOnSharedLibraryEvents;
+    m_collection_sp->SetPropertyAtIndexAsBoolean(NULL, idx, stop);
+}
+
 void
 ProcessInstanceInfo::Dump (Stream &s, Platform *platform) const
 {
@@ -469,7 +518,8 @@ ProcessLaunchInfo::ConvertArgumentsForLa
                     // We have a relative path to our executable which may not work if
                     // we just try to run "a.out" (without it being converted to "./a.out")
                     const char *working_dir = GetWorkingDirectory();
-                    std::string new_path("PATH=");
+                    // Be sure to put quotes around PATH's value in case any paths have spaces...
+                    std::string new_path("PATH=\"");
                     const size_t empty_path_len = new_path.size();
                     
                     if (working_dir && working_dir[0])
@@ -490,7 +540,7 @@ ProcessLaunchInfo::ConvertArgumentsForLa
                             new_path += ':';
                         new_path += curr_path;
                     }
-                    new_path += ' ';
+                    new_path += "\" ";
                     shell_command.PutCString(new_path.c_str());
                 }
 
@@ -885,6 +935,8 @@ ProcessInstanceInfoMatch::Clear()
 ProcessSP
 Process::FindPlugin (Target &target, const char *plugin_name, Listener &listener, const FileSpec *crash_file_path)
 {
+    static uint32_t g_process_unique_id = 0;
+
     ProcessSP process_sp;
     ProcessCreateInstance create_callback = NULL;
     if (plugin_name)
@@ -895,7 +947,11 @@ Process::FindPlugin (Target &target, con
             process_sp = create_callback(target, listener, crash_file_path);
             if (process_sp)
             {
-                if (!process_sp->CanDebug(target, true))
+                if (process_sp->CanDebug(target, true))
+                {
+                    process_sp->m_process_unique_id = ++g_process_unique_id;
+                }
+                else
                     process_sp.reset();
             }
         }
@@ -907,10 +963,13 @@ Process::FindPlugin (Target &target, con
             process_sp = create_callback(target, listener, crash_file_path);
             if (process_sp)
             {
-                if (!process_sp->CanDebug(target, false))
-                    process_sp.reset();
-                else
+                if (process_sp->CanDebug(target, false))
+                {
+                    process_sp->m_process_unique_id = ++g_process_unique_id;
                     break;
+                }
+                else
+                    process_sp.reset();
             }
         }
     }
@@ -940,7 +999,9 @@ Process::Process(Target &target, Listene
     m_private_state_control_wait(),
     m_private_state_thread (LLDB_INVALID_HOST_THREAD),
     m_mod_id (),
+    m_process_unique_id(0),
     m_thread_index_id (0),
+    m_thread_id_to_index_id_map (),
     m_exit_status (-1),
     m_exit_string (),
     m_thread_list (this),
@@ -962,14 +1023,18 @@ Process::Process(Target &target, Listene
     m_allocated_memory_cache (*this),
     m_should_detach (false),
     m_next_event_action_ap(),
-    m_run_lock (),
+    m_public_run_lock (),
+    m_private_run_lock (),
     m_currently_handling_event(false),
     m_finalize_called(false),
+    m_last_broadcast_state (eStateInvalid),
+    m_destroy_in_process (false),
     m_can_jit(eCanJITDontKnow)
 {
     CheckInWithManager ();
+	m_private_run_lock.WriteLock();
 
-    LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_OBJECT));
+    Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_OBJECT));
     if (log)
         log->Printf ("%p Process::Process()", this);
 
@@ -1005,7 +1070,7 @@ Process::Process(Target &target, Listene
 //----------------------------------------------------------------------
 Process::~Process()
 {
-    LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_OBJECT));
+    Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_OBJECT));
     if (log)
         log->Printf ("%p Process::~Process()", this);
     StopPrivateStateThread();
@@ -1079,6 +1144,8 @@ Process::Finalize()
     // contain events that have ProcessSP values in them which can keep this
     // process around forever. These events need to be cleared out.
     m_private_state_listener.Clear();
+    //m_public_run_lock.WriteUnlock();
+    m_private_run_lock.WriteUnlock();
     m_finalize_called = true;
 }
 
@@ -1244,7 +1311,7 @@ Process::RestorePrivateProcessEvents ()
 StateType
 Process::WaitForStateChangedEvents (const TimeValue *timeout, EventSP &event_sp)
 {
-    LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_PROCESS));
+    Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_PROCESS));
 
     if (log)
         log->Printf ("Process::%s (timeout = %p, event_sp)...", __FUNCTION__, timeout);
@@ -1272,7 +1339,7 @@ Process::WaitForStateChangedEvents (cons
 Event *
 Process::PeekAtStateChangedEvents ()
 {
-    LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_PROCESS));
+    Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_PROCESS));
 
     if (log)
         log->Printf ("Process::%s...", __FUNCTION__);
@@ -1300,7 +1367,7 @@ Process::PeekAtStateChangedEvents ()
 StateType
 Process::WaitForStateChangedEventsPrivate (const TimeValue *timeout, EventSP &event_sp)
 {
-    LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_PROCESS));
+    Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_PROCESS));
 
     if (log)
         log->Printf ("Process::%s (timeout = %p, event_sp)...", __FUNCTION__, timeout);
@@ -1329,7 +1396,7 @@ Process::WaitForStateChangedEventsPrivat
 bool
 Process::WaitForEventsPrivate (const TimeValue *timeout, EventSP &event_sp, bool control_only)
 {
-    LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_PROCESS));
+    Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_PROCESS));
 
     if (log)
         log->Printf ("Process::%s (timeout = %p, event_sp)...", __FUNCTION__, timeout);
@@ -1366,7 +1433,7 @@ Process::GetExitDescription ()
 bool
 Process::SetExitStatus (int status, const char *cstr)
 {
-    LogSP log(lldb_private::GetLogIfAnyCategoriesSet (LIBLLDB_LOG_STATE | LIBLLDB_LOG_PROCESS));
+    Log *log(lldb_private::GetLogIfAnyCategoriesSet (LIBLLDB_LOG_STATE | LIBLLDB_LOG_PROCESS));
     if (log)
         log->Printf("Process::SetExitStatus (status=%i (0x%8.8x), description=%s%s%s)", 
                     status, status,
@@ -1406,7 +1473,7 @@ Process::SetProcessExitStatus (void *cal
                                int exit_status     // Exit value of process if signal is zero
 )
 {
-    LogSP log(lldb_private::GetLogIfAnyCategoriesSet (LIBLLDB_LOG_PROCESS));
+    Log *log(lldb_private::GetLogIfAnyCategoriesSet (LIBLLDB_LOG_PROCESS));
     if (log)
         log->Printf ("Process::SetProcessExitStatus (baton=%p, pid=%" PRIu64 ", exited=%i, signal=%i, exit_status=%i)\n",
                      callback_baton,
@@ -1454,22 +1521,87 @@ Process::UpdateThreadListIfNeeded ()
             // thread list, but only update if "true" is returned
             if (UpdateThreadList (m_thread_list, new_thread_list))
             {
-                OperatingSystem *os = GetOperatingSystem ();
-                if (os)
-                    os->UpdateThreadList (m_thread_list, new_thread_list);
-                m_thread_list.Update (new_thread_list);
-                m_thread_list.SetStopID (stop_id);
+                // Don't call into the OperatingSystem to update the thread list if we are shutting down, since
+                // that may call back into the SBAPI's, requiring the API lock which is already held by whoever is
+                // shutting us down, causing a deadlock.
+                if (!m_destroy_in_process)
+                {
+                    OperatingSystem *os = GetOperatingSystem ();
+                    if (os)
+                    {
+                        // Clear any old backing threads where memory threads might have been
+                        // backed by actual threads from the lldb_private::Process subclass
+                        size_t num_old_threads = m_thread_list.GetSize(false);
+                        for (size_t i=0; i<num_old_threads; ++i)
+                            m_thread_list.GetThreadAtIndex(i, false)->ClearBackingThread();
+
+                        // Now let the OperatingSystem plug-in update the thread list
+                        os->UpdateThreadList (m_thread_list, new_thread_list);
+                    }
+                    m_thread_list.Update (new_thread_list);
+                    m_thread_list.SetStopID (stop_id);
+                }
             }
         }
     }
 }
 
+ThreadSP
+Process::CreateOSPluginThread (lldb::tid_t tid, lldb::addr_t context)
+{
+    OperatingSystem *os = GetOperatingSystem ();
+    if (os)
+        return os->CreateThread(tid, context);
+    return ThreadSP();
+}
+
+
+
+// This is obsoleted. Staged removal for Xcode.
 uint32_t
 Process::GetNextThreadIndexID ()
 {
     return ++m_thread_index_id;
 }
 
+uint32_t
+Process::GetNextThreadIndexID (uint64_t thread_id)
+{
+    return AssignIndexIDToThread(thread_id);
+}
+
+bool
+Process::HasAssignedIndexIDToThread(uint64_t thread_id)
+{
+    std::map<uint64_t, uint32_t>::iterator iterator = m_thread_id_to_index_id_map.find(thread_id);
+    if (iterator == m_thread_id_to_index_id_map.end())
+    {
+        return false;
+    }
+    else
+    {
+        return true;
+    }
+}
+
+uint32_t
+Process::AssignIndexIDToThread(uint64_t thread_id)
+{
+    uint32_t result = 0;
+    std::map<uint64_t, uint32_t>::iterator iterator = m_thread_id_to_index_id_map.find(thread_id);
+    if (iterator == m_thread_id_to_index_id_map.end())
+    {
+        result = ++m_thread_index_id;
+        m_thread_id_to_index_id_map[thread_id] = result;
+    }
+    else
+    {
+        result = iterator->second;
+    }
+    
+    return result;
+}
+
 StateType
 Process::GetState()
 {
@@ -1480,7 +1612,7 @@ Process::GetState()
 void
 Process::SetPublicState (StateType new_state)
 {
-    LogSP log(lldb_private::GetLogIfAnyCategoriesSet (LIBLLDB_LOG_STATE | LIBLLDB_LOG_PROCESS));
+    Log *log(lldb_private::GetLogIfAnyCategoriesSet (LIBLLDB_LOG_STATE | LIBLLDB_LOG_PROCESS));
     if (log)
         log->Printf("Process::SetPublicState (%s)", StateAsCString(new_state));
     const StateType old_state = m_public_state.GetValue();
@@ -1495,7 +1627,7 @@ Process::SetPublicState (StateType new_s
         {
             if (log)
                 log->Printf("Process::SetPublicState (%s) -- unlocking run lock for detach", StateAsCString(new_state));
-            m_run_lock.WriteUnlock();
+            m_public_run_lock.WriteUnlock();
         }
         else
         {
@@ -1507,7 +1639,7 @@ Process::SetPublicState (StateType new_s
                 {
                     if (log)
                         log->Printf("Process::SetPublicState (%s) -- unlocking run lock", StateAsCString(new_state));
-                    m_run_lock.WriteUnlock();
+                    m_public_run_lock.WriteUnlock();
                 }
             }
         }
@@ -1517,10 +1649,10 @@ Process::SetPublicState (StateType new_s
 Error
 Process::Resume ()
 {
-    LogSP log(lldb_private::GetLogIfAnyCategoriesSet (LIBLLDB_LOG_STATE | LIBLLDB_LOG_PROCESS));
+    Log *log(lldb_private::GetLogIfAnyCategoriesSet (LIBLLDB_LOG_STATE | LIBLLDB_LOG_PROCESS));
     if (log)
         log->Printf("Process::Resume -- locking run lock");
-    if (!m_run_lock.WriteTryLock())
+    if (!m_public_run_lock.WriteTryLock())
     {
         Error error("Resume request failed - process still running.");
         if (log)
@@ -1539,7 +1671,7 @@ Process::GetPrivateState ()
 void
 Process::SetPrivateState (StateType new_state)
 {
-    LogSP log(lldb_private::GetLogIfAnyCategoriesSet (LIBLLDB_LOG_STATE | LIBLLDB_LOG_PROCESS));
+    Log *log(lldb_private::GetLogIfAnyCategoriesSet (LIBLLDB_LOG_STATE | LIBLLDB_LOG_PROCESS));
     bool state_changed = false;
 
     if (log)
@@ -1632,7 +1764,8 @@ Process::LoadImage (const FileSpec &imag
             {
                 ExecutionContext exe_ctx;
                 frame_sp->CalculateExecutionContext (exe_ctx);
-                bool unwind_on_error = true;
+                const bool unwind_on_error = true;
+                const bool ignore_breakpoints = true;
                 StreamString expr;
                 expr.Printf("dlopen (\"%s\", 2)", path);
                 const char *prefix = "extern \"C\" void* dlopen (const char *path, int mode);\n";
@@ -1642,6 +1775,7 @@ Process::LoadImage (const FileSpec &imag
                                                lldb::eLanguageTypeUnknown,
                                                ClangUserExpression::eResultTypeAny,
                                                unwind_on_error,
+                                               ignore_breakpoints,
                                                expr.GetData(),
                                                prefix,
                                                result_valobj_sp,
@@ -1707,7 +1841,8 @@ Process::UnloadImage (uint32_t image_tok
                     {
                         ExecutionContext exe_ctx;
                         frame_sp->CalculateExecutionContext (exe_ctx);
-                        bool unwind_on_error = true;
+                        const bool unwind_on_error = true;
+                        const bool ignore_breakpoints = true;
                         StreamString expr;
                         expr.Printf("dlclose ((void *)0x%" PRIx64 ")", image_addr);
                         const char *prefix = "extern \"C\" int dlclose(void* handle);\n";
@@ -1717,6 +1852,7 @@ Process::UnloadImage (uint32_t image_tok
                                                        lldb::eLanguageTypeUnknown,
                                                        ClangUserExpression::eResultTypeAny,
                                                        unwind_on_error,
+                                                       ignore_breakpoints,
                                                        expr.GetData(),
                                                        prefix,
                                                        result_valobj_sp,
@@ -1836,7 +1972,7 @@ Process::DisableAllBreakpointSites ()
     size_t num_sites = m_breakpoint_site_list.GetSize();
     for (size_t i = 0; i < num_sites; i++)
     {
-        DisableBreakpoint (m_breakpoint_site_list.GetByIndex(i).get());
+        DisableBreakpointSite (m_breakpoint_site_list.GetByIndex(i).get());
     }
 }
 
@@ -1859,7 +1995,7 @@ Process::DisableBreakpointSiteByID (lldb
     if (bp_site_sp)
     {
         if (bp_site_sp->IsEnabled())
-            error = DisableBreakpoint (bp_site_sp.get());
+            error = DisableBreakpointSite (bp_site_sp.get());
     }
     else
     {
@@ -1877,7 +2013,7 @@ Process::EnableBreakpointSiteByID (lldb:
     if (bp_site_sp)
     {
         if (!bp_site_sp->IsEnabled())
-            error = EnableBreakpoint (bp_site_sp.get());
+            error = EnableBreakpointSite (bp_site_sp.get());
     }
     else
     {
@@ -1907,10 +2043,10 @@ Process::CreateBreakpointSite (const Bre
         }
         else
         {
-            bp_site_sp.reset (new BreakpointSite (&m_breakpoint_site_list, owner, load_addr, LLDB_INVALID_THREAD_ID, use_hardware));
+            bp_site_sp.reset (new BreakpointSite (&m_breakpoint_site_list, owner, load_addr, use_hardware));
             if (bp_site_sp)
             {
-                if (EnableBreakpoint (bp_site_sp.get()).Success())
+                if (EnableBreakpointSite (bp_site_sp.get()).Success())
                 {
                     owner->SetBreakpointSite (bp_site_sp);
                     return m_breakpoint_site_list.Add (bp_site_sp);
@@ -1929,7 +2065,9 @@ Process::RemoveOwnerFromBreakpointSite (
     uint32_t num_owners = bp_site_sp->RemoveOwner (owner_id, owner_loc_id);
     if (num_owners == 0)
     {
-        DisableBreakpoint(bp_site_sp.get());
+        // Don't try to disable the site if we don't have a live process anymore.
+        if (IsAlive())
+            DisableBreakpointSite (bp_site_sp.get());
         m_breakpoint_site_list.RemoveByAddress(bp_site_sp->GetLoadAddress());
     }
 }
@@ -1982,7 +2120,7 @@ Process::EnableSoftwareBreakpoint (Break
 {
     Error error;
     assert (bp_site != NULL);
-    LogSP log(lldb_private::GetLogIfAnyCategoriesSet (LIBLLDB_LOG_BREAKPOINTS));
+    Log *log(lldb_private::GetLogIfAnyCategoriesSet (LIBLLDB_LOG_BREAKPOINTS));
     const addr_t bp_addr = bp_site->GetLoadAddress();
     if (log)
         log->Printf ("Process::EnableSoftwareBreakpoint (site_id = %d) addr = 0x%" PRIx64, bp_site->GetID(), (uint64_t)bp_addr);
@@ -2059,11 +2197,11 @@ Process::DisableSoftwareBreakpoint (Brea
 {
     Error error;
     assert (bp_site != NULL);
-    LogSP log(lldb_private::GetLogIfAnyCategoriesSet (LIBLLDB_LOG_BREAKPOINTS));
+    Log *log(lldb_private::GetLogIfAnyCategoriesSet (LIBLLDB_LOG_BREAKPOINTS));
     addr_t bp_addr = bp_site->GetLoadAddress();
     lldb::user_id_t breakID = bp_site->GetID();
     if (log)
-        log->Printf ("Process::DisableBreakpoint (breakID = %" PRIu64 ") addr = 0x%" PRIx64, breakID, (uint64_t)bp_addr);
+        log->Printf ("Process::DisableSoftwareBreakpoint (breakID = %" PRIu64 ") addr = 0x%" PRIx64, breakID, (uint64_t)bp_addr);
 
     if (bp_site->IsHardware())
     {
@@ -2426,7 +2564,7 @@ Process::WriteMemory (addr_t addr, const
 }
 
 size_t
-Process::WriteScalarToMemory (addr_t addr, const Scalar &scalar, uint32_t byte_size, Error &error)
+Process::WriteScalarToMemory (addr_t addr, const Scalar &scalar, size_t byte_size, Error &error)
 {
     if (byte_size == UINT32_MAX)
         byte_size = scalar.GetByteSize();
@@ -2461,7 +2599,7 @@ Process::ReadScalarIntegerFromMemory (ad
         if (bytes_read == byte_size)
         {
             DataExtractor data (&uval, sizeof(uval), GetByteOrder(), GetAddressByteSize());
-            uint32_t offset = 0;
+            lldb::offset_t offset = 0;
             if (byte_size <= 4)
                 scalar = data.GetMaxU32 (&offset, byte_size);
             else
@@ -2490,7 +2628,7 @@ Process::AllocateMemory(size_t size, uin
     return m_allocated_memory_cache.AllocateMemory(size, permissions, error);
 #else
     addr_t allocated_addr = DoAllocateMemory (size, permissions, error);
-    LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_PROCESS));
+    Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_PROCESS));
     if (log)
         log->Printf("Process::AllocateMemory(size=%4zu, permissions=%s) => 0x%16.16" PRIx64 " (m_stop_id = %u m_memory_id = %u)",
                     size, 
@@ -2542,7 +2680,7 @@ Process::DeallocateMemory (addr_t ptr)
 #else
     error = DoDeallocateMemory (ptr);
     
-    LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_PROCESS));
+    Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_PROCESS));
     if (log)
         log->Printf("Process::DeallocateMemory(addr=0x%16.16" PRIx64 ") => err = %s (m_stop_id = %u, m_memory_id = %u)",
                     ptr, 
@@ -2556,9 +2694,7 @@ Process::DeallocateMemory (addr_t ptr)
 
 ModuleSP
 Process::ReadModuleFromMemory (const FileSpec& file_spec, 
-                               lldb::addr_t header_addr, 
-                               bool add_image_to_target,
-                               bool load_sections_in_target)
+                               lldb::addr_t header_addr)
 {
     ModuleSP module_sp (new Module (file_spec, ArchSpec()));
     if (module_sp)
@@ -2566,18 +2702,7 @@ Process::ReadModuleFromMemory (const Fil
         Error error;
         ObjectFile *objfile = module_sp->GetMemoryObjectFile (shared_from_this(), header_addr, error);
         if (objfile)
-        {
-            if (add_image_to_target)
-            {
-                m_target.GetImages().Append(module_sp);
-                if (load_sections_in_target)
-                {
-                    bool changed = false;
-                    module_sp->SetLoadAddress (m_target, 0, changed);
-                }
-            }
             return module_sp;
-        }
     }
     return ModuleSP();
 }
@@ -2649,7 +2774,7 @@ Process::Launch (const ProcessLaunchInfo
                 SetPublicState (eStateLaunching);
                 m_should_detach = false;
 
-                if (m_run_lock.WriteTryLock())
+                if (m_public_run_lock.WriteTryLock())
                 {
                     // Now launch using these arguments.
                     error = DoLaunch (exe_module, launch_info);
@@ -2833,7 +2958,7 @@ Process::Attach (ProcessAttachInfo &atta
                 error = WillAttachToProcessWithName(process_name, wait_for_launch);
                 if (error.Success())
                 {
-                    if (m_run_lock.WriteTryLock())
+                    if (m_public_run_lock.WriteTryLock())
                     {
                         m_should_detach = true;
                         SetPublicState (eStateAttaching);
@@ -2910,7 +3035,7 @@ Process::Attach (ProcessAttachInfo &atta
         if (error.Success())
         {
 
-            if (m_run_lock.WriteTryLock())
+            if (m_public_run_lock.WriteTryLock())
             {
                 // Now attach using these arguments.
                 m_should_detach = true;
@@ -2960,7 +3085,7 @@ Process::CompleteAttach ()
     if (platform_sp)
     {
         const ArchSpec &target_arch = m_target.GetArchitecture();
-        if (target_arch.IsValid() && !platform_sp->IsCompatibleArchitecture (target_arch))
+        if (target_arch.IsValid() && !platform_sp->IsCompatibleArchitecture (target_arch, false, NULL))
         {
             ArchSpec platform_arch;
             platform_sp = platform_sp->GetPlatformForArchitecture (target_arch, &platform_arch);
@@ -3049,9 +3174,9 @@ Process::ConnectRemote (Stream *strm, co
 Error
 Process::PrivateResume ()
 {
-    LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_PROCESS|LIBLLDB_LOG_STEP));
+    Log *log(lldb_private::GetLogIfAnyCategoriesSet (LIBLLDB_LOG_PROCESS|LIBLLDB_LOG_STEP));
     if (log)
-        log->Printf("Process::Resume() m_stop_id = %u, public state: %s private state: %s", 
+        log->Printf("Process::PrivateResume() m_stop_id = %u, public state: %s private state: %s", 
                     m_mod_id.GetStopID(),
                     StateAsCString(m_public_state.GetValue()),
                     StateAsCString(m_private_state.GetValue()));
@@ -3073,11 +3198,12 @@ Process::PrivateResume ()
             // Last thing, do the PreResumeActions.
             if (!RunPreResumeActions())
             {
-                error.SetErrorStringWithFormat ("Process::Resume PreResumeActions failed, not resuming.");
+                error.SetErrorStringWithFormat ("Process::PrivateResume PreResumeActions failed, not resuming.");
             }
             else
             {
                 m_mod_id.BumpResumeID();
+                m_private_run_lock.WriteLock();
                 error = DoResume();
                 if (error.Success())
                 {
@@ -3086,6 +3212,10 @@ Process::PrivateResume ()
                     if (log)
                         log->Printf ("Process thinks the process has resumed.");
                 }
+                else
+                {
+                    m_private_run_lock.WriteUnlock();
+                }
             }
         }
         else
@@ -3100,7 +3230,7 @@ Process::PrivateResume ()
         }
     }
     else if (log)
-        log->Printf ("Process::WillResume() got an error \"%s\".", error.AsCString("<unknown error>"));
+        log->Printf ("Process::PrivateResume() got an error \"%s\".", error.AsCString("<unknown error>"));
     return error;
 }
 
@@ -3167,7 +3297,7 @@ Process::Halt ()
                         }
                         else
                         {
-                            LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_PROCESS));
+                            Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_PROCESS));
                             if (log)
                                 log->Printf("Process::Halt() failed to stop, state is: %s", StateAsCString(state));
                             error.SetErrorString ("Did not get stopped event after halt.");
@@ -3192,13 +3322,85 @@ Process::Halt ()
 }
 
 Error
+Process::HaltForDestroyOrDetach(lldb::EventSP &exit_event_sp)
+{
+    Error error;
+    if (m_public_state.GetValue() == eStateRunning)
+    {
+        Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_PROCESS));
+        if (log)
+            log->Printf("Process::Destroy() About to halt.");
+        error = Halt();
+        if (error.Success())
+        {
+            // Consume the halt event.
+            TimeValue timeout (TimeValue::Now());
+            timeout.OffsetWithSeconds(1);
+            StateType state = WaitForProcessToStop (&timeout, &exit_event_sp);
+            
+            // If the process exited while we were waiting for it to stop, put the exited event into
+            // the shared pointer passed in and return.  Our caller doesn't need to do anything else, since
+            // they don't have a process anymore...
+            
+            if (state == eStateExited || m_private_state.GetValue() == eStateExited)
+            {
+                if (log)
+                    log->Printf("Process::HaltForDestroyOrDetach() Process exited while waiting to Halt.");
+                return error;
+            }
+            else
+                exit_event_sp.reset(); // It is ok to consume any non-exit stop events
+    
+            if (state != eStateStopped)
+            {
+                if (log)
+                    log->Printf("Process::HaltForDestroyOrDetach() Halt failed to stop, state is: %s", StateAsCString(state));
+                // If we really couldn't stop the process then we should just error out here, but if the
+                // lower levels just bobbled sending the event and we really are stopped, then continue on.
+                StateType private_state = m_private_state.GetValue();
+                if (private_state != eStateStopped)
+                {
+                    return error;
+                }
+            }
+        }
+        else
+        {
+            if (log)
+                log->Printf("Process::HaltForDestroyOrDetach() Halt got error: %s", error.AsCString());
+        }
+    }
+    return error;
+}
+
+Error
 Process::Detach ()
 {
-    Error error (WillDetach());
+    EventSP exit_event_sp;
+    Error error;
+    m_destroy_in_process = true;
+    
+    error = WillDetach();
 
     if (error.Success())
     {
-        DisableAllBreakpointSites();
+        if (DetachRequiresHalt())
+        {
+            error = HaltForDestroyOrDetach (exit_event_sp);
+            if (!error.Success())
+            {
+                m_destroy_in_process = false;
+                return error;
+            }
+            else if (exit_event_sp)
+            {
+                // We shouldn't need to do anything else here.  There's no process left to detach from...
+                StopPrivateStateThread();
+                m_destroy_in_process = false;
+                return error;
+            }
+        }
+    
         error = DoDetach(); 
         if (error.Success())
         {
@@ -3206,54 +3408,44 @@ Process::Detach ()
             StopPrivateStateThread();
         }
     }
+    m_destroy_in_process = false;
+    
+    // If we exited when we were waiting for a process to stop, then
+    // forward the event here so we don't lose the event
+    if (exit_event_sp)
+    {
+        // Directly broadcast our exited event because we shut down our
+        // private state thread above
+        BroadcastEvent(exit_event_sp);
+    }
+
+    // If we have been interrupted (to kill us) in the middle of running, we may not end up propagating
+    // the last events through the event system, in which case we might strand the write lock.  Unlock
+    // it here so when we do to tear down the process we don't get an error destroying the lock.
+    
+    m_public_run_lock.WriteUnlock();
     return error;
 }
 
 Error
 Process::Destroy ()
 {
+    
+    // Tell ourselves we are in the process of destroying the process, so that we don't do any unnecessary work
+    // that might hinder the destruction.  Remember to set this back to false when we are done.  That way if the attempt
+    // failed and the process stays around for some reason it won't be in a confused state.
+    
+    m_destroy_in_process = true;
+
     Error error (WillDestroy());
     if (error.Success())
     {
         EventSP exit_event_sp;
-        if (m_public_state.GetValue() == eStateRunning)
+        if (DestroyRequiresHalt())
         {
-            LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_PROCESS));
-            if (log)
-                log->Printf("Process::Destroy() About to halt.");
-            error = Halt();
-            if (error.Success())
-            {
-                // Consume the halt event.
-                TimeValue timeout (TimeValue::Now());
-                timeout.OffsetWithSeconds(1);
-                StateType state = WaitForProcessToStop (&timeout, &exit_event_sp);
-                if (state != eStateExited)
-                    exit_event_sp.reset(); // It is ok to consume any non-exit stop events
-        
-                if (state != eStateStopped)
-                {
-                    if (log)
-                        log->Printf("Process::Destroy() Halt failed to stop, state is: %s", StateAsCString(state));
-                    // If we really couldn't stop the process then we should just error out here, but if the
-                    // lower levels just bobbled sending the event and we really are stopped, then continue on.
-                    StateType private_state = m_private_state.GetValue();
-                    if (private_state != eStateStopped && private_state != eStateExited)
-                    {
-                        // If we exited when we were waiting for a process to stop, then
-                        // forward the event here so we don't lose the event
-                        return error;
-                    }
-                }
-            }
-            else
-            {
-                if (log)
-                    log->Printf("Process::Destroy() Halt got error: %s", error.AsCString());
-                return error;
-            }
+            error = HaltForDestroyOrDetach(exit_event_sp);
         }
-
+        
         if (m_public_state.GetValue() != eStateRunning)
         {
             // Ditch all thread plans, and remove all our breakpoints: in case we have to restart the target to
@@ -3263,7 +3455,7 @@ Process::Destroy ()
             m_thread_list.DiscardThreadPlans();
             DisableAllBreakpointSites();
         }
-        
+
         error = DoDestroy();
         if (error.Success())
         {
@@ -3289,9 +3481,11 @@ Process::Destroy ()
         // If we have been interrupted (to kill us) in the middle of running, we may not end up propagating
         // the last events through the event system, in which case we might strand the write lock.  Unlock
         // it here so when we do to tear down the process we don't get an error destroying the lock.
-        if (!StateIsStoppedState(m_public_state.GetValue(), false))
-            m_run_lock.WriteUnlock();
+        m_public_run_lock.WriteUnlock();
     }
+    
+    m_destroy_in_process = false;
+    
     return error;
 }
 
@@ -3326,8 +3520,8 @@ Process::ShouldBroadcastEvent (Event *ev
 {
     const StateType state = Process::ProcessEventData::GetStateFromEvent (event_ptr);
     bool return_value = true;
-    LogSP log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EVENTS));
-
+    Log *log(lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_EVENTS | LIBLLDB_LOG_PROCESS));
+    
     switch (state)
     {
         case eStateConnected:
@@ -3352,7 +3546,7 @@ Process::ShouldBroadcastEvent (Event *ev
             // stopped -> running: Report except when there is one or more no votes
             //     and no yes votes.
             SynchronouslyNotifyStateChanged (state);
-            switch (m_public_state.GetValue())
+            switch (m_last_broadcast_state)
             {
                 case eStateRunning:
                 case eStateStepping:
@@ -3390,36 +3584,56 @@ Process::ShouldBroadcastEvent (Event *ev
             // If we aren't going to stop, let the thread plans decide if we're going to report this event.
             // If no thread has an opinion, we don't report it.
             
+            m_private_run_lock.WriteUnlock();
+
             RefreshStateAfterStop ();
             if (ProcessEventData::GetInterruptedFromEvent (event_ptr))
             {
                 if (log)
-                    log->Printf ("Process::ShouldBroadcastEvent (%p) stopped due to an interrupt, state: %s", event_ptr, StateAsCString(state));
-                return true;
+                    log->Printf ("Process::ShouldBroadcastEvent (%p) stopped due to an interrupt, state: %s",
+                                 event_ptr,
+                                 StateAsCString(state));
+                return_value = true;
             }
             else
             {
-
-                if (m_thread_list.ShouldStop (event_ptr) == false)
+                // It makes no sense to ask "ShouldStop" if we've already been restarted...
+                // Asking the thread list is also not likely to go well, since we are running again.
+                // So in that case just report the event.
+                
+                bool was_restarted = ProcessEventData::GetRestartedFromEvent (event_ptr);
+                bool should_resume = false;
+                if (!was_restarted)
+                    should_resume = m_thread_list.ShouldStop (event_ptr) == false;
+                if (was_restarted || should_resume)
                 {
-                    // ShouldStop may have restarted the target already.  If so, don't
-                    // resume it twice.
-                    bool was_restarted = ProcessEventData::GetRestartedFromEvent (event_ptr);
-                    switch (m_thread_list.ShouldReportStop (event_ptr))
+                    Vote stop_vote = m_thread_list.ShouldReportStop (event_ptr);
+                    if (log)
+                        log->Printf ("Process::ShouldBroadcastEvent: should_stop: %i state: %s was_restarted: %i stop_vote: %d.",
+                                     should_resume,
+                                     StateAsCString(state),
+                                     was_restarted,
+                                     stop_vote);
+                    
+                    switch (stop_vote)
                     {
                         case eVoteYes:
-                            Process::ProcessEventData::SetRestartedInEvent (event_ptr, true);
-                            // Intentional fall-through here.
+                            return_value = true;
+                            break;
                         case eVoteNoOpinion:
                         case eVoteNo:
                             return_value = false;
                             break;
                     }
-
-                    if (log)
-                        log->Printf ("Process::ShouldBroadcastEvent (%p) Restarting process from state: %s", event_ptr, StateAsCString(state));
+                    
                     if (!was_restarted)
+                    {
+                        if (log)
+                            log->Printf ("Process::ShouldBroadcastEvent (%p) Restarting process from state: %s", event_ptr, StateAsCString(state));
+                        ProcessEventData::SetRestartedInEvent(event_ptr, true);
                         PrivateResume ();
+                    }
+                    
                 }
                 else
                 {
@@ -3428,10 +3642,25 @@ Process::ShouldBroadcastEvent (Event *ev
                 }
             }
         }
+        break;
     }
-
+    
+    // We do some coalescing of events (for instance two consecutive running events get coalesced.)
+    // But we only coalesce against events we actually broadcast.  So we use m_last_broadcast_state
+    // to track that.  NB - you can't use "m_public_state.GetValue()" for that purpose, as was originally done,
+    // because the PublicState reflects the last event pulled off the queue, and there may be several
+    // events stacked up on the queue unserviced.  So the PublicState may not reflect the last broadcasted event
+    // yet.  m_last_broadcast_state gets updated here.
+    
+    if (return_value)
+        m_last_broadcast_state = state;
+    
     if (log)
-        log->Printf ("Process::ShouldBroadcastEvent (%p) => %s - %s", event_ptr, StateAsCString(state), return_value ? "YES" : "NO");
+        log->Printf ("Process::ShouldBroadcastEvent (%p) => new state: %s, last broadcast state: %s - %s",
+                     event_ptr,
+                     StateAsCString(state),
+                     StateAsCString(m_last_broadcast_state),
+                     return_value ? "YES" : "NO");
     return return_value;
 }
 
@@ -3439,7 +3668,7 @@ Process::ShouldBroadcastEvent (Event *ev
 bool
 Process::StartPrivateStateThread (bool force)
 {
-    LogSP log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EVENTS));
+    Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EVENTS));
 
     bool already_running = PrivateStateThreadIsValid ();
     if (log)
@@ -3487,16 +3716,16 @@ Process::StopPrivateStateThread ()
         ControlPrivateStateThread (eBroadcastInternalStateControlStop);
     else
     {
-        LogSP log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_PROCESS));
+        Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_PROCESS));
         if (log)
-            printf ("Went to stop the private state thread, but it was already invalid.");
+            log->Printf ("Went to stop the private state thread, but it was already invalid.");
     }
 }
 
 void
 Process::ControlPrivateStateThread (uint32_t signal)
 {
-    LogSP log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_PROCESS));
+    Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_PROCESS));
 
     assert (signal == eBroadcastInternalStateControlStop ||
             signal == eBroadcastInternalStateControlPause ||
@@ -3562,7 +3791,7 @@ Process::SendAsyncInterrupt ()
 void
 Process::HandlePrivateEvent (EventSP &event_sp)
 {
-    LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_PROCESS));
+    Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_PROCESS));
     m_currently_handling_event.SetValue(true, eBroadcastNever);
     
     const StateType new_state = Process::ProcessEventData::GetStateFromEvent(event_sp.get());
@@ -3571,6 +3800,9 @@ Process::HandlePrivateEvent (EventSP &ev
     if (m_next_event_action_ap.get() != NULL)
     {
         NextEventAction::EventActionResult action_result = m_next_event_action_ap->PerformAction(event_sp);
+        if (log)
+            log->Printf ("Ran next event action, result was %d.", action_result);
+        
         switch (action_result)
         {
             case NextEventAction::eEventActionSuccess:
@@ -3650,7 +3882,7 @@ Process::RunPrivateStateThread ()
     bool control_only = true;
     m_private_state_control_wait.SetValue (false, eBroadcastNever);
 
-    LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_PROCESS));
+    Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_PROCESS));
     if (log)
         log->Printf ("Process::%s (arg = %p, pid = %" PRIu64 ") thread starting...", __FUNCTION__, this, GetID());
 
@@ -3725,6 +3957,7 @@ Process::RunPrivateStateThread ()
     if (log)
         log->Printf ("Process::%s (arg = %p, pid = %" PRIu64 ") thread exiting...", __FUNCTION__, this, GetID());
 
+    m_public_run_lock.WriteUnlock();
     m_private_state_control_wait.SetValue (true, eBroadcastAlways);
     m_private_state_thread = LLDB_INVALID_HOST_THREAD;
     return NULL;
@@ -3783,7 +4016,7 @@ Process::ProcessEventData::DoOnRemoval (
     
     if (m_update_state != 1)
         return;
-        
+    
     m_process_sp->SetPublicState (m_state);
         
     // If we're stopped and haven't restarted, then do the breakpoint commands here:
@@ -3816,7 +4049,7 @@ Process::ProcessEventData::DoOnRemoval (
             curr_thread_list = m_process_sp->GetThreadList();
             if (curr_thread_list.GetSize() != num_threads)
             {
-                lldb::LogSP log(lldb_private::GetLogIfAnyCategoriesSet (LIBLLDB_LOG_STEP | LIBLLDB_LOG_PROCESS));
+                Log *log(lldb_private::GetLogIfAnyCategoriesSet (LIBLLDB_LOG_STEP | LIBLLDB_LOG_PROCESS));
                 if (log)
                     log->Printf("Number of threads changed from %u to %u while processing event.", num_threads, curr_thread_list.GetSize());
                 break;
@@ -3826,7 +4059,7 @@ Process::ProcessEventData::DoOnRemoval (
             
             if (thread_sp->GetIndexID() != thread_index_array[idx])
             {
-                lldb::LogSP log(lldb_private::GetLogIfAnyCategoriesSet (LIBLLDB_LOG_STEP | LIBLLDB_LOG_PROCESS));
+                Log *log(lldb_private::GetLogIfAnyCategoriesSet (LIBLLDB_LOG_STEP | LIBLLDB_LOG_PROCESS));
                 if (log)
                     log->Printf("The thread at position %u changed from %u to %u while processing event.", 
                                 idx, 
@@ -3838,27 +4071,36 @@ Process::ProcessEventData::DoOnRemoval (
             StopInfoSP stop_info_sp = thread_sp->GetStopInfo ();
             if (stop_info_sp && stop_info_sp->IsValid())
             {
-                stop_info_sp->PerformAction(event_ptr);
-                // The stop action might restart the target.  If it does, then we want to mark that in the
-                // event so that whoever is receiving it will know to wait for the running event and reflect
-                // that state appropriately.
-                // We also need to stop processing actions, since they aren't expecting the target to be running.
-                
-                // FIXME: we might have run.
-                if (stop_info_sp->HasTargetRunSinceMe())
+                bool this_thread_wants_to_stop;
+                if (stop_info_sp->GetOverrideShouldStop())
                 {
-                    SetRestarted (true);
-                    break;
+                    this_thread_wants_to_stop = stop_info_sp->GetOverriddenShouldStopValue();
+                }
+                else
+                {
+                    stop_info_sp->PerformAction(event_ptr);
+                    // The stop action might restart the target.  If it does, then we want to mark that in the
+                    // event so that whoever is receiving it will know to wait for the running event and reflect
+                    // that state appropriately.
+                    // We also need to stop processing actions, since they aren't expecting the target to be running.
+                    
+                    // FIXME: we might have run.
+                    if (stop_info_sp->HasTargetRunSinceMe())
+                    {
+                        SetRestarted (true);
+                        break;
+                    }
+                    
+                    this_thread_wants_to_stop = stop_info_sp->ShouldStop(event_ptr);
                 }
                 
-                bool this_thread_wants_to_stop = stop_info_sp->ShouldStop(event_ptr);
                 if (still_should_stop == false)
                     still_should_stop = this_thread_wants_to_stop;
             }
         }
 
-        
-        if (m_process_sp->GetPrivateState() != eStateRunning)
+		lldb::StateType state = m_process_sp->GetPrivateState();
+		if (state != eStateRunning && state != eStateCrashed && state != eStateDetached && state != eStateExited)
         {
             if (!still_should_stop)
             {
@@ -3866,7 +4108,7 @@ Process::ProcessEventData::DoOnRemoval (
                 SetRestarted(true);
                 // Use the public resume method here, since this is just
                 // extending a public resume.
-                m_process_sp->Resume();
+                m_process_sp->PrivateResume();
             }
             else
             {
@@ -3877,7 +4119,6 @@ Process::ProcessEventData::DoOnRemoval (
                     SetRestarted(true);
             }
         }
-        
     }
 }
 
@@ -3940,6 +4181,34 @@ Process::ProcessEventData::SetRestartedI
         data->SetRestarted(new_value);
 }
 
+size_t
+Process::ProcessEventData::GetNumRestartedReasons(const Event *event_ptr)
+{
+    ProcessEventData *data = const_cast<ProcessEventData *>(GetEventDataFromEvent (event_ptr));
+    if (data != NULL)
+        return data->GetNumRestartedReasons();
+    else
+        return 0;
+}
+
+const char *
+Process::ProcessEventData::GetRestartedReasonAtIndex(const Event *event_ptr, size_t idx)
+{
+    ProcessEventData *data = const_cast<ProcessEventData *>(GetEventDataFromEvent (event_ptr));
+    if (data != NULL)
+        return data->GetRestartedReasonAtIndex(idx);
+    else
+        return NULL;
+}
+
+void
+Process::ProcessEventData::AddRestartedReason (Event *event_ptr, const char *reason)
+{
+    ProcessEventData *data = const_cast<ProcessEventData *>(GetEventDataFromEvent (event_ptr));
+    if (data != NULL)
+        data->AddRestartedReason(reason);
+}
+
 bool
 Process::ProcessEventData::GetInterruptedFromEvent (const Event *event_ptr)
 {
@@ -4037,7 +4306,7 @@ Process::GetAsyncProfileData (char *buf,
     size_t bytes_available = m_profile_data.front().size();
     if (bytes_available > 0)
     {
-        LogSP log (lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_PROCESS));
+        Log *log (lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_PROCESS));
         if (log)
             log->Printf ("Process::GetProfileData (buf = %p, size = %" PRIu64 ")", buf, (uint64_t)buf_size);
         if (bytes_available > buf_size)
@@ -4067,7 +4336,7 @@ Process::GetSTDOUT (char *buf, size_t bu
     size_t bytes_available = m_stdout_data.size();
     if (bytes_available > 0)
     {
-        LogSP log (lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_PROCESS));
+        Log *log (lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_PROCESS));
         if (log)
             log->Printf ("Process::GetSTDOUT (buf = %p, size = %" PRIu64 ")", buf, (uint64_t)buf_size);
         if (bytes_available > buf_size)
@@ -4093,7 +4362,7 @@ Process::GetSTDERR (char *buf, size_t bu
     size_t bytes_available = m_stderr_data.size();
     if (bytes_available > 0)
     {
-        LogSP log (lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_PROCESS));
+        Log *log (lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_PROCESS));
         if (log)
             log->Printf ("Process::GetSTDERR (buf = %p, size = %" PRIu64 ")", buf, (uint64_t)buf_size);
         if (bytes_available > buf_size)
@@ -4266,7 +4535,8 @@ Process::RunThreadPlan (ExecutionContext
                         lldb::ThreadPlanSP &thread_plan_sp,
                         bool stop_others,
                         bool run_others,
-                        bool discard_on_error,
+                        bool unwind_on_error,
+                        bool ignore_breakpoints,
                         uint32_t timeout_usec,
                         Stream &errors)
 {
@@ -4277,7 +4547,13 @@ Process::RunThreadPlan (ExecutionContext
         errors.Printf("RunThreadPlan called with empty thread plan.");
         return eExecutionSetupError;
     }
-
+    
+    if (!thread_plan_sp->ValidatePlan(NULL))
+    {
+        errors.Printf ("RunThreadPlan called with an invalid thread plan.");
+        return eExecutionSetupError;
+    }
+    
     if (exe_ctx.GetProcessPtr() != this)
     {
         errors.Printf("RunThreadPlan called on wrong process.");
@@ -4306,7 +4582,19 @@ Process::RunThreadPlan (ExecutionContext
     
     // Save the thread & frame from the exe_ctx for restoration after we run
     const uint32_t thread_idx_id = thread->GetIndexID();
-    StackID ctx_frame_id = thread->GetSelectedFrame()->GetStackID();
+    StackFrameSP selected_frame_sp = thread->GetSelectedFrame();
+    if (!selected_frame_sp)
+    {
+        thread->SetSelectedFrame(0);
+        selected_frame_sp = thread->GetSelectedFrame();
+        if (!selected_frame_sp)
+        {
+            errors.Printf("RunThreadPlan called without a selected frame on thread %d", thread_idx_id);
+            return eExecutionSetupError;
+        }
+    }
+    
+    StackID ctx_frame_id = selected_frame_sp->GetStackID();
 
     // N.B. Running the target may unset the currently selected thread and frame.  We don't want to do that either, 
     // so we should arrange to reset them as well.
@@ -4329,7 +4617,7 @@ Process::RunThreadPlan (ExecutionContext
     lldb::StateType old_state;
     lldb::ThreadPlanSP stopper_base_plan_sp;
     
-    lldb::LogSP log(lldb_private::GetLogIfAnyCategoriesSet (LIBLLDB_LOG_STEP | LIBLLDB_LOG_PROCESS));
+    Log *log(lldb_private::GetLogIfAnyCategoriesSet (LIBLLDB_LOG_STEP | LIBLLDB_LOG_PROCESS));
     if (Host::GetCurrentThread() == m_private_state_thread)
     {
         // Yikes, we are running on the private state thread!  So we can't wait for public events on this thread, since
@@ -4390,11 +4678,38 @@ Process::RunThreadPlan (ExecutionContext
         TimeValue* timeout_ptr = NULL;
         TimeValue real_timeout;
         
-        bool first_timeout = true;
+        bool before_first_timeout = true;  // This is set to false the first time that we have to halt the target.
         bool do_resume = true;
+        bool handle_running_event = true;
         const uint64_t default_one_thread_timeout_usec = 250000;
-        uint64_t computed_timeout = 0;
         
+        // This is just for accounting:
+        uint32_t num_resumes = 0;
+        
+        TimeValue one_thread_timeout = TimeValue::Now();
+        TimeValue final_timeout = one_thread_timeout;
+        
+        if (run_others)
+        {
+            // If we are running all threads then we take half the time to run all threads, bounded by
+            // .25 sec.
+            if (timeout_usec == 0)
+                one_thread_timeout.OffsetWithMicroSeconds(default_one_thread_timeout_usec);
+            else
+            {
+                uint64_t computed_timeout = computed_timeout = timeout_usec / 2;
+                if (computed_timeout > default_one_thread_timeout_usec)
+                    computed_timeout = default_one_thread_timeout_usec;
+                one_thread_timeout.OffsetWithMicroSeconds(computed_timeout);
+            }
+            final_timeout.OffsetWithMicroSeconds (timeout_usec);
+        }
+        else
+        {
+            if (timeout_usec != 0)
+                final_timeout.OffsetWithMicroSeconds(timeout_usec);
+        }
+
         // This while loop must exit out the bottom, there's cleanup that we need to do when we are done.
         // So don't call return anywhere within it.
         
@@ -4403,42 +4718,71 @@ Process::RunThreadPlan (ExecutionContext
             // We usually want to resume the process if we get to the top of the loop.
             // The only exception is if we get two running events with no intervening
             // stop, which can happen, we will just wait for then next stop event.
+            if (log)
+                log->Printf ("Top of while loop: do_resume: %i handle_running_event: %i before_first_timeout: %i.",
+                             do_resume,
+                             handle_running_event,
+                             before_first_timeout);
             
-            if (do_resume)
+            if (do_resume || handle_running_event)
             {
                 // Do the initial resume and wait for the running event before going further.
         
-                Error resume_error = PrivateResume ();
-                if (!resume_error.Success())
+                if (do_resume)
                 {
-                    errors.Printf("Error resuming inferior: \"%s\".\n", resume_error.AsCString());
-                    return_value = eExecutionSetupError;
-                    break;
+                    num_resumes++;
+                    Error resume_error = PrivateResume ();
+                    if (!resume_error.Success())
+                    {
+                        errors.Printf("Error resuming inferior the %d time: \"%s\".\n",
+                                      num_resumes,
+                                      resume_error.AsCString());
+                        return_value = eExecutionSetupError;
+                        break;
+                    }
                 }
-        
-                real_timeout = TimeValue::Now();
-                real_timeout.OffsetWithMicroSeconds(500000);
-                timeout_ptr = &real_timeout;
                 
-                got_event = listener.WaitForEvent(timeout_ptr, event_sp);
+                TimeValue resume_timeout = TimeValue::Now();
+                resume_timeout.OffsetWithMicroSeconds(500000);
+                
+                got_event = listener.WaitForEvent(&resume_timeout, event_sp);
                 if (!got_event)
                 {
                     if (log)
-                        log->PutCString("Process::RunThreadPlan(): didn't get any event after initial resume, exiting.");
+                        log->Printf ("Process::RunThreadPlan(): didn't get any event after resume %d, exiting.",
+                                        num_resumes);
 
-                    errors.Printf("Didn't get any event after initial resume, exiting.");
+                    errors.Printf("Didn't get any event after resume %d, exiting.", num_resumes);
                     return_value = eExecutionSetupError;
                     break;
                 }
                 
                 stop_state = Process::ProcessEventData::GetStateFromEvent(event_sp.get());
+
                 if (stop_state != eStateRunning)
                 {
-                    if (log)
-                        log->Printf("Process::RunThreadPlan(): didn't get running event after "
-                                    "initial resume, got %s instead.",
-                                    StateAsCString(stop_state));
-
+                    bool restarted = false;
+                    
+                    if (stop_state == eStateStopped)
+                    {
+                        restarted = Process::ProcessEventData::GetRestartedFromEvent(event_sp.get());
+                        if (log)
+                            log->Printf("Process::RunThreadPlan(): didn't get running event after "
+                                        "resume %d, got %s instead (restarted: %i, do_resume: %i, handle_running_event: %i).",
+                                        num_resumes,
+                                        StateAsCString(stop_state),
+                                        restarted,
+                                        do_resume,
+                                        handle_running_event);
+                    }
+                    
+                    if (restarted)
+                    {
+                        // This is probably an overabundance of caution, I don't think I should ever get a stopped & restarted
+                        // event here.  But if I do, the best thing is to Halt and then get out of here.
+                        Halt();
+                    }
+                    
                     errors.Printf("Didn't get running event after initial resume, got %s instead.",
                                   StateAsCString(stop_state));
                     return_value = eExecutionSetupError;
@@ -4452,54 +4796,35 @@ Process::RunThreadPlan (ExecutionContext
                 // won't be able to gather the result at this point.
                 // We set the timeout AFTER the resume, since the resume takes some time and we
                 // don't want to charge that to the timeout.
-                
-                if (first_timeout)
-                {
-                    if (run_others)
-                    {
-                        // If we are running all threads then we take half the time to run all threads, bounded by
-                        // .25 sec.
-                        if (timeout_usec == 0)
-                            computed_timeout = default_one_thread_timeout_usec;
-                        else
-                        {
-                            computed_timeout = timeout_usec / 2;
-                            if (computed_timeout > default_one_thread_timeout_usec)
-                            {
-                                computed_timeout = default_one_thread_timeout_usec;
-                            }
-                            timeout_usec -= computed_timeout;
-                        }
-                    }
-                    else
-                    {
-                        computed_timeout = timeout_usec;
-                    }
-                }
-                else
-                {
-                    computed_timeout = timeout_usec;
-                }
-                
-                if (computed_timeout != 0)
-                {
-                    // we have a > 0 timeout, let us set it so that we stop after the deadline
-                    real_timeout = TimeValue::Now();
-                    real_timeout.OffsetWithMicroSeconds(computed_timeout);
+            }
+            else
+            {
+                if (log)
+                    log->PutCString ("Process::RunThreadPlan(): waiting for next event.");
+            }
                         
-                    timeout_ptr = &real_timeout;
-                }
+            if (before_first_timeout)
+            {
+                if (run_others)
+                    timeout_ptr = &one_thread_timeout;
                 else
                 {
-                    timeout_ptr = NULL;
+                    if (timeout_usec == 0)
+                        timeout_ptr = NULL;
+                    else
+                        timeout_ptr = &final_timeout;
                 }
             }
             else
             {
-                if (log)
-                    log->PutCString ("Process::RunThreadPlan(): handled an extra running event.");
-                do_resume = true;
+                if (timeout_usec == 0)
+                    timeout_ptr = NULL;
+                else
+                    timeout_ptr = &final_timeout;
             }
+        
+            do_resume = true;
+            handle_running_event = true;
             
             // Now wait for the process to stop again:
             event_sp.reset();
@@ -4508,12 +4833,9 @@ Process::RunThreadPlan (ExecutionContext
             {
                 if (timeout_ptr)
                 {
-                    StreamString s;
-                    s.Printf ("about to wait - timeout is:\n   ");
-                    timeout_ptr->Dump (&s, 120);
-                    s.Printf ("\nNow is:\n    ");
-                    TimeValue::Now().Dump (&s, 120);
-                    log->Printf ("Process::RunThreadPlan(): %s", s.GetData());
+                    log->Printf ("Process::RunThreadPlan(): about to wait - now is %" PRIu64 " - endpoint is %" PRIu64,
+                                 TimeValue::Now().GetAsMicroSecondsSinceJan1_1970(),
+                                 timeout_ptr->GetAsMicroSecondsSinceJan1_1970());
                 }
                 else
                 {
@@ -4531,11 +4853,11 @@ Process::RunThreadPlan (ExecutionContext
                     if (event_sp->GetType() == eBroadcastBitInterrupt)
                     {
                         Halt();
-                        keep_going = false;
                         return_value = eExecutionInterrupted;
                         errors.Printf ("Execution halted by user interrupt.");
                         if (log)
                             log->Printf ("Process::RunThreadPlan(): Got  interrupted by eBroadcastBitInterrupted, exiting.");
+                        break;
                     }
                     else
                     {
@@ -4547,7 +4869,7 @@ Process::RunThreadPlan (ExecutionContext
                         {
                         case lldb::eStateStopped:
                             {
-                                // Yay, we're done.  Now make sure that our thread plan actually completed.
+                                // We stopped, figure out what we are going to do now.
                                 ThreadSP thread_sp = GetThreadList().FindThreadByIndexID (thread_idx_id);
                                 if (!thread_sp)
                                 {
@@ -4558,40 +4880,66 @@ Process::RunThreadPlan (ExecutionContext
                                 }
                                 else
                                 {
-                                    StopInfoSP stop_info_sp (thread_sp->GetStopInfo ());
-                                    StopReason stop_reason = eStopReasonInvalid;
-                                    if (stop_info_sp)
-                                         stop_reason = stop_info_sp->GetStopReason();
-                                    if (stop_reason == eStopReasonPlanComplete)
+                                    // If we were restarted, we just need to go back up to fetch another event.
+                                    if (Process::ProcessEventData::GetRestartedFromEvent(event_sp.get()))
                                     {
                                         if (log)
-                                            log->PutCString ("Process::RunThreadPlan(): execution completed successfully.");
-                                        // Now mark this plan as private so it doesn't get reported as the stop reason
-                                        // after this point.  
-                                        if (thread_plan_sp)
-                                            thread_plan_sp->SetPrivate (orig_plan_private);
-                                        return_value = eExecutionCompleted;
+                                        {
+                                            log->Printf ("Process::RunThreadPlan(): Got a stop and restart, so we'll continue waiting.");
+                                        }
+                                       keep_going = true;
+                                       do_resume = false;
+                                       handle_running_event = true;
+                                       
                                     }
                                     else
                                     {
-                                        if (log)
-                                            log->PutCString ("Process::RunThreadPlan(): thread plan didn't successfully complete.");
-
-                                        return_value = eExecutionInterrupted;
+                                    
+                                        StopInfoSP stop_info_sp (thread_sp->GetStopInfo ());
+                                        StopReason stop_reason = eStopReasonInvalid;
+                                        if (stop_info_sp)
+                                             stop_reason = stop_info_sp->GetStopReason();
+                                        
+                                        
+                                        // FIXME: We only check if the stop reason is plan complete, should we make sure that
+                                        // it is OUR plan that is complete?
+                                        if (stop_reason == eStopReasonPlanComplete)
+                                        {
+                                            if (log)
+                                                log->PutCString ("Process::RunThreadPlan(): execution completed successfully.");
+                                            // Now mark this plan as private so it doesn't get reported as the stop reason
+                                            // after this point.  
+                                            if (thread_plan_sp)
+                                                thread_plan_sp->SetPrivate (orig_plan_private);
+                                            return_value = eExecutionCompleted;
+                                        }
+                                        else
+                                        {
+                                            // Something restarted the target, so just wait for it to stop for real.
+                                            if (stop_reason == eStopReasonBreakpoint)
+                                            {
+                                                if (log)
+                                                    log->Printf ("Process::RunThreadPlan() stopped for breakpoint: %s.", stop_info_sp->GetDescription());
+                                                return_value = eExecutionHitBreakpoint;
+                                            }
+                                            else
+                                            {
+                                                if (log)
+                                                    log->PutCString ("Process::RunThreadPlan(): thread plan didn't successfully complete.");
+                                                return_value = eExecutionInterrupted;
+                                            }
+                                        }
                                     }
                                 }
                             }        
                             break;
 
-                        case lldb::eStateCrashed:
-                            if (log)
-                                log->PutCString ("Process::RunThreadPlan(): execution crashed.");
-                            return_value = eExecutionInterrupted;
-                            break;
-
                         case lldb::eStateRunning:
+                            // This shouldn't really happen, but sometimes we do get two running events without an
+                            // intervening stop, and in that case we should just go back to waiting for the stop.
                             do_resume = false;
                             keep_going = true;
+                            handle_running_event = false;
                             break;
 
                         default:
@@ -4625,15 +4973,15 @@ Process::RunThreadPlan (ExecutionContext
                 // If we didn't get an event that means we've timed out...
                 // We will interrupt the process here.  Depending on what we were asked to do we will
                 // either exit, or try with all threads running for the same timeout.
-                // Not really sure what to do if Halt fails here...
                 
                 if (log) {
                     if (run_others)
                     {
-                        if (first_timeout)
-                            log->Printf ("Process::RunThreadPlan(): Running function with timeout: %" PRId64 " timed out, "
-                                         "trying  for %d usec with all threads enabled.",
-                                         computed_timeout, timeout_usec);
+                        uint64_t remaining_time = final_timeout - TimeValue::Now();
+                        if (before_first_timeout)
+                            log->Printf ("Process::RunThreadPlan(): Running function with one thread timeout timed out, "
+                                         "running till  for %" PRId64 " usec with all threads enabled.",
+                                         remaining_time);
                         else
                             log->Printf ("Process::RunThreadPlan(): Restarting function with all threads enabled "
                                          "and timeout: %d timed out, abandoning execution.",
@@ -4645,150 +4993,123 @@ Process::RunThreadPlan (ExecutionContext
                                      timeout_usec);
                 }
                 
-                Error halt_error = Halt();
-                if (halt_error.Success())
-                {
-                    if (log)
-                        log->PutCString ("Process::RunThreadPlan(): Halt succeeded.");
-                        
-                    // If halt succeeds, it always produces a stopped event.  Wait for that:
-                    
-                    real_timeout = TimeValue::Now();
-                    real_timeout.OffsetWithMicroSeconds(500000);
-
-                    got_event = listener.WaitForEvent(&real_timeout, event_sp);
-                    
-                    if (got_event)
-                    {
-                        stop_state = Process::ProcessEventData::GetStateFromEvent(event_sp.get());
-                        if (log)
-                        {
-                            log->Printf ("Process::RunThreadPlan(): Stopped with event: %s", StateAsCString(stop_state));
-                            if (stop_state == lldb::eStateStopped 
-                                && Process::ProcessEventData::GetInterruptedFromEvent(event_sp.get()))
-                                log->PutCString ("    Event was the Halt interruption event.");
-                        }
-                        
-                        if (stop_state == lldb::eStateStopped)
-                        {
-                            // Between the time we initiated the Halt and the time we delivered it, the process could have
-                            // already finished its job.  Check that here:
-                            
-                            if (thread->IsThreadPlanDone (thread_plan_sp.get()))
-                            {
-                                if (log)
-                                    log->PutCString ("Process::RunThreadPlan(): Even though we timed out, the call plan was done.  "
-                                                 "Exiting wait loop.");
-                                return_value = eExecutionCompleted;
-                                break;
-                            }
-
-                            if (!run_others)
-                            {
-                                if (log)
-                                    log->PutCString ("Process::RunThreadPlan(): try_all_threads was false, we stopped so now we're quitting.");
-                                return_value = eExecutionInterrupted;
-                                break;
-                            }
-                            
-                            if (first_timeout)
-                            {
-                                // Set all the other threads to run, and return to the top of the loop, which will continue;
-                                first_timeout = false;
-                                thread_plan_sp->SetStopOthers (false);
-                                if (log)
-                                    log->PutCString ("Process::RunThreadPlan(): about to resume.");
-
-                                continue;
-                            }
-                            else
-                            {
-                                // Running all threads failed, so return Interrupted.
-                                if (log)
-                                    log->PutCString("Process::RunThreadPlan(): running all threads timed out.");
-                                return_value = eExecutionInterrupted;
-                                break;
-                            }
-                        }
-                    }
-                    else
-                    {   if (log)
-                            log->PutCString("Process::RunThreadPlan(): halt said it succeeded, but I got no event.  "
-                                    "I'm getting out of here passing Interrupted.");
-                        return_value = eExecutionInterrupted;
-                        break;
-                    }
-                }
-                else
+                // It is possible that between the time we issued the Halt, and we get around to calling Halt the target
+                // could have stopped.  That's fine, Halt will figure that out and send the appropriate Stopped event.
+                // BUT it is also possible that we stopped & restarted (e.g. hit a signal with "stop" set to false.)  In
+                // that case, we'll get the stopped & restarted event, and we should go back to waiting for the Halt's
+                // stopped event.  That's what this while loop does.
+                
+                bool back_to_top = true;
+                uint32_t try_halt_again = 0;
+                bool do_halt = true;
+                const uint32_t num_retries = 5;
+                while (try_halt_again < num_retries)
                 {
-                    // This branch is to work around some problems with gdb-remote's Halt.  It is a little racy, and can return 
-                    // an error from halt, but if you wait a bit you'll get a stopped event anyway.
-                    if (log)
-                        log->Printf ("Process::RunThreadPlan(): halt failed: error = \"%s\", I'm just going to wait a little longer and see if I get a stopped event.", 
-                                     halt_error.AsCString());                
-                    real_timeout = TimeValue::Now();
-                    real_timeout.OffsetWithMicroSeconds(500000);
-                    timeout_ptr = &real_timeout;
-                    got_event = listener.WaitForEvent(&real_timeout, event_sp);
-                    if (!got_event || event_sp.get() == NULL)
+                    Error halt_error;
+                    if (do_halt)
                     {
-                        // This is not going anywhere, bag out.
                         if (log)
-                            log->PutCString ("Process::RunThreadPlan(): halt failed: and waiting for the stopped event failed.");
-                        return_value = eExecutionInterrupted;
-                        break;                
+                            log->Printf ("Process::RunThreadPlan(): Running Halt.");
+                        halt_error = Halt();
                     }
-                    else
+                    if (halt_error.Success())
                     {
-                        stop_state = Process::ProcessEventData::GetStateFromEvent(event_sp.get());
                         if (log)
-                            log->PutCString ("Process::RunThreadPlan(): halt failed: but then I got a stopped event.  Whatever...");
-                        if (stop_state == lldb::eStateStopped)
-                        {
-                            // Between the time we initiated the Halt and the time we delivered it, the process could have
-                            // already finished its job.  Check that here:
+                            log->PutCString ("Process::RunThreadPlan(): Halt succeeded.");
                             
-                            if (thread->IsThreadPlanDone (thread_plan_sp.get()))
-                            {
-                                if (log)
-                                    log->PutCString ("Process::RunThreadPlan(): Even though we timed out, the call plan was done.  "
-                                                 "Exiting wait loop.");
-                                return_value = eExecutionCompleted;
-                                break;
-                            }
+                        real_timeout = TimeValue::Now();
+                        real_timeout.OffsetWithMicroSeconds(500000);
 
-                            if (first_timeout)
+                        got_event = listener.WaitForEvent(&real_timeout, event_sp);
+                        
+                        if (got_event)
+                        {
+                            stop_state = Process::ProcessEventData::GetStateFromEvent(event_sp.get());
+                            if (log)
                             {
-                                // Set all the other threads to run, and return to the top of the loop, which will continue;
-                                first_timeout = false;
-                                thread_plan_sp->SetStopOthers (false);
-                                if (log)
-                                    log->PutCString ("Process::RunThreadPlan(): About to resume.");
-
-                                continue;
+                                log->Printf ("Process::RunThreadPlan(): Stopped with event: %s", StateAsCString(stop_state));
+                                if (stop_state == lldb::eStateStopped 
+                                    && Process::ProcessEventData::GetInterruptedFromEvent(event_sp.get()))
+                                    log->PutCString ("    Event was the Halt interruption event.");
                             }
-                            else
+                            
+                            if (stop_state == lldb::eStateStopped)
                             {
-                                // Running all threads failed, so return Interrupted.
-                                if (log)
-                                    log->PutCString ("Process::RunThreadPlan(): running all threads timed out.");
-                                return_value = eExecutionInterrupted;
-                                break;
+                                // Between the time we initiated the Halt and the time we delivered it, the process could have
+                                // already finished its job.  Check that here:
+                                
+                                if (thread->IsThreadPlanDone (thread_plan_sp.get()))
+                                {
+                                    if (log)
+                                        log->PutCString ("Process::RunThreadPlan(): Even though we timed out, the call plan was done.  "
+                                                     "Exiting wait loop.");
+                                    return_value = eExecutionCompleted;
+                                    back_to_top = false;
+                                    break;
+                                }
+                                
+                                if (Process::ProcessEventData::GetRestartedFromEvent(event_sp.get()))
+                                {
+                                    if (log)
+                                        log->PutCString ("Process::RunThreadPlan(): Went to halt but got a restarted event, there must be an un-restarted stopped event so try again...  "
+                                                     "Exiting wait loop.");
+                                    try_halt_again++;
+                                    do_halt = false;
+                                    continue;
+                                }
+
+                                if (!run_others)
+                                {
+                                    if (log)
+                                        log->PutCString ("Process::RunThreadPlan(): try_all_threads was false, we stopped so now we're quitting.");
+                                    return_value = eExecutionInterrupted;
+                                    back_to_top = false;
+                                    break;
+                                }
+                                
+                                if (before_first_timeout)
+                                {
+                                    // Set all the other threads to run, and return to the top of the loop, which will continue;
+                                    before_first_timeout = false;
+                                    thread_plan_sp->SetStopOthers (false);
+                                    if (log)
+                                        log->PutCString ("Process::RunThreadPlan(): about to resume.");
+
+                                    back_to_top = true;
+                                    break;
+                                }
+                                else
+                                {
+                                    // Running all threads failed, so return Interrupted.
+                                    if (log)
+                                        log->PutCString("Process::RunThreadPlan(): running all threads timed out.");
+                                    return_value = eExecutionInterrupted;
+                                    back_to_top = false;
+                                    break;
+                                }
                             }
                         }
                         else
-                        {
-                            if (log)
-                                log->Printf ("Process::RunThreadPlan(): halt failed, I waited and didn't get"
-                                             " a stopped event, instead got %s.", StateAsCString(stop_state));
+                        {   if (log)
+                                log->PutCString("Process::RunThreadPlan(): halt said it succeeded, but I got no event.  "
+                                        "I'm getting out of here passing Interrupted.");
                             return_value = eExecutionInterrupted;
-                            break;                
+                            back_to_top = false;
+                            break;
                         }
                     }
+                    else
+                    {
+                        try_halt_again++;
+                        continue;
+                    }
                 }
-
+                
+                if (!back_to_top || try_halt_again > num_retries)
+                    break;
+                else
+                    continue;
             }
-            
         }  // END WAIT LOOP
         
         // If we had to start up a temporary private state thread to run this thread plan, shut it down now.
@@ -4805,15 +5126,22 @@ Process::RunThreadPlan (ExecutionContext
 
         }
         
-        // Restore the thread state if we are going to discard the plan execution.
+        // Restore the thread state if we are going to discard the plan execution.  There are three cases where this
+        // could happen:
+        // 1) The execution successfully completed
+        // 2) We hit a breakpoint, and ignore_breakpoints was true
+        // 3) We got some other error, and discard_on_error was true
+        bool should_unwind = (return_value == eExecutionInterrupted && unwind_on_error)
+                             || (return_value == eExecutionHitBreakpoint && ignore_breakpoints);
         
-        if (return_value == eExecutionCompleted || discard_on_error)
+        if (return_value == eExecutionCompleted
+            || should_unwind)
         {
             thread_plan_sp->RestoreThreadState();
         }
         
         // Now do some processing on the results of the run:
-        if (return_value == eExecutionInterrupted)
+        if (return_value == eExecutionInterrupted || return_value == eExecutionHitBreakpoint)
         {
             if (log)
             {
@@ -4906,7 +5234,7 @@ Process::RunThreadPlan (ExecutionContext
                     log->Printf("Process::RunThreadPlan(): execution interrupted: %s", s.GetData());
             }
             
-            if (discard_on_error && thread_plan_sp)
+            if (should_unwind && thread_plan_sp)
             {
                 if (log)
                     log->Printf ("Process::RunThreadPlan: ExecutionInterrupted - discarding thread plans up to %p.", thread_plan_sp.get());
@@ -4924,7 +5252,7 @@ Process::RunThreadPlan (ExecutionContext
             if (log)
                 log->PutCString("Process::RunThreadPlan(): execution set up error.");
                 
-            if (discard_on_error && thread_plan_sp)
+            if (unwind_on_error && thread_plan_sp)
             {
                 thread->DiscardThreadPlansUpToPlan (thread_plan_sp);
                 thread_plan_sp->SetPrivate (orig_plan_private);
@@ -4948,10 +5276,10 @@ Process::RunThreadPlan (ExecutionContext
             {
                 if (log)
                     log->PutCString("Process::RunThreadPlan(): thread plan stopped in mid course");
-                if (discard_on_error && thread_plan_sp)
+                if (unwind_on_error && thread_plan_sp)
                 {
                     if (log)
-                        log->PutCString("Process::RunThreadPlan(): discarding thread plan 'cause discard_on_error is set.");
+                        log->PutCString("Process::RunThreadPlan(): discarding thread plan 'cause unwind_on_error is set.");
                     thread->DiscardThreadPlansUpToPlan (thread_plan_sp);
                     thread_plan_sp->SetPrivate (orig_plan_private);
                 }
@@ -5010,6 +5338,9 @@ Process::ExecutionResultAsCString (Execu
         case eExecutionInterrupted:
             result_name = "eExecutionInterrupted";
             break;
+        case eExecutionHitBreakpoint:
+            result_name = "eExecutionHitBreakpoint";
+            break;
         case eExecutionSetupError:
             result_name = "eExecutionSetupError";
             break;

Modified: lldb/branches/windows/source/Target/SectionLoadList.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Target/SectionLoadList.cpp?rev=179679&r1=179678&r2=179679&view=diff
==============================================================================
--- lldb/branches/windows/source/Target/SectionLoadList.cpp (original)
+++ lldb/branches/windows/source/Target/SectionLoadList.cpp Wed Apr 17 03:38:48 2013
@@ -59,7 +59,7 @@ SectionLoadList::GetSectionLoadAddress (
 bool
 SectionLoadList::SetSectionLoadAddress (const lldb::SectionSP &section, addr_t load_addr, bool warn_multiple)
 {
-    LogSP log(lldb_private::GetLogIfAnyCategoriesSet (LIBLLDB_LOG_DYNAMIC_LOADER | LIBLLDB_LOG_VERBOSE));
+    Log *log(lldb_private::GetLogIfAnyCategoriesSet (LIBLLDB_LOG_DYNAMIC_LOADER | LIBLLDB_LOG_VERBOSE));
 
     if (log)
     {
@@ -136,7 +136,7 @@ SectionLoadList::SetSectionUnloaded (con
 
     if (section_sp)
     {
-        LogSP log(lldb_private::GetLogIfAnyCategoriesSet (LIBLLDB_LOG_DYNAMIC_LOADER | LIBLLDB_LOG_VERBOSE));
+        Log *log(lldb_private::GetLogIfAnyCategoriesSet (LIBLLDB_LOG_DYNAMIC_LOADER | LIBLLDB_LOG_VERBOSE));
 
         if (log)
         {
@@ -155,6 +155,7 @@ SectionLoadList::SetSectionUnloaded (con
         sect_to_addr_collection::iterator sta_pos = m_sect_to_addr.find(section_sp.get());
         if (sta_pos != m_sect_to_addr.end())
         {
+            ++unload_count;
             addr_t load_addr = sta_pos->second;
             m_sect_to_addr.erase (sta_pos);
 
@@ -169,7 +170,7 @@ SectionLoadList::SetSectionUnloaded (con
 bool
 SectionLoadList::SetSectionUnloaded (const lldb::SectionSP &section_sp, addr_t load_addr)
 {
-    LogSP log(lldb_private::GetLogIfAnyCategoriesSet (LIBLLDB_LOG_DYNAMIC_LOADER | LIBLLDB_LOG_VERBOSE));
+    Log *log(lldb_private::GetLogIfAnyCategoriesSet (LIBLLDB_LOG_DYNAMIC_LOADER | LIBLLDB_LOG_VERBOSE));
 
     if (log)
     {
@@ -215,9 +216,10 @@ SectionLoadList::ResolveLoadAddress (add
         {
             if (load_addr != pos->first && pos != m_addr_to_sect.begin())
                 --pos;
-            if (load_addr >= pos->first)
+            const addr_t pos_load_addr = pos->first;
+            if (load_addr >= pos_load_addr)
             {
-                addr_t offset = load_addr - pos->first;
+                addr_t offset = load_addr - pos_load_addr;
                 if (offset < pos->second->GetByteSize())
                 {
                     // We have found the top level section, now we need to find the

Modified: lldb/branches/windows/source/Target/StackFrame.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Target/StackFrame.cpp?rev=179679&r1=179678&r2=179679&view=diff
==============================================================================
--- lldb/branches/windows/source/Target/StackFrame.cpp (original)
+++ lldb/branches/windows/source/Target/StackFrame.cpp Wed Apr 17 03:38:48 2013
@@ -250,7 +250,7 @@ void
 StackFrame::ChangePC (addr_t pc)
 {
     m_frame_code_addr.SetRawAddress(pc);
-    m_sc.Clear();
+    m_sc.Clear(false);
     m_flags.Reset(0);
     ThreadSP thread_sp (GetThread());
     if (thread_sp)
@@ -266,9 +266,12 @@ StackFrame::Disassemble ()
         Target *target = exe_ctx.GetTargetPtr();
         if (target)
         {
+            const char *plugin_name = NULL;
+            const char *flavor = NULL;
             Disassembler::Disassemble (target->GetDebugger(),
                                        target->GetArchitecture(),
-                                       NULL,
+                                       plugin_name,
+                                       flavor,
                                        exe_ctx,
                                        0,
                                        0,
@@ -452,7 +455,9 @@ StackFrame::GetSymbolContext (uint32_t r
             // function, block, line entry or symbol, so we can safely call
             // ResolveSymbolContextForAddress with our symbol context member m_sc.
             if (m_sc.target_sp)
+            {
                 resolved |= m_sc.target_sp->GetImages().ResolveSymbolContextForAddress (lookup_addr, resolve_scope, m_sc);
+            }
         }
 
         // Update our internal flags so we remember what we have tried to locate so
@@ -1424,9 +1429,12 @@ StackFrame::GetStatus (Stream& strm,
                         AddressRange pc_range;
                         pc_range.GetBaseAddress() = GetFrameCodeAddress();
                         pc_range.SetByteSize(disasm_lines * target_arch.GetMaximumOpcodeByteSize());
+                        const char *plugin_name = NULL;
+                        const char *flavor = NULL;
                         Disassembler::Disassemble (target->GetDebugger(),
                                                    target_arch,
-                                                   NULL,
+                                                   plugin_name,
+                                                   flavor,
                                                    exe_ctx,
                                                    pc_range,
                                                    disasm_lines,

Modified: lldb/branches/windows/source/Target/StackFrameList.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Target/StackFrameList.cpp?rev=179679&r1=179678&r2=179679&view=diff
==============================================================================
--- lldb/branches/windows/source/Target/StackFrameList.cpp (original)
+++ lldb/branches/windows/source/Target/StackFrameList.cpp Wed Apr 17 03:38:48 2013
@@ -65,6 +65,9 @@ StackFrameList::StackFrameList
 //----------------------------------------------------------------------
 StackFrameList::~StackFrameList()
 {
+    // Call clear since this takes a lock and clears the stack frame list
+    // in case another thread is currently using this stack frame list
+    Clear();
 }
 
 void
@@ -87,7 +90,7 @@ StackFrameList::GetCurrentInlinedDepth (
         {
             m_current_inlined_pc = LLDB_INVALID_ADDRESS;
             m_current_inlined_depth = UINT32_MAX;
-            LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP));
+            Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP));
             if (log && log->GetVerbose())
                 log->Printf ("GetCurrentInlinedDepth: invalidating current inlined depth.\n");
         }
@@ -109,7 +112,7 @@ StackFrameList::ResetCurrentInlinedDepth
         {
             m_current_inlined_depth = UINT32_MAX;
             m_current_inlined_pc = LLDB_INVALID_ADDRESS;
-            LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP));
+            Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP));
             if (log && log->GetVerbose())
                 log->Printf ("ResetCurrentInlinedDepth: Invalidating current inlined depth.\n");
         }
@@ -204,7 +207,7 @@ StackFrameList::ResetCurrentInlinedDepth
                                     }
                                     m_current_inlined_pc = curr_pc;
                                     m_current_inlined_depth = num_inlined_functions + 1;
-                                    LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP));
+                                    Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP));
                                     if (log && log->GetVerbose())
                                         log->Printf ("ResetCurrentInlinedDepth: setting inlined depth: %d 0x%" PRIx64 ".\n", m_current_inlined_depth, curr_pc);
                                     
@@ -250,6 +253,10 @@ StackFrameList::SetCurrentInlinedDepth (
 void
 StackFrameList::GetFramesUpTo(uint32_t end_idx)
 {
+    // this makes sure we do not fetch frames for an invalid thread
+    if (m_thread.IsValid() == false)
+        return;
+
     // We've already gotten more frames than asked for, or we've already finished unwinding, return.
     if (m_frames.size() > end_idx || GetAllFramesFetched())
         return;
@@ -289,27 +296,30 @@ StackFrameList::GetFramesUpTo(uint32_t e
                 // if we need to
                 if (m_frames.empty())
                 {
-                    m_thread.GetRegisterContext();
-                    assert (m_thread.m_reg_context_sp.get());
-
-                    const bool success = unwinder->GetFrameInfoAtIndex(idx, cfa, pc);
-                    // There shouldn't be any way not to get the frame info for frame 0.
-                    // But if the unwinder can't make one, lets make one by hand with the
-                    // SP as the CFA and see if that gets any further.
-                    if (!success)
+                    RegisterContextSP reg_ctx_sp (m_thread.GetRegisterContext());
+                    
+                    if (reg_ctx_sp)
                     {
-                        cfa = m_thread.GetRegisterContext()->GetSP();
-                        pc = m_thread.GetRegisterContext()->GetPC();
+
+                        const bool success = unwinder->GetFrameInfoAtIndex(idx, cfa, pc);
+                        // There shouldn't be any way not to get the frame info for frame 0.
+                        // But if the unwinder can't make one, lets make one by hand with the
+                        // SP as the CFA and see if that gets any further.
+                        if (!success)
+                        {
+                            cfa = reg_ctx_sp->GetSP();
+                            pc = reg_ctx_sp->GetPC();
+                        }
+                        
+                        unwind_frame_sp.reset (new StackFrame (m_thread.shared_from_this(),
+                                                               m_frames.size(), 
+                                                               idx,
+                                                               reg_ctx_sp,
+                                                               cfa,
+                                                               pc,
+                                                               NULL));
+                        m_frames.push_back (unwind_frame_sp);
                     }
-                    
-                    unwind_frame_sp.reset (new StackFrame (m_thread.shared_from_this(),
-                                                           m_frames.size(), 
-                                                           idx,
-                                                           m_thread.m_reg_context_sp,
-                                                           cfa,
-                                                           pc,
-                                                           NULL));
-                    m_frames.push_back (unwind_frame_sp);
                 }
                 else
                 {
@@ -493,6 +503,8 @@ StackFrameList::GetFrameAtIndex (uint32_
 {
     StackFrameSP frame_sp;
     Mutex::Locker locker (m_mutex);
+    uint32_t original_idx = idx;
+    
     uint32_t inlined_depth = GetCurrentInlinedDepth();
     if (inlined_depth != UINT32_MAX)
         idx += inlined_depth;
@@ -503,44 +515,63 @@ StackFrameList::GetFrameAtIndex (uint32_
     if (frame_sp)
         return frame_sp;
         
-        // GetFramesUpTo will fill m_frames with as many frames as you asked for,
-        // if there are that many.  If there weren't then you asked for too many
-        // frames.
-        GetFramesUpTo (idx);
-        if (idx < m_frames.size())
+    // GetFramesUpTo will fill m_frames with as many frames as you asked for,
+    // if there are that many.  If there weren't then you asked for too many
+    // frames.
+    GetFramesUpTo (idx);
+    if (idx < m_frames.size())
+    {
+        if (m_show_inlined_frames)
         {
-            if (m_show_inlined_frames)
-            {
-                // When inline frames are enabled we actually create all the frames in GetFramesUpTo.
-                frame_sp = m_frames[idx];
-            }
-            else
+            // When inline frames are enabled we actually create all the frames in GetFramesUpTo.
+            frame_sp = m_frames[idx];
+        }
+        else
+        {
+            Unwind *unwinder = m_thread.GetUnwinder ();
+            if (unwinder)
             {
-                Unwind *unwinder = m_thread.GetUnwinder ();
-                if (unwinder)
+                addr_t pc, cfa;
+                if (unwinder->GetFrameInfoAtIndex(idx, cfa, pc))
                 {
-                    addr_t pc, cfa;
-                    if (unwinder->GetFrameInfoAtIndex(idx, cfa, pc))
+                    frame_sp.reset (new StackFrame (m_thread.shared_from_this(), idx, idx, cfa, pc, NULL));
+                    
+                    Function *function = frame_sp->GetSymbolContext (eSymbolContextFunction).function;
+                    if (function)
                     {
-                        frame_sp.reset (new StackFrame (m_thread.shared_from_this(), idx, idx, cfa, pc, NULL));
-                        
-                        Function *function = frame_sp->GetSymbolContext (eSymbolContextFunction).function;
-                        if (function)
-                        {
-                            // When we aren't showing inline functions we always use
-                            // the top most function block as the scope.
-                            frame_sp->SetSymbolContextScope (&function->GetBlock(false));
-                        }
-                        else 
-                        {
-                            // Set the symbol scope from the symbol regardless if it is NULL or valid.
-                            frame_sp->SetSymbolContextScope (frame_sp->GetSymbolContext (eSymbolContextSymbol).symbol);
-                        }
-                        SetFrameAtIndex(idx, frame_sp);
+                        // When we aren't showing inline functions we always use
+                        // the top most function block as the scope.
+                        frame_sp->SetSymbolContextScope (&function->GetBlock(false));
+                    }
+                    else 
+                    {
+                        // Set the symbol scope from the symbol regardless if it is NULL or valid.
+                        frame_sp->SetSymbolContextScope (frame_sp->GetSymbolContext (eSymbolContextSymbol).symbol);
                     }
+                    SetFrameAtIndex(idx, frame_sp);
                 }
             }
         }
+    }
+    else if (original_idx == 0)
+    {
+        // There should ALWAYS be a frame at index 0.  If something went wrong with the CurrentInlinedDepth such that
+        // there weren't as many frames as we thought taking that into account, then reset the current inlined depth
+        // and return the real zeroth frame.
+        if (m_frames.size() > 0)
+        {
+            ResetCurrentInlinedDepth();
+            frame_sp = m_frames[original_idx];
+        }
+        else
+        {
+            // Why do we have a thread with zero frames, that should not ever happen...
+            if (m_thread.IsValid())
+                assert ("A valid thread has no frames.");
+            
+        }
+    }
+    
     return frame_sp;
 }
 

Modified: lldb/branches/windows/source/Target/StopInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Target/StopInfo.cpp?rev=179679&r1=179678&r2=179679&view=diff
==============================================================================
--- lldb/branches/windows/source/Target/StopInfo.cpp (original)
+++ lldb/branches/windows/source/Target/StopInfo.cpp Wed Apr 17 03:38:48 2013
@@ -38,7 +38,9 @@ StopInfo::StopInfo (Thread &thread, uint
     m_thread (thread),
     m_stop_id (thread.GetProcess()->GetStopID()),
     m_resume_id (thread.GetProcess()->GetResumeID()),
-    m_value (value)
+    m_value (value),
+    m_override_set(false),
+    m_override_value(true)
 {
 }
 
@@ -164,7 +166,7 @@ public:
             }
             else
             {
-                LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_PROCESS));
+                Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_PROCESS));
 
                 if (log)
                     log->Printf ("Process::%s could not find breakpoint site id: %" PRId64 "...", __FUNCTION__, m_value);
@@ -206,6 +208,22 @@ public:
             if (bp_site_sp)
             {
                 StreamString strm;
+                // If we have just hit an internal breakpoint, and it has a kind description, print that instead of the
+                // full breakpoint printing:
+                if (bp_site_sp->IsInternal())
+                {
+                    size_t num_owners = bp_site_sp->GetNumberOfOwners();
+                    for (size_t idx = 0; idx < num_owners; idx++)
+                    {
+                        const char *kind = bp_site_sp->GetOwnerAtIndex(idx)->GetBreakpoint().GetBreakpointKind();
+                        if (kind != NULL)
+                        {
+                            m_description.assign (kind);
+                            return kind;
+                        }
+                    }
+                }
+                
                 strm.Printf("breakpoint ");
                 bp_site_sp->GetDescription(&strm, eDescriptionLevelBrief);
                 m_description.swap (strm.GetString());
@@ -215,10 +233,29 @@ public:
                 StreamString strm;
                 if (m_break_id != LLDB_INVALID_BREAK_ID)
                 {
-                    if (m_was_one_shot)
-                        strm.Printf ("one-shot breakpoint %d", m_break_id);
+                    BreakpointSP break_sp = m_thread.GetProcess()->GetTarget().GetBreakpointByID(m_break_id);
+                    if (break_sp)
+                    {
+                        if (break_sp->IsInternal())
+                        {
+                            const char *kind = break_sp->GetBreakpointKind();
+                            if (kind)
+                                strm.Printf ("internal %s breakpoint(%d).", kind, m_break_id);
+                            else
+                                strm.Printf ("internal breakpoint(%d).", m_break_id);
+                        }
+                        else
+                        {
+                            strm.Printf ("breakpoint %d.", m_break_id);
+                        }
+                    } 
                     else
-                        strm.Printf ("breakpoint %d which has been deleted.", m_break_id);
+                    {
+                        if (m_was_one_shot)
+                            strm.Printf ("one-shot breakpoint %d", m_break_id);
+                        else
+                            strm.Printf ("breakpoint %d which has been deleted.", m_break_id);
+                    }
                 }
                 else if (m_address == LLDB_INVALID_ADDRESS)
                     strm.Printf("breakpoint site %" PRIi64 " which has been deleted - unknown address", m_value);
@@ -248,7 +285,16 @@ protected:
             return;
         m_should_perform_action = false;
         
-        LogSP log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_BREAKPOINTS);
+        Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_BREAKPOINTS);
+        
+        if (!m_thread.IsValid())
+        {
+            // This shouldn't ever happen, but just in case, don't do more harm.
+            log->Printf ("PerformAction got called with an invalid thread.");
+            m_should_stop = true;
+            m_should_stop_is_valid = true;
+            return;
+        }
         
         BreakpointSiteSP bp_site_sp (m_thread.GetProcess()->GetBreakpointSiteList().FindByID (m_value));
         
@@ -275,14 +321,71 @@ protected:
                 m_should_stop = false;
 
                 ExecutionContext exe_ctx (m_thread.GetStackFrameAtIndex(0));
+                Process *process  = exe_ctx.GetProcessPtr();
+                if (process->GetModIDRef().IsLastResumeForUserExpression())
+                {
+                    // If we are in the middle of evaluating an expression, don't run asynchronous breakpoint commands or
+                    // expressions.  That could lead to infinite recursion if the command or condition re-calls the function
+                    // with this breakpoint.
+                    // TODO: We can keep a list of the breakpoints we've seen while running expressions in the nested
+                    // PerformAction calls that can arise when the action runs a function that hits another breakpoint,
+                    // and only stop running commands when we see the same breakpoint hit a second time.
+                    
+                    m_should_stop_is_valid = true;
+                    if (log)
+                        log->Printf ("StopInfoBreakpoint::PerformAction - Hit a breakpoint while running an expression,"
+                                     " not running commands to avoid recursion.");
+                    bool ignoring_breakpoints = process->GetIgnoreBreakpointsInExpressions();
+                    if (ignoring_breakpoints)
+                    {
+                        m_should_stop = false;
+                        // Internal breakpoints will always stop.  
+                        for (size_t j = 0; j < num_owners; j++)
+                        {
+                            lldb::BreakpointLocationSP bp_loc_sp = bp_site_sp->GetOwnerAtIndex(j);
+                            if (bp_loc_sp->GetBreakpoint().IsInternal())
+                            {
+                                m_should_stop = true;
+                                break;
+                            }
+                        }
+                    }
+                    else
+                    {
+                        m_should_stop = true;
+                    }
+                    if (log)
+                        log->Printf ("StopInfoBreakpoint::PerformAction - in expression, continuing: %s.",
+                                     m_should_stop ? "true" : "false");
+                    process->GetTarget().GetDebugger().GetAsyncOutputStream()->Printf("Warning: hit breakpoint while "
+                                           "running function, skipping commands and conditions to prevent recursion.");
+                    return;
+                }
+                
                 StoppointCallbackContext context (event_ptr, exe_ctx, false);
+                
+                // Let's copy the breakpoint locations out of the site and store them in a local list.  That way if
+                // one of the breakpoint actions changes the site, then we won't be operating on a bad list.
+                
+                BreakpointLocationCollection site_locations;
+                for (size_t j = 0; j < num_owners; j++)
+                    site_locations.Add(bp_site_sp->GetOwnerAtIndex(j));
 
                 for (size_t j = 0; j < num_owners; j++)
                 {
-                    lldb::BreakpointLocationSP bp_loc_sp = bp_site_sp->GetOwnerAtIndex(j);
+                    lldb::BreakpointLocationSP bp_loc_sp = site_locations.GetByIndex(j);
+                    
+                    // If another action disabled this breakpoint or its location, then don't run the actions.
+                    if (!bp_loc_sp->IsEnabled() || !bp_loc_sp->GetBreakpoint().IsEnabled())
+                        continue;
+                    
+                    // The breakpoint site may have many locations associated with it, not all of them valid for
+                    // this thread.  Skip the ones that aren't:
+                    if (!bp_loc_sp->ValidForThisThread(&m_thread))
+                        continue;
                                                       
                     // First run the condition for the breakpoint.  If that says we should stop, then we'll run
-                    // the callback for the breakpoint.  If the callback says we shouldn't stop that will win.
+                    // the callback for the breakpoint.  If the callback says we shouldn't stop that will win.                    
                     
                     bool condition_says_stop = true;
                     if (bp_loc_sp->GetConditionText() != NULL)
@@ -294,13 +397,15 @@ protected:
                         
                         ExecutionResults result_code;
                         ValueObjectSP result_value_sp;
-                        const bool discard_on_error = true;
+                        const bool unwind_on_error = true;
+                        const bool ignore_breakpoints = true;
                         Error error;
                         result_code = ClangUserExpression::EvaluateWithError (exe_ctx,
                                                                               eExecutionPolicyOnlyWhenNeeded,
                                                                               lldb::eLanguageTypeUnknown,
                                                                               ClangUserExpression::eResultTypeAny,
-                                                                              discard_on_error,
+                                                                              unwind_on_error,
+                                                                              ignore_breakpoints,
                                                                               bp_loc_sp->GetConditionText(),
                                                                               NULL,
                                                                               result_value_sp,
@@ -396,7 +501,7 @@ protected:
         {
             m_should_stop = true;
             m_should_stop_is_valid = true;
-            LogSP log_process(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_PROCESS));
+            Log * log_process(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_PROCESS));
 
             if (log_process)
                 log_process->Printf ("Process::%s could not find breakpoint site id: %" PRId64 "...", __FUNCTION__, m_value);
@@ -489,7 +594,7 @@ public:
 
 protected:
     virtual bool
-    ShouldStop (Event *event_ptr)
+    ShouldStopSynchronous (Event *event_ptr)
     {
         // ShouldStop() method is idempotent and should not affect hit count.
         // See Process::RunPrivateStateThread()->Process()->HandlePrivateEvent()
@@ -512,7 +617,7 @@ protected:
         }
         else
         {
-            LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_PROCESS));
+            Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_PROCESS));
 
             if (log)
                 log->Printf ("Process::%s could not find watchpoint location id: %" PRId64 "...",
@@ -524,10 +629,19 @@ protected:
         return m_should_stop;
     }
     
+    bool
+    ShouldStop (Event *event_ptr)
+    {
+        // This just reports the work done by PerformAction or the synchronous stop.  It should
+        // only ever get called after they have had a chance to run.
+        assert (m_should_stop_is_valid);
+        return m_should_stop;
+    }
+    
     virtual void
     PerformAction (Event *event_ptr)
     {
-        LogSP log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_WATCHPOINTS);
+        Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_WATCHPOINTS);
         // We're going to calculate if we should stop or not in some way during the course of
         // this code.  Also by default we're going to stop, so set that here.
         m_should_stop = true;
@@ -575,13 +689,15 @@ protected:
                 // constructor errors up to the debugger's Async I/O.
                 ExecutionResults result_code;
                 ValueObjectSP result_value_sp;
-                const bool discard_on_error = true;
+                const bool unwind_on_error = true;
+                const bool ignore_breakpoints = true;
                 Error error;
                 result_code = ClangUserExpression::EvaluateWithError (exe_ctx,
                                                                       eExecutionPolicyOnlyWhenNeeded,
                                                                       lldb::eLanguageTypeUnknown,
                                                                       ClangUserExpression::eResultTypeAny,
-                                                                      discard_on_error,
+                                                                      unwind_on_error,
+                                                                      ignore_breakpoints,
                                                                       wp_sp->GetConditionText(),
                                                                       NULL,
                                                                       result_value_sp,
@@ -669,7 +785,7 @@ protected:
         }
         else
         {
-            LogSP log_process(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_PROCESS));
+            Log * log_process(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_PROCESS));
 
             if (log_process)
                 log_process->Printf ("Process::%s could not find watchpoint id: %" PRId64 "...", __FUNCTION__, m_value);
@@ -677,6 +793,8 @@ protected:
         if (log)
             log->Printf ("Process::%s returning from action with m_should_stop: %d.", __FUNCTION__, m_should_stop);
         
+        m_should_stop_is_valid = true;
+        
     }
         
 private:
@@ -712,6 +830,12 @@ public:
     }
 
     virtual bool
+    ShouldStopSynchronous (Event *event_ptr)
+    {
+        return m_thread.GetProcess()->GetUnixSignals().GetShouldStop (m_value);
+    }
+
+    virtual bool
     ShouldStop (Event *event_ptr)
     {
         return m_thread.GetProcess()->GetUnixSignals().GetShouldStop (m_value);
@@ -722,7 +846,16 @@ public:
     virtual bool
     ShouldNotify (Event *event_ptr)
     {
-        return m_thread.GetProcess()->GetUnixSignals().GetShouldNotify (m_value);
+        bool should_notify = m_thread.GetProcess()->GetUnixSignals().GetShouldNotify (m_value);
+        if (should_notify)
+        {
+            StreamString strm;
+            strm.Printf ("thread %d received signal: %s",
+                         m_thread.GetIndexID(),
+                         m_thread.GetProcess()->GetUnixSignals().GetSignalAsCString (m_value));
+            Process::ProcessEventData::AddRestartedReason(event_ptr, strm.GetData());
+        }
+        return should_notify;
     }
 
     
@@ -863,6 +996,16 @@ public:
     {
         return m_return_valobj_sp;
     }
+    
+protected:
+    virtual bool
+    ShouldStop (Event *event_ptr)
+    {
+        if (m_plan_sp)
+            return m_plan_sp->ShouldStop(event_ptr);
+        else
+            return StopInfo::ShouldStop(event_ptr);
+    }
 
 private:
     ThreadPlanSP m_plan_sp;
@@ -896,7 +1039,6 @@ public:
         return "exec";
     }
 protected:
-protected:
     
     virtual void
     PerformAction (Event *event_ptr)

Modified: lldb/branches/windows/source/Target/Target.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Target/Target.cpp?rev=179679&r1=179678&r2=179679&view=diff
==============================================================================
--- lldb/branches/windows/source/Target/Target.cpp (original)
+++ lldb/branches/windows/source/Target/Target.cpp Wed Apr 17 03:38:48 2013
@@ -27,6 +27,7 @@
 #include "lldb/Core/Module.h"
 #include "lldb/Core/ModuleSpec.h"
 #include "lldb/Core/Section.h"
+#include "lldb/Core/SourceManager.h"
 #include "lldb/Core/StreamString.h"
 #include "lldb/Core/Timer.h"
 #include "lldb/Core/ValueObject.h"
@@ -66,20 +67,7 @@ Target::Target(Debugger &debugger, const
     m_platform_sp (platform_sp),
     m_mutex (Mutex::eMutexTypeRecursive), 
     m_arch (target_arch),
-#ifndef LLDB_DISABLE_PYTHON
     m_images (this),
-#else
-    // FIXME: The module added notification needed for python scripting support 
-    // causes a problem with in-memory-only Modules at startup if we have
-    // a breakpoint (the ObjectFile is parsed before we've set the Section load
-    // addresses leading to an invalid __LINKEDIT section addr on Mac OS X and
-    // all the problems that will happen from that).  
-    // As a temporary solution for iOS debugging (where all the modules are in-memory-only), 
-    // disable this notification system there. The problem could still happen on 
-    // an x86 system but it is much less common. 
-    // <rdar://problem/12831670> describes the failure mode for on-iOS debugging.
-    m_images (NULL),
-#endif
     m_section_load_list (),
     m_breakpoint_list (false),
     m_internal_breakpoint_list (true),
@@ -92,7 +80,7 @@ Target::Target(Debugger &debugger, const
     m_scratch_ast_source_ap (NULL),
     m_ast_importer_ap (NULL),
     m_persistent_variables (),
-    m_source_manager(*this),
+    m_source_manager_ap(),
     m_stop_hooks (),
     m_stop_hook_next_id (0),
     m_suppress_stop_hooks (false),
@@ -102,10 +90,11 @@ Target::Target(Debugger &debugger, const
     SetEventName (eBroadcastBitModulesLoaded, "modules-loaded");
     SetEventName (eBroadcastBitModulesUnloaded, "modules-unloaded");
     SetEventName (eBroadcastBitWatchpointChanged, "watchpoint-changed");
+    SetEventName (eBroadcastBitSymbolsLoaded, "symbols-loaded");
     
     CheckInWithManager();
 
-    LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_OBJECT));
+    Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_OBJECT));
     if (log)
         log->Printf ("%p Target::Target()", this);
     if (m_arch.IsValid())
@@ -119,7 +108,7 @@ Target::Target(Debugger &debugger, const
 //----------------------------------------------------------------------
 Target::~Target()
 {
-    LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_OBJECT));
+    Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_OBJECT));
     if (log)
         log->Printf ("%p Target::~Target()", this);
     DeleteCurrentProcess ();
@@ -507,7 +496,7 @@ Target::CreateBreakpoint (SearchFilterSP
         else
             m_breakpoint_list.Add (bp_sp, true);
 
-        LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_BREAKPOINTS));
+        Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_BREAKPOINTS));
         if (log)
         {
             StreamString s;
@@ -552,7 +541,7 @@ CheckIfWatchpointsExhausted(Target *targ
 WatchpointSP
 Target::CreateWatchpoint(lldb::addr_t addr, size_t size, const ClangASTType *type, uint32_t kind, Error &error)
 {
-    LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_WATCHPOINTS));
+    Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_WATCHPOINTS));
     if (log)
         log->Printf("Target::%s (addr = 0x%8.8" PRIx64 " size = %" PRIu64 " type = %u)\n",
                     __FUNCTION__, addr, (uint64_t)size, kind);
@@ -632,7 +621,7 @@ Target::CreateWatchpoint(lldb::addr_t ad
 void
 Target::RemoveAllBreakpoints (bool internal_also)
 {
-    LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_BREAKPOINTS));
+    Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_BREAKPOINTS));
     if (log)
         log->Printf ("Target::%s (internal_also = %s)\n", __FUNCTION__, internal_also ? "yes" : "no");
 
@@ -646,7 +635,7 @@ Target::RemoveAllBreakpoints (bool inter
 void
 Target::DisableAllBreakpoints (bool internal_also)
 {
-    LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_BREAKPOINTS));
+    Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_BREAKPOINTS));
     if (log)
         log->Printf ("Target::%s (internal_also = %s)\n", __FUNCTION__, internal_also ? "yes" : "no");
 
@@ -658,7 +647,7 @@ Target::DisableAllBreakpoints (bool inte
 void
 Target::EnableAllBreakpoints (bool internal_also)
 {
-    LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_BREAKPOINTS));
+    Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_BREAKPOINTS));
     if (log)
         log->Printf ("Target::%s (internal_also = %s)\n", __FUNCTION__, internal_also ? "yes" : "no");
 
@@ -670,7 +659,7 @@ Target::EnableAllBreakpoints (bool inter
 bool
 Target::RemoveBreakpointByID (break_id_t break_id)
 {
-    LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_BREAKPOINTS));
+    Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_BREAKPOINTS));
     if (log)
         log->Printf ("Target::%s (break_id = %i, internal = %s)\n", __FUNCTION__, break_id, LLDB_BREAK_ID_IS_INTERNAL (break_id) ? "yes" : "no");
 
@@ -695,7 +684,7 @@ Target::RemoveBreakpointByID (break_id_t
 bool
 Target::DisableBreakpointByID (break_id_t break_id)
 {
-    LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_BREAKPOINTS));
+    Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_BREAKPOINTS));
     if (log)
         log->Printf ("Target::%s (break_id = %i, internal = %s)\n", __FUNCTION__, break_id, LLDB_BREAK_ID_IS_INTERNAL (break_id) ? "yes" : "no");
 
@@ -716,7 +705,7 @@ Target::DisableBreakpointByID (break_id_
 bool
 Target::EnableBreakpointByID (break_id_t break_id)
 {
-    LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_BREAKPOINTS));
+    Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_BREAKPOINTS));
     if (log)
         log->Printf ("Target::%s (break_id = %i, internal = %s)\n",
                      __FUNCTION__,
@@ -746,7 +735,7 @@ Target::EnableBreakpointByID (break_id_t
 bool
 Target::RemoveAllWatchpoints (bool end_to_end)
 {
-    LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_WATCHPOINTS));
+    Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_WATCHPOINTS));
     if (log)
         log->Printf ("Target::%s\n", __FUNCTION__);
 
@@ -780,7 +769,7 @@ Target::RemoveAllWatchpoints (bool end_t
 bool
 Target::DisableAllWatchpoints (bool end_to_end)
 {
-    LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_WATCHPOINTS));
+    Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_WATCHPOINTS));
     if (log)
         log->Printf ("Target::%s\n", __FUNCTION__);
 
@@ -813,7 +802,7 @@ Target::DisableAllWatchpoints (bool end_
 bool
 Target::EnableAllWatchpoints (bool end_to_end)
 {
-    LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_WATCHPOINTS));
+    Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_WATCHPOINTS));
     if (log)
         log->Printf ("Target::%s\n", __FUNCTION__);
 
@@ -845,7 +834,7 @@ Target::EnableAllWatchpoints (bool end_t
 bool
 Target::ClearAllWatchpointHitCounts ()
 {
-    LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_WATCHPOINTS));
+    Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_WATCHPOINTS));
     if (log)
         log->Printf ("Target::%s\n", __FUNCTION__);
 
@@ -866,7 +855,7 @@ Target::ClearAllWatchpointHitCounts ()
 bool
 Target::IgnoreAllWatchpoints (uint32_t ignore_count)
 {
-    LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_WATCHPOINTS));
+    Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_WATCHPOINTS));
     if (log)
         log->Printf ("Target::%s\n", __FUNCTION__);
 
@@ -889,7 +878,7 @@ Target::IgnoreAllWatchpoints (uint32_t i
 bool
 Target::DisableWatchpointByID (lldb::watch_id_t watch_id)
 {
-    LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_WATCHPOINTS));
+    Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_WATCHPOINTS));
     if (log)
         log->Printf ("Target::%s (watch_id = %i)\n", __FUNCTION__, watch_id);
 
@@ -912,7 +901,7 @@ Target::DisableWatchpointByID (lldb::wat
 bool
 Target::EnableWatchpointByID (lldb::watch_id_t watch_id)
 {
-    LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_WATCHPOINTS));
+    Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_WATCHPOINTS));
     if (log)
         log->Printf ("Target::%s (watch_id = %i)\n", __FUNCTION__, watch_id);
 
@@ -935,7 +924,7 @@ Target::EnableWatchpointByID (lldb::watc
 bool
 Target::RemoveWatchpointByID (lldb::watch_id_t watch_id)
 {
-    LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_WATCHPOINTS));
+    Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_WATCHPOINTS));
     if (log)
         log->Printf ("Target::%s (watch_id = %i)\n", __FUNCTION__, watch_id);
 
@@ -951,7 +940,7 @@ Target::RemoveWatchpointByID (lldb::watc
 bool
 Target::IgnoreWatchpointByID (lldb::watch_id_t watch_id, uint32_t ignore_count)
 {
-    LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_WATCHPOINTS));
+    Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_WATCHPOINTS));
     if (log)
         log->Printf ("Target::%s (watch_id = %i)\n", __FUNCTION__, watch_id);
 
@@ -994,7 +983,7 @@ LoadScriptingResourceForModule (const Mo
 void
 Target::SetExecutableModule (ModuleSP& executable_sp, bool get_dependent_files)
 {
-    LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_TARGET));
+    Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_TARGET));
     m_images.Clear();
     m_scratch_ast_context_ap.reset();
     m_scratch_ast_source_ap.reset();
@@ -1049,7 +1038,7 @@ Target::SetExecutableModule (ModuleSP& e
 bool
 Target::SetArchitecture (const ArchSpec &arch_spec)
 {
-    LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_TARGET));
+    Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_TARGET));
     if (m_arch.IsCompatibleMatch(arch_spec) || !m_arch.IsValid())
     {
         // If we haven't got a valid arch spec, or the architectures are
@@ -1138,6 +1127,23 @@ Target::ModulesDidLoad (ModuleList &modu
 }
 
 void
+Target::SymbolsDidLoad (ModuleList &module_list)
+{
+    if (module_list.GetSize() == 0)
+        return;
+    if (m_process_sp)
+    {
+        LanguageRuntime* runtime = m_process_sp->GetLanguageRuntime(lldb::eLanguageTypeObjC);
+        if (runtime)
+        {
+            ObjCLanguageRuntime *objc_runtime = (ObjCLanguageRuntime*)runtime;
+            objc_runtime->SymbolsDidLoad(module_list);
+        }
+    }
+    BroadcastEvent(eBroadcastBitSymbolsLoaded, NULL);
+}
+
+void
 Target::ModulesDidUnload (ModuleList &module_list)
 {
     if (module_list.GetSize())
@@ -1327,6 +1333,82 @@ Target::ReadMemory (const Address& addr,
 }
 
 size_t
+Target::ReadCStringFromMemory (const Address& addr, std::string &out_str, Error &error)
+{
+    char buf[256];
+    out_str.clear();
+    addr_t curr_addr = addr.GetLoadAddress(this);
+    Address address(addr);
+    while (1)
+    {
+        size_t length = ReadCStringFromMemory (address, buf, sizeof(buf), error);
+        if (length == 0)
+            break;
+        out_str.append(buf, length);
+        // If we got "length - 1" bytes, we didn't get the whole C string, we
+        // need to read some more characters
+        if (length == sizeof(buf) - 1)
+            curr_addr += length;
+        else
+            break;
+        address = Address(curr_addr);
+    }
+    return out_str.size();
+}
+
+
+size_t
+Target::ReadCStringFromMemory (const Address& addr, char *dst, size_t dst_max_len, Error &result_error)
+{
+    size_t total_cstr_len = 0;
+    if (dst && dst_max_len)
+    {
+        result_error.Clear();
+        // NULL out everything just to be safe
+        memset (dst, 0, dst_max_len);
+        Error error;
+        addr_t curr_addr = addr.GetLoadAddress(this);
+        Address address(addr);
+        const size_t cache_line_size = 512;
+        size_t bytes_left = dst_max_len - 1;
+        char *curr_dst = dst;
+        
+        while (bytes_left > 0)
+        {
+            addr_t cache_line_bytes_left = cache_line_size - (curr_addr % cache_line_size);
+            addr_t bytes_to_read = std::min<addr_t>(bytes_left, cache_line_bytes_left);
+            size_t bytes_read = ReadMemory (address, false, curr_dst, bytes_to_read, error);
+            
+            if (bytes_read == 0)
+            {
+                result_error = error;
+                dst[total_cstr_len] = '\0';
+                break;
+            }
+            const size_t len = strlen(curr_dst);
+            
+            total_cstr_len += len;
+            
+            if (len < bytes_to_read)
+                break;
+            
+            curr_dst += bytes_read;
+            curr_addr += bytes_read;
+            bytes_left -= bytes_read;
+            address = Address(curr_addr);
+        }
+    }
+    else
+    {
+        if (dst == NULL)
+            result_error.SetErrorString("invalid arguments");
+        else
+            result_error.Clear();
+    }
+    return total_cstr_len;
+}
+
+size_t
 Target::ReadScalarIntegerFromMemory (const Address& addr, 
                                      bool prefer_file_cache,
                                      uint32_t byte_size, 
@@ -1342,7 +1424,7 @@ Target::ReadScalarIntegerFromMemory (con
         if (bytes_read == byte_size)
         {
             DataExtractor data (&uval, sizeof(uval), m_arch.GetByteOrder(), m_arch.GetAddressByteSize());
-            uint32_t offset = 0;
+            lldb::offset_t offset = 0;
             if (byte_size <= 4)
                 scalar = data.GetMaxU32 (&offset, byte_size);
             else
@@ -1722,31 +1804,10 @@ Target::EvaluateExpression
     m_suppress_stop_hooks = true;
 
     ExecutionContext exe_ctx;
-
-    const size_t expr_cstr_len = ::strlen (expr_cstr);
-
+    
     if (frame)
     {
         frame->CalculateExecutionContext(exe_ctx);
-        Error error;
-        const uint32_t expr_path_options = StackFrame::eExpressionPathOptionCheckPtrVsMember |
-                                           StackFrame::eExpressionPathOptionsNoFragileObjcIvar |
-                                           StackFrame::eExpressionPathOptionsNoSyntheticChildren;
-        lldb::VariableSP var_sp;
-        
-        // Make sure we don't have any things that we know a variable expression
-        // won't be able to deal with before calling into it
-        if (::strcspn (expr_cstr, "()+*&|!~<=/^%,?") == expr_cstr_len)
-        {
-            result_valobj_sp = frame->GetValueForVariableExpressionPath (expr_cstr, 
-                                                                         options.GetUseDynamic(),
-                                                                         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)
     {
@@ -1757,89 +1818,33 @@ Target::EvaluateExpression
         CalculateExecutionContext(exe_ctx);
     }
     
-    if (result_valobj_sp)
+    // Make sure we aren't just trying to see the value of a persistent
+    // variable (something like "$0")
+    lldb::ClangExpressionVariableSP persistent_var_sp;
+    // Only check for persistent variables the expression starts with a '$' 
+    if (expr_cstr[0] == '$')
+        persistent_var_sp = m_persistent_variables.GetVariable (expr_cstr);
+
+    if (persistent_var_sp)
     {
+        result_valobj_sp = persistent_var_sp->GetValueObject ();
         execution_results = eExecutionCompleted;
-        // We got a result from the frame variable expression path above...
-        ConstString persistent_variable_name (m_persistent_variables.GetNextPersistentVariableName());
-
-        lldb::ValueObjectSP const_valobj_sp;
-        
-        // Check in case our value is already a constant value
-        if (result_valobj_sp->GetIsConstant())
-        {
-            const_valobj_sp = result_valobj_sp;
-            const_valobj_sp->SetName (persistent_variable_name);
-        }
-        else
-        {
-            if (options.GetUseDynamic() != lldb::eNoDynamicValues)
-            {
-                ValueObjectSP dynamic_sp = result_valobj_sp->GetDynamicValue(options.GetUseDynamic());
-                if (dynamic_sp)
-                    result_valobj_sp = dynamic_sp;
-            }
-
-            const_valobj_sp = result_valobj_sp->CreateConstantValue (persistent_variable_name);
-        }
-
-        lldb::ValueObjectSP live_valobj_sp = result_valobj_sp;
-        
-        result_valobj_sp = const_valobj_sp;
-
-        ClangExpressionVariableSP clang_expr_variable_sp(m_persistent_variables.CreatePersistentVariable(result_valobj_sp));        
-        assert (clang_expr_variable_sp.get());
-        
-        // Set flags and live data as appropriate
-
-        const Value &result_value = live_valobj_sp->GetValue();
-        
-        switch (result_value.GetValueType())
-        {
-        case Value::eValueTypeHostAddress:
-        case Value::eValueTypeFileAddress:
-            // we don't do anything with these for now
-            break;
-        case Value::eValueTypeScalar:
-        case Value::eValueTypeVector:
-            clang_expr_variable_sp->m_flags |= ClangExpressionVariable::EVIsLLDBAllocated;
-            clang_expr_variable_sp->m_flags |= ClangExpressionVariable::EVNeedsAllocation;
-            break;
-        case Value::eValueTypeLoadAddress:
-            clang_expr_variable_sp->m_live_sp = live_valobj_sp;
-            clang_expr_variable_sp->m_flags |= ClangExpressionVariable::EVIsProgramReference;
-            break;
-        }
     }
     else
     {
-        // Make sure we aren't just trying to see the value of a persistent 
-        // variable (something like "$0")
-        lldb::ClangExpressionVariableSP persistent_var_sp;
-        // Only check for persistent variables the expression starts with a '$' 
-        if (expr_cstr[0] == '$')
-            persistent_var_sp = m_persistent_variables.GetVariable (expr_cstr);
-
-        if (persistent_var_sp)
-        {
-            result_valobj_sp = persistent_var_sp->GetValueObject ();
-            execution_results = eExecutionCompleted;
-        }
-        else
-        {
-            const char *prefix = GetExpressionPrefixContentsAsCString();
-                    
-            execution_results = ClangUserExpression::Evaluate (exe_ctx, 
-                                                               options.GetExecutionPolicy(),
-                                                               lldb::eLanguageTypeUnknown,
-                                                               options.DoesCoerceToId() ? ClangUserExpression::eResultTypeId : ClangUserExpression::eResultTypeAny,
-                                                               options.DoesUnwindOnError(),
-                                                               expr_cstr, 
-                                                               prefix, 
-                                                               result_valobj_sp,
-                                                               options.GetRunOthers(),
-                                                               options.GetTimeoutUsec());
-        }
+        const char *prefix = GetExpressionPrefixContentsAsCString();
+                
+        execution_results = ClangUserExpression::Evaluate (exe_ctx, 
+                                                           options.GetExecutionPolicy(),
+                                                           lldb::eLanguageTypeUnknown,
+                                                           options.DoesCoerceToId() ? ClangUserExpression::eResultTypeId : ClangUserExpression::eResultTypeAny,
+                                                           options.DoesUnwindOnError(),
+                                                           options.DoesIgnoreBreakpoints(),
+                                                           expr_cstr, 
+                                                           prefix, 
+                                                           result_valobj_sp,
+                                                           options.GetRunOthers(),
+                                                           options.GetTimeoutUsec());
     }
     
     m_suppress_stop_hooks = old_suppress_value;
@@ -1922,6 +1927,15 @@ Target::GetOpcodeLoadAddress (lldb::addr
     return opcode_addr;
 }
 
+SourceManager &
+Target::GetSourceManager ()
+{
+    if (m_source_manager_ap.get() == NULL)
+        m_source_manager_ap.reset (new SourceManager(shared_from_this()));
+    return *m_source_manager_ap;
+}
+
+
 lldb::user_id_t
 Target::AddStopHook (Target::StopHookSP &new_hook_sp)
 {
@@ -2224,6 +2238,22 @@ g_inline_breakpoint_enums[] =
     { 0, NULL, NULL }
 };
 
+typedef enum x86DisassemblyFlavor
+{
+    eX86DisFlavorDefault,
+    eX86DisFlavorIntel,
+    eX86DisFlavorATT
+} x86DisassemblyFlavor;
+
+static OptionEnumValueElement
+g_x86_dis_flavor_value_types[] =
+{
+    { eX86DisFlavorDefault, "default", "Disassembler default (currently att)."},
+    { eX86DisFlavorIntel,   "intel",   "Intel disassembler flavor."},
+    { eX86DisFlavorATT,     "att",     "AT&T disassembler flavor."},
+    { 0, NULL, NULL }
+};
+
 static PropertyDefinition
 g_properties[] =
 {
@@ -2257,6 +2287,9 @@ g_properties[] =
         "Always checking for inlined breakpoint locations can be expensive (memory and time), so we try to minimize the "
         "times we look for inlined locations. This setting allows you to control exactly which strategy is used when settings "
         "file and line breakpoints." },
+    // FIXME: This is the wrong way to do per-architecture settings, but we don't have a general per architecture settings system in place yet.
+    { "x86-disassembly-flavor"             , OptionValue::eTypeEnum      , false, eX86DisFlavorDefault,       NULL, g_x86_dis_flavor_value_types, "The default disassembly flavor to use for x86 or x86-64 targets." },
+    { "use-fast-stepping"                  , OptionValue::eTypeBoolean   , false, true,                       NULL, NULL, "Use a fast stepping algorithm based on running from branch to branch rather than instruction single-stepping." },
     { NULL                                 , OptionValue::eTypeInvalid   , false, 0                         , NULL, NULL, NULL }
 };
 enum
@@ -2280,7 +2313,9 @@ enum
     ePropertyErrorPath,
     ePropertyDisableASLR,
     ePropertyDisableSTDIO,
-    ePropertyInlineStrategy
+    ePropertyInlineStrategy,
+    ePropertyDisassemblyFlavor,
+    ePropertyUseFastStepping
 };
 
 
@@ -2456,6 +2491,17 @@ TargetProperties::SetDisableSTDIO (bool
     m_collection_sp->SetPropertyAtIndexAsBoolean (NULL, idx, b);
 }
 
+const char *
+TargetProperties::GetDisassemblyFlavor () const
+{
+    const uint32_t idx = ePropertyDisassemblyFlavor;
+    const char *return_value;
+    
+    x86DisassemblyFlavor flavor_value = (x86DisassemblyFlavor) m_collection_sp->GetPropertyAtIndexAsEnumeration (NULL, idx, g_properties[idx].default_uint_value);
+    return_value = g_x86_dis_flavor_value_types[flavor_value].string_value;
+    return return_value;
+}
+
 InlineStrategy
 TargetProperties::GetInlineStrategy () const
 {
@@ -2608,6 +2654,13 @@ TargetProperties::GetBreakpointsConsultP
     return m_collection_sp->GetPropertyAtIndexAsBoolean (NULL, idx, g_properties[idx].default_uint_value != 0);
 }
 
+bool
+TargetProperties::GetUseFastStepping () const
+{
+    const uint32_t idx = ePropertyUseFastStepping;
+    return m_collection_sp->GetPropertyAtIndexAsBoolean (NULL, idx, g_properties[idx].default_uint_value != 0);
+}
+
 const TargetPropertiesSP &
 Target::GetGlobalProperties()
 {

Modified: lldb/branches/windows/source/Target/TargetList.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Target/TargetList.cpp?rev=179679&r1=179678&r2=179679&view=diff
==============================================================================
--- lldb/branches/windows/source/Target/TargetList.cpp (original)
+++ lldb/branches/windows/source/Target/TargetList.cpp Wed Apr 17 03:38:48 2013
@@ -104,7 +104,7 @@ TargetList::CreateTarget (Debugger &debu
         // current architecture if we have a valid architecture.
         platform_sp = debugger.GetPlatformList().GetSelectedPlatform ();
         
-        if (arch.IsValid() && !platform_sp->IsCompatibleArchitecture(arch, &platform_arch))
+        if (arch.IsValid() && !platform_sp->IsCompatibleArchitecture(arch, false, &platform_arch))
         {
             platform_sp = Platform::GetPlatformForArchitecture(arch, &platform_arch);
         }
@@ -146,7 +146,7 @@ TargetList::CreateTarget (Debugger &debu
     {
         if (arch.IsValid())
         {
-            if (!platform_sp->IsCompatibleArchitecture(arch))
+            if (!platform_sp->IsCompatibleArchitecture(arch, false, NULL))
                 platform_sp = Platform::GetPlatformForArchitecture(specified_arch, &arch);
         }
     }
@@ -182,7 +182,9 @@ TargetList::CreateTarget (Debugger &debu
                     std::string cwd_user_exe_path (cwd);
                     cwd_user_exe_path += '/';
                     cwd_user_exe_path += user_exe_path;
-                    file.SetFile(cwd_user_exe_path.c_str(), false);
+                    FileSpec cwd_file (cwd_user_exe_path.c_str(), false);
+                    if (cwd_file.Exists())
+                        file = cwd_file;
                 }
             }
         }

Modified: lldb/branches/windows/source/Target/Thread.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Target/Thread.cpp?rev=179679&r1=179678&r2=179679&view=diff
==============================================================================
--- lldb/branches/windows/source/Target/Thread.cpp (original)
+++ lldb/branches/windows/source/Target/Thread.cpp Wed Apr 17 03:38:48 2013
@@ -243,7 +243,7 @@ Thread::Thread (Process &process, lldb::
     Broadcaster(&process.GetTarget().GetDebugger(), Thread::GetStaticBroadcasterClass().AsCString()),
     m_process_wp (process.shared_from_this()),
     m_actual_stop_info_sp (),
-    m_index_id (process.GetNextThreadIndexID ()),
+    m_index_id (process.GetNextThreadIndexID(tid)),
     m_reg_context_sp (),
     m_state (eStateUnloaded),
     m_state_mutex (Mutex::eMutexTypeRecursive),
@@ -258,9 +258,8 @@ Thread::Thread (Process &process, lldb::
     m_unwinder_ap (),
     m_destroy_called (false),
     m_thread_stop_reason_stop_id (0)
-
 {
-    LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_OBJECT));
+    Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_OBJECT));
     if (log)
         log->Printf ("%p Thread::Thread(tid = 0x%4.4" PRIx64 ")", this, GetID());
 
@@ -271,7 +270,7 @@ Thread::Thread (Process &process, lldb::
 
 Thread::~Thread()
 {
-    LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_OBJECT));
+    Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_OBJECT));
     if (log)
         log->Printf ("%p Thread::~Thread(tid = 0x%4.4" PRIx64 ")", this, GetID());
     /// If you hit this assert, it means your derived class forgot to call DoDestroy in its destructor.
@@ -324,6 +323,33 @@ Thread::SetSelectedFrameByIndex (uint32_
         return false;
 }
 
+bool
+Thread::SetSelectedFrameByIndexNoisily (uint32_t frame_idx, Stream &output_stream)
+{
+    const bool broadcast = true;
+    bool success = SetSelectedFrameByIndex (frame_idx, broadcast);
+    if (success)
+    {
+        StackFrameSP frame_sp = GetSelectedFrame();
+        if (frame_sp)
+        {
+            bool already_shown = false;
+            SymbolContext frame_sc(frame_sp->GetSymbolContext(eSymbolContextLineEntry));
+            if (GetProcess()->GetTarget().GetDebugger().GetUseExternalEditor() && frame_sc.line_entry.file && frame_sc.line_entry.line != 0)
+            {
+                already_shown = Host::OpenFileInExternalEditor (frame_sc.line_entry.file, frame_sc.line_entry.line);
+            }
+
+            bool show_frame_info = true;
+            bool show_source = !already_shown;
+            return frame_sp->GetStatus (output_stream, show_frame_info, show_source);
+        }
+        return false;
+    }
+    else
+        return false;
+}
+
 
 lldb::StopInfoSP
 Thread::GetStopInfo ()
@@ -453,12 +479,17 @@ Thread::SetupForResume ()
         // telling the current plan it will resume, since we might change what the current
         // plan is.
 
-        StopReason stop_reason = lldb::eStopReasonInvalid;
-        StopInfoSP stop_info_sp = GetStopInfo();
-        if (stop_info_sp.get())
-            stop_reason = stop_info_sp->GetStopReason();
-        if (stop_reason == lldb::eStopReasonBreakpoint)
+//      StopReason stop_reason = lldb::eStopReasonInvalid;
+//      StopInfoSP stop_info_sp = GetStopInfo();
+//      if (stop_info_sp.get())
+//          stop_reason = stop_info_sp->GetStopReason();
+//      if (stop_reason == lldb::eStopReasonBreakpoint)
+        lldb::RegisterContextSP reg_ctx_sp (GetRegisterContext());
+        if (reg_ctx_sp)
         {
+            BreakpointSiteSP bp_site_sp = GetProcess()->GetBreakpointSiteList().FindByAddress(reg_ctx_sp->GetPC());
+            if (bp_site_sp)
+            {
             // Note, don't assume there's a ThreadPlanStepOverBreakpoint, the target may not require anything
             // special to step over a breakpoint.
                 
@@ -482,6 +513,7 @@ Thread::SetupForResume ()
             }
         }
     }
+    }
 }
 
 bool
@@ -541,7 +573,7 @@ Thread::ShouldStop (Event* event_ptr)
     ThreadPlan *current_plan = GetCurrentPlan();
     bool should_stop = true;
 
-    LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP));
+    Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP));
     
     if (GetResumeState () == eStateSuspended)
     {
@@ -549,10 +581,6 @@ Thread::ShouldStop (Event* event_ptr)
             log->Printf ("Thread::%s for tid = 0x%4.4" PRIx64 ", should_stop = 0 (ignore since thread was suspended)",
                          __FUNCTION__, 
                          GetID ());
-//            log->Printf ("Thread::%s for tid = 0x%4.4" PRIx64 ", pc = 0x%16.16" PRIx64 ", should_stop = 0 (ignore since thread was suspended)",
-//                         __FUNCTION__, 
-//                         GetID (), 
-//                         GetRegisterContext()->GetPC());
         return false;
     }
     
@@ -562,10 +590,6 @@ Thread::ShouldStop (Event* event_ptr)
             log->Printf ("Thread::%s for tid = 0x%4.4" PRIx64 ", should_stop = 0 (ignore since thread was suspended)",
                          __FUNCTION__, 
                          GetID ());
-//            log->Printf ("Thread::%s for tid = 0x%4.4" PRIx64 ", pc = 0x%16.16" PRIx64 ", should_stop = 0 (ignore since thread was suspended)",
-//                         __FUNCTION__, 
-//                         GetID (), 
-//                         GetRegisterContext()->GetPC());
         return false;
     }
     
@@ -575,7 +599,7 @@ Thread::ShouldStop (Event* event_ptr)
             log->Printf ("Thread::%s for tid = 0x%4.4" PRIx64 ", pc = 0x%16.16" PRIx64 ", should_stop = 0 (ignore since no stop reason)",
                          __FUNCTION__, 
                          GetID (), 
-                         GetRegisterContext()->GetPC());
+                         GetRegisterContext() ? GetRegisterContext()->GetPC() : LLDB_INVALID_ADDRESS);
         return false;
     }
     
@@ -584,7 +608,7 @@ Thread::ShouldStop (Event* event_ptr)
         log->Printf ("Thread::%s for tid = 0x%4.4" PRIx64 ", pc = 0x%16.16" PRIx64,
                      __FUNCTION__, 
                      GetID (), 
-                     GetRegisterContext()->GetPC());
+                     GetRegisterContext() ? GetRegisterContext()->GetPC() : LLDB_INVALID_ADDRESS);
         log->Printf ("^^^^^^^^ Thread::ShouldStop Begin ^^^^^^^^");
         StreamString s;
         s.IndentMore();
@@ -620,7 +644,7 @@ Thread::ShouldStop (Event* event_ptr)
     
     bool done_processing_current_plan = false;
     
-    if (!current_plan->PlanExplainsStop())
+    if (!current_plan->PlanExplainsStop(event_ptr))
     {
         if (current_plan->TracerExplainsStop())
         {
@@ -634,7 +658,7 @@ Thread::ShouldStop (Event* event_ptr)
             ThreadPlan *plan_ptr = current_plan;
             while ((plan_ptr = GetPreviousPlan(plan_ptr)) != NULL)
             {
-                if (plan_ptr->PlanExplainsStop())
+                if (plan_ptr->PlanExplainsStop(event_ptr))
                 {
                     should_stop = plan_ptr->ShouldStop (event_ptr);
                     
@@ -773,7 +797,7 @@ Thread::ShouldReportStop (Event* event_p
     StateType thread_state = GetResumeState ();
     StateType temp_thread_state = GetTemporaryResumeState();
     
-    LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP));
+    Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP));
 
     if (thread_state == eStateSuspended || thread_state == eStateInvalid)
     {
@@ -805,9 +829,24 @@ Thread::ShouldReportStop (Event* event_p
     }
     else
     {
+        Vote thread_vote = eVoteNoOpinion;
+        ThreadPlan *plan_ptr = GetCurrentPlan();
+        while (1)
+        {
+            if (plan_ptr->PlanExplainsStop(event_ptr))
+            {
+                thread_vote = plan_ptr->ShouldReportStop(event_ptr);
+                break;
+            }
+            if (PlanIsBasePlan(plan_ptr))
+                break;
+            else
+                plan_ptr = GetPreviousPlan(plan_ptr);
+        }
         if (log)
-            log->Printf ("Thread::ShouldReportStop() tid = 0x%4.4" PRIx64 ": returning vote  for current plan\n", GetID());
-        return GetCurrentPlan()->ShouldReportStop (event_ptr);
+            log->Printf ("Thread::ShouldReportStop() tid = 0x%4.4" PRIx64 ": returning vote %i for current plan\n", GetID(), thread_vote);
+
+        return thread_vote;
     }
 }
 
@@ -822,7 +861,7 @@ Thread::ShouldReportRun (Event* event_pt
         return eVoteNoOpinion;
     }
     
-    LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP));
+    Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP));
     if (m_completed_plan_stack.size() > 0)
     {
         // Don't use GetCompletedPlan here, since that suppresses private plans.
@@ -867,7 +906,7 @@ Thread::PushPlan (ThreadPlanSP &thread_p
             
         thread_plan_sp->DidPush();
 
-        LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP));
+        Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP));
         if (log)
         {
             StreamString s;
@@ -882,7 +921,7 @@ Thread::PushPlan (ThreadPlanSP &thread_p
 void
 Thread::PopPlan ()
 {
-    LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP));
+    Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP));
 
     if (m_plan_stack.size() <= 1)
         return;
@@ -1053,7 +1092,7 @@ Thread::DiscardThreadPlansUpToPlan (lldb
 void
 Thread::DiscardThreadPlansUpToPlan (ThreadPlan *up_to_plan_ptr)
 {
-    LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP));
+    Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP));
     if (log)
     {
         log->Printf("Discarding thread plans for thread tid = 0x%4.4" PRIx64 ", up to %p", GetID(), up_to_plan_ptr);
@@ -1094,7 +1133,7 @@ Thread::DiscardThreadPlansUpToPlan (Thre
 void
 Thread::DiscardThreadPlans(bool force)
 {
-    LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP));
+    Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP));
     if (log)
     {
         log->Printf("Discarding thread plans for thread (tid = 0x%4.4" PRIx64 ", force %d)", GetID(), force);
@@ -1166,6 +1205,28 @@ Thread::PlanIsBasePlan (ThreadPlan *plan
        return m_plan_stack[0].get() == plan_ptr;
 }
 
+Error
+Thread::UnwindInnermostExpression()
+{
+    Error error;
+    int stack_size = m_plan_stack.size();
+    
+    // If the input plan is NULL, discard all plans.  Otherwise make sure this plan is in the
+    // stack, and if so discard up to and including it.
+    
+    for (int i = stack_size - 1; i > 0; i--)
+    {
+        if (m_plan_stack[i]->GetKind() == ThreadPlan::eKindCallFunction)
+        {
+            DiscardThreadPlansUpToPlan(m_plan_stack[i].get());
+            return error;
+        }
+    }
+    error.SetErrorString("No expressions currently active on this thread");
+    return error;
+}
+
+
 ThreadPlan *
 Thread::QueueFundamentalPlan (bool abort_other_plans)
 {
@@ -1284,9 +1345,16 @@ Thread::QueueThreadPlanForCallFunction (
                                         Address& function,
                                         lldb::addr_t arg,
                                         bool stop_other_threads,
-                                        bool discard_on_error)
+                                        bool unwind_on_error,
+                                        bool ignore_breakpoints)
 {
-    ThreadPlanSP thread_plan_sp (new ThreadPlanCallFunction (*this, function, ClangASTType(), arg, stop_other_threads, discard_on_error));
+    ThreadPlanSP thread_plan_sp (new ThreadPlanCallFunction (*this,
+                                                             function,
+                                                             ClangASTType(),
+                                                             arg,
+                                                             stop_other_threads,
+                                                             unwind_on_error,
+                                                             ignore_breakpoints));
     QueueThreadPlan (thread_plan_sp, abort_other_plans);
     return thread_plan_sp.get();
 }
@@ -1472,6 +1540,11 @@ Thread::ReturnFromFrame (lldb::StackFram
     Thread *thread = frame_sp->GetThread().get();
     uint32_t older_frame_idx = frame_sp->GetFrameIndex() + 1;
     StackFrameSP older_frame_sp = thread->GetStackFrameAtIndex(older_frame_idx);
+    if (!older_frame_sp)
+    {
+        return_error.SetErrorString("No older frame to return to.");
+        return return_error;
+    }
     
     if (return_value_sp)
     {    
@@ -1513,21 +1586,37 @@ Thread::ReturnFromFrame (lldb::StackFram
     
     // Now write the return registers for the chosen frame:
     // Note, we can't use ReadAllRegisterValues->WriteAllRegisterValues, since the read & write
-    // cook their data 
-    bool copy_success = thread->GetStackFrameAtIndex(0)->GetRegisterContext()->CopyFromRegisterContext(older_frame_sp->GetRegisterContext());
+    // cook their data
+    
+    StackFrameSP youngest_frame_sp = thread->GetStackFrameAtIndex(0);
+    if (youngest_frame_sp)
+    {
+        lldb::RegisterContextSP reg_ctx_sp (youngest_frame_sp->GetRegisterContext());
+        if (reg_ctx_sp)
+        {
+            bool copy_success = reg_ctx_sp->CopyFromRegisterContext(older_frame_sp->GetRegisterContext());
     if (copy_success)
     {
         thread->DiscardThreadPlans(true);
         thread->ClearStackFrames();
         if (broadcast && EventTypeHasListeners(eBroadcastBitStackChanged))
             BroadcastEvent(eBroadcastBitStackChanged, new ThreadEventData (this->shared_from_this()));
-        return return_error;
     }
     else
     {
         return_error.SetErrorString("Could not reset register values.");
-        return return_error;
+            }
+        }
+        else
+        {
+            return_error.SetErrorString("Frame has no register context.");
+        }
     }
+    else
+    {
+        return_error.SetErrorString("Returned past top frame.");
+    }
+        return return_error;
 }
 
 void
@@ -1683,7 +1772,9 @@ Thread::SaveFrameZeroState (RegisterChec
     if (frame_sp)
     {
         checkpoint.SetStackID(frame_sp->GetStackID());
-        return frame_sp->GetRegisterContext()->ReadAllRegisterValues (checkpoint.GetData());
+        lldb::RegisterContextSP reg_ctx_sp (frame_sp->GetRegisterContext());
+        if (reg_ctx_sp)
+            return reg_ctx_sp->ReadAllRegisterValues (checkpoint.GetData());
     }
     return false;
 }
@@ -1700,16 +1791,19 @@ Thread::ResetFrameZeroRegisters (lldb::D
     lldb::StackFrameSP frame_sp(GetStackFrameAtIndex (0));
     if (frame_sp)
     {
-        bool ret = frame_sp->GetRegisterContext()->WriteAllRegisterValues (register_data_sp);
+        lldb::RegisterContextSP reg_ctx_sp (frame_sp->GetRegisterContext());
+        if (reg_ctx_sp)
+        {
+            bool ret = reg_ctx_sp->WriteAllRegisterValues (register_data_sp);
 
         // Clear out all stack frames as our world just changed.
         ClearStackFrames();
-        frame_sp->GetRegisterContext()->InvalidateIfNeeded(true);
+            reg_ctx_sp->InvalidateIfNeeded(true);
         if (m_unwinder_ap.get())
             m_unwinder_ap->Clear();
-
         return ret;
     }
+    }
     return false;
 }
 
@@ -1758,11 +1852,15 @@ Thread::IsStillAtLastBreakpointHit ()
         StopReason stop_reason = m_actual_stop_info_sp->GetStopReason();
         if (stop_reason == lldb::eStopReasonBreakpoint) {
             uint64_t value = m_actual_stop_info_sp->GetValue();
-            lldb::addr_t pc = GetRegisterContext()->GetPC();
+            lldb::RegisterContextSP reg_ctx_sp (GetRegisterContext());
+            if (reg_ctx_sp)
+            {
+                lldb::addr_t pc = reg_ctx_sp->GetPC();
             BreakpointSiteSP bp_site_sp = GetProcess()->GetBreakpointSiteList().FindByAddress(pc);
             if (bp_site_sp && value == bp_site_sp->GetID())
                 return true;
         }
     }
+    }
     return false;
 }

Modified: lldb/branches/windows/source/Target/ThreadList.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Target/ThreadList.cpp?rev=179679&r1=179678&r2=179679&view=diff
==============================================================================
--- lldb/branches/windows/source/Target/ThreadList.cpp (original)
+++ lldb/branches/windows/source/Target/ThreadList.cpp Wed Apr 17 03:38:48 2013
@@ -60,6 +60,10 @@ ThreadList::operator = (const ThreadList
 
 ThreadList::~ThreadList()
 {
+    // Clear the thread list. Clear will take the mutex lock
+    // which will ensure that if anyone is using the list
+    // they won't get it removed while using it.
+    Clear();
 }
 
 
@@ -128,6 +132,29 @@ ThreadList::FindThreadByID (lldb::tid_t
 }
 
 ThreadSP
+ThreadList::RemoveThreadByID (lldb::tid_t tid, bool can_update)
+{
+    Mutex::Locker locker(m_threads_mutex);
+    
+    if (can_update)
+        m_process->UpdateThreadListIfNeeded();
+    
+    ThreadSP thread_sp;
+    uint32_t idx = 0;
+    const uint32_t num_threads = m_threads.size();
+    for (idx = 0; idx < num_threads; ++idx)
+    {
+        if (m_threads[idx]->GetID() == tid)
+        {
+            thread_sp = m_threads[idx];
+            m_threads.erase(m_threads.begin()+idx);
+            break;
+        }
+    }
+    return thread_sp;
+}
+
+ThreadSP
 ThreadList::GetThreadSPForThreadPtr (Thread *thread_ptr)
 {
     ThreadSP thread_sp;
@@ -175,10 +202,9 @@ ThreadList::FindThreadByIndexID (uint32_
 bool
 ThreadList::ShouldStop (Event *event_ptr)
 {
-    bool should_stop = false;    
     // Running events should never stop, obviously...
 
-    LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP));
+    Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP));
 
     // The ShouldStop method of the threads can do a whole lot of work,
     // running breakpoint commands & conditions, etc.  So we don't want
@@ -205,15 +231,31 @@ ThreadList::ShouldStop (Event *event_ptr
         log->Printf ("ThreadList::%s: %" PRIu64 " threads", __FUNCTION__, (uint64_t)m_threads.size());
     }
 
+    bool did_anybody_stop_for_a_reason = false;
+    bool should_stop = false;    
+    
     for (pos = threads_copy.begin(); pos != end; ++pos)
     {
         ThreadSP thread_sp(*pos);
         
+        did_anybody_stop_for_a_reason |= thread_sp->ThreadStoppedForAReason();
+        
         const bool thread_should_stop = thread_sp->ShouldStop(event_ptr);
         if (thread_should_stop)
             should_stop |= true;
     }
 
+    // We should never get a stop for which no thread had a stop reason, but sometimes we do see this -
+    // for instance when we first connect to a remote stub.  In that case we should stop, since we can't figure out
+    // the right thing to do and stopping gives the user control over what to do in this instance.
+    
+    if (!should_stop && !did_anybody_stop_for_a_reason)
+    {
+        should_stop = true;
+        if (log)
+            log->Printf ("ThreadList::%s we stopped but no threads had a stop reason, overriding should_stop and stopping.", __FUNCTION__);
+    }
+    
     if (log)
         log->Printf ("ThreadList::%s overall should_stop = %i", __FUNCTION__, should_stop);
 
@@ -238,7 +280,7 @@ ThreadList::ShouldReportStop (Event *eve
     m_process->UpdateThreadListIfNeeded();
     collection::iterator pos, end = m_threads.end();
 
-    LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP));
+    Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP));
 
     if (log)
         log->Printf ("ThreadList::%s %" PRIu64 " threads", __FUNCTION__, (uint64_t)m_threads.size());
@@ -293,7 +335,7 @@ ThreadList::ShouldReportRun (Event *even
     // Run through the threads and ask whether we should report this event.
     // The rule is NO vote wins over everything, a YES vote wins over no opinion.
 
-    LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP));
+    Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP));
     
     for (pos = m_threads.begin(); pos != end; ++pos)
     {
@@ -347,7 +389,7 @@ ThreadList::RefreshStateAfterStop ()
 
     m_process->UpdateThreadListIfNeeded();
     
-    LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP));
+    Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP));
     if (log && log->GetVerbose())
         log->Printf ("Turning off notification of new threads while single stepping a thread.");
 
@@ -402,14 +444,14 @@ ThreadList::WillResume ()
 
     if (wants_solo_run)
     {
-        LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP));
+        Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP));
         if (log && log->GetVerbose())
             log->Printf ("Turning on notification of new threads while single stepping a thread.");
         m_process->StartNoticingNewThreads();
     }
     else
     {
-        LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP));
+        Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP));
         if (log && log->GetVerbose())
             log->Printf ("Turning off notification of new threads while single stepping a thread.");
         m_process->StopNoticingNewThreads();

Modified: lldb/branches/windows/source/Target/ThreadPlan.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Target/ThreadPlan.cpp?rev=179679&r1=179678&r2=179679&view=diff
==============================================================================
--- lldb/branches/windows/source/Target/ThreadPlan.cpp (original)
+++ lldb/branches/windows/source/Target/ThreadPlan.cpp Wed Apr 17 03:38:48 2013
@@ -79,7 +79,7 @@ ThreadPlan::MischiefManaged ()
 Vote
 ThreadPlan::ShouldReportStop (Event *event_ptr)
 {
-    LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP));
+    Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP));
 
     if (m_stop_vote == eVoteNoOpinion)
     {
@@ -133,7 +133,7 @@ ThreadPlan::WillResume (StateType resume
 {
     if (current_plan)
     {
-        LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP));
+        Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP));
 
         if (log)
         {

Modified: lldb/branches/windows/source/Target/ThreadPlanBase.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Target/ThreadPlanBase.cpp?rev=179679&r1=179678&r2=179679&view=diff
==============================================================================
--- lldb/branches/windows/source/Target/ThreadPlanBase.cpp (original)
+++ lldb/branches/windows/source/Target/ThreadPlanBase.cpp Wed Apr 17 03:38:48 2013
@@ -68,7 +68,7 @@ ThreadPlanBase::ValidatePlan (Stream *er
 }
 
 bool
-ThreadPlanBase::PlanExplainsStop ()
+ThreadPlanBase::PlanExplainsStop (Event *event_ptr)
 {
     // The base plan should defer to its tracer, since by default it
     // always handles the stop.
@@ -84,7 +84,7 @@ ThreadPlanBase::ShouldStop (Event *event
     m_stop_vote = eVoteYes;
     m_run_vote = eVoteYes;
 
-    LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP));
+    Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP));
 
     StopInfoSP stop_info_sp = GetPrivateStopReason();
     if (stop_info_sp)
@@ -101,7 +101,7 @@ ThreadPlanBase::ShouldStop (Event *event
 
         case eStopReasonBreakpoint:
         case eStopReasonWatchpoint:
-            if (stop_info_sp->ShouldStop(event_ptr))
+            if (stop_info_sp->ShouldStopSynchronous(event_ptr))
             {
                 // If we are going to stop for a breakpoint, then unship the other plans
                 // at this point.  Don't force the discard, however, so Master plans can stay

Modified: lldb/branches/windows/source/Target/ThreadPlanCallFunction.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Target/ThreadPlanCallFunction.cpp?rev=179679&r1=179678&r2=179679&view=diff
==============================================================================
--- lldb/branches/windows/source/Target/ThreadPlanCallFunction.cpp (original)
+++ lldb/branches/windows/source/Target/ThreadPlanCallFunction.cpp Wed Apr 17 03:38:48 2013
@@ -57,7 +57,7 @@ ThreadPlanCallFunction::ConstructorSetup
     
     TargetSP target_sp (thread.CalculateTarget());
 
-    LogSP log(lldb_private::GetLogIfAnyCategoriesSet (LIBLLDB_LOG_STEP));
+    Log *log(lldb_private::GetLogIfAnyCategoriesSet (LIBLLDB_LOG_STEP));
     
     SetBreakpoints();
     
@@ -68,8 +68,9 @@ ThreadPlanCallFunction::ConstructorSetup
     process_sp->ReadUnsignedIntegerFromMemory(m_function_sp, 4, 0, error);
     if (!error.Success())
     {
+        m_constructor_errors.Printf ("Trying to put the stack in unreadable memory at: 0x%" PRIx64 ".", m_function_sp);
         if (log)
-            log->Printf ("ThreadPlanCallFunction(%p): Trying to put the stack in unreadable memory at: 0x%" PRIx64 ".", this, m_function_sp);
+            log->Printf ("ThreadPlanCallFunction(%p): %s.", this, m_constructor_errors.GetData());
         return false;
     }
     
@@ -77,8 +78,9 @@ ThreadPlanCallFunction::ConstructorSetup
 
     if (exe_module == NULL)
     {
+        m_constructor_errors.Printf ("Can't execute code without an executable module.");
         if (log)
-            log->Printf ("ThreadPlanCallFunction(%p): Can't execute code without an executable module.", this);
+            log->Printf ("ThreadPlanCallFunction(%p): %s.", this, m_constructor_errors.GetData());
         return false;
     }
     else
@@ -86,17 +88,21 @@ ThreadPlanCallFunction::ConstructorSetup
         ObjectFile *objectFile = exe_module->GetObjectFile();
         if (!objectFile)
         {
+            m_constructor_errors.Printf ("Could not find object file for module \"%s\".", 
+                                         exe_module->GetFileSpec().GetFilename().AsCString());
+
             if (log)
-                log->Printf ("ThreadPlanCallFunction(%p): Could not find object file for module \"%s\".", 
-                             this, exe_module->GetFileSpec().GetFilename().AsCString());
+                log->Printf ("ThreadPlanCallFunction(%p): %s.", this, m_constructor_errors.GetData());
             return false;
         }
+        
         m_start_addr = objectFile->GetEntryPointAddress();
         if (!m_start_addr.IsValid())
         {
+            m_constructor_errors.Printf ("Could not find entry point address for executable module \"%s\".", 
+                                         exe_module->GetFileSpec().GetFilename().AsCString());
             if (log)
-                log->Printf ("ThreadPlanCallFunction(%p): Could not find entry point address for executable module \"%s\".", 
-                             this, exe_module->GetFileSpec().GetFilename().AsCString());
+                log->Printf ("ThreadPlanCallFunction(%p): %s.", this, m_constructor_errors.GetData());
             return false;
         }
     }
@@ -109,8 +115,9 @@ ThreadPlanCallFunction::ConstructorSetup
 
     if (!thread.CheckpointThreadState (m_stored_thread_state))
     {
+        m_constructor_errors.Printf ("Setting up ThreadPlanCallFunction, failed to checkpoint thread state.");
         if (log)
-            log->Printf ("ThreadPlanCallFunction(%p): Setting up ThreadPlanCallFunction, failed to checkpoint thread state.", this);
+            log->Printf ("ThreadPlanCallFunction(%p): %s.", this, m_constructor_errors.GetData());
         return false;
     }
     function_load_addr = m_function_addr.GetLoadAddress (target_sp.get());
@@ -119,11 +126,12 @@ ThreadPlanCallFunction::ConstructorSetup
 }
 
 ThreadPlanCallFunction::ThreadPlanCallFunction (Thread &thread,
-                                                Address &function,
+                                                const Address &function,
                                                 const ClangASTType &return_type,
                                                 addr_t arg,
                                                 bool stop_other_threads,
-                                                bool discard_on_error,
+                                                bool unwind_on_error,
+                                                bool ignore_breakpoints,
                                                 addr_t *this_arg,
                                                 addr_t *cmd_arg) :
     ThreadPlan (ThreadPlan::eKindCallFunction, "Call function plan", thread, eVoteNoOpinion, eVoteNoOpinion),
@@ -134,7 +142,8 @@ ThreadPlanCallFunction::ThreadPlanCallFu
     m_return_type (return_type),
     m_takedown_done (false),
     m_stop_address (LLDB_INVALID_ADDRESS),
-    m_discard_on_error (discard_on_error)
+    m_unwind_on_error (unwind_on_error),
+    m_ignore_breakpoints (ignore_breakpoints)
 {
     lldb::addr_t start_load_addr;
     ABI *abi;
@@ -180,10 +189,11 @@ ThreadPlanCallFunction::ThreadPlanCallFu
 
 
 ThreadPlanCallFunction::ThreadPlanCallFunction (Thread &thread,
-                                                Address &function,
+                                                const Address &function,
                                                 const ClangASTType &return_type,
                                                 bool stop_other_threads,
-                                                bool discard_on_error,
+                                                bool unwind_on_error,
+                                                bool ignore_breakpoints,
                                                 addr_t *arg1_ptr,
                                                 addr_t *arg2_ptr,
                                                 addr_t *arg3_ptr,
@@ -198,7 +208,8 @@ ThreadPlanCallFunction::ThreadPlanCallFu
     m_return_type (return_type),
     m_takedown_done (false),
     m_stop_address (LLDB_INVALID_ADDRESS),
-    m_discard_on_error (discard_on_error)
+    m_unwind_on_error (unwind_on_error),
+    m_ignore_breakpoints (ignore_breakpoints)
 {
     lldb::addr_t start_load_addr;
     ABI *abi;
@@ -227,13 +238,13 @@ ThreadPlanCallFunction::ThreadPlanCallFu
 
 ThreadPlanCallFunction::~ThreadPlanCallFunction ()
 {
-    DoTakedown(true);
+    DoTakedown(PlanSucceeded());
 }
 
 void
 ThreadPlanCallFunction::ReportRegisterState (const char *message)
 {
-    LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP | LIBLLDB_LOG_VERBOSE));
+    Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP | LIBLLDB_LOG_VERBOSE));
     if (log)
     {
         StreamString strm;
@@ -261,7 +272,7 @@ ThreadPlanCallFunction::ReportRegisterSt
 void
 ThreadPlanCallFunction::DoTakedown (bool success)
 {
-    LogSP log(lldb_private::GetLogIfAnyCategoriesSet (LIBLLDB_LOG_STEP));
+    Log *log(lldb_private::GetLogIfAnyCategoriesSet (LIBLLDB_LOG_STEP));
     
     if (!m_valid)
     {
@@ -305,7 +316,7 @@ ThreadPlanCallFunction::DoTakedown (bool
 void
 ThreadPlanCallFunction::WillPop ()
 {
-    DoTakedown(true);
+    DoTakedown(PlanSucceeded());
 }
 
 void
@@ -326,20 +337,43 @@ bool
 ThreadPlanCallFunction::ValidatePlan (Stream *error)
 {
     if (!m_valid)
+    {
+        if (error)
+        {
+            if (m_constructor_errors.GetSize() > 0)
+                error->PutCString (m_constructor_errors.GetData());
+            else
+                error->PutCString ("Unknown error");
+        }
         return false;
+    }
 
     return true;
 }
 
+
+Vote
+ThreadPlanCallFunction::ShouldReportStop(Event *event_ptr)
+{
+    if (m_takedown_done || IsPlanComplete())
+        return eVoteYes;
+    else
+        return ThreadPlan::ShouldReportStop(event_ptr);
+}
+
 bool
-ThreadPlanCallFunction::PlanExplainsStop ()
+ThreadPlanCallFunction::PlanExplainsStop (Event *event_ptr)
 {    
+    Log *log(lldb_private::GetLogIfAnyCategoriesSet (LIBLLDB_LOG_STEP|LIBLLDB_LOG_PROCESS));
     m_real_stop_info_sp = GetPrivateStopReason();
     
     // If our subplan knows why we stopped, even if it's done (which would forward the question to us)
     // we answer yes.
-    if (m_subplan_sp.get() != NULL && m_subplan_sp->PlanExplainsStop())
+    if (m_subplan_sp.get() != NULL && m_subplan_sp->PlanExplainsStop(event_ptr))
+    {
+        SetPlanComplete();
         return true;
+    }
     
     // Check if the breakpoint is one of ours.
     
@@ -348,16 +382,15 @@ ThreadPlanCallFunction::PlanExplainsStop
         stop_reason = eStopReasonNone;
     else
         stop_reason = m_real_stop_info_sp->GetStopReason();
+    if (log)
+        log->Printf ("ThreadPlanCallFunction::PlanExplainsStop: Got stop reason - %s.", Thread::StopReasonAsCString(stop_reason));
 
     if (stop_reason == eStopReasonBreakpoint && BreakpointsExplainStop())
         return true;
     
-    // If we don't want to discard this plan, than any stop we don't understand should be propagated up the stack.
-    if (!m_discard_on_error)
-        return false;
-            
-    // Otherwise, check the case where we stopped for an internal breakpoint, in that case, continue on.
-    // If it is not an internal breakpoint, consult OkayToDiscard.
+    // We control breakpoints separately from other "stop reasons."  So first,
+    // check the case where we stopped for an internal breakpoint, in that case, continue on.
+    // If it is not an internal breakpoint, consult m_ignore_breakpoints.
     
     
     if (stop_reason == eStopReasonBreakpoint)
@@ -374,6 +407,8 @@ ThreadPlanCallFunction::PlanExplainsStop
             for (uint32_t i = 0; i < num_owners; i++)
             {
                 Breakpoint &bp = bp_site_sp->GetOwnerAtIndex(i)->GetBreakpoint();
+                if (log)
+                    log->Printf ("ThreadPlanCallFunction::PlanExplainsStop: hit breakpoint %d while calling function", bp.GetID());
                 
                 if (!bp.IsInternal())
                 {
@@ -382,16 +417,32 @@ ThreadPlanCallFunction::PlanExplainsStop
                 }
             }
             if (is_internal)
+            {
+                if (log)
+                    log->Printf ("ThreadPlanCallFunction::PlanExplainsStop hit an internal breakpoint, not stopping.");
                 return false;
+            }
         }
-        
-        if (m_discard_on_error)
+
+        if (m_ignore_breakpoints)
         {
-            DoTakedown(false);
+            if (log)
+                log->Printf("ThreadPlanCallFunction::PlanExplainsStop: we are ignoring breakpoints, overriding breakpoint stop info ShouldStop, returning true");
+            m_real_stop_info_sp->OverrideShouldStop(false);
             return true;
         }
         else
+        {
+            if (log)
+                log->Printf("ThreadPlanCallFunction::PlanExplainsStop: we are not ignoring breakpoints, overriding breakpoint stop info ShouldStop, returning true");
+            m_real_stop_info_sp->OverrideShouldStop(true);
             return false;
+        }
+    }
+    else if (!m_unwind_on_error)
+    {
+        // If we don't want to discard this plan, than any stop we don't understand should be propagated up the stack.
+        return false;
     }
     else
     {
@@ -399,30 +450,38 @@ ThreadPlanCallFunction::PlanExplainsStop
         // If we want to discard the plan, then we say we explain the stop
         // but if we are going to be discarded, let whoever is above us
         // explain the stop.
-        if (m_subplan_sp)
+        // But don't discard the plan if the stop would restart itself (for instance if it is a
+        // signal that is set not to stop.  Check that here first.  We just say we explain the stop
+        // but aren't done and everything will continue on from there.
+        
+        if (m_real_stop_info_sp->ShouldStopSynchronous(event_ptr))
         {
-            if (m_discard_on_error)
+            SetPlanComplete(false);
+            if (m_subplan_sp)
             {
-                DoTakedown(false);
-                return true;
+                if (m_unwind_on_error)
+                    return true;
+                else
+                    return false;
             }
             else
                 return false;
         }
         else
-            return false;
+            return true;
     }
 }
 
 bool
 ThreadPlanCallFunction::ShouldStop (Event *event_ptr)
 {
-    if (IsPlanComplete() || PlanExplainsStop())
+    // We do some computation in PlanExplainsStop that may or may not set the plan as complete.
+    // We need to do that here to make sure our state is correct.
+    PlanExplainsStop(event_ptr);
+    
+    if (IsPlanComplete())
     {
         ReportRegisterState ("Function completed.  Register state was:");
-        
-        DoTakedown(true);
-        
         return true;
     }
     else
@@ -481,10 +540,10 @@ ThreadPlanCallFunction::WillStop ()
 bool
 ThreadPlanCallFunction::MischiefManaged ()
 {
+    Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP));
+    
     if (IsPlanComplete())
     {
-        LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP));
-
         if (log)
             log->Printf("ThreadPlanCallFunction(%p): Completed call function plan.", this);
 
@@ -527,13 +586,14 @@ ThreadPlanCallFunction::BreakpointsExpla
 {
     StopInfoSP stop_info_sp = GetPrivateStopReason();
     
-    if (m_cxx_language_runtime &&
-        m_cxx_language_runtime->ExceptionBreakpointsExplainStop(stop_info_sp))
-        return true;
-    
-    if (m_objc_language_runtime &&
-        m_objc_language_runtime->ExceptionBreakpointsExplainStop(stop_info_sp))
+    if ((m_cxx_language_runtime &&
+            m_cxx_language_runtime->ExceptionBreakpointsExplainStop(stop_info_sp))
+       ||(m_objc_language_runtime &&
+            m_objc_language_runtime->ExceptionBreakpointsExplainStop(stop_info_sp)))
+    {
+        SetPlanComplete(false);
         return true;
+    }
     
     return false;
 }

Modified: lldb/branches/windows/source/Target/ThreadPlanCallUserExpression.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Target/ThreadPlanCallUserExpression.cpp?rev=179679&r1=179678&r2=179679&view=diff
==============================================================================
--- lldb/branches/windows/source/Target/ThreadPlanCallUserExpression.cpp (original)
+++ lldb/branches/windows/source/Target/ThreadPlanCallUserExpression.cpp Wed Apr 17 03:38:48 2013
@@ -40,11 +40,12 @@ ThreadPlanCallUserExpression::ThreadPlan
                                                 Address &function,
                                                 lldb::addr_t arg,
                                                 bool stop_other_threads,
-                                                bool discard_on_error,
+                                                bool unwind_on_error,
+                                                bool ignore_breakpoints,
                                                 lldb::addr_t *this_arg,
                                                 lldb::addr_t *cmd_arg,
                                                 ClangUserExpression::ClangUserExpressionSP &user_expression_sp) :
-    ThreadPlanCallFunction (thread, function, ClangASTType(), arg, stop_other_threads, discard_on_error, this_arg, cmd_arg),
+    ThreadPlanCallFunction (thread, function, ClangASTType(), arg, stop_other_threads, unwind_on_error, ignore_breakpoints, this_arg, cmd_arg),
     m_user_expression_sp (user_expression_sp)
 {
     // User expressions are generally "User generated" so we should set them up to stop when done.

Modified: lldb/branches/windows/source/Target/ThreadPlanRunToAddress.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Target/ThreadPlanRunToAddress.cpp?rev=179679&r1=179678&r2=179679&view=diff
==============================================================================
--- lldb/branches/windows/source/Target/ThreadPlanRunToAddress.cpp (original)
+++ lldb/branches/windows/source/Target/ThreadPlanRunToAddress.cpp Wed Apr 17 03:38:48 2013
@@ -93,6 +93,7 @@ ThreadPlanRunToAddress::SetInitialBreakp
         {
             m_break_ids[i] = breakpoint->GetID();
             breakpoint->SetThreadID(m_thread.GetID());
+            breakpoint->SetBreakpointKind("run-to-address");
         }
     }
 }
@@ -187,7 +188,7 @@ ThreadPlanRunToAddress::ValidatePlan (St
 }
 
 bool
-ThreadPlanRunToAddress::PlanExplainsStop ()
+ThreadPlanRunToAddress::PlanExplainsStop (Event *event_ptr)
 {
     return AtOurAddress();
 }
@@ -225,7 +226,7 @@ ThreadPlanRunToAddress::WillStop ()
 bool
 ThreadPlanRunToAddress::MischiefManaged ()
 {
-    LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP));
+    Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP));
 
     if (AtOurAddress())
     {

Modified: lldb/branches/windows/source/Target/ThreadPlanShouldStopHere.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Target/ThreadPlanShouldStopHere.cpp?rev=179679&r1=179678&r2=179679&view=diff
==============================================================================
--- lldb/branches/windows/source/Target/ThreadPlanShouldStopHere.cpp (original)
+++ lldb/branches/windows/source/Target/ThreadPlanShouldStopHere.cpp Wed Apr 17 03:38:48 2013
@@ -51,7 +51,7 @@ ThreadPlanShouldStopHere::InvokeShouldSt
     if (m_callback)
     {
         ThreadPlan *return_plan = m_callback (m_owner, m_flags, m_baton);
-        LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP));
+        Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP));
         if (log)
         {
             lldb::addr_t current_addr = m_owner->GetThread().GetRegisterContext()->GetPC(0);

Modified: lldb/branches/windows/source/Target/ThreadPlanStepInRange.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Target/ThreadPlanStepInRange.cpp?rev=179679&r1=179678&r2=179679&view=diff
==============================================================================
--- lldb/branches/windows/source/Target/ThreadPlanStepInRange.cpp (original)
+++ lldb/branches/windows/source/Target/ThreadPlanStepInRange.cpp Wed Apr 17 03:38:48 2013
@@ -89,7 +89,7 @@ ThreadPlanStepInRange::GetDescription (S
 bool
 ThreadPlanStepInRange::ShouldStop (Event *event_ptr)
 {
-    LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP));
+    Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP));
     m_no_more_plans = false;
     
     if (log)
@@ -274,7 +274,30 @@ ThreadPlanStepInRange::FrameMatchesAvoid
         {
             const char *frame_function_name = sc.GetFunctionName().GetCString();
             if (frame_function_name)
-               return avoid_regexp_to_use->Execute(frame_function_name);
+            {
+                size_t num_matches = 0;
+                Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP));
+                if (log)
+                    num_matches = 1;
+                
+                RegularExpression::Match regex_match(num_matches);
+
+                bool return_value = avoid_regexp_to_use->Execute(frame_function_name, &regex_match);
+                if (return_value)
+                {
+                    if (log)
+                    {
+                        std::string match;
+                        regex_match.GetMatchAtIndex(frame_function_name,0, match);
+                        log->Printf ("Stepping out of function \"%s\" because it matches the avoid regexp \"%s\" - match substring: \"%s\".",
+                                     frame_function_name,
+                                     avoid_regexp_to_use->GetText(),
+                                     match.c_str());
+                    }
+
+                }
+                return return_value;
+            }
         }
     }
     return false;
@@ -285,12 +308,12 @@ ThreadPlanStepInRange::DefaultShouldStop
 {
     bool should_step_out = false;
     StackFrame *frame = current_plan->GetThread().GetStackFrameAtIndex(0).get();
+    Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP));
 
     if (flags.Test(eAvoidNoDebug))
     {
         if (!frame->HasDebugInformation())
         {
-            LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP));
             if (log)
                 log->Printf ("Stepping out of frame with no debug info");
 
@@ -321,13 +344,18 @@ ThreadPlanStepInRange::DefaultShouldStop
                     else if (strstr (function_name, target_name) == NULL)
                         should_step_out = true;
                 }
+                if (log && should_step_out)
+                    log->Printf("Stepping out of frame %s which did not match step into target %s.",
+                                sc.GetFunctionName().AsCString(),
+                                step_in_range_plan->m_step_into_target.AsCString());
             }
         }
         
         if (!should_step_out)
         {
-                ThreadPlanStepInRange *step_in_range_plan = static_cast<ThreadPlanStepInRange *> (current_plan);
-                should_step_out = step_in_range_plan->FrameMatchesAvoidRegexp ();
+            ThreadPlanStepInRange *step_in_range_plan = static_cast<ThreadPlanStepInRange *> (current_plan);
+            // Don't log the should_step_out here, it's easier to do it in FrameMatchesAvoidRegexp.
+            should_step_out = step_in_range_plan->FrameMatchesAvoidRegexp ();
         }
     }
     
@@ -351,7 +379,7 @@ ThreadPlanStepInRange::DefaultShouldStop
 }
 
 bool
-ThreadPlanStepInRange::PlanExplainsStop ()
+ThreadPlanStepInRange::PlanExplainsStop (Event *event_ptr)
 {
     // We always explain a stop.  Either we've just done a single step, in which
     // case we'll do our ordinary processing, or we stopped for some
@@ -386,7 +414,7 @@ ThreadPlanStepInRange::PlanExplainsStop
         case eStopReasonExec:
         case eStopReasonThreadExiting:
             {
-                LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP));
+                Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP));
                 if (log)
                     log->PutCString ("ThreadPlanStepInRange got asked if it explains the stop for some reason other than step.");
             }
@@ -408,7 +436,7 @@ ThreadPlanStepInRange::WillResume (lldb:
         bool step_without_resume = m_thread.DecrementCurrentInlinedDepth();
         if (step_without_resume)
         {
-            LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP));
+            Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP));
             if (log)
                 log->Printf ("ThreadPlanStepInRange::WillResume: returning false, inline_depth: %d",
                              m_thread.GetCurrentInlinedDepth());

Modified: lldb/branches/windows/source/Target/ThreadPlanStepInstruction.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Target/ThreadPlanStepInstruction.cpp?rev=179679&r1=179678&r2=179679&view=diff
==============================================================================
--- lldb/branches/windows/source/Target/ThreadPlanStepInstruction.cpp (original)
+++ lldb/branches/windows/source/Target/ThreadPlanStepInstruction.cpp Wed Apr 17 03:38:48 2013
@@ -81,7 +81,7 @@ ThreadPlanStepInstruction::ValidatePlan
 }
 
 bool
-ThreadPlanStepInstruction::PlanExplainsStop ()
+ThreadPlanStepInstruction::PlanExplainsStop (Event *event_ptr)
 {
     StopInfoSP stop_info_sp = GetPrivateStopReason();
     if (stop_info_sp)
@@ -100,7 +100,7 @@ ThreadPlanStepInstruction::ShouldStop (E
 {
     if (m_step_over)
     {
-        LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP));
+        Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP));
         
         StackID cur_frame_zero_id = m_thread.GetStackFrameAtIndex(0)->GetStackID();
         
@@ -190,7 +190,7 @@ ThreadPlanStepInstruction::MischiefManag
 {
     if (IsPlanComplete())
     {
-        LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP));
+        Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP));
         if (log)
             log->Printf("Completed single instruction step plan.");
         ThreadPlan::MischiefManaged ();

Modified: lldb/branches/windows/source/Target/ThreadPlanStepOut.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Target/ThreadPlanStepOut.cpp?rev=179679&r1=179678&r2=179679&view=diff
==============================================================================
--- lldb/branches/windows/source/Target/ThreadPlanStepOut.cpp (original)
+++ lldb/branches/windows/source/Target/ThreadPlanStepOut.cpp Wed Apr 17 03:38:48 2013
@@ -107,6 +107,7 @@ ThreadPlanStepOut::ThreadPlanStepOut
         {
             return_bp->SetThreadID(m_thread.GetID());
             m_return_bp_id = return_bp->GetID();
+            return_bp->SetBreakpointKind ("step-out");
         }
         
         if (immediate_return_from_sp)
@@ -173,7 +174,7 @@ ThreadPlanStepOut::ValidatePlan (Stream
 }
 
 bool
-ThreadPlanStepOut::PlanExplainsStop ()
+ThreadPlanStepOut::PlanExplainsStop (Event *event_ptr)
 {
     // If one of our child plans just finished, then we do explain the stop.
     if (m_step_out_plan_sp)
@@ -377,7 +378,7 @@ ThreadPlanStepOut::MischiefManaged ()
         // reason and we're now stopping for some other reason altogether, then we're done
         // with this step out operation.
 
-        LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP));
+        Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP));
         if (log)
             log->Printf("Completed step out plan.");
         if (m_return_bp_id != LLDB_INVALID_BREAK_ID)
@@ -405,7 +406,7 @@ ThreadPlanStepOut::QueueInlinedStepPlan
     if (!immediate_return_from_sp)
         return false;
         
-    LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP));
+    Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP));
     if (log)
     {   
         StreamString s;

Modified: lldb/branches/windows/source/Target/ThreadPlanStepOverBreakpoint.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Target/ThreadPlanStepOverBreakpoint.cpp?rev=179679&r1=179678&r2=179679&view=diff
==============================================================================
--- lldb/branches/windows/source/Target/ThreadPlanStepOverBreakpoint.cpp (original)
+++ lldb/branches/windows/source/Target/ThreadPlanStepOverBreakpoint.cpp Wed Apr 17 03:38:48 2013
@@ -58,7 +58,7 @@ ThreadPlanStepOverBreakpoint::ValidatePl
 }
 
 bool
-ThreadPlanStepOverBreakpoint::PlanExplainsStop ()
+ThreadPlanStepOverBreakpoint::PlanExplainsStop (Event *event_ptr)
 {
     StopInfoSP stop_info_sp = GetPrivateStopReason();
     if (stop_info_sp)
@@ -99,7 +99,7 @@ ThreadPlanStepOverBreakpoint::WillResume
     {
         BreakpointSiteSP bp_site_sp (m_thread.GetProcess()->GetBreakpointSiteList().FindByAddress (m_breakpoint_addr));
         if (bp_site_sp  && bp_site_sp->IsEnabled())
-            m_thread.GetProcess()->DisableBreakpoint (bp_site_sp.get());
+            m_thread.GetProcess()->DisableBreakpointSite (bp_site_sp.get());
     }
     return true;
 }
@@ -109,7 +109,7 @@ ThreadPlanStepOverBreakpoint::WillStop (
 {
     BreakpointSiteSP bp_site_sp (m_thread.GetProcess()->GetBreakpointSiteList().FindByAddress (m_breakpoint_addr));
     if (bp_site_sp)
-        m_thread.GetProcess()->EnableBreakpoint (bp_site_sp.get());
+        m_thread.GetProcess()->EnableBreakpointSite (bp_site_sp.get());
     return true;
 }
 
@@ -126,13 +126,13 @@ ThreadPlanStepOverBreakpoint::MischiefMa
     }
     else
     {
-        LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP));
+        Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP));
         if (log)
             log->Printf("Completed step over breakpoint plan.");
         // Otherwise, re-enable the breakpoint we were stepping over, and we're done.
         BreakpointSiteSP bp_site_sp (m_thread.GetProcess()->GetBreakpointSiteList().FindByAddress (m_breakpoint_addr));
         if (bp_site_sp)
-            m_thread.GetProcess()->EnableBreakpoint (bp_site_sp.get());
+            m_thread.GetProcess()->EnableBreakpointSite (bp_site_sp.get());
         ThreadPlan::MischiefManaged ();
         return true;
     }

Modified: lldb/branches/windows/source/Target/ThreadPlanStepOverRange.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Target/ThreadPlanStepOverRange.cpp?rev=179679&r1=179678&r2=179679&view=diff
==============================================================================
--- lldb/branches/windows/source/Target/ThreadPlanStepOverRange.cpp (original)
+++ lldb/branches/windows/source/Target/ThreadPlanStepOverRange.cpp Wed Apr 17 03:38:48 2013
@@ -68,7 +68,7 @@ ThreadPlanStepOverRange::GetDescription
 bool
 ThreadPlanStepOverRange::ShouldStop (Event *event_ptr)
 {
-    LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP));
+    Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP));
 
     if (log)
     {
@@ -290,7 +290,7 @@ ThreadPlanStepOverRange::ShouldStop (Eve
 }
 
 bool
-ThreadPlanStepOverRange::PlanExplainsStop ()
+ThreadPlanStepOverRange::PlanExplainsStop (Event *event_ptr)
 {
     // For crashes, breakpoint hits, signals, etc, let the base plan (or some plan above us)
     // handle the stop.  That way the user can see the stop, step around, and then when they
@@ -299,7 +299,7 @@ ThreadPlanStepOverRange::PlanExplainsSto
     // Note, unlike the step in range plan, we don't mark ourselves complete if we hit an
     // unexplained breakpoint/crash.
     
-    LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP));
+    Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP));
     StopInfoSP stop_info_sp = GetPrivateStopReason();
     if (stop_info_sp)
     {
@@ -344,7 +344,7 @@ ThreadPlanStepOverRange::WillResume (lld
             bool in_inlined_stack = m_thread.DecrementCurrentInlinedDepth();
             if (in_inlined_stack)
             {
-                LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP));
+                Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP));
                 if (log)
                     log->Printf ("ThreadPlanStepInRange::WillResume: adjusting range to the frame at inlined depth %d.",
                                  m_thread.GetCurrentInlinedDepth());

Modified: lldb/branches/windows/source/Target/ThreadPlanStepRange.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Target/ThreadPlanStepRange.cpp?rev=179679&r1=179678&r2=179679&view=diff
==============================================================================
--- lldb/branches/windows/source/Target/ThreadPlanStepRange.cpp (original)
+++ lldb/branches/windows/source/Target/ThreadPlanStepRange.cpp Wed Apr 17 03:38:48 2013
@@ -15,6 +15,8 @@
 // Project includes
 
 #include "lldb/lldb-private-log.h"
+#include "lldb/Breakpoint/BreakpointLocation.h"
+#include "lldb/Breakpoint/BreakpointSite.h"
 #include "lldb/Core/Disassembler.h"
 #include "lldb/Core/Log.h"
 #include "lldb/Core/Stream.h"
@@ -49,8 +51,10 @@ ThreadPlanStepRange::ThreadPlanStepRange
     m_stop_others (stop_others),
     m_stack_id (),
     m_no_more_plans (false),
-    m_first_run_event (true)
+    m_first_run_event (true),
+    m_use_fast_step(false)
 {
+    m_use_fast_step = GetTarget().GetUseFastStepping();
     AddRange(range);
     m_stack_id = m_thread.GetStackFrameAtIndex(0)->GetStackID();
 }
@@ -76,7 +80,7 @@ ThreadPlanStepRange::ValidatePlan (Strea
 Vote
 ThreadPlanStepRange::ShouldReportStop (Event *event_ptr)
 {
-    LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP));
+    Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP));
 
     const Vote vote = IsPlanComplete() ? eVoteYes : eVoteNo;
     if (log)
@@ -115,7 +119,7 @@ ThreadPlanStepRange::DumpRanges(Stream *
 bool
 ThreadPlanStepRange::InRange ()
 {
-    LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP));
+    Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP));
     bool ret_value = false;
 
     lldb::addr_t pc_load_addr = m_thread.GetRegisterContext()->GetPC();
@@ -265,8 +269,11 @@ ThreadPlanStepRange::GetInstructionsForA
             {
                 //Disassemble the address range given:
                 ExecutionContext exe_ctx (m_thread.GetProcess());
+                const char *plugin_name = NULL;
+                const char *flavor = NULL;
                 m_instruction_ranges[i] = Disassembler::DisassembleRange(GetTarget().GetArchitecture(),
-                                                                         NULL,
+                                                                         plugin_name,
+                                                                         flavor,
                                                                          exe_ctx,
                                                                          m_address_ranges[i]);
                 
@@ -297,6 +304,9 @@ ThreadPlanStepRange::ClearNextBranchBrea
 {
     if (m_next_branch_bp_sp)
     {
+        Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP));
+        if (log)
+            log->Printf ("Removing next branch breakpoint: %d.", m_next_branch_bp_sp->GetID());
         GetTarget().RemoveBreakpointByID (m_next_branch_bp_sp->GetID());
         m_next_branch_bp_sp.reset();
     }
@@ -305,11 +315,15 @@ ThreadPlanStepRange::ClearNextBranchBrea
 bool
 ThreadPlanStepRange::SetNextBranchBreakpoint ()
 {
+    if (m_next_branch_bp_sp)
+        return true;
+
+    Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP));
     // Stepping through ranges using breakpoints doesn't work yet, but with this off we fall back to instruction
     // single stepping.
-    return false;
-    // Always clear the next branch breakpoint, we don't want to leave one of these stranded.
-    ClearNextBranchBreakpoint();
+    if (!m_use_fast_step)
+         return false;
+
     lldb::addr_t cur_addr = GetThread().GetRegisterContext()->GetPC();
     // Find the current address in our address ranges, and fetch the disassembly if we haven't already:
     size_t pc_index;
@@ -327,15 +341,39 @@ ThreadPlanStepRange::SetNextBranchBreakp
         // If we didn't find a branch, run to the end of the range.
         if (branch_index == UINT32_MAX)
         {
-            branch_index = instructions->GetSize() - 2;
+            branch_index = instructions->GetSize() - 1;
         }
+        
         if (branch_index - pc_index > 1)
         {
             const bool is_internal = true;
             run_to_address = instructions->GetInstructionAtIndex(branch_index)->GetAddress();
             m_next_branch_bp_sp = GetTarget().CreateBreakpoint(run_to_address, is_internal);
-            m_next_branch_bp_sp->SetThreadID(m_thread.GetID());
-            return true;
+            if (m_next_branch_bp_sp)
+            {
+                if (log)
+                {
+                    lldb::break_id_t bp_site_id = LLDB_INVALID_BREAK_ID;
+                    BreakpointLocationSP bp_loc = m_next_branch_bp_sp->GetLocationAtIndex(0);
+                    if (bp_loc)
+                    {
+                        BreakpointSiteSP bp_site = bp_loc->GetBreakpointSite();
+                        if (bp_site)
+                        {
+                            bp_site_id = bp_site->GetID();
+                        }
+                    }
+                    log->Printf ("ThreadPlanStepRange::SetNextBranchBreakpoint - Setting breakpoint %d (site %d) to run to address 0x%" PRIx64,
+                                 m_next_branch_bp_sp->GetID(),
+                                 bp_site_id,
+                                 run_to_address.GetLoadAddress(&m_thread.GetProcess()->GetTarget()));
+                }
+                m_next_branch_bp_sp->SetThreadID(m_thread.GetID());
+                m_next_branch_bp_sp->SetBreakpointKind ("next-branch-location");
+                return true;
+            }
+            else
+                return false;
         }
     }
     return false;
@@ -344,15 +382,39 @@ ThreadPlanStepRange::SetNextBranchBreakp
 bool
 ThreadPlanStepRange::NextRangeBreakpointExplainsStop (lldb::StopInfoSP stop_info_sp)
 {
+    Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP));
     if (!m_next_branch_bp_sp)
         return false;
     
     break_id_t bp_site_id = stop_info_sp->GetValue();
     BreakpointSiteSP bp_site_sp = m_thread.GetProcess()->GetBreakpointSiteList().FindByID(bp_site_id);
-    if (!bp_site_sp->IsBreakpointAtThisSite (m_next_branch_bp_sp->GetID()))
+    if (!bp_site_sp)
+        return false;
+    else if (!bp_site_sp->IsBreakpointAtThisSite (m_next_branch_bp_sp->GetID()))
         return false;
     else
-        return bp_site_sp->GetNumberOfOwners() == 1;
+    {
+        // If we've hit the next branch breakpoint, then clear it.
+        size_t num_owners = bp_site_sp->GetNumberOfOwners();
+        bool explains_stop = true;
+        // If all the owners are internal, then we are probably just stepping over this range from multiple threads,
+        // or multiple frames, so we want to continue.  If one is not internal, then we should not explain the stop,
+        // and let the user breakpoint handle the stop.
+        for (size_t i = 0; i < num_owners; i++)
+        {
+            if (!bp_site_sp->GetOwnerAtIndex(i)->GetBreakpoint().IsInternal())
+            {
+                explains_stop = false;
+                break;
+            }
+        }
+        if (log)
+            log->Printf ("ThreadPlanStepRange::NextRangeBreakpointExplainsStop - Hit next range breakpoint which has %zu owners - explains stop: %u.",
+                        num_owners,
+                        explains_stop);
+        ClearNextBranchBreakpoint();
+        return  explains_stop;
+    }
 }
 
 bool
@@ -405,9 +467,10 @@ ThreadPlanStepRange::MischiefManaged ()
 
     if (done)
     {
-        LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP));
+        Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP));
         if (log)
             log->Printf("Completed step through range plan.");
+        ClearNextBranchBreakpoint();
         ThreadPlan::MischiefManaged ();
         return true;
     }
@@ -421,7 +484,7 @@ ThreadPlanStepRange::MischiefManaged ()
 bool
 ThreadPlanStepRange::IsPlanStale ()
 {
-    LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP));
+    Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP));
     FrameComparison frame_order = CompareCurrentFrameToStartFrame();
     
     if (frame_order == eFrameCompareOlder)

Modified: lldb/branches/windows/source/Target/ThreadPlanStepThrough.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Target/ThreadPlanStepThrough.cpp?rev=179679&r1=179678&r2=179679&view=diff
==============================================================================
--- lldb/branches/windows/source/Target/ThreadPlanStepThrough.cpp (original)
+++ lldb/branches/windows/source/Target/ThreadPlanStepThrough.cpp Wed Apr 17 03:38:48 2013
@@ -61,8 +61,9 @@ ThreadPlanStepThrough::ThreadPlanStepThr
             {
                 return_bp->SetThreadID(m_thread.GetID());
                 m_backstop_bkpt_id = return_bp->GetID();
+                return_bp->SetBreakpointKind("step-through-backstop");
             }
-            LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP));
+            Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP));
             if (log)
             {
                 log->Printf ("Setting backstop breakpoint %d at address: 0x%" PRIx64, m_backstop_bkpt_id, m_backstop_addr);
@@ -95,7 +96,7 @@ ThreadPlanStepThrough::LookForPlanToStep
             m_sub_plan_sp = objc_runtime->GetStepThroughTrampolinePlan (m_thread, m_stop_others);
     }
     
-    LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP));
+    Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP));
     if (log)
     {
         lldb::addr_t current_address = GetThread().GetRegisterContext()->GetPC(0);
@@ -138,7 +139,7 @@ ThreadPlanStepThrough::ValidatePlan (Str
 }
 
 bool
-ThreadPlanStepThrough::PlanExplainsStop ()
+ThreadPlanStepThrough::PlanExplainsStop (Event *event_ptr)
 {
     // If we have a sub-plan, it will have been asked first if we explain the stop, and
     // we won't get asked.  The only time we would be the one directly asked this question
@@ -247,7 +248,7 @@ ThreadPlanStepThrough::ClearBackstopBrea
 bool
 ThreadPlanStepThrough::MischiefManaged ()
 {
-    LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP));
+    Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP));
 
     if (!IsPlanComplete())
     {
@@ -278,7 +279,7 @@ ThreadPlanStepThrough::HitOurBackstopBre
             
             if (cur_frame_zero_id == m_return_stack_id)
             {
-                LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP));
+                Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP));
                 if (log)
                     log->PutCString ("ThreadPlanStepThrough hit backstop breakpoint.");
                 return true;

Modified: lldb/branches/windows/source/Target/ThreadPlanStepUntil.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Target/ThreadPlanStepUntil.cpp?rev=179679&r1=179678&r2=179679&view=diff
==============================================================================
--- lldb/branches/windows/source/Target/ThreadPlanStepUntil.cpp (original)
+++ lldb/branches/windows/source/Target/ThreadPlanStepUntil.cpp Wed Apr 17 03:38:48 2013
@@ -73,6 +73,7 @@ ThreadPlanStepUntil::ThreadPlanStepUntil
             {
                 return_bp->SetThreadID(thread_id);
                 m_return_bp_id = return_bp->GetID();
+                return_bp->SetBreakpointKind ("until-return-backstop");
             }
         }
 
@@ -86,6 +87,7 @@ ThreadPlanStepUntil::ThreadPlanStepUntil
             {
                 until_bp->SetThreadID(thread_id);
                 m_until_points[address_list[i]] = until_bp->GetID();
+                until_bp->SetBreakpointKind("until-target");
             }
             else
             {
@@ -303,7 +305,7 @@ ThreadPlanStepUntil::AnalyzeStop()
 }
 
 bool
-ThreadPlanStepUntil::PlanExplainsStop ()
+ThreadPlanStepUntil::PlanExplainsStop (Event *event_ptr)
 {
     // We don't explain signals or breakpoints (breakpoints that handle stepping in or
     // out will be handled by a child plan.
@@ -396,7 +398,7 @@ ThreadPlanStepUntil::MischiefManaged ()
     bool done = false;
     if (IsPlanComplete())
     {
-        LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP));
+        Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP));
         if (log)
             log->Printf("Completed step until plan.");
 

Modified: lldb/branches/windows/source/Target/ThreadPlanTracer.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Target/ThreadPlanTracer.cpp?rev=179679&r1=179678&r2=179679&view=diff
==============================================================================
--- lldb/branches/windows/source/Target/ThreadPlanTracer.cpp (original)
+++ lldb/branches/windows/source/Target/ThreadPlanTracer.cpp Wed Apr 17 03:38:48 2013
@@ -120,7 +120,7 @@ Disassembler *
 ThreadPlanAssemblyTracer::GetDisassembler ()
 {
     if (m_disassembler_sp.get() == NULL)
-        m_disassembler_sp = Disassembler::FindPlugin(m_thread.GetProcess()->GetTarget().GetArchitecture(), NULL);
+        m_disassembler_sp = Disassembler::FindPlugin(m_thread.GetProcess()->GetTarget().GetArchitecture(), NULL, NULL);
     return m_disassembler_sp.get();
 }
 
@@ -208,10 +208,11 @@ ThreadPlanAssemblyTracer::Log ()
                                     process_sp->GetByteOrder(), 
                                     process_sp->GetAddressByteSize());
             
+			bool data_from_file = false;
             if (addr_valid)
-                disassembler->DecodeInstructions (pc_addr, extractor, 0, 1, false);
+                disassembler->DecodeInstructions (pc_addr, extractor, 0, 1, false, data_from_file);
             else
-                disassembler->DecodeInstructions (Address (pc), extractor, 0, 1, false);
+                disassembler->DecodeInstructions (Address (pc), extractor, 0, 1, false, data_from_file);
             
             InstructionList &instruction_list = disassembler->GetInstructionList();
             const uint32_t max_opcode_byte_size = instruction_list.GetMaxOpcocdeByteSize();

Modified: lldb/branches/windows/source/Utility/ARM_DWARF_Registers.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Utility/ARM_DWARF_Registers.cpp?rev=179679&r1=179678&r2=179679&view=diff
==============================================================================
--- lldb/branches/windows/source/Utility/ARM_DWARF_Registers.cpp (original)
+++ lldb/branches/windows/source/Utility/ARM_DWARF_Registers.cpp Wed Apr 17 03:38:48 2013
@@ -81,8 +81,8 @@ GetARMDWARFRegisterName (unsigned reg_nu
         case dwarf_f6:  return "f6";
         case dwarf_f7:  return "f7";
             
-        // Intel wireless MMX general purpose registers 0–7
-        // XScale accumulator register 0–7 (they do overlap with wCGR0 - wCGR7)
+        // Intel wireless MMX general purpose registers 0 - 7
+        // XScale accumulator register 0 - 7 (they do overlap with wCGR0 - wCGR7)
         case dwarf_wCGR0: return "wCGR0/ACC0";   
         case dwarf_wCGR1: return "wCGR1/ACC1";
         case dwarf_wCGR2: return "wCGR2/ACC2";
@@ -92,7 +92,7 @@ GetARMDWARFRegisterName (unsigned reg_nu
         case dwarf_wCGR6: return "wCGR6/ACC6";
         case dwarf_wCGR7: return "wCGR7/ACC7";
             
-        // Intel wireless MMX data registers 0–15
+        // Intel wireless MMX data registers 0 - 15
         case dwarf_wR0:   return "wR0";
         case dwarf_wR1:   return "wR1";
         case dwarf_wR2:   return "wR2";
@@ -140,7 +140,7 @@ GetARMDWARFRegisterName (unsigned reg_nu
         case dwarf_r13_svc:     return "r13_svc";
         case dwarf_r14_svc:     return "r14_svc";
             
-        // Intel wireless MMX control register in co-processor 0–7
+        // Intel wireless MMX control register in co-processor 0 - 7
         case dwarf_wC0:         return "wC0";
         case dwarf_wC1:         return "wC1";
         case dwarf_wC2:         return "wC2";
@@ -183,6 +183,24 @@ GetARMDWARFRegisterName (unsigned reg_nu
         case dwarf_d29:         return "d29";
         case dwarf_d30:         return "d30";
         case dwarf_d31:         return "d31";
+
+        // NEON 128-bit vector registers (overlays the d registers)
+        case dwarf_q0:          return "q0"; 
+        case dwarf_q1:          return "q1"; 
+        case dwarf_q2:          return "q2"; 
+        case dwarf_q3:          return "q3"; 
+        case dwarf_q4:          return "q4"; 
+        case dwarf_q5:          return "q5"; 
+        case dwarf_q6:          return "q6"; 
+        case dwarf_q7:          return "q7"; 
+        case dwarf_q8:          return "q8"; 
+        case dwarf_q9:          return "q9"; 
+        case dwarf_q10:         return "q10";
+        case dwarf_q11:         return "q11";
+        case dwarf_q12:         return "q12";
+        case dwarf_q13:         return "q13";
+        case dwarf_q14:         return "q14";
+        case dwarf_q15:         return "q15";
     }
     return 0;
 }
@@ -192,6 +210,13 @@ GetARMDWARFRegisterInfo (unsigned reg_nu
 {
     ::memset (&reg_info, 0, sizeof(RegisterInfo));
     ::memset (reg_info.kinds, LLDB_INVALID_REGNUM, sizeof(reg_info.kinds));
+
+    if (reg_num >= dwarf_q0 && reg_num <= dwarf_q15)
+    {
+        reg_info.byte_size = 16;
+        reg_info.format = eFormatVectorOfUInt8;
+        reg_info.encoding = eEncodingVector;
+    }
     
     if (reg_num >= dwarf_d0 && reg_num <= dwarf_d31)
     {
@@ -273,7 +298,7 @@ GetARMDWARFRegisterInfo (unsigned reg_nu
         case dwarf_s30: reg_info.name = "s30"; break;
         case dwarf_s31: reg_info.name = "s31"; break;
             
-            // FPA Registers 0-7
+        // FPA Registers 0-7
         case dwarf_f0:  reg_info.name = "f0"; break;
         case dwarf_f1:  reg_info.name = "f1"; break;
         case dwarf_f2:  reg_info.name = "f2"; break;
@@ -283,8 +308,8 @@ GetARMDWARFRegisterInfo (unsigned reg_nu
         case dwarf_f6:  reg_info.name = "f6"; break;
         case dwarf_f7:  reg_info.name = "f7"; break;
             
-            // Intel wireless MMX general purpose registers 0–7
-            // XScale accumulator register 0–7 (they do overlap with wCGR0 - wCGR7)
+        // Intel wireless MMX general purpose registers 0 - 7
+        // XScale accumulator register 0 - 7 (they do overlap with wCGR0 - wCGR7)
         case dwarf_wCGR0: reg_info.name = "wCGR0/ACC0"; break;   
         case dwarf_wCGR1: reg_info.name = "wCGR1/ACC1"; break;
         case dwarf_wCGR2: reg_info.name = "wCGR2/ACC2"; break;
@@ -294,7 +319,7 @@ GetARMDWARFRegisterInfo (unsigned reg_nu
         case dwarf_wCGR6: reg_info.name = "wCGR6/ACC6"; break;
         case dwarf_wCGR7: reg_info.name = "wCGR7/ACC7"; break;
             
-            // Intel wireless MMX data registers 0–15
+        // Intel wireless MMX data registers 0 - 15
         case dwarf_wR0:   reg_info.name = "wR0"; break;
         case dwarf_wR1:   reg_info.name = "wR1"; break;
         case dwarf_wR2:   reg_info.name = "wR2"; break;
@@ -342,7 +367,7 @@ GetARMDWARFRegisterInfo (unsigned reg_nu
         case dwarf_r13_svc:     reg_info.name = "r13_svc"; break;
         case dwarf_r14_svc:     reg_info.name = "r14_svc"; break;
             
-            // Intel wireless MMX control register in co-processor 0–7
+        // Intel wireless MMX control register in co-processor 0 - 7
         case dwarf_wC0:         reg_info.name = "wC0"; break;
         case dwarf_wC1:         reg_info.name = "wC1"; break;
         case dwarf_wC2:         reg_info.name = "wC2"; break;
@@ -352,7 +377,7 @@ GetARMDWARFRegisterInfo (unsigned reg_nu
         case dwarf_wC6:         reg_info.name = "wC6"; break;
         case dwarf_wC7:         reg_info.name = "wC7"; break;
             
-            // VFP-v3/Neon
+        // VFP-v3/Neon
         case dwarf_d0:          reg_info.name = "d0"; break;
         case dwarf_d1:          reg_info.name = "d1"; break;
         case dwarf_d2:          reg_info.name = "d2"; break;
@@ -385,6 +410,25 @@ GetARMDWARFRegisterInfo (unsigned reg_nu
         case dwarf_d29:         reg_info.name = "d29"; break;
         case dwarf_d30:         reg_info.name = "d30"; break;
         case dwarf_d31:         reg_info.name = "d31"; break;
+
+        // NEON 128-bit vector registers (overlays the d registers)
+        case dwarf_q0:          reg_info.name = "q0"; break;
+        case dwarf_q1:          reg_info.name = "q1"; break;
+        case dwarf_q2:          reg_info.name = "q2"; break;
+        case dwarf_q3:          reg_info.name = "q3"; break;
+        case dwarf_q4:          reg_info.name = "q4"; break;
+        case dwarf_q5:          reg_info.name = "q5"; break;
+        case dwarf_q6:          reg_info.name = "q6"; break;
+        case dwarf_q7:          reg_info.name = "q7"; break;
+        case dwarf_q8:          reg_info.name = "q8"; break;
+        case dwarf_q9:          reg_info.name = "q9"; break;
+        case dwarf_q10:         reg_info.name = "q10"; break;
+        case dwarf_q11:         reg_info.name = "q11"; break;
+        case dwarf_q12:         reg_info.name = "q12"; break;
+        case dwarf_q13:         reg_info.name = "q13"; break;
+        case dwarf_q14:         reg_info.name = "q14"; break;
+        case dwarf_q15:         reg_info.name = "q15"; break;
+
         default: return false;
     }
     return true;

Modified: lldb/branches/windows/source/Utility/ARM_DWARF_Registers.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Utility/ARM_DWARF_Registers.h?rev=179679&r1=179678&r2=179679&view=diff
==============================================================================
--- lldb/branches/windows/source/Utility/ARM_DWARF_Registers.h (original)
+++ lldb/branches/windows/source/Utility/ARM_DWARF_Registers.h Wed Apr 17 03:38:48 2013
@@ -75,7 +75,7 @@ enum
     dwarf_f6,
     dwarf_f7,
 
-    // Intel wireless MMX general purpose registers 0–7
+    // Intel wireless MMX general purpose registers 0 - 7
     dwarf_wCGR0 = 104,
     dwarf_wCGR1,
     dwarf_wCGR2,
@@ -85,7 +85,7 @@ enum
     dwarf_wCGR6,
     dwarf_wCGR7,
 
-    // XScale accumulator register 0–7 (they do overlap with wCGR0 - wCGR7)
+    // XScale accumulator register 0 - 7 (they do overlap with wCGR0 - wCGR7)
     dwarf_ACC0 = 104,
     dwarf_ACC1,
     dwarf_ACC2,
@@ -95,7 +95,7 @@ enum
     dwarf_ACC6,
     dwarf_ACC7,
 
-    // Intel wireless MMX data registers 0–15
+    // Intel wireless MMX data registers 0 - 15
     dwarf_wR0 = 112,
     dwarf_wR1,
     dwarf_wR2,
@@ -143,7 +143,7 @@ enum
     dwarf_r13_svc,
     dwarf_r14_svc,
 
-    // Intel wireless MMX control register in co-processor 0–7
+    // Intel wireless MMX control register in co-processor 0 - 7
     dwarf_wC0 = 192,
     dwarf_wC1,
     dwarf_wC2,

Modified: lldb/branches/windows/source/Utility/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Utility/CMakeLists.txt?rev=179679&r1=179678&r2=179679&view=diff
==============================================================================
--- lldb/branches/windows/source/Utility/CMakeLists.txt (original)
+++ lldb/branches/windows/source/Utility/CMakeLists.txt Wed Apr 17 03:38:48 2013
@@ -2,9 +2,12 @@ set(LLVM_NO_RTTI 1)
 
 add_lldb_library(lldbUtility
   ARM_DWARF_Registers.cpp
+  KQueue.cpp
   PseudoTerminal.cpp
   RefCounter.cpp
   SharingPtr.cpp
   StringExtractor.cpp
   StringExtractorGDBRemote.cpp
+  TimeSpecTimeout.cpp
   )
+

Modified: lldb/branches/windows/source/Utility/Makefile
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Utility/Makefile?rev=179679&r1=179678&r2=179679&view=diff
==============================================================================
--- lldb/branches/windows/source/Utility/Makefile (original)
+++ lldb/branches/windows/source/Utility/Makefile Wed Apr 17 03:38:48 2013
@@ -12,11 +12,4 @@ LIBRARYNAME := lldbUtility
 BUILD_ARCHIVE = 1
 NO_PEDANTIC = 1
 
-# Enable RTTI on GCC builds because liblldbCore.a requires RTTI.
-# See source/Core/Makefile for details.
-ifeq (g++,$(shell basename $(CXX)))
-  REQUIRES_RTTI = 1
-endif
-
-
 include $(LLDB_LEVEL)/Makefile

Modified: lldb/branches/windows/source/Utility/StringExtractor.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Utility/StringExtractor.cpp?rev=179679&r1=179678&r2=179679&view=diff
==============================================================================
--- lldb/branches/windows/source/Utility/StringExtractor.cpp (original)
+++ lldb/branches/windows/source/Utility/StringExtractor.cpp Wed Apr 17 03:38:48 2013
@@ -134,7 +134,7 @@ StringExtractor::GetChar (char fail_valu
         ++m_index;
         return ch;
     }
-    m_index = UINT32_MAX;
+    m_index = UINT64_MAX;
     return fail_value;
 }
 
@@ -157,7 +157,7 @@ StringExtractor::GetHexU8 (uint8_t fail_
         }
     }
     if (set_eof_on_fail || m_index >= m_packet.size())
-        m_index = UINT32_MAX;
+        m_index = UINT64_MAX;
     return fail_value;
 }
 
@@ -195,7 +195,7 @@ StringExtractor::GetHexMaxU32 (bool litt
             // Make sure we don't exceed the size of a uint32_t...
             if (nibble_count >= (sizeof(uint32_t) * 2))
             {
-                m_index = UINT32_MAX;
+                m_index = UINT64_MAX;
                 return fail_value;
             }
 
@@ -227,7 +227,7 @@ StringExtractor::GetHexMaxU32 (bool litt
             // Make sure we don't exceed the size of a uint32_t...
             if (nibble_count >= (sizeof(uint32_t) * 2))
             {
-                m_index = UINT32_MAX;
+                m_index = UINT64_MAX;
                 return fail_value;
             }
 
@@ -257,7 +257,7 @@ StringExtractor::GetHexMaxU64 (bool litt
             // Make sure we don't exceed the size of a uint64_t...
             if (nibble_count >= (sizeof(uint64_t) * 2))
             {
-                m_index = UINT32_MAX;
+                m_index = UINT64_MAX;
                 return fail_value;
             }
 
@@ -289,7 +289,7 @@ StringExtractor::GetHexMaxU64 (bool litt
             // Make sure we don't exceed the size of a uint64_t...
             if (nibble_count >= (sizeof(uint64_t) * 2))
             {
-                m_index = UINT32_MAX;
+                m_index = UINT64_MAX;
                 return fail_value;
             }
 
@@ -341,7 +341,7 @@ StringExtractor::GetHexWithFixedSize (ui
             // Little Endian
             uint32_t shift_amount;
             for (i = 0, shift_amount = 0;
-                 i < byte_size && m_index != UINT32_MAX;
+                 i < byte_size && IsGood();
                  ++i, shift_amount += 8)
             {
                 result |= ((uint64_t)GetHexU8() << shift_amount);
@@ -350,14 +350,14 @@ StringExtractor::GetHexWithFixedSize (ui
         else
         {
             // Big Endian
-            for (i = 0; i < byte_size && m_index != UINT32_MAX; ++i)
+            for (i = 0; i < byte_size && IsGood(); ++i)
             {
                 result <<= 8;
                 result |= GetHexU8();
             }
         }
     }
-    m_index = UINT32_MAX;
+    m_index = UINT64_MAX;
     return fail_value;
 }
 
@@ -392,6 +392,6 @@ StringExtractor::GetNameColonValue (std:
             }
         }
     }
-    m_index = UINT32_MAX;
+    m_index = UINT64_MAX;
     return false;
 }

Modified: lldb/branches/windows/source/Utility/StringExtractor.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Utility/StringExtractor.h?rev=179679&r1=179678&r2=179679&view=diff
==============================================================================
--- lldb/branches/windows/source/Utility/StringExtractor.h (original)
+++ lldb/branches/windows/source/Utility/StringExtractor.h Wed Apr 17 03:38:48 2013
@@ -45,10 +45,10 @@ public:
     bool
     IsGood() const
     {
-        return m_index != UINT32_MAX;
+        return m_index != UINT64_MAX;
     }
 
-    uint32_t
+    uint64_t
     GetFilePos () const
     {
         return m_index;
@@ -79,7 +79,7 @@ public:
         return m_packet.empty();
     }
 
-    uint32_t
+    size_t
     GetBytesLeft ()
     {
         if (m_index < m_packet.size())
@@ -126,9 +126,9 @@ protected:
     // For StringExtractor only
     //------------------------------------------------------------------
     std::string m_packet;   // The string in which to extract data.
-    uint32_t m_index;       // When extracting data from a packet, this index
+    uint64_t m_index;       // When extracting data from a packet, this index
                             // will march along as things get extracted. If set
-                            // to UINT32_MAX the end of the packet data was
+                            // to UINT64_MAX the end of the packet data was
                             // reached when decoding information
 };
 

Copied: lldb/branches/windows/source/Utility/TimeSpecTimeout.h (from r179594, lldb/trunk/source/Utility/TimeSpecTimeout.h)
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/Utility/TimeSpecTimeout.h?p2=lldb/branches/windows/source/Utility/TimeSpecTimeout.h&p1=lldb/trunk/source/Utility/TimeSpecTimeout.h&r1=179594&r2=179679&rev=179679&view=diff
==============================================================================
--- lldb/trunk/source/Utility/TimeSpecTimeout.h (original)
+++ lldb/branches/windows/source/Utility/TimeSpecTimeout.h Wed Apr 17 03:38:48 2013
@@ -14,6 +14,13 @@
 
 namespace lldb_private {
 
+#if defined(_WIN32)
+struct timespec {
+    time_t tv_sec;
+    long   tv_nsec;
+};
+#endif
+
 class TimeSpecTimeout
 {
 public:
@@ -81,7 +88,8 @@ public:
     }
     
 protected:
-    struct timespec m_timespec;
+    struct timespec 
+        m_timespec;
     bool m_infinite;
 };
 

Modified: lldb/branches/windows/source/lldb-log.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/lldb-log.cpp?rev=179679&r1=179678&r2=179679&view=diff
==============================================================================
--- lldb/branches/windows/source/lldb-log.cpp (original)
+++ lldb/branches/windows/source/lldb-log.cpp Wed Apr 17 03:38:48 2013
@@ -26,17 +26,21 @@ using namespace lldb_private;
 // control access to our static g_log_sp by hiding it in a singleton function
 // that will construct the static g_lob_sp the first time this function is 
 // called.
-static LogSP &
+
+static bool g_log_enabled = false;
+static Log * g_log = NULL;
+static Log *
 GetLog ()
 {
-    static LogSP g_log_sp;
-    return g_log_sp;
+    if (!g_log_enabled)
+        return NULL;
+    return g_log;
 }
 
 uint32_t
 lldb_private::GetLogMask ()
 {
-    LogSP log(GetLog ());
+    Log *log(GetLog ());
     if (log)
         return log->GetMask().Get();
     return 0;
@@ -49,15 +53,15 @@ lldb_private::IsLogVerbose ()
     return (mask & LIBLLDB_LOG_VERBOSE);
 }
 
-LogSP
+Log *
 lldb_private::GetLogIfAllCategoriesSet (uint32_t mask)
 {
-    LogSP log(GetLog ());
+    Log *log(GetLog ());
     if (log && mask)
     {
         uint32_t log_mask = log->GetMask().Get();
         if ((log_mask & mask) != mask)
-            return LogSP();
+            return NULL;
     }
     return log;
 }
@@ -65,7 +69,7 @@ lldb_private::GetLogIfAllCategoriesSet (
 void
 lldb_private::LogIfAllCategoriesSet (uint32_t mask, const char *format, ...)
 {
-    LogSP log(GetLogIfAllCategoriesSet (mask));
+    Log *log(GetLogIfAllCategoriesSet (mask));
     if (log)
     {
         va_list args;
@@ -78,7 +82,7 @@ lldb_private::LogIfAllCategoriesSet (uin
 void
 lldb_private::LogIfAnyCategoriesSet (uint32_t mask, const char *format, ...)
 {
-    LogSP log(GetLogIfAnyCategoriesSet (mask));
+    Log *log(GetLogIfAnyCategoriesSet (mask));
     if (log)
     {
         va_list args;
@@ -88,19 +92,19 @@ lldb_private::LogIfAnyCategoriesSet (uin
     }
 }
 
-LogSP
+Log *
 lldb_private::GetLogIfAnyCategoriesSet (uint32_t mask)
 {
-    LogSP log(GetLog ());
+    Log *log(GetLog ());
     if (log && mask && (mask & log->GetMask().Get()))
         return log;
-    return LogSP();
+    return NULL;
 }
 
 void
 lldb_private::DisableLog (const char **categories, Stream *feedback_strm)
 {
-    LogSP log(GetLog ());
+    Log *log(GetLog ());
 
     if (log)
     {
@@ -137,6 +141,7 @@ lldb_private::DisableLog (const char **c
                 else if (0 == ::strncasecmp(arg, "types", 5))   flag_bits &= ~LIBLLDB_LOG_TYPES;
                 else if (0 == ::strncasecmp(arg, "symbol", 6))  flag_bits &= ~LIBLLDB_LOG_SYMBOLS;
                 else if (0 == ::strncasecmp(arg, "module", 6))  flag_bits &= ~LIBLLDB_LOG_MODULES;
+                else if (0 == ::strncasecmp(arg, "mmap", 4))    flag_bits &= ~LIBLLDB_LOG_MMAP;
                 else
                 {
                     feedback_strm->Printf ("error:  unrecognized log category '%s'\n", arg);
@@ -146,35 +151,35 @@ lldb_private::DisableLog (const char **c
                 
             }
         }
+        log->GetMask().Reset (flag_bits);
         if (flag_bits == 0)
-            GetLog ().reset();
-        else
-            log->GetMask().Reset (flag_bits);
+            g_log_enabled = false;
     }
 
     return;
 }
 
-LogSP
+Log *
 lldb_private::EnableLog (StreamSP &log_stream_sp, uint32_t log_options, const char **categories, Stream *feedback_strm)
 {
     // Try see if there already is a log - that way we can reuse its settings.
     // We could reuse the log in toto, but we don't know that the stream is the same.
     uint32_t flag_bits;
-    LogSP log(GetLog ());
-    if (log)
-        flag_bits = log->GetMask().Get();
+    if (g_log)
+        flag_bits = g_log->GetMask().Get();
     else
         flag_bits = 0;
 
     // Now make a new log with this stream if one was provided
     if (log_stream_sp)
     {
-        log.reset (new Log(log_stream_sp));
-        GetLog () = log;
+        if (g_log)
+            g_log->SetStream(log_stream_sp);
+        else
+            g_log = new Log(log_stream_sp);
     }
 
-    if (log)
+    if (g_log)
     {
         for (size_t i=0; categories[i] != NULL; ++i)
         {
@@ -205,18 +210,20 @@ lldb_private::EnableLog (StreamSP &log_s
             else if (0 == ::strncasecmp(arg, "types", 5))   flag_bits |= LIBLLDB_LOG_TYPES;
             else if (0 == ::strncasecmp(arg, "symbol", 6))  flag_bits |= LIBLLDB_LOG_SYMBOLS;
             else if (0 == ::strncasecmp(arg, "module", 6))  flag_bits |= LIBLLDB_LOG_MODULES;
+            else if (0 == ::strncasecmp(arg, "mmap", 4))    flag_bits |= LIBLLDB_LOG_MMAP;
             else
             {
                 feedback_strm->Printf("error: unrecognized log category '%s'\n", arg);
                 ListLogCategories (feedback_strm);
-                return log;
+                return g_log;
             }
         }
 
-        log->GetMask().Reset(flag_bits);
-        log->GetOptions().Reset(log_options);
+        g_log->GetMask().Reset(flag_bits);
+        g_log->GetOptions().Reset(log_options);
     }
-    return log;
+    g_log_enabled = true;
+    return g_log;
 }
 
 

Modified: lldb/branches/windows/source/lldb.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/source/lldb.cpp?rev=179679&r1=179678&r2=179679&view=diff
==============================================================================
--- lldb/branches/windows/source/lldb.cpp (original)
+++ lldb/branches/windows/source/lldb.cpp Wed Apr 17 03:38:48 2013
@@ -51,13 +51,13 @@
 #include "Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.h"
 #include "Plugins/ABI/MacOSX-i386/ABIMacOSX_i386.h"
 #include "Plugins/ABI/MacOSX-arm/ABIMacOSX_arm.h"
-#if defined (__APPLE__)
 #include "Plugins/OperatingSystem/Darwin-Kernel/OperatingSystemDarwinKernel.h"
+#if defined (__APPLE__)
 #include "Plugins/Process/MacOSX-Kernel/ProcessKDP.h"
-#include "Plugins/Process/gdb-remote/ProcessGDBRemote.h"
 #endif
 #include "Plugins/Platform/MacOSX/PlatformMacOSX.h"
 #include "Plugins/Platform/MacOSX/PlatformRemoteiOS.h"
+#include "Plugins/Platform/MacOSX/PlatformDarwinKernel.h"
 #include "Plugins/Platform/MacOSX/PlatformiOSSimulator.h"
 
 #include "Plugins/Process/mach-core/ProcessMachCore.h"
@@ -69,7 +69,6 @@
 
 #if defined (__FreeBSD__)
 #include "Plugins/Platform/FreeBSD/PlatformFreeBSD.h"
-#include "Plugins/Process/gdb-remote/ProcessGDBRemote.h"
 #include "Plugins/Process/POSIX/ProcessPOSIX.h"
 #include "Plugins/Process/FreeBSD/ProcessFreeBSD.h"
 #endif
@@ -80,6 +79,7 @@
 #endif
 
 #include "Plugins/Platform/gdb-server/PlatformRemoteGDBServer.h"
+#include "Plugins/Process/gdb-remote/ProcessGDBRemote.h"
 #include "Plugins/DynamicLoader/Static/DynamicLoaderStatic.h"
 
 using namespace lldb;
@@ -135,10 +135,10 @@ lldb_private::Initialize ()
         // Apple/Darwin hosted plugins
         //----------------------------------------------------------------------
         OperatingSystemDarwinKernel::Initialize();
-        ProcessGDBRemote::Initialize();
         ProcessKDP::Initialize();
         ProcessMachCore::Initialize();
         SymbolVendorMacOSX::Initialize();
+        PlatformDarwinKernel::Initialize();
 #endif
         SymbolFileDWARFDebugMap::Initialize();
         PlatformRemoteiOS::Initialize();
@@ -152,16 +152,13 @@ lldb_private::Initialize ()
 #endif
 #if defined (__FreeBSD__)
         ProcessFreeBSD::Initialize();
-        ProcessGDBRemote::Initialize();
 #endif
         //----------------------------------------------------------------------
         // Platform agnostic plugins
         //----------------------------------------------------------------------
-#ifdef _WIN32 // TODO: Enable this for Windows later
-        ProcessGDBRemote::Initialize();
-#endif
-        PlatformRemoteGDBServer::Initialize ();
 
+        PlatformRemoteGDBServer::Initialize ();
+        ProcessGDBRemote::Initialize();
         DynamicLoaderStatic::Initialize();
       
         // Scan for any system or user LLDB plug-ins
@@ -214,7 +211,6 @@ lldb_private::Terminate ()
 #if defined (__APPLE__)
     OperatingSystemDarwinKernel::Terminate();
     ProcessMachCore::Terminate();
-    ProcessGDBRemote::Terminate();
     ProcessKDP::Terminate();
     SymbolVendorMacOSX::Terminate();
 #endif
@@ -222,6 +218,9 @@ lldb_private::Terminate ()
     ObjectContainerUniversalMachO::Terminate();
     ObjectFileMachO::Terminate();
     PlatformMacOSX::Terminate();
+#if defined (__APPLE__)
+    PlatformDarwinKernel::Terminate();
+#endif
     PlatformRemoteiOS::Terminate();
     PlatformiOSSimulator::Terminate();
 
@@ -235,29 +234,105 @@ lldb_private::Terminate ()
 #if defined (__FreeBSD__)
 	PlatformFreeBSD::Terminate();
     ProcessFreeBSD::Terminate();
-    ProcessGDBRemote::Terminate();
 #endif
     
+    ProcessGDBRemote::Terminate();
     DynamicLoaderStatic::Terminate();
 
     Log::Terminate();
 }
 
-#ifndef _WIN32
- extern "C" const double liblldb_coreVersionNumber;
+#if defined (__APPLE__)
+extern "C" const unsigned char liblldb_coreVersionString[];
+#else
+
+#include "clang/Basic/Version.h"
+
+static const char *
+GetLLDBRevision()
+{
+#ifdef LLDB_REVISION
+    return LLDB_REVISION;
 #else
-const unsigned char liblldb_coreVersionString[] = "LLDB-win32-1";
-const double liblldb_coreVersionNumber = (double) 1.0;
+    return NULL;
+#endif
+}
+
+static const char *
+GetLLDBRepository()
+{
+#ifdef LLDB_REPOSITORY
+    return LLDB_REPOSITORY;
+#else
+    return NULL;
+#endif
+}
+
 #endif
 
 const char *
 lldb_private::GetVersion ()
 {
+#if defined (__APPLE__)
     static char g_version_string[32];
     if (g_version_string[0] == '\0')
-        ::snprintf (g_version_string, sizeof(g_version_string), "LLDB-%g", liblldb_coreVersionNumber);
+    {
+        const char *version_string = ::strstr ((const char *)liblldb_coreVersionString, "PROJECT:");
+        
+        if (version_string)
+            version_string += sizeof("PROJECT:") - 1;
+        else
+            version_string = "unknown";
+        
+        const char *newline_loc = strchr(version_string, '\n');
+        
+        size_t version_len = sizeof(g_version_string);
+        
+        if (newline_loc && (newline_loc - version_string < version_len))
+            version_len = newline_loc - version_string;
+        
+        ::strncpy(g_version_string, version_string, version_len);
+    }
 
     return g_version_string;
+#else
+    // On Linux/FreeBSD/Windows, report a version number in the same style as the clang tool.
+    static std::string g_version_str;
+    if (g_version_str.empty())
+    {
+        g_version_str += "lldb version ";
+        g_version_str += CLANG_VERSION_STRING;
+        const char * lldb_repo = GetLLDBRepository();
+        if (lldb_repo)
+        {
+            g_version_str += " (";
+            g_version_str += lldb_repo;
+        }
+
+        const char *lldb_rev = GetLLDBRevision();
+        if (lldb_rev)
+        {
+            g_version_str += " revision ";
+            g_version_str += lldb_rev;
+        }
+        std::string clang_rev (clang::getClangRevision());
+        if (clang_rev.length() > 0)
+        {
+            g_version_str += " clang revision ";
+            g_version_str += clang_rev;
+        }
+        std::string llvm_rev (clang::getLLVMRevision());
+        if (llvm_rev.length() > 0)
+        {
+            g_version_str += " llvm revision ";
+            g_version_str += llvm_rev;
+        }
+
+        if (lldb_repo)
+            g_version_str += ")";
+    }
+    return g_version_str.c_str();
+#endif
 }
 
 const char *

Modified: lldb/branches/windows/test/Makefile
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/test/Makefile?rev=179679&r1=179678&r2=179679&view=diff
==============================================================================
--- lldb/branches/windows/test/Makefile (original)
+++ lldb/branches/windows/test/Makefile Wed Apr 17 03:38:48 2013
@@ -29,10 +29,5 @@ clean::
 # Run the tests
 #----------------------------------------------------------------------
 check-local::
-	rm -rf ../test-rdir
-	env PATH="$(ToolDir):$(PATH)" \
-	    PYTHONPATH="$(shell python -c "from distutils.sysconfig import get_python_lib; print get_python_lib(True, False, \"$(LibDir)/..\")" )" \
-	    LLDB_EXEC=$(ToolDir)/lldb \
-	    LLDB_BUILD_TYPE=Makefile \
-	    $(SHLIBPATH_VAR)=$(LibDir):$($(SHLIBPATH_VAR)) \
-	     python $(PROJ_SRC_DIR)/dotest.py -i -v -r ../test-rdir
+	rm -rf lldb-test-traces
+	python $(PROJ_SRC_DIR)/dosep.ty -o "--executable $(ToolDir)/lldb -q -s lldb-test-traces -C $(subst ccache,,$(CC))"

Modified: lldb/branches/windows/test/api/check_public_api_headers/Makefile
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/test/api/check_public_api_headers/Makefile?rev=179679&r1=179678&r2=179679&view=diff
==============================================================================
--- lldb/branches/windows/test/api/check_public_api_headers/Makefile (original)
+++ lldb/branches/windows/test/api/check_public_api_headers/Makefile Wed Apr 17 03:38:48 2013
@@ -6,7 +6,7 @@ MY_OS = $(shell uname -s)
 ifeq "$(MY_OS)" "Darwin"
     LD_EXTRAS ?= -framework LLDB
 else
-    LD_EXTRAS ?= $(LLDB_BUILD_DIR)/_lldb.so
+    LD_EXTRAS ?= $(LLDB_LIB_DIR)/liblldb.so
 endif
 
 # Example dictionary to pass to the Python build method:

Modified: lldb/branches/windows/test/api/check_public_api_headers/TestPublicAPIHeaders.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/test/api/check_public_api_headers/TestPublicAPIHeaders.py?rev=179679&r1=179678&r2=179679&view=diff
==============================================================================
--- lldb/branches/windows/test/api/check_public_api_headers/TestPublicAPIHeaders.py (original)
+++ lldb/branches/windows/test/api/check_public_api_headers/TestPublicAPIHeaders.py Wed Apr 17 03:38:48 2013
@@ -14,21 +14,21 @@ class SBDirCheckerCase(TestBase):
 
     def setUp(self):
         TestBase.setUp(self)
-        self.build_dir = os.environ["LLDB_BUILD_DIR"]
+        self.lib_dir = os.environ["LLDB_LIB_DIR"]
         self.template = 'main.cpp.template'
         self.source = 'main.cpp'
 
     def test_sb_api_directory(self):
         """Test the SB API directory and make sure there's no unwanted stuff."""
 
-        if sys.platform.startswith("darwin") and self.getArchitecture() == "i386":
-            self.skipTest("LLDB.framework built 64-bit")
+        if self.getArchitecture() == "i386":
+            self.skipTest("LLDB is 64-bit and cannot be linked to 32-bit test program.")
 
         # Call the program generator to produce main.cpp.
         self.generate_main_cpp()
 
         if sys.platform.startswith("darwin"):
-            d = {'FRAMEWORK_INCLUDES' : "-F%s" % self.build_dir}
+            d = {'FRAMEWORK_INCLUDES' : "-F%s" % self.lib_dir}
         if sys.platform.startswith("linux") or os.environ.get('LLDB_BUILD_TYPE') == 'Makefile':
             d = {'FRAMEWORK_INCLUDES' : "-I%s" % os.path.join(os.environ["LLDB_SRC"], "include")}
         self.buildDefault(dictionary=d)
@@ -69,18 +69,14 @@ class SBDirCheckerCase(TestBase):
 
         self.line_to_break = line_number(self.source, '// Set breakpoint here.')
 
-        if sys.platform.startswith("darwin"):
-            env_var = 'DYLD_FRAMEWORK_PATH'
-            env_val = self.build_dir
-        if sys.platform.startswith("linux"):
-            env_var = 'LD_LIBRARY_PATH'
-            env_val = self.build_dir
+        existing_library_path = os.environ[self.dylibPath] if self.dylibPath in os.environ else None
 
-        env_cmd = "settings set target.env-vars %s=%s" %(env_var, env_val)
+        env_val = self.lib_dir if not existing_library_path else "%s:%s" % (existing_library_path, self.lib_dir)
+        env_cmd = "settings set target.env-vars %s=%s" %(self.dylibPath, env_val)
         if self.TraceOn():
             print "Set environment to: ", env_cmd
         self.runCmd(env_cmd)
-        self.addTearDownHook(lambda: self.runCmd("settings remove target.env-vars %s" % env_var))
+        self.addTearDownHook(lambda: self.runCmd("settings remove target.env-vars %s" % self.dylibPath))
 
         lldbutil.run_break_set_by_file_and_line (self, self.source, self.line_to_break, num_expected_locations = -1)
 

Modified: lldb/branches/windows/test/dosep.ty
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/test/dosep.ty?rev=179679&r1=179678&r2=179679&view=diff
==============================================================================
--- lldb/branches/windows/test/dosep.ty (original)
+++ lldb/branches/windows/test/dosep.ty Wed Apr 17 03:38:48 2013
@@ -12,6 +12,8 @@ template = '%s/dotest.py %s -p %s %s'
 
 def walk_and_invoke(test_root, dotest_options):
     """Look for matched file and invoke test driver on it."""
+    failed = []
+    passed = []
     for root, dirs, files in os.walk(test_root, topdown=False):
         for name in files:
             path = os.path.join(root, name)
@@ -26,7 +28,11 @@ def walk_and_invoke(test_root, dotest_op
 
             command = template % (test_root, dotest_options if dotest_options else "", name, root)
             print "Running %s" % (command)
-            os.system(command)
+            if 0 != os.system(command):
+                failed.append(name) 
+            else:
+                passed.append(name)
+    return (failed, passed)
 
 def main():
     test_root = sys.path[0]
@@ -44,8 +50,15 @@ Run lldb test suite using a separate pro
 
     print "dotest.py options:", dotest_options
 
-    walk_and_invoke(test_root, dotest_options)
-
+    (failed, passed) = walk_and_invoke(test_root, dotest_options)
+    num_tests = len(failed) + len(passed)
+    print "Ran %d tests." % num_tests
+    if len(failed) > 0:
+        print "Failing Tests (%d)" % len(failed)
+        for f in failed:
+          print "FAIL: LLDB :: (%s)" % f
+        sys.exit(1)
+    sys.exit(0)
 
 if __name__ == '__main__':
     main()

Modified: lldb/branches/windows/test/dotest.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/test/dotest.py?rev=179679&r1=179678&r2=179679&view=diff
==============================================================================
--- lldb/branches/windows/test/dotest.py (original)
+++ lldb/branches/windows/test/dotest.py Wed Apr 17 03:38:48 2013
@@ -20,7 +20,6 @@ Type:
 for available options.
 """
 
-import argparse
 import os
 import platform
 import signal
@@ -29,6 +28,12 @@ import sys
 import textwrap
 import time
 import unittest2
+import progress
+
+if sys.version_info >= (2, 7):
+    argparse = __import__('argparse')
+else:
+    argparse = __import__('argparse_compat')
 
 def is_exe(fpath):
     """Returns true if fpath is an executable."""
@@ -74,7 +79,8 @@ validCategories = {
 'dataformatters':'Tests related to the type command and the data formatters subsystem',
 'expression':'Tests related to the expression parser',
 'objc':'Tests related to the Objective-C programming language support',
-'pyapi':'Tests related to the Python API'
+'pyapi':'Tests related to the Python API',
+'basic_process': 'Basic process execution sniff tests.'
 }
 
 # The test suite.
@@ -132,7 +138,7 @@ post_flight = None
 
 # The 'archs' and 'compilers' can be specified via either command line or configFile,
 # with the command line overriding the configFile.  The corresponding options can be
-# specified more than once. For example, "-A x86_64 -A i386" => archs=['x86_64', 'i386'] 
+# specified more than once. For example, "-A x86_64 -A i386" => archs=['x86_64', 'i386']
 # and "-C gcc -C clang" => compilers=['gcc', 'clang'].
 archs = None        # Must be initialized after option parsing
 compilers = None    # Must be initialized after option parsing
@@ -186,6 +192,10 @@ skip_long_running_test = True
 # turn it off.
 noHeaders = False
 
+# Parsable mode silences headers, and any other output this script might generate, and instead
+# prints machine-readable output similar to what clang tests produce.
+parsable = False
+
 # The regular expression pattern to match against eligible filenames as our test cases.
 regexp = None
 
@@ -206,11 +216,11 @@ sdir_has_content = False
 # svn_info stores the output from 'svn info lldb.base.dir'.
 svn_info = ''
 
-# The environment variables to unset before running the test cases.
-unsets = []
+# svn_silent means do not try to obtain svn status
+svn_silent = True
 
 # Default verbosity is 0.
-verbose = 0
+verbose = 1
 
 # Set to True only if verbose is 0 and LLDB trace mode is off.
 progress_bar = False
@@ -221,6 +231,7 @@ testdirs = [ sys.path[0] ]
 # Separator string.
 separator = '-' * 70
 
+failed = False
 
 def usage(parser):
     parser.print_help()
@@ -343,10 +354,11 @@ def parseOptionsAndInitTestdirs():
     global skip_build_and_cleanup
     global skip_long_running_test
     global noHeaders
+    global parsable
     global regexp
     global rdir
     global sdir_name
-    global unsets
+    global svn_silent
     global verbose
     global testdirs
 
@@ -404,11 +416,14 @@ def parseOptionsAndInitTestdirs():
     X('-F', 'Fail fast. Stop the test suite on the first error/failure')
     X('-i', "Ignore (don't bailout) if 'lldb.py' module cannot be located in the build tree relative to this script; use PYTHONPATH to locate the module")
     X('-n', "Don't print the headers like build dir, lldb version, and svn info at all")
+    X('-P', "Use the graphic progress bar.")
+    X('-q', "Don't print extra output from this script.")
     X('-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). This can be used with '-# n' to stress test certain test cases for n number of times")
     X('-t', 'Turn on tracing of lldb command and other detailed test executions')
-    group.add_argument('-u', metavar='variable', action='append', help='Specify an environment variable to unset before running the test cases. e.g., -u DYLD_INSERT_LIBRARIES -u MallocScribble')
+    group.add_argument('-u', dest='unset_env_varnames', metavar='variable', action='append', help='Specify an environment variable to unset before running the test cases. e.g., -u DYLD_INSERT_LIBRARIES -u MallocScribble')
     X('-v', 'Do verbose mode of unittest framework (print out each test case invocation)')
     X('-w', 'Insert some wait time (currently 0.5 sec) between consecutive test cases')
+    X('-T', 'Obtain and dump svn information for this checkout of LLDB (off by default)')
 
     # Remove the reference to our helper function
     del X
@@ -420,8 +435,16 @@ def parseOptionsAndInitTestdirs():
     platform_system = platform.system()
     platform_machine = platform.machine()
     
-    # only print the args if being verbose
-    if args.v:
+    if args.unset_env_varnames:
+        for env_var in args.unset_env_varnames:
+            if env_var in os.environ:
+                # From Python Doc: When unsetenv() is supported, deletion of items in os.environ
+                # is automatically translated into a corresponding call to unsetenv().
+                del os.environ[env_var]
+                #os.unsetenv(env_var)
+    
+    # only print the args if being verbose (and parsable is off)
+    if args.v and not args.q:
         print args
 
     if args.h:
@@ -540,6 +563,14 @@ def parseOptionsAndInitTestdirs():
             usage(parser)
         regexp = args.p
 
+    if args.q:
+        noHeaders = True
+        parsable = True
+
+    if args.P:
+        progress_bar = True
+        verbose = 0
+
     if args.R:
         if args.R.startswith('-'):
             usage(parser)
@@ -568,8 +599,8 @@ def parseOptionsAndInitTestdirs():
     if args.t:
         os.environ['LLDB_COMMAND_TRACE'] = 'YES'
 
-    if args.u:
-        unsets.extend(args.u)
+    if args.T:
+        svn_silent = False
 
     if args.v:
         verbose = 2
@@ -602,10 +633,6 @@ def parseOptionsAndInitTestdirs():
     if dont_do_python_api_test and just_do_python_api_test:
         usage(parser)
 
-    # The simple progress bar is turned on only if verbose == 0 and LLDB_COMMAND_TRACE is not 'YES'
-    if ("LLDB_COMMAND_TRACE" not in os.environ or os.environ["LLDB_COMMAND_TRACE"] != "YES") and verbose == 0:
-        progress_bar = True
-
     # Gather all the dirs passed on the command line.
     if len(args.args) > 0:
         testdirs = map(os.path.abspath, args.args)
@@ -694,6 +721,7 @@ def setupSysPath():
     global dumpSysPath
     global noHeaders
     global svn_info
+    global svn_silent
     global lldbFrameworkPath
     global lldbExecutablePath
 
@@ -797,12 +825,14 @@ def setupSysPath():
             lldbExec = which('lldb')
             if lldbHere and not lldbExec:
                 lldbExec = lldbHere
+            if lldbExec and not lldbHere:
+                lldbHere = lldbExec
     
     if lldbHere:
         os.environ["LLDB_HERE"] = lldbHere
-        os.environ["LLDB_BUILD_DIR"] = os.path.split(lldbHere)[0]
+        os.environ["LLDB_LIB_DIR"] = os.path.split(lldbHere)[0]
         if not noHeaders:
-            print "LLDB build dir:", os.environ["LLDB_BUILD_DIR"]
+            print "LLDB library dir:", os.environ["LLDB_LIB_DIR"]
             os.system('%s -v' % lldbHere)
 
     if not lldbExec:
@@ -811,14 +841,16 @@ def setupSysPath():
         os.environ["LLDB_EXEC"] = lldbExec
         #print "The 'lldb' from PATH env variable", lldbExec
 
-    if os.path.isdir(os.path.join(base, '.svn')):
-        pipe = subprocess.Popen(["svn", "info", base], stdout = subprocess.PIPE)
-        svn_info = pipe.stdout.read()
-    elif os.path.isdir(os.path.join(base, '.git')):
-        pipe = subprocess.Popen(["git", "svn", "info", base], stdout = subprocess.PIPE)
-        svn_info = pipe.stdout.read()
-    if not noHeaders:
-        print svn_info
+    # Skip printing svn/git information when running in parsable (lit-test compatibility) mode
+    if not svn_silent and not parsable:
+        if os.path.isdir(os.path.join(base, '.svn')) and which("svn") is not None:
+            pipe = subprocess.Popen([which("svn"), "info", base], stdout = subprocess.PIPE)
+            svn_info = pipe.stdout.read()
+        elif os.path.isdir(os.path.join(base, '.git')) and which("git") is not None:
+            pipe = subprocess.Popen([which("git"), "svn", "info", base], stdout = subprocess.PIPE)
+            svn_info = pipe.stdout.read()
+        if not noHeaders:
+            print svn_info
 
     global ignore
 
@@ -850,7 +882,7 @@ def setupSysPath():
             if len(lines) == 1 and os.path.isfile(os.path.join(lines[0], init_in_python_dir)):
                 lldbPath = lines[0]
                 if "linux" in sys.platform:
-                    os.environ['LLDB_BUILD_DIR'] = os.path.join(lldbPath, 'lldb')
+                    os.environ['LLDB_LIB_DIR'] = os.path.join(lldbPath, '..', '..')
         
         if not lldbPath: 
             dbgPath  = os.path.join(base, *(xcode3_build_dir + dbg + python_resource_dir))
@@ -890,6 +922,8 @@ def setupSysPath():
     if frameWithVersion != "" :
         lldbPath = before + "LLDB.framework" + after
 
+    lldbPath = os.path.abspath(lldbPath)
+
     # If tests need to find LLDB_FRAMEWORK, now they can do it
     os.environ["LLDB_FRAMEWORK"] = os.path.dirname(os.path.dirname(lldbPath))
 
@@ -1107,8 +1141,9 @@ def getsource_if_available(obj):
     except:
         return repr(obj)
 
-print "lldb.pre_flight:", getsource_if_available(lldb.pre_flight)
-print "lldb.post_flight:", getsource_if_available(lldb.post_flight)
+if not noHeaders:
+    print "lldb.pre_flight:", getsource_if_available(lldb.pre_flight)
+    print "lldb.post_flight:", getsource_if_available(lldb.post_flight)
 
 # Put all these test decorators in the lldb namespace.
 lldb.dont_do_python_api_test = dont_do_python_api_test
@@ -1161,16 +1196,6 @@ with open(fname, "w") as f:
     print >> f, "Command invoked: %s\n" % getMyCommandLine()
 
 #
-# If we have environment variables to unset, do it here before we invoke the test runner.
-#
-for env_var in unsets :
-    if env_var in os.environ:
-        # From Python Doc: When unsetenv() is supported, deletion of items in os.environ
-        # is automatically translated into a corresponding call to unsetenv().
-        del os.environ[env_var]
-        #os.unsetenv(env_var)
-
-#
 # Invoke the default TextTestRunner to run the test suite, possibly iterating
 # over different configurations.
 #
@@ -1206,7 +1231,8 @@ for i in range(len(compilers)):
                     compilers[i] = cmd_output.split('\n')[0]
                     print "'xcrun -find %s' returning %s" % (c, compilers[i])
 
-print "compilers=%s" % str(compilers)
+if not parsable:
+    print "compilers=%s" % str(compilers)
 
 if not compilers or len(compilers) == 0:
     print "No eligible compiler found, exiting."
@@ -1286,16 +1312,18 @@ for ia in range(len(archs) if iterArchs
                 sys.path = [x.replace(rdir, newrdir, 1) for x in old_sys_path]
 
             # Output the configuration.
-            sys.stderr.write("\nConfiguration: " + configString + "\n")
+            if not parsable:
+                sys.stderr.write("\nConfiguration: " + configString + "\n")
 
         #print "sys.stderr name is", sys.stderr.name
         #print "sys.stdout name is", sys.stdout.name
 
         # First, write out the number of collected test cases.
-        sys.stderr.write(separator + "\n")
-        sys.stderr.write("Collected %d test%s\n\n"
-                         % (suite.countTestCases(),
-                            suite.countTestCases() != 1 and "s" or ""))
+        if not parsable:
+            sys.stderr.write(separator + "\n")
+            sys.stderr.write("Collected %d test%s\n\n"
+                             % (suite.countTestCases(),
+                                suite.countTestCases() != 1 and "s" or ""))
 
         class LLDBTestResult(unittest2.TextTestResult):
             """
@@ -1309,6 +1337,30 @@ for ia in range(len(archs) if iterArchs
             __singleton__ = None
             __ignore_singleton__ = False
 
+            @staticmethod
+            def getTerminalSize():
+                import os
+                env = os.environ
+                def ioctl_GWINSZ(fd):
+                    try:
+                        import fcntl, termios, struct, os
+                        cr = struct.unpack('hh', fcntl.ioctl(fd, termios.TIOCGWINSZ,
+                    '1234'))
+                    except:
+                        return
+                    return cr
+                cr = ioctl_GWINSZ(0) or ioctl_GWINSZ(1) or ioctl_GWINSZ(2)
+                if not cr:
+                    try:
+                        fd = os.open(os.ctermid(), os.O_RDONLY)
+                        cr = ioctl_GWINSZ(fd)
+                        os.close(fd)
+                    except:
+                        pass
+                if not cr:
+                    cr = (env.get('LINES', 25), env.get('COLUMNS', 80))
+                return int(cr[1]), int(cr[0])
+
             def __init__(self, *args):
                 if not LLDBTestResult.__ignore_singleton__ and LLDBTestResult.__singleton__:
                     raise Exception("LLDBTestResult instantiated more than once")
@@ -1323,6 +1375,19 @@ for ia in range(len(archs) if iterArchs
                 self.indentation = ' ' * (counterWidth + 2)
                 # This counts from 1 .. suite.countTestCases().
                 self.counter = 0
+                (width, height) = LLDBTestResult.getTerminalSize()
+                self.progressbar = None
+                global progress_bar
+                if width > 10 and not parsable and progress_bar:
+                    try:
+                        self.progressbar = progress.ProgressWithEvents(stdout=self.stream,start=0,end=suite.countTestCases(),width=width-10)
+                    except:
+                        self.progressbar = None
+
+            def _config_string(self, test):
+              compiler = getattr(test, "getCompiler", None)
+              arch = getattr(test, "getArchitecture", None)
+              return "%s-%s" % (compiler() if compiler else "", arch() if arch else "")
 
             def _exc_info_to_string(self, err, test):
                 """Overrides superclass TestResult's method in order to append
@@ -1340,7 +1405,14 @@ for ia in range(len(archs) if iterArchs
                     return str(test)
 
             def getCategoriesForTest(self,test):
-                if hasattr(test,"getCategories"):
+                if hasattr(test,"_testMethodName"):
+                    test_method = getattr(test,"_testMethodName")
+                    test_method = getattr(test,test_method)
+                else:
+                    test_method = None
+                if test_method != None and hasattr(test_method,"getCategories"):
+                    test_categories = test_method.getCategories(test)
+                elif hasattr(test,"getCategories"):
                     test_categories = test.getCategories()
                 elif inspect.ismethod(test) and test.__self__ != None and hasattr(test.__self__,"getCategories"):
                     test_categories = test.__self__.getCategories()
@@ -1372,22 +1444,34 @@ for ia in range(len(archs) if iterArchs
                     self.stream.write(self.fmt % self.counter)
                 super(LLDBTestResult, self).startTest(test)
 
+            def addSuccess(self, test):
+                global parsable
+                super(LLDBTestResult, self).addSuccess(test)
+                if parsable:
+                    self.stream.write("PASS: LLDB (%s) :: %s\n" % (self._config_string(test), str(test)))
+
             def addError(self, test, err):
                 global sdir_has_content
+                global parsable
                 sdir_has_content = True
                 super(LLDBTestResult, self).addError(test, err)
                 method = getattr(test, "markError", None)
                 if method:
                     method()
+                if parsable:
+                    self.stream.write("FAIL: LLDB (%s) :: %s\n" % (self._config_string(test), str(test)))
 
             def addFailure(self, test, err):
                 global sdir_has_content
                 global failuresPerCategory
+                global parsable
                 sdir_has_content = True
                 super(LLDBTestResult, self).addFailure(test, err)
                 method = getattr(test, "markFailure", None)
                 if method:
                     method()
+                if parsable:
+                    self.stream.write("FAIL: LLDB (%s) :: %s\n" % (self._config_string(test), str(test)))
                 if useCategories:
                     test_categories = self.getCategoriesForTest(test)
                     for category in test_categories:
@@ -1396,34 +1480,50 @@ for ia in range(len(archs) if iterArchs
                         else:
                             failuresPerCategory[category] = 1
 
-            def addExpectedFailure(self, test, err):
+            def addExpectedFailure(self, test, err, bugnumber):
                 global sdir_has_content
+                global parsable
                 sdir_has_content = True
-                super(LLDBTestResult, self).addExpectedFailure(test, err)
+                super(LLDBTestResult, self).addExpectedFailure(test, err, bugnumber)
                 method = getattr(test, "markExpectedFailure", None)
                 if method:
-                    method()
+                    method(err, bugnumber)
+                if parsable:
+                    self.stream.write("XFAIL: LLDB (%s) :: %s\n" % (self._config_string(test), str(test)))
 
             def addSkip(self, test, reason):
                 global sdir_has_content
+                global parsable
                 sdir_has_content = True
                 super(LLDBTestResult, self).addSkip(test, reason)
                 method = getattr(test, "markSkippedTest", None)
                 if method:
                     method()
+                if parsable:
+                    self.stream.write("UNSUPPORTED: LLDB (%s) :: %s (%s) \n" % (self._config_string(test), str(test), reason))
 
-            def addUnexpectedSuccess(self, test):
+            def addUnexpectedSuccess(self, test, bugnumber):
                 global sdir_has_content
+                global parsable
                 sdir_has_content = True
-                super(LLDBTestResult, self).addUnexpectedSuccess(test)
+                super(LLDBTestResult, self).addUnexpectedSuccess(test, bugnumber)
                 method = getattr(test, "markUnexpectedSuccess", None)
                 if method:
-                    method()
+                    method(bugnumber)
+                if parsable:
+                    self.stream.write("XPASS: LLDB (%s) :: %s\n" % (self._config_string(test), str(test)))
+
+        if parsable:
+            v = 0
+        elif progress_bar:
+            v = 1
+        else:
+            v = verbose
 
         # Invoke the test runner.
         if count == 1:
             result = unittest2.TextTestRunner(stream=sys.stderr,
-                                              verbosity=(1 if progress_bar else verbose),
+                                              verbosity=v,
                                               failfast=failfast,
                                               resultclass=LLDBTestResult).run(suite)
         else:
@@ -1432,13 +1532,15 @@ for ia in range(len(archs) if iterArchs
             # not enforced.
             LLDBTestResult.__ignore_singleton__ = True
             for i in range(count):
+               
                 result = unittest2.TextTestRunner(stream=sys.stderr,
-                                                  verbosity=(1 if progress_bar else verbose),
+                                                  verbosity=v,
                                                   failfast=failfast,
                                                   resultclass=LLDBTestResult).run(suite)
 
+        failed = failed or not result.wasSuccessful()
 
-if sdir_has_content:
+if sdir_has_content and not parsable:
     sys.stderr.write("Session logs for test failures/errors/unexpected successes"
                      " can be found in directory '%s'\n" % sdir_name)
 
@@ -1458,4 +1560,4 @@ if ("LLDB_TESTSUITE_FORCE_FINISH" in os.
     subprocess.Popen(["/bin/sh", "-c", "kill %s; exit 0" % (os.getpid())])
 
 # Exiting.
-sys.exit(not result.wasSuccessful)
+sys.exit(failed)

Modified: lldb/branches/windows/test/expression_command/call-function/TestCallStdStringFunction.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/test/expression_command/call-function/TestCallStdStringFunction.py?rev=179679&r1=179678&r2=179679&view=diff
==============================================================================
--- lldb/branches/windows/test/expression_command/call-function/TestCallStdStringFunction.py (original)
+++ lldb/branches/windows/test/expression_command/call-function/TestCallStdStringFunction.py Wed Apr 17 03:38:48 2013
@@ -25,8 +25,8 @@ class ExprCommandCallFunctionTestCase(Te
         self.buildDsym()
         self.call_function()
 
-    @expectedFailureLinux # bugzilla 14437
     @dwarf_test
+    @expectedFailureGcc # bugzilla 14437, fails with GCC 4.6.3 and 4.7.2
     def test_with_dwarf(self):
         """Test calling std::String member function."""
         self.buildDwarf()
@@ -36,7 +36,8 @@ class ExprCommandCallFunctionTestCase(Te
         """Test calling std::String member function."""
         self.runCmd("file a.out", CURRENT_EXECUTABLE_SET)
 
-        lldbutil.run_break_set_by_file_and_line (self, "main.cpp", self.line, loc_exact=True)
+        # Some versions of GCC encode two locations for the 'return' statement in main.cpp
+        lldbutil.run_break_set_by_file_and_line (self, "main.cpp", self.line, num_expected_locations=-1, loc_exact=True)
 
         self.runCmd("run", RUN_SUCCEEDED)
 

Modified: lldb/branches/windows/test/expression_command/formatters/TestFormatters.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/test/expression_command/formatters/TestFormatters.py?rev=179679&r1=179678&r2=179679&view=diff
==============================================================================
--- lldb/branches/windows/test/expression_command/formatters/TestFormatters.py (original)
+++ lldb/branches/windows/test/expression_command/formatters/TestFormatters.py Wed Apr 17 03:38:48 2013
@@ -25,7 +25,6 @@ class ExprFormattersTestCase(TestBase):
         self.buildDsym()
         self.do_my_test()
 
-    @expectedFailureLinux # bugzilla 14437
     @dwarf_test
     def test_with_dwarf(self):
         """Test expr + formatters for good interoperability."""
@@ -56,7 +55,7 @@ class ExprFormattersTestCase(TestBase):
         self.runCmd("frame variable foo1.b --show-types")
         self.runCmd("frame variable foo1.b.b_ref --show-types")
 
-        self.expect("expression *(new foo(47))",
+        self.expect("expression --show-types -- *(new foo(47))",
             substrs = ['(int) a = 47', '(bar) b = {', '(int) i = 94', '(baz) b = {', '(int) k = 99'])
 
         self.runCmd("type summary add -F formatters.foo_SummaryProvider foo")
@@ -94,7 +93,7 @@ class ExprFormattersTestCase(TestBase):
         self.runCmd("type summary delete foo")
         self.runCmd("type synthetic add --python-class foosynth.FooSyntheticProvider foo")
 
-        self.expect("expression $" + object_name,
+        self.expect("expression --show-types -- $" + object_name,
             substrs = ['(foo) $', ' = {', '(int) *i_ptr = 243'])
 
         self.runCmd("n")
@@ -118,7 +117,7 @@ class ExprFormattersTestCase(TestBase):
         self.runCmd("type summary delete foo")
         self.runCmd("type synthetic add --python-class foosynth.FooSyntheticProvider foo")
 
-        self.expect("expression $" + object_name,
+        self.expect("expression --show-types -- $" + object_name,
             substrs = ['(foo) $', ' = {', '(int) *i_ptr = 8888'])
 
         self.runCmd("n")

Modified: lldb/branches/windows/test/expression_command/issue_11588/Test11588.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/test/expression_command/issue_11588/Test11588.py?rev=179679&r1=179678&r2=179679&view=diff
==============================================================================
--- lldb/branches/windows/test/expression_command/issue_11588/Test11588.py (original)
+++ lldb/branches/windows/test/expression_command/issue_11588/Test11588.py Wed Apr 17 03:38:48 2013
@@ -7,6 +7,7 @@ expected in a SyntheticChildrenProvider
 import os, time
 import unittest2
 import lldb
+import lldbutil
 from lldbtest import *
 
 class Issue11581TestCase(TestBase):
@@ -19,28 +20,32 @@ class Issue11581TestCase(TestBase):
         def cleanup():
             self.runCmd('type synthetic clear', check=False)
 
+
         # Execute the cleanup function during test case tear down.
         self.addTearDownHook(cleanup)
 
         """valobj.AddressOf() should return correct values."""
         self.buildDefault()
-
-        self.runCmd("file a.out", CURRENT_EXECUTABLE_SET)
-
-        self.runCmd("breakpoint set --name main")
-
-        self.runCmd("run", RUN_SUCCEEDED)
-
-        self.runCmd("next", RUN_SUCCEEDED)
-        self.runCmd("next", RUN_SUCCEEDED)
-        self.runCmd("next", RUN_SUCCEEDED)
-        self.runCmd("next", RUN_SUCCEEDED)
-        self.runCmd("next", RUN_SUCCEEDED)
+        
+        exe = os.path.join(os.getcwd(), "a.out")
+        
+        target = self.dbg.CreateTarget(exe)
+        self.assertTrue(target, VALID_TARGET)
+
+        breakpoint = target.BreakpointCreateBySourceRegex('Set breakpoint here.',lldb.SBFileSpec ("main.cpp", False))
+        
+        process = target.LaunchSimple (None, None, os.getcwd())
+        self.assertTrue (process, "Created a process.")
+        self.assertTrue (process.GetState() == lldb.eStateStopped, "Stopped it too.")
+
+        thread_list = lldbutil.get_threads_stopped_at_breakpoint (process, breakpoint)
+        self.assertTrue (len(thread_list) == 1)
+        thread = thread_list[0]
 
         self.runCmd("command script import --allow-reload s11588.py")
         self.runCmd("type synthetic add --python-class s11588.Issue11581SyntheticProvider StgClosure")
 
-        self.expect("print *((StgClosure*)(r14-1))",
+        self.expect("expr --show-types -- *((StgClosure*)(r14-1))",
             substrs = ["(StgClosure) $",
             "(StgClosure *) &$","0x",
             "addr = ",
@@ -60,7 +65,7 @@ class Issue11581TestCase(TestBase):
                 self.runCmd("register write r14 %d" % addr)
                 self.expect("register read r14",
                     substrs = ["0x",hex(addr)[2:].rstrip("L")])  # Remove trailing 'L' if it exists
-                self.expect("print *(StgClosure*)$r14",
+                self.expect("expr --show-types -- *(StgClosure*)$r14",
                     substrs = ["(StgClosure) $",
                     "(StgClosure *) &$","0x",
                     "addr = ",

Modified: lldb/branches/windows/test/expression_command/issue_11588/main.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/test/expression_command/issue_11588/main.cpp?rev=179679&r1=179678&r2=179679&view=diff
==============================================================================
--- lldb/branches/windows/test/expression_command/issue_11588/main.cpp (original)
+++ lldb/branches/windows/test/expression_command/issue_11588/main.cpp Wed Apr 17 03:38:48 2013
@@ -50,5 +50,5 @@ int main()
 	ptr_type r14 = (ptr_type)r14_;
 	int x = 0;
 	x = 3;
-	return (x-1);
+	return (x-1); // Set breakpoint here.
 }

Modified: lldb/branches/windows/test/expression_command/radar_9673664/TestExprHelpExamples.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/test/expression_command/radar_9673664/TestExprHelpExamples.py?rev=179679&r1=179678&r2=179679&view=diff
==============================================================================
--- lldb/branches/windows/test/expression_command/radar_9673664/TestExprHelpExamples.py (original)
+++ lldb/branches/windows/test/expression_command/radar_9673664/TestExprHelpExamples.py Wed Apr 17 03:38:48 2013
@@ -20,7 +20,7 @@ class Radar9673644TestCase(TestBase):
         self.line = line_number(self.main_source, '// Set breakpoint here.')
 
     # rdar://problem/9673664
-    @expectedFailureLinux # bugzilla 14805 -- expressions that require memory allocation evaluate incorrectly on Linux
+    @skipOnLinux # PR-14805: expressions that require memory allocation evaluate incorrectly on Linux
     def test_expr_commands(self):
         """The following expression commands should just work."""
         self.buildDefault()

Modified: lldb/branches/windows/test/expression_command/test/TestExprs.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/test/expression_command/test/TestExprs.py?rev=179679&r1=179678&r2=179679&view=diff
==============================================================================
--- lldb/branches/windows/test/expression_command/test/TestExprs.py (original)
+++ lldb/branches/windows/test/expression_command/test/TestExprs.py Wed Apr 17 03:38:48 2013
@@ -28,6 +28,11 @@ class BasicExprCommandsTestCase(TestBase
         self.line = line_number('main.cpp',
                                 '// Please test many expressions while stopped at this line:')
 
+        # Disable confirmation prompt to avoid infinite wait
+        self.runCmd("settings set auto-confirm true")
+        self.addTearDownHook(lambda: self.runCmd("settings clear auto-confirm"))
+
+
     def test_many_expr_commands(self):
         """These basic expression commands should work as expected."""
         self.buildDefault()
@@ -157,6 +162,22 @@ class BasicExprCommandsTestCase(TestBase
             startstr = "'Z'")
         self.DebugSBValue(val)
 
+        callee_break = target.BreakpointCreateByName ("a_function_to_call", None)
+        self.assertTrue(callee_break.GetNumLocations() > 0)
+
+        # Make sure ignoring breakpoints works from the command line:
+        self.expect("expression -i true -- a_function_to_call()",
+                    substrs = ['(int) $', ' 1'])
+        self.assertTrue (callee_break.GetHitCount() == 1)
+
+        # Now try ignoring breakpoints using the SB API's:
+        options = lldb.SBExpressionOptions()
+        options.SetIgnoreBreakpoints(True)
+        value = frame.EvaluateExpression('a_function_to_call()', options)
+        self.assertTrue (value.IsValid())
+        self.assertTrue (value.GetValueAsSigned(0) == 2)
+        self.assertTrue (callee_break.GetHitCount() == 2)
+
     # rdar://problem/8686536
     # CommandInterpreter::HandleCommand is stripping \'s from input for WantsRawCommand commands
     def test_expr_commands_can_handle_quotes(self):
@@ -207,7 +228,6 @@ class BasicExprCommandsTestCase(TestBase
             substrs = ['(int) $',
                        '6'])
 
-
 if __name__ == '__main__':
     import atexit
     lldb.SBDebugger.Initialize()

Modified: lldb/branches/windows/test/expression_command/test/main.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/test/expression_command/test/main.cpp?rev=179679&r1=179678&r2=179679&view=diff
==============================================================================
--- lldb/branches/windows/test/expression_command/test/main.cpp (original)
+++ lldb/branches/windows/test/expression_command/test/main.cpp Wed Apr 17 03:38:48 2013
@@ -1,5 +1,14 @@
 #include <stdio.h>
 
+static int static_value = 0;
+
+int
+a_function_to_call()
+{
+    static_value++;
+    return static_value;
+}
+
 int main (int argc, char const *argv[])
 {
     printf ("Hello world!\n");
@@ -29,5 +38,7 @@ int main (int argc, char const *argv[])
     expression printf ("two: %llu, one: %i\n", 2ull, 1)
     expression random() % 255l
 #endif
+
+    a_function_to_call();
     return 0;
 }

Modified: lldb/branches/windows/test/functionalities/abbreviation/TestAbbreviations.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/test/functionalities/abbreviation/TestAbbreviations.py?rev=179679&r1=179678&r2=179679&view=diff
==============================================================================
--- lldb/branches/windows/test/functionalities/abbreviation/TestAbbreviations.py (original)
+++ lldb/branches/windows/test/functionalities/abbreviation/TestAbbreviations.py Wed Apr 17 03:38:48 2013
@@ -62,7 +62,7 @@ class AbbreviationsTestCase(TestBase):
         self.expect("lo li",
                     startstr = "Logging categories for ")
 
-        self.runCmd("se se prompt Sycamore> ")
+        self.runCmd("se se prompt 'Sycamore> '")
         self.expect("se sh prompt",
                     startstr = 'prompt (string) = "Sycamore> "')
 
@@ -168,7 +168,6 @@ class AbbreviationsTestCase(TestBase):
             self.expect("i li",
                         substrs = [ 'a.out',
                                     '/usr/lib/dyld',
-                                    '/usr/lib/libstdc++',
                                     '/usr/lib/libSystem.B.dylib'])
 
 

Modified: lldb/branches/windows/test/functionalities/abbreviation/change_prompt.lldb
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/test/functionalities/abbreviation/change_prompt.lldb?rev=179679&r1=179678&r2=179679&view=diff
==============================================================================
--- lldb/branches/windows/test/functionalities/abbreviation/change_prompt.lldb (original)
+++ lldb/branches/windows/test/functionalities/abbreviation/change_prompt.lldb Wed Apr 17 03:38:48 2013
@@ -1,2 +1 @@
-settings set prompt [with-three-trailing-spaces]   
-
+settings set prompt "[with-three-trailing-spaces]   "
\ No newline at end of file

Modified: lldb/branches/windows/test/functionalities/alias/TestAliases.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/test/functionalities/alias/TestAliases.py?rev=179679&r1=179678&r2=179679&view=diff
==============================================================================
--- lldb/branches/windows/test/functionalities/alias/TestAliases.py (original)
+++ lldb/branches/windows/test/functionalities/alias/TestAliases.py Wed Apr 17 03:38:48 2013
@@ -136,22 +136,22 @@ class AliasTestCase(TestBase):
                                  "= 0x00000044" ])
 
         self.runCmd ("alias exprf expr -f %1")
-        self.runCmd ("alias exprf2 expr -f %1 --")
+        self.runCmd ("alias exprf2 expr --raw -f %1 --")
         self.expect ("exprf x -- 1234",
                      substrs = [ "(int) $",
                                  "= 0x000004d2" ])
 
         self.expect ('exprf2 c "Hi there!"',
-                     substrs = [ "(const char) [0] = 'H'",
-                                 "(const char) [1] = 'i'",
-                                 "(const char) [2] = ' '",
-                                 "(const char) [3] = 't'",
-                                 "(const char) [4] = 'h'",
-                                 "(const char) [5] = 'e'",
-                                 "(const char) [6] = 'r'",
-                                 "(const char) [7] = 'e'",
-                                 "(const char) [8] = '!'",
-                                 "(const char) [9] = '\\0'" ])
+                     substrs = [ "[0] = 'H'",
+                                 "[1] = 'i'",
+                                 "[2] = ' '",
+                                 "[3] = 't'",
+                                 "[4] = 'h'",
+                                 "[5] = 'e'",
+                                 "[6] = 'r'",
+                                 "[7] = 'e'",
+                                 "[8] = '!'",
+                                 "[9] = '\\0'" ])
         
 
         self.expect ("exprf x 1234",

Modified: lldb/branches/windows/test/functionalities/breakpoint/breakpoint_conditions/TestBreakpointConditions.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/test/functionalities/breakpoint/breakpoint_conditions/TestBreakpointConditions.py?rev=179679&r1=179678&r2=179679&view=diff
==============================================================================
--- lldb/branches/windows/test/functionalities/breakpoint/breakpoint_conditions/TestBreakpointConditions.py (original)
+++ lldb/branches/windows/test/functionalities/breakpoint/breakpoint_conditions/TestBreakpointConditions.py Wed Apr 17 03:38:48 2013
@@ -34,21 +34,18 @@ class BreakpointConditionsTestCase(TestB
         self.buildDsym()
         self.breakpoint_conditions_python()
 
-    @expectedFailureLinux # bugzilla 14426
     @dwarf_test
     def test_breakpoint_condition_with_dwarf_and_run_command(self):
         """Exercise breakpoint condition with 'breakpoint modify -c <expr> id'."""
         self.buildDwarf()
         self.breakpoint_conditions()
 
-    @expectedFailureLinux # bugzilla 14426
     @dwarf_test
     def test_breakpoint_condition_inline_with_dwarf_and_run_command(self):
         """Exercise breakpoint condition inline with 'breakpoint set'."""
         self.buildDwarf()
         self.breakpoint_conditions(inline=True)
 
-    @expectedFailureLinux # bugzilla 14426
     @python_api_test
     @dwarf_test
     def test_breakpoint_condition_with_dwarf_and_python_api(self):
@@ -168,7 +165,7 @@ class BreakpointConditionsTestCase(TestB
         # Frame #0 should be on self.line1 and the break condition should hold.
         from lldbutil import get_stopped_thread
         thread = get_stopped_thread(process, lldb.eStopReasonBreakpoint)
-        self.assertTrue(thread != None, "There should be a thread stopped due to breakpoint condition")
+        self.assertTrue(thread.IsValid(), "There should be a thread stopped due to breakpoint condition")
         frame0 = thread.GetFrameAtIndex(0)
         var = frame0.FindValue('val', lldb.eValueTypeVariableArgument)
         self.assertTrue(frame0.GetLineEntry().GetLine() == self.line1 and

Modified: lldb/branches/windows/test/functionalities/breakpoint/breakpoint_ignore_count/TestBreakpointIgnoreCount.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/test/functionalities/breakpoint/breakpoint_ignore_count/TestBreakpointIgnoreCount.py?rev=179679&r1=179678&r2=179679&view=diff
==============================================================================
--- lldb/branches/windows/test/functionalities/breakpoint/breakpoint_ignore_count/TestBreakpointIgnoreCount.py (original)
+++ lldb/branches/windows/test/functionalities/breakpoint/breakpoint_ignore_count/TestBreakpointIgnoreCount.py Wed Apr 17 03:38:48 2013
@@ -134,7 +134,7 @@ class BreakpointIgnoreCountTestCase(Test
         #lldbutil.print_stacktraces(process)
         from lldbutil import get_stopped_thread
         thread = get_stopped_thread(process, lldb.eStopReasonBreakpoint)
-        self.assertTrue(thread != None, "There should be a thread stopped due to breakpoint")
+        self.assertTrue(thread.IsValid(), "There should be a thread stopped due to breakpoint")
         frame0 = thread.GetFrameAtIndex(0)
         frame1 = thread.GetFrameAtIndex(1)
         frame2 = thread.GetFrameAtIndex(2)

Modified: lldb/branches/windows/test/functionalities/command_script/TestCommandScript.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/test/functionalities/command_script/TestCommandScript.py?rev=179679&r1=179678&r2=179679&view=diff
==============================================================================
--- lldb/branches/windows/test/functionalities/command_script/TestCommandScript.py (original)
+++ lldb/branches/windows/test/functionalities/command_script/TestCommandScript.py Wed Apr 17 03:38:48 2013
@@ -18,6 +18,7 @@ class CmdPythonTestCase(TestBase):
         self.pycmd_tests ()
 
     @dwarf_test
+    @skipOnLinux # causes buildbot failures, skip until we can investigate it
     def test_with_dwarf (self):
         self.buildDwarf ()
         self.pycmd_tests ()
@@ -44,6 +45,9 @@ class CmdPythonTestCase(TestBase):
         # Execute the cleanup function during test case tear down.
         self.addTearDownHook(cleanup)
 
+        # Interact with debugger in synchronous mode
+        self.setAsync(False)
+
         # We don't want to display the stdout if not in TraceOn() mode.
         if not self.TraceOn():
             self.HideStdout()
@@ -106,11 +110,22 @@ class CmdPythonTestCase(TestBase):
         self.expect("tell_async",
                     substrs = ['running async'])
         self.expect("tell_curr",
-                    substrs = ['I am running','sync'])
+                    substrs = ['I am running sync'])
 
+        # Test that a python command can redefine itself
+        self.expect('command script add -f foobar welcome')
 
         self.runCmd("command script clear")
 
+        # Test that re-defining an existing command works
+        self.runCmd('command script add my_command --function welcome.welcome_impl')
+        self.expect('my_command Blah', substrs = ['Hello Blah, welcome to LLDB'])
+
+        self.runCmd('command script add my_command --function welcome.target_name_impl')
+        self.expect('my_command', substrs = ['a.out'])
+
+        self.runCmd("command script clear")
+                
         self.expect('command script list', matching=False,
                     substrs = ['targetname',
                                'longwait'])

Modified: lldb/branches/windows/test/functionalities/command_script/import/TestImport.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/test/functionalities/command_script/import/TestImport.py?rev=179679&r1=179678&r2=179679&view=diff
==============================================================================
--- lldb/branches/windows/test/functionalities/command_script/import/TestImport.py (original)
+++ lldb/branches/windows/test/functionalities/command_script/import/TestImport.py Wed Apr 17 03:38:48 2013
@@ -10,6 +10,7 @@ class ImportTestCase(TestBase):
     mydir = os.path.join("functionalities", "command_script", "import")
 
     @python_api_test
+    @skipOnLinux # causes buildbot failures, skip until we can investigate it
     def test_import_command(self):
         """Import some Python scripts by path and test them"""
         self.run_test()

Modified: lldb/branches/windows/test/functionalities/command_script/import/bar/bar.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/test/functionalities/command_script/import/bar/bar.py?rev=179679&r1=179678&r2=179679&view=diff
==============================================================================
--- lldb/branches/windows/test/functionalities/command_script/import/bar/bar.py (original)
+++ lldb/branches/windows/test/functionalities/command_script/import/bar/bar.py Wed Apr 17 03:38:48 2013
@@ -1,6 +1,6 @@
 def bar_function(debugger, args, result, dict):
 	global UtilityModule
-	result.Printf(UtilityModule.barutil_function("bar told me " + args))
+	print >>result,  (UtilityModule.barutil_function("bar told me " + args))
 	return None
 
 def __lldb_init_module(debugger, session_dict):

Modified: lldb/branches/windows/test/functionalities/command_script/import/foo/bar/foobar.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/test/functionalities/command_script/import/foo/bar/foobar.py?rev=179679&r1=179678&r2=179679&view=diff
==============================================================================
--- lldb/branches/windows/test/functionalities/command_script/import/foo/bar/foobar.py (original)
+++ lldb/branches/windows/test/functionalities/command_script/import/foo/bar/foobar.py Wed Apr 17 03:38:48 2013
@@ -1,3 +1,3 @@
 def foo_function(debugger, args, result, dict):
-	result.Printf("foobar says " + args)
+	print >>result,  ("foobar says " + args)
 	return None

Modified: lldb/branches/windows/test/functionalities/command_script/import/foo/foo.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/test/functionalities/command_script/import/foo/foo.py?rev=179679&r1=179678&r2=179679&view=diff
==============================================================================
--- lldb/branches/windows/test/functionalities/command_script/import/foo/foo.py (original)
+++ lldb/branches/windows/test/functionalities/command_script/import/foo/foo.py Wed Apr 17 03:38:48 2013
@@ -1,3 +1,3 @@
 def foo_function(debugger, args, result, dict):
-	result.Printf("foo says " + args)
+	print >>result,  ("foo says " + args)
 	return None

Modified: lldb/branches/windows/test/functionalities/command_script/import/foo/foo2.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/test/functionalities/command_script/import/foo/foo2.py?rev=179679&r1=179678&r2=179679&view=diff
==============================================================================
--- lldb/branches/windows/test/functionalities/command_script/import/foo/foo2.py (original)
+++ lldb/branches/windows/test/functionalities/command_script/import/foo/foo2.py Wed Apr 17 03:38:48 2013
@@ -1,5 +1,5 @@
 def foo2_function(debugger, args, result, dict):
-	result.Printf("foo2 says " + args)
+	print >>result,  ("foo2 says " + args)
 	return None
 
 def __lldb_init_module(debugger, session_dict):

Modified: lldb/branches/windows/test/functionalities/command_script/mysto.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/test/functionalities/command_script/mysto.py?rev=179679&r1=179678&r2=179679&view=diff
==============================================================================
--- lldb/branches/windows/test/functionalities/command_script/mysto.py (original)
+++ lldb/branches/windows/test/functionalities/command_script/mysto.py Wed Apr 17 03:38:48 2013
@@ -11,7 +11,7 @@ def StepOver(debugger, args, result, dic
 	print type(arg_split)
 	count = int(arg_split[0])
 	for i in range(0,count):
-		lldb.thread.StepOver(lldb.eOnlyThisThread)
+		debugger.GetSelectedTarget().GetProcess().GetSelectedThread().StepOver(lldb.eOnlyThisThread)
 		print "step<%d>"%i
 
 def __lldb_init_module(debugger, session_dict):

Modified: lldb/branches/windows/test/functionalities/command_script/welcome.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/test/functionalities/command_script/welcome.py?rev=179679&r1=179678&r2=179679&view=diff
==============================================================================
--- lldb/branches/windows/test/functionalities/command_script/welcome.py (original)
+++ lldb/branches/windows/test/functionalities/command_script/welcome.py Wed Apr 17 03:38:48 2013
@@ -5,13 +5,13 @@ def welcome_impl(debugger, args, result,
         Just a docstring for welcome_impl
         A command that says hello to LLDB users
     """
-    result.Printf('Hello ' + args + ', welcome to LLDB');
+    print >>result,  ('Hello ' + args + ', welcome to LLDB');
     return None;
 
 def target_name_impl(debugger, args, result, dict):
     target = debugger.GetSelectedTarget()
     file = target.GetExecutable()
-    result.PutCString('Current target ' + file.GetFilename())
+    print >>result,  ('Current target ' + file.GetFilename())
     if args == 'fail':
         return 'a test for error in command'
     else:
@@ -19,17 +19,17 @@ def target_name_impl(debugger, args, res
 
 def print_wait_impl(debugger, args, result, dict):
     result.SetImmediateOutputFile(sys.stdout)
-    result.PutCString('Trying to do long task..')
+    print >>result,  ('Trying to do long task..')
     import time
     time.sleep(1)
-    result.PutCString('Still doing long task..')
+    print >>result,  ('Still doing long task..')
     time.sleep(1)
-    result.PutCString('Done; if you saw the delays I am doing OK')
+    print >>result,  ('Done; if you saw the delays I am doing OK')
     return None
 
 def check_for_synchro(debugger, args, result, dict):
     if debugger.GetAsync() == True:
-        result.PutCString('I am running async')
+        print >>result,  ('I am running async')
     if debugger.GetAsync() == False:
-        result.PutCString('I am running sync')
+        print >>result,  ('I am running sync')
     return None

Modified: lldb/branches/windows/test/functionalities/completion/TestCompletion.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/test/functionalities/completion/TestCompletion.py?rev=179679&r1=179678&r2=179679&view=diff
==============================================================================
--- lldb/branches/windows/test/functionalities/completion/TestCompletion.py (original)
+++ lldb/branches/windows/test/functionalities/completion/TestCompletion.py Wed Apr 17 03:38:48 2013
@@ -29,12 +29,13 @@ class CommandLineCompletionTestCase(Test
         """Test that 'de' completes to 'detach '."""
         self.complete_from_to('de', 'detach ')
 
-    @expectedFailureLinux # bugzilla 14425
+    @expectedFailureLinux # PR-14425: completion broken for strings that begin with --
     def test_process_attach_dash_dash_con(self):
         """Test that 'process attach --con' completes to 'process attach --continue '."""
         self.complete_from_to('process attach --con', 'process attach --continue ')
 
     # <rdar://problem/11052829>
+    @skipOnLinux # PR-14637: this test case fails (with GCC 4.6 but not clang) because the input prompt "(lldb)" is missing
     def test_infinite_loop_while_completing(self):
         """Test that 'process print hello\' completes to itself and does not infinite loop."""
         self.complete_from_to('process print hello\\', 'process print hello\\',

Modified: lldb/branches/windows/test/functionalities/conditional_break/.lldb
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/test/functionalities/conditional_break/.lldb?rev=179679&r1=179678&r2=179679&view=diff
==============================================================================
--- lldb/branches/windows/test/functionalities/conditional_break/.lldb (original)
+++ lldb/branches/windows/test/functionalities/conditional_break/.lldb Wed Apr 17 03:38:48 2013
@@ -1,7 +1,7 @@
 file a.out
 breakpoint set -n c
-script import sys, os
-script sys.path.append(os.path.join(os.getcwd(), os.pardir))
-script import conditional_break
-breakpoint command add -s python 1 -o "conditional_break.stop_if_called_from_a()"
+#script import sys, os
+#script sys.path.append(os.path.join(os.getcwd(), os.pardir))
+command script import -r conditional_break.py
+breakpoint command add 1 -F "conditional_break.stop_if_called_from_a"
 

Modified: lldb/branches/windows/test/functionalities/conditional_break/TestConditionalBreak.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/test/functionalities/conditional_break/TestConditionalBreak.py?rev=179679&r1=179678&r2=179679&view=diff
==============================================================================
--- lldb/branches/windows/test/functionalities/conditional_break/TestConditionalBreak.py (original)
+++ lldb/branches/windows/test/functionalities/conditional_break/TestConditionalBreak.py Wed Apr 17 03:38:48 2013
@@ -40,6 +40,7 @@ class ConditionalBreakTestCase(TestBase)
         self.simulate_conditional_break_by_user()
 
     @dwarf_test
+    @skipOnLinux # due to two assertion failures introduced by r174793: ProcessPOSIX.cpp:223 (assertion 'state == eStateStopped || state == eStateCrashed') and POSIXThread.cpp:254 (assertion 'bp_site')
     def test_with_dwarf_command(self):
         """Simulate a user using lldb commands to break on c() if called from a()."""
         self.buildDwarf()
@@ -115,9 +116,14 @@ class ConditionalBreakTestCase(TestBase)
             self.HideStdout()
         self.runCmd("command source .lldb")
 
+        self.runCmd ("break list")
+
         if self.TraceOn():
             print "About to run."
         self.runCmd("run", RUN_SUCCEEDED)
+
+        self.runCmd ("break list")
+
         if self.TraceOn():
             print "Done running"
 

Modified: lldb/branches/windows/test/functionalities/conditional_break/conditional_break.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/test/functionalities/conditional_break/conditional_break.py?rev=179679&r1=179678&r2=179679&view=diff
==============================================================================
--- lldb/branches/windows/test/functionalities/conditional_break/conditional_break.py (original)
+++ lldb/branches/windows/test/functionalities/conditional_break/conditional_break.py Wed Apr 17 03:38:48 2013
@@ -1,31 +1,25 @@
 import sys
 import lldb
-import lldbutil
 
-def stop_if_called_from_a():
-    # lldb.debugger_unique_id stores the id of the debugger associated with us.
-    dbg = lldb.SBDebugger.FindDebuggerWithID(lldb.debugger_unique_id)
+def stop_if_called_from_a(frame, bp_loc, dict):
+
+    thread = frame.GetThread()
+    process = thread.GetProcess()
+    target = process.GetTarget()
+    dbg = target.GetDebugger()
 
     # Perform synchronous interaction with the debugger.
     old_async = dbg.GetAsync()
     dbg.SetAsync(True)
 
-    # Retrieve the target, process, and the only thread.
-    target = dbg.GetSelectedTarget()
-    process = target.GetProcess()
-    thread = process.GetThreadAtIndex(0)
-
     # We check the call frames in order to stop only when the immediate caller
     # of the leaf function c() is a().  If it's not the right caller, we ask the
     # command interpreter to continue execution.
 
-    print >> sys.stdout, "Checking call frames..."
-    lldbutil.print_stacktrace(thread)
     should_stop = True
     if thread.GetNumFrames() >= 2:
-        funcs = lldbutil.get_function_names(thread)
-        print >> sys.stdout, funcs[0], "called from", funcs[1]
-        if (funcs[0] == 'c' and funcs[1] == 'a'):
+
+        if (thread.frames[0].function.name == 'c' and thread.frames[1].function.name == 'a'):
             should_stop = True
         else:
             process.Continue()

Modified: lldb/branches/windows/test/functionalities/connect_remote/TestConnectRemote.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/test/functionalities/connect_remote/TestConnectRemote.py?rev=179679&r1=179678&r2=179679&view=diff
==============================================================================
--- lldb/branches/windows/test/functionalities/connect_remote/TestConnectRemote.py (original)
+++ lldb/branches/windows/test/functionalities/connect_remote/TestConnectRemote.py Wed Apr 17 03:38:48 2013
@@ -12,7 +12,6 @@ class ConnectRemoteTestCase(TestBase):
 
     mydir = os.path.join("functionalities", "connect_remote")
 
-    @expectedFailureLinux # bugzilla 14427
     def test_connect_remote(self):
         """Test "process connect connect:://localhost:12345"."""
 

Modified: lldb/branches/windows/test/functionalities/data-formatter/data-formatter-objc/.categories
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/test/functionalities/data-formatter/data-formatter-objc/.categories?rev=179679&r1=179678&r2=179679&view=diff
==============================================================================
--- lldb/branches/windows/test/functionalities/data-formatter/data-formatter-objc/.categories (original)
+++ lldb/branches/windows/test/functionalities/data-formatter/data-formatter-objc/.categories Wed Apr 17 03:38:48 2013
@@ -1 +1 @@
-dataformatter,objc
+dataformatters,objc

Modified: lldb/branches/windows/test/functionalities/data-formatter/data-formatter-objc/TestDataFormatterObjC.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/test/functionalities/data-formatter/data-formatter-objc/TestDataFormatterObjC.py?rev=179679&r1=179678&r2=179679&view=diff
==============================================================================
--- lldb/branches/windows/test/functionalities/data-formatter/data-formatter-objc/TestDataFormatterObjC.py (original)
+++ lldb/branches/windows/test/functionalities/data-formatter/data-formatter-objc/TestDataFormatterObjC.py Wed Apr 17 03:38:48 2013
@@ -90,8 +90,6 @@ class ObjCDataFormatterTestCase(TestBase
         """Test common cases of expression parser <--> formatters interaction."""
         self.buildDsym()
         self.expr_objc_data_formatter_commands()
-        def getCategories(self):
-            return ['dataformatters','expression','objc']
 
     @unittest2.skipUnless(sys.platform.startswith("darwin"), "requires Darwin")
     @dwarf_test
@@ -99,8 +97,6 @@ class ObjCDataFormatterTestCase(TestBase
         """Test common cases of expression parser <--> formatters interaction."""
         self.buildDwarf()
         self.expr_objc_data_formatter_commands()
-        def getCategories(self):
-            return ['dataformatters','expression','objc']
 
     def setUp(self):
         # Call super's setUp().
@@ -270,7 +266,7 @@ class ObjCDataFormatterTestCase(TestBase
                     '(NSAttributedString *) mutableAttrString = ',' @"hello world from foo"',
                     '(NSString *) mutableGetConst = ',' @"foo said this string needs to be very long so much longer than whatever other string has been seen ever before by anyone of the mankind that of course this is still not long enough given what foo our friend foo our lovely dearly friend foo desired of us so i am adding more stuff here for the sake of it and for the joy of our friend who is named guess what just foo. hence, dear friend foo, stay safe, your string is now  long enough to accommodate your testing need and I will make sure that if not we extend it with even more fuzzy random meaningless words pasted one after the other from a long tiresome friday evening spent working in my office. my office mate went home but I am still randomly typing just for the fun of seeing what happens of the length of a Mutable String in Cocoa if it goes beyond one byte.. so be it, dear foo"'])
 
-        self.expect('frame variable -d run-target path',substrs = ['usr/blah/stuff'])
+        self.expect('expr -d run-target -- path',substrs = ['usr/blah/stuff'])
         self.expect('frame variable path',substrs = ['usr/blah/stuff'])
 
         self.expect('frame variable immutableData mutableData data_ref mutable_data_ref mutable_string_ref',
@@ -411,18 +407,18 @@ class ObjCDataFormatterTestCase(TestBase
         self.expect('expression ((id)@"Hello")', matching=False,
                     substrs = ['Hello'])
 
-        self.expect('expression -d true -- ((id)@"Hello")',
+        self.expect('expression -d run -- ((id)@"Hello")',
         substrs = ['Hello'])
 
-        self.expect('expr -d true -- label1',
+        self.expect('expr -d run -- label1',
             substrs = ['Process Name'])
 
-        self.expect('expr -d true -- @"Hello"',
+        self.expect('expr -d run -- @"Hello"',
             substrs = ['Hello'])
 
-        self.expect('expr -d true --object-description -- @"Hello"',
+        self.expect('expr -d run --object-description -- @"Hello"',
             substrs = ['Hello'])
-        self.expect('expr -d true --object-description -- @"Hello"', matching=False,
+        self.expect('expr -d run --object-description -- @"Hello"', matching=False,
             substrs = ['@"Hello" Hello'])
 
 

Modified: lldb/branches/windows/test/functionalities/data-formatter/data-formatter-skip-summary/Makefile
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/test/functionalities/data-formatter/data-formatter-skip-summary/Makefile?rev=179679&r1=179678&r2=179679&view=diff
==============================================================================
--- lldb/branches/windows/test/functionalities/data-formatter/data-formatter-skip-summary/Makefile (original)
+++ lldb/branches/windows/test/functionalities/data-formatter/data-formatter-skip-summary/Makefile Wed Apr 17 03:38:48 2013
@@ -3,3 +3,10 @@ LEVEL = ../../../make
 CXX_SOURCES := main.cpp
 
 include $(LEVEL)/Makefile.rules
+
+CXXFLAGS += -O0
+
+ifeq (,$(findstring gcc,$(CC)))
+CXXFLAGS += -stdlib=libstdc++
+LDFLAGS += -stdlib=libstdc++
+endif

Modified: lldb/branches/windows/test/functionalities/data-formatter/data-formatter-smart-array/TestDataFormatterSmartArray.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/test/functionalities/data-formatter/data-formatter-smart-array/TestDataFormatterSmartArray.py?rev=179679&r1=179678&r2=179679&view=diff
==============================================================================
--- lldb/branches/windows/test/functionalities/data-formatter/data-formatter-smart-array/TestDataFormatterSmartArray.py (original)
+++ lldb/branches/windows/test/functionalities/data-formatter/data-formatter-smart-array/TestDataFormatterSmartArray.py Wed Apr 17 03:38:48 2013
@@ -240,11 +240,11 @@ class SmartArrayDataFormatterTestCase(Te
 # using [] is required here
         self.runCmd("type summary add --summary-string \"arr = ${var%x}\" \"int [5]\"")
         
-        self.expect("frame variable intarr",
-                    substrs = ['<invalid usage of pointer value as object>'])
+        self.expect("frame variable intarr",matching=False,
+                    substrs = ['0x00000001,0x00000001,0x00000002,0x00000003,0x00000005'])
         
-        self.expect("frame variable other.intarr",
-                    substrs = ['<invalid usage of pointer value as object>'])
+        self.expect("frame variable other.intarr", matching=False,
+                    substrs = ['0x00000009,0x00000008,0x00000007,0x00000006,0x00000005'])
 
         self.runCmd("type summary add --summary-string \"arr = ${var[]%x}\" \"int [5]\"")
         

Modified: lldb/branches/windows/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/list/Makefile
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/list/Makefile?rev=179679&r1=179678&r2=179679&view=diff
==============================================================================
--- lldb/branches/windows/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/list/Makefile (original)
+++ lldb/branches/windows/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/list/Makefile Wed Apr 17 03:38:48 2013
@@ -3,3 +3,6 @@ LEVEL = ../../../../../make
 CXX_SOURCES := main.cpp
 
 include $(LEVEL)/Makefile.rules
+
+CXXFLAGS += -stdlib=libstdc++ -O0
+LDFLAGS += -stdlib=libstdc++
\ No newline at end of file

Modified: lldb/branches/windows/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/list/TestDataFormatterStdList.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/list/TestDataFormatterStdList.py?rev=179679&r1=179678&r2=179679&view=diff
==============================================================================
--- lldb/branches/windows/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/list/TestDataFormatterStdList.py (original)
+++ lldb/branches/windows/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/list/TestDataFormatterStdList.py Wed Apr 17 03:38:48 2013
@@ -20,6 +20,7 @@ class StdListDataFormatterTestCase(TestB
         self.data_formatter_commands()
 
     @dwarf_test
+    @expectedFailureGcc # llvm.org/pr15301 LLDB prints incorrect sizes of STL containers
     def test_with_dwarf_and_run_command(self):
         """Test data formatter commands."""
         self.buildDwarf()

Modified: lldb/branches/windows/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/map/Makefile
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/map/Makefile?rev=179679&r1=179678&r2=179679&view=diff
==============================================================================
--- lldb/branches/windows/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/map/Makefile (original)
+++ lldb/branches/windows/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/map/Makefile Wed Apr 17 03:38:48 2013
@@ -3,3 +3,6 @@ LEVEL = ../../../../../make
 CXX_SOURCES := main.cpp
 
 include $(LEVEL)/Makefile.rules
+
+CXXFLAGS += -stdlib=libstdc++ -O0
+LDFLAGS += -stdlib=libstdc++

Modified: lldb/branches/windows/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/map/TestDataFormatterStdMap.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/map/TestDataFormatterStdMap.py?rev=179679&r1=179678&r2=179679&view=diff
==============================================================================
--- lldb/branches/windows/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/map/TestDataFormatterStdMap.py (original)
+++ lldb/branches/windows/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/map/TestDataFormatterStdMap.py Wed Apr 17 03:38:48 2013
@@ -19,6 +19,10 @@ class StdMapDataFormatterTestCase(TestBa
         self.buildDsym()
         self.data_formatter_commands()
 
+    @expectedFailureClang # llvm.org/pr15301: LLDB prints incorrect size of
+                          # libstdc++ containers
+    @skipIfGcc # llvm.org/pr15036: When built with GCC, this test causes lldb to crash with
+               # assert DeclCXX.h:554 queried property of class with no definition
     @dwarf_test
     def test_with_dwarf_and_run_command(self):
         """Test data formatter commands."""

Modified: lldb/branches/windows/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/vector/Makefile
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/vector/Makefile?rev=179679&r1=179678&r2=179679&view=diff
==============================================================================
--- lldb/branches/windows/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/vector/Makefile (original)
+++ lldb/branches/windows/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/vector/Makefile Wed Apr 17 03:38:48 2013
@@ -3,3 +3,6 @@ LEVEL = ../../../../../make
 CXX_SOURCES := main.cpp
 
 include $(LEVEL)/Makefile.rules
+
+CXXFLAGS += -stdlib=libstdc++ -O0
+LDFLAGS += -stdlib=libstdc++
\ No newline at end of file

Modified: lldb/branches/windows/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/vector/TestDataFormatterStdVector.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/vector/TestDataFormatterStdVector.py?rev=179679&r1=179678&r2=179679&view=diff
==============================================================================
--- lldb/branches/windows/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/vector/TestDataFormatterStdVector.py (original)
+++ lldb/branches/windows/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/vector/TestDataFormatterStdVector.py Wed Apr 17 03:38:48 2013
@@ -20,6 +20,7 @@ class StdVectorDataFormatterTestCase(Tes
         self.data_formatter_commands()
 
     @dwarf_test
+    @expectedFailureLinux # llvm.org/pr15301 LLDB prints incorrect sizes of STL containers
     def test_with_dwarf_and_run_command(self):
         """Test data formatter commands."""
         self.buildDwarf()

Modified: lldb/branches/windows/test/functionalities/data-formatter/rdar-10887661/TestRdar10887661.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/test/functionalities/data-formatter/rdar-10887661/TestRdar10887661.py?rev=179679&r1=179678&r2=179679&view=diff
==============================================================================
--- lldb/branches/windows/test/functionalities/data-formatter/rdar-10887661/TestRdar10887661.py (original)
+++ lldb/branches/windows/test/functionalities/data-formatter/rdar-10887661/TestRdar10887661.py Wed Apr 17 03:38:48 2013
@@ -13,7 +13,6 @@ class Rdar10887661TestCase(TestBase):
     mydir = os.path.join("functionalities", "data-formatter", "rdar-10887661")
 
     # rdar://problem/10887661
-    @unittest2.expectedFailure
     @unittest2.skipUnless(sys.platform.startswith("darwin"), "requires Darwin")
     @dsym_test
     def test_with_dsym_and_run_command(self):
@@ -22,7 +21,6 @@ class Rdar10887661TestCase(TestBase):
         self.capping_test_commands()
 
     # rdar://problem/10887661
-    @unittest2.expectedFailure
     @dwarf_test
     def test_with_dwarf_and_run_command(self):
         """Check for an issue where capping does not work because the Target pointer appears to be changing behind our backs."""

Modified: lldb/branches/windows/test/functionalities/data-formatter/rdar-12437442/TestRdar12437442.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/test/functionalities/data-formatter/rdar-12437442/TestRdar12437442.py?rev=179679&r1=179678&r2=179679&view=diff
==============================================================================
--- lldb/branches/windows/test/functionalities/data-formatter/rdar-12437442/TestRdar12437442.py (original)
+++ lldb/branches/windows/test/functionalities/data-formatter/rdar-12437442/TestRdar12437442.py Wed Apr 17 03:38:48 2013
@@ -64,18 +64,19 @@ class DataFormatterRdar12437442TestCase(
         id_x.SetPreferSyntheticValue(True)
         
         if self.TraceOn():
-            self.runCmd("frame variable x --dynamic-type run-target --ptr-depth 1")
-        
+            self.runCmd("expr --dynamic-type run-target --ptr-depth 1 -- x")
+
         self.assertTrue(id_x.GetSummary() == '@"5 objects"', "array does not get correct summary")
 
         self.runCmd("next")
+        self.runCmd("frame select 0")
 
         id_x = self.dbg.GetSelectedTarget().GetProcess().GetSelectedThread().GetSelectedFrame().FindVariable("x")
         id_x.SetPreferDynamicValue(lldb.eDynamicCanRunTarget)
         id_x.SetPreferSyntheticValue(True)
 
         if self.TraceOn():
-            self.runCmd("frame variable x --dynamic-type run-target --ptr-depth 1")
+            self.runCmd("expr --dynamic-type run-target --ptr-depth 1 -- x")
 
         self.assertTrue(id_x.GetNumChildren() == 7, "dictionary does not have 7 children")
         id_x.SetPreferSyntheticValue(False)

Modified: lldb/branches/windows/test/functionalities/embedded_interpreter/TestConvenienceVariables.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/test/functionalities/embedded_interpreter/TestConvenienceVariables.py?rev=179679&r1=179678&r2=179679&view=diff
==============================================================================
--- lldb/branches/windows/test/functionalities/embedded_interpreter/TestConvenienceVariables.py (original)
+++ lldb/branches/windows/test/functionalities/embedded_interpreter/TestConvenienceVariables.py Wed Apr 17 03:38:48 2013
@@ -18,6 +18,7 @@ class ConvenienceVariablesCase(TestBase)
         self.convenience_variables()
 
     @dwarf_test
+    @skipOnLinux # PR-14637: this test case fails sometimes because the input prompt "(lldb)" is missing
     def test_with_dwarf_and_run_commands(self):
         """Test convenience variables lldb.debugger, lldb.target, lldb.process, lldb.thread, and lldb.frame."""
         self.buildDwarf()

Modified: lldb/branches/windows/test/functionalities/expr-doesnt-deadlock/TestExprDoesntBlock.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/test/functionalities/expr-doesnt-deadlock/TestExprDoesntBlock.py?rev=179679&r1=179678&r2=179679&view=diff
==============================================================================
--- lldb/branches/windows/test/functionalities/expr-doesnt-deadlock/TestExprDoesntBlock.py (original)
+++ lldb/branches/windows/test/functionalities/expr-doesnt-deadlock/TestExprDoesntBlock.py Wed Apr 17 03:38:48 2013
@@ -10,6 +10,9 @@ from lldbtest import *
 
 class ExprDoesntDeadlockTestCase(TestBase):
 
+    def getCategories(self):
+        return ['basic_process']
+
     mydir = os.path.join("functionalities", "expr-doesnt-deadlock")
 
     @unittest2.skipUnless(sys.platform.startswith("darwin"), "requires Darwin")
@@ -20,7 +23,7 @@ class ExprDoesntDeadlockTestCase(TestBas
         self.expr_doesnt_deadlock()
 
     @dwarf_test
-    @expectedFailureLinux # due to bugzilla 14437
+    @skipOnLinux # PR-15258: disabled due to assertion failure in ProcessMonitor::GetCrashReasonForSIGSEGV:
     def test_with_dwarf_and_run_command(self):
         """Test that expr will time out and allow other threads to run if it blocks."""
         self.buildDwarf()
@@ -55,14 +58,14 @@ class ExprDoesntDeadlockTestCase(TestBas
         # Frame #0 should be on self.line1 and the break condition should hold.
         from lldbutil import get_stopped_thread
         thread = get_stopped_thread(process, lldb.eStopReasonBreakpoint)
-        self.assertTrue(thread != None, "There should be a thread stopped due to breakpoint condition")
+        self.assertTrue(thread.IsValid(), "There should be a thread stopped due to breakpoint condition")
 
         frame0 = thread.GetFrameAtIndex(0)
 
         var = frame0.EvaluateExpression ("call_me_to_get_lock()")
         self.assertTrue (var.IsValid())
         self.assertTrue (var.GetValueAsSigned (0) == 567)
-        
+
 if __name__ == '__main__':
     import atexit
     lldb.SBDebugger.Initialize()

Modified: lldb/branches/windows/test/functionalities/inferior-changed/TestInferiorChanged.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/test/functionalities/inferior-changed/TestInferiorChanged.py?rev=179679&r1=179678&r2=179679&view=diff
==============================================================================
--- lldb/branches/windows/test/functionalities/inferior-changed/TestInferiorChanged.py (original)
+++ lldb/branches/windows/test/functionalities/inferior-changed/TestInferiorChanged.py Wed Apr 17 03:38:48 2013
@@ -21,12 +21,15 @@ class ChangedInferiorTestCase(TestBase):
         self.setTearDownCleanup(dictionary=d)
         self.inferior_not_crashing()
 
-    @expectedFailureLinux # bugzilla 14662 - POSIX dynamic loader asserts on re-launch
     def test_inferior_crashing_dwarf(self):
         """Test lldb reloads the inferior after it was changed during the session."""
         self.buildDwarf()
         self.inferior_crashing()
         self.cleanup()
+        # lldb needs to recognize the inferior has changed. If lldb needs to check the
+        # new module timestamp, make sure it is not the same as the old one, so add a
+        # 1 second delay.
+        time.sleep(1)
         d = {'C_SOURCES': 'main2.c'}
         self.buildDwarf(dictionary=d)
         self.setTearDownCleanup(dictionary=d)
@@ -46,16 +49,19 @@ class ChangedInferiorTestCase(TestBase):
 
         self.runCmd("run", RUN_SUCCEEDED)
 
-        # FIXME: This expected stop reason is Darwin-specific
+        if sys.platform.startswith("darwin"):
+            stop_reason = 'stop reason = EXC_BAD_ACCESS'
+        else:
+            stop_reason = 'stop reason = invalid address'
+
         # The stop reason of the thread should be a bad access exception.
         self.expect("thread list", STOPPED_DUE_TO_EXC_BAD_ACCESS,
             substrs = ['stopped',
-                       'stop reason = EXC_BAD_ACCESS'])
+                       stop_reason])
 
-        # FIXME: This expected stop reason is Darwin-specific
         # And it should report the correct line number.
         self.expect("thread backtrace all",
-            substrs = ['stop reason = EXC_BAD_ACCESS',
+            substrs = [stop_reason,
                        'main.c:%d' % self.line1])
 
     def inferior_not_crashing(self):
@@ -64,8 +70,12 @@ class ChangedInferiorTestCase(TestBase):
         self.runCmd("run", RUN_SUCCEEDED)
         self.runCmd("process status")
 
-        # FIXME: This unexpected stop reason is Darwin-specific
-        if 'EXC_BAD_ACCESS' in self.res.GetOutput():
+        if sys.platform.startswith("darwin"):
+            stop_reason = 'EXC_BAD_ACCESS'
+        else:
+            stop_reason = 'invalid address'
+
+        if stop_reason in self.res.GetOutput():
             self.fail("Inferior changed, but lldb did not perform a reload")
 
         # Break inside the main.

Modified: lldb/branches/windows/test/functionalities/inline-stepping/TestInlineStepping.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/test/functionalities/inline-stepping/TestInlineStepping.py?rev=179679&r1=179678&r2=179679&view=diff
==============================================================================
--- lldb/branches/windows/test/functionalities/inline-stepping/TestInlineStepping.py (original)
+++ lldb/branches/windows/test/functionalities/inline-stepping/TestInlineStepping.py Wed Apr 17 03:38:48 2013
@@ -18,6 +18,9 @@ class TestInlineStepping(TestBase):
         self.buildDsym()
         self.inline_stepping()
 
+    @expectedFailureGcc # Some versions of GCC emit DWARF that considers functions to start at the line with the '{' whereas this test
+                        # expects the first line of a function to be the first line of source (i.e. what clang does). As such, this test
+                        # fails with some versions of GCC.
     @python_api_test
     @dwarf_test
     def test_with_dwarf_and_python_api(self):
@@ -33,6 +36,9 @@ class TestInlineStepping(TestBase):
         self.buildDsym()
         self.inline_stepping_step_over()
 
+    @expectedFailureGcc # Some versions of GCC emit DWARF that considers functions to start at the line with the '{' whereas this test
+                        # expects the first line of a function to be the first line of source (i.e. what clang does). As such, this test
+                        # fails with some versions of GCC.
     @python_api_test
     @dwarf_test
     def test_step_over_with_dwarf_and_python_api(self):

Modified: lldb/branches/windows/test/functionalities/load_unload/Makefile
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/test/functionalities/load_unload/Makefile?rev=179679&r1=179678&r2=179679&view=diff
==============================================================================
--- lldb/branches/windows/test/functionalities/load_unload/Makefile (original)
+++ lldb/branches/windows/test/functionalities/load_unload/Makefile Wed Apr 17 03:38:48 2013
@@ -4,7 +4,7 @@ CC ?= clang
 ifeq "$(ARCH)" ""
 	ARCH = x86_64
 endif
-CFLAGS ?=-arch $(ARCH) -gdwarf-2 -O0
+CFLAGS ?=-arch $(ARCH) -g -O0
 CWD := $(shell pwd)
 
 all: a.out hidden/libd.dylib

Modified: lldb/branches/windows/test/functionalities/load_unload/TestLoadUnload.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/test/functionalities/load_unload/TestLoadUnload.py?rev=179679&r1=179678&r2=179679&view=diff
==============================================================================
--- lldb/branches/windows/test/functionalities/load_unload/TestLoadUnload.py (original)
+++ lldb/branches/windows/test/functionalities/load_unload/TestLoadUnload.py Wed Apr 17 03:38:48 2013
@@ -11,6 +11,9 @@ import lldbutil
 
 class LoadUnloadTestCase(TestBase):
 
+    def getCategories (self):
+        return ['basic_process']
+
     mydir = os.path.join("functionalities", "load_unload")
 
     def setUp(self):

Modified: lldb/branches/windows/test/functionalities/process_launch/TestProcessLaunch.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/test/functionalities/process_launch/TestProcessLaunch.py?rev=179679&r1=179678&r2=179679&view=diff
==============================================================================
--- lldb/branches/windows/test/functionalities/process_launch/TestProcessLaunch.py (original)
+++ lldb/branches/windows/test/functionalities/process_launch/TestProcessLaunch.py Wed Apr 17 03:38:48 2013
@@ -152,7 +152,7 @@ class ProcessLaunchTestCase(TestBase):
                                                                err_file_path)
 
         self.expect(launch_command, error=True,
-                startstr = "error: No such file or directory: %sz" % my_working_dir_path)
+                patterns = ["error:.* No such file or directory: %sz" % my_working_dir_path])
 
         # Really launch the process
         launch_command = "process launch -w %s -o %s -e %s" % (my_working_dir_path,

Modified: lldb/branches/windows/test/functionalities/register/TestRegisters.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/test/functionalities/register/TestRegisters.py?rev=179679&r1=179678&r2=179679&view=diff
==============================================================================
--- lldb/branches/windows/test/functionalities/register/TestRegisters.py (original)
+++ lldb/branches/windows/test/functionalities/register/TestRegisters.py Wed Apr 17 03:38:48 2013
@@ -56,6 +56,10 @@ class RegisterCommandsTestCase(TestBase)
         self.expect("register read -a", MISSING_EXPECTED_REGISTERS,
             substrs = ['registers were unavailable'], matching = False)
         self.runCmd("register read xmm0")
+        self.runCmd("register read ymm15") # may be available
+
+        self.expect("register read -s 3",
+            substrs = ['invalid register set index: 3'], error = True)
 
         # rdar://problem/10611315
         # expression command doesn't handle xmm or stmm registers...
@@ -100,18 +104,14 @@ class RegisterCommandsTestCase(TestBase)
         """Test convenience registers after a 'process attach'."""
         exe = self.lldbHere
         
-        # Spawn a new process and don't display the stdout if not in TraceOn() mode.
-        import subprocess
-        popen = subprocess.Popen([exe, self.lldbOption],
-                                 stdout = open(os.devnull, 'w') if not self.TraceOn() else None)
-        if self.TraceOn():
-            print "pid of spawned process: %d" % popen.pid
+        # Spawn a new process
+        proc = self.spawnSubprocess(exe, [self.lldbOption])
+        self.addTearDownHook(self.cleanupSubprocesses)
 
-        self.runCmd("process attach -p %d" % popen.pid)
+        if self.TraceOn():
+            print "pid of spawned process: %d" % proc.pid
 
-        # Add a hook to kill the child process during teardown.
-        self.addTearDownHook(
-            lambda: popen.kill())
+        self.runCmd("process attach -p %d" % proc.pid)
 
         # Check that "register read eax" works.
         self.runCmd("register read eax")

Modified: lldb/branches/windows/test/functionalities/return-value/TestReturnValue.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/test/functionalities/return-value/TestReturnValue.py?rev=179679&r1=179678&r2=179679&view=diff
==============================================================================
--- lldb/branches/windows/test/functionalities/return-value/TestReturnValue.py (original)
+++ lldb/branches/windows/test/functionalities/return-value/TestReturnValue.py Wed Apr 17 03:38:48 2013
@@ -211,6 +211,9 @@ class ReturnValueTestCase(TestBase):
         #self.return_and_test_struct_value ("return_one_int_one_double_packed")
         self.return_and_test_struct_value ("return_one_int_one_long")
 
+        self.return_and_test_struct_value ("return_vector_size_float32")
+        self.return_and_test_struct_value ("return_ext_vector_size_float32")
+
         
 if __name__ == '__main__':
     import atexit

Modified: lldb/branches/windows/test/functionalities/return-value/call-func.c
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/test/functionalities/return-value/call-func.c?rev=179679&r1=179678&r2=179679&view=diff
==============================================================================
--- lldb/branches/windows/test/functionalities/return-value/call-func.c (original)
+++ lldb/branches/windows/test/functionalities/return-value/call-func.c Wed Apr 17 03:38:48 2013
@@ -301,6 +301,21 @@ return_one_int_one_pointer (struct one_i
   return value;
 }
 
+typedef float vector_size_float32 __attribute__((__vector_size__(16)));
+typedef float ext_vector_size_float32 __attribute__((ext_vector_type(4)));
+
+vector_size_float32
+return_vector_size_float32 (vector_size_float32 value)
+{
+    return value;
+}
+
+ext_vector_size_float32
+return_ext_vector_size_float32 (ext_vector_size_float32 value)
+{
+    return value;
+}
+
 int 
 main ()
 {
@@ -351,6 +366,9 @@ main ()
   return_one_int_one_double_packed ((struct one_int_one_double_packed) {10, 20.0});
   return_one_int_one_long ((struct one_int_one_long) {10, 20});
 
+  return_vector_size_float32 (( vector_size_float32 ){1.5, 2.25, 4.125, 8.0625});
+  return_ext_vector_size_float32 ((ext_vector_size_float32){ 16.5, 32.25, 64.125, 128.0625});
+  
   return 0;
   
 }

Modified: lldb/branches/windows/test/functionalities/single-quote-in-filename-to-lldb/TestSingleQuoteInFilename.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/test/functionalities/single-quote-in-filename-to-lldb/TestSingleQuoteInFilename.py?rev=179679&r1=179678&r2=179679&view=diff
==============================================================================
--- lldb/branches/windows/test/functionalities/single-quote-in-filename-to-lldb/TestSingleQuoteInFilename.py (original)
+++ lldb/branches/windows/test/functionalities/single-quote-in-filename-to-lldb/TestSingleQuoteInFilename.py Wed Apr 17 03:38:48 2013
@@ -23,6 +23,7 @@ class SingleQuoteInCommandLineTestCase(T
         except:
             pass
 
+    @skipOnLinux # PR-14637: this test case fails sometimes because the input prompt "(lldb)" is missing
     def test_lldb_invocation_with_single_quote_in_filename(self):
         """Test that 'lldb my_file_name' works where my_file_name is a string with a single quote char in it."""
         self.buildDefault()

Modified: lldb/branches/windows/test/functionalities/stop-hook/TestStopHookMechanism.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/test/functionalities/stop-hook/TestStopHookMechanism.py?rev=179679&r1=179678&r2=179679&view=diff
==============================================================================
--- lldb/branches/windows/test/functionalities/stop-hook/TestStopHookMechanism.py (original)
+++ lldb/branches/windows/test/functionalities/stop-hook/TestStopHookMechanism.py Wed Apr 17 03:38:48 2013
@@ -19,6 +19,7 @@ class StopHookMechanismTestCase(TestBase
         self.buildDsym()
         self.stop_hook_firing()
 
+    @skipOnLinux # PR-15037: stop-hooks sometimes fail to fire on Linux (disabled to avoid needless noise)
     @dwarf_test
     def test_with_dwarf(self):
         """Test the stop-hook mechanism."""

Modified: lldb/branches/windows/test/functionalities/stop-hook/multiple_threads/Makefile
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/test/functionalities/stop-hook/multiple_threads/Makefile?rev=179679&r1=179678&r2=179679&view=diff
==============================================================================
--- lldb/branches/windows/test/functionalities/stop-hook/multiple_threads/Makefile (original)
+++ lldb/branches/windows/test/functionalities/stop-hook/multiple_threads/Makefile Wed Apr 17 03:38:48 2013
@@ -1,6 +1,6 @@
 LEVEL = ../../../make
 
-LDFLAGS := -lpthread
+LD_EXTRAS := -lpthread
 CXX_SOURCES := main.cpp
 
 include $(LEVEL)/Makefile.rules

Modified: lldb/branches/windows/test/functionalities/type_completion/TestTypeCompletion.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/test/functionalities/type_completion/TestTypeCompletion.py?rev=179679&r1=179678&r2=179679&view=diff
==============================================================================
--- lldb/branches/windows/test/functionalities/type_completion/TestTypeCompletion.py (original)
+++ lldb/branches/windows/test/functionalities/type_completion/TestTypeCompletion.py Wed Apr 17 03:38:48 2013
@@ -20,6 +20,7 @@ class TypeCompletionTestCase(TestBase):
         self.type_completion_commands()
 
     @dwarf_test
+    @expectedFailureGcc # llvm.org/pr15301 LLDB prints incorrect sizes of STL containers
     def test_with_dwarf_and_run_command(self):
         """Check that types only get completed when necessary."""
         self.buildDwarf()
@@ -48,8 +49,10 @@ class TypeCompletionTestCase(TestBase):
         # clean slate for the next test case.
         def cleanup():
             self.runCmd('type category enable gnu-libstdc++', check=False)
+            self.runCmd('type category enable libcxx', check=False)
 
         self.runCmd('type category disable gnu-libstdc++', check=False)
+        self.runCmd('type category disable libcxx', check=False)
 
         # Execute the cleanup function during test case tear down.
         self.addTearDownHook(cleanup)
@@ -118,6 +121,7 @@ class TypeCompletionTestCase(TestBase):
         self.assertFalse(string.IsTypeComplete(), 'std::string complete but it should not be')
 
         self.runCmd('type category enable gnu-libstdc++', check=False)
+        self.runCmd('type category enable libcxx', check=False)
         self.runCmd('frame variable guy --show-types')
 
         p_vector = self.dbg.GetSelectedTarget().GetProcess().GetSelectedThread().GetSelectedFrame().FindVariable('p')

Modified: lldb/branches/windows/test/functionalities/watchpoint/hello_watchlocation/Makefile
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/test/functionalities/watchpoint/hello_watchlocation/Makefile?rev=179679&r1=179678&r2=179679&view=diff
==============================================================================
--- lldb/branches/windows/test/functionalities/watchpoint/hello_watchlocation/Makefile (original)
+++ lldb/branches/windows/test/functionalities/watchpoint/hello_watchlocation/Makefile Wed Apr 17 03:38:48 2013
@@ -1,6 +1,6 @@
 LEVEL = ../../../make
 
-LDFLAGS := -lpthread
+LD_EXTRAS := -lpthread
 CXX_SOURCES := main.cpp
 
 include $(LEVEL)/Makefile.rules

Modified: lldb/branches/windows/test/functionalities/watchpoint/hello_watchlocation/TestWatchLocation.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/test/functionalities/watchpoint/hello_watchlocation/TestWatchLocation.py?rev=179679&r1=179678&r2=179679&view=diff
==============================================================================
--- lldb/branches/windows/test/functionalities/watchpoint/hello_watchlocation/TestWatchLocation.py (original)
+++ lldb/branches/windows/test/functionalities/watchpoint/hello_watchlocation/TestWatchLocation.py Wed Apr 17 03:38:48 2013
@@ -21,7 +21,7 @@ class HelloWatchLocationTestCase(TestBas
         self.setTearDownCleanup(dictionary=self.d)
         self.hello_watchlocation()
 
-    @expectedFailureLinux # bugzilla 14416
+    @expectedFailureLinux # llvm.org/pr14416
     @dwarf_test
     def test_hello_watchlocation_with_dwarf(self):
         """Test watching a location with '-x size' option."""

Modified: lldb/branches/windows/test/functionalities/watchpoint/hello_watchpoint/TestMyFirstWatchpoint.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/test/functionalities/watchpoint/hello_watchpoint/TestMyFirstWatchpoint.py?rev=179679&r1=179678&r2=179679&view=diff
==============================================================================
--- lldb/branches/windows/test/functionalities/watchpoint/hello_watchpoint/TestMyFirstWatchpoint.py (original)
+++ lldb/branches/windows/test/functionalities/watchpoint/hello_watchpoint/TestMyFirstWatchpoint.py Wed Apr 17 03:38:48 2013
@@ -10,6 +10,9 @@ import lldbutil
 
 class HelloWatchpointTestCase(TestBase):
 
+    def getCategories (self):
+        return ['basic_process']
+
     mydir = os.path.join("functionalities", "watchpoint", "hello_watchpoint")
 
     @dsym_test

Modified: lldb/branches/windows/test/functionalities/watchpoint/multiple_threads/Makefile
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/test/functionalities/watchpoint/multiple_threads/Makefile?rev=179679&r1=179678&r2=179679&view=diff
==============================================================================
--- lldb/branches/windows/test/functionalities/watchpoint/multiple_threads/Makefile (original)
+++ lldb/branches/windows/test/functionalities/watchpoint/multiple_threads/Makefile Wed Apr 17 03:38:48 2013
@@ -1,6 +1,6 @@
 LEVEL = ../../../make
 
-LDFLAGS := -lpthread
+LD_EXTRAS := -lpthread
 CXX_SOURCES := main.cpp
 
 include $(LEVEL)/Makefile.rules

Modified: lldb/branches/windows/test/functionalities/watchpoint/watchpoint_set_command/Makefile
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/test/functionalities/watchpoint/watchpoint_set_command/Makefile?rev=179679&r1=179678&r2=179679&view=diff
==============================================================================
--- lldb/branches/windows/test/functionalities/watchpoint/watchpoint_set_command/Makefile (original)
+++ lldb/branches/windows/test/functionalities/watchpoint/watchpoint_set_command/Makefile Wed Apr 17 03:38:48 2013
@@ -1,6 +1,6 @@
 LEVEL = ../../../make
 
-LDFLAGS := -lpthread
+LD_EXTRAS := -lpthread
 CXX_SOURCES := main.cpp
 
 include $(LEVEL)/Makefile.rules

Modified: lldb/branches/windows/test/functionalities/watchpoint/watchpoint_set_command/TestWatchLocationWithWatchSet.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/test/functionalities/watchpoint/watchpoint_set_command/TestWatchLocationWithWatchSet.py?rev=179679&r1=179678&r2=179679&view=diff
==============================================================================
--- lldb/branches/windows/test/functionalities/watchpoint/watchpoint_set_command/TestWatchLocationWithWatchSet.py (original)
+++ lldb/branches/windows/test/functionalities/watchpoint/watchpoint_set_command/TestWatchLocationWithWatchSet.py Wed Apr 17 03:38:48 2013
@@ -20,7 +20,7 @@ class WatchLocationUsingWatchpointSetTes
         self.setTearDownCleanup(dictionary=self.d)
         self.watchlocation_using_watchpoint_set()
 
-    @expectedFailureLinux # bugzilla 14416
+    @expectedFailureLinux # llvm.org/pr14416
     @dwarf_test
     def test_watchlocation_with_dwarf_using_watchpoint_set(self):
         """Test watching a location with 'watchpoint set expression -w write -x size' option."""

Modified: lldb/branches/windows/test/functionalities/watchpoint/watchpoint_set_command/TestWatchpointSetErrorCases.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/test/functionalities/watchpoint/watchpoint_set_command/TestWatchpointSetErrorCases.py?rev=179679&r1=179678&r2=179679&view=diff
==============================================================================
--- lldb/branches/windows/test/functionalities/watchpoint/watchpoint_set_command/TestWatchpointSetErrorCases.py (original)
+++ lldb/branches/windows/test/functionalities/watchpoint/watchpoint_set_command/TestWatchpointSetErrorCases.py Wed Apr 17 03:38:48 2013
@@ -58,16 +58,12 @@ class WatchpointSetErrorTestCase(TestBas
         # 'watchpoint set expression' with '-w' or '-x' specified now needs
         # an option terminator and a raw expression after that.
         self.expect("watchpoint set expression -w write --", error=True,
-            startstr = 'error: required argument missing; specify an expression to evaulate into the addres to watch for')
+            startstr = 'error: ')
 
         # It's an error if the expression did not evaluate to an address.
         self.expect("watchpoint set expression MyAggregateDataType", error=True,
             startstr = 'error: expression did not evaluate to an address')
 
-        # Check for missing option terminator '--'.
-        self.expect("watchpoint set expression -w write -x 1 g_char_ptr", error=True,
-            startstr = 'error: did you forget to enter the option terminator string "--"?')
-
         # Wrong size parameter is an error.
         self.expect("watchpoint set variable -x -128", error=True,
             substrs = ['invalid enumeration value'])

Modified: lldb/branches/windows/test/help/TestHelp.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/test/help/TestHelp.py?rev=179679&r1=179678&r2=179679&view=diff
==============================================================================
--- lldb/branches/windows/test/help/TestHelp.py (original)
+++ lldb/branches/windows/test/help/TestHelp.py Wed Apr 17 03:38:48 2013
@@ -77,8 +77,13 @@ class HelpCommandTestCase(TestBase):
         version_str = self.version_number_string()
         import re
         match = re.match('[0-9]+', version_str)
+        if sys.platform.startswith("darwin"):
+            search_regexp = ['lldb-' + (version_str if match else '[0-9]+')]
+        else:
+            search_regexp = ['lldb version (\d|\.)+.*$']
+
         self.expect("version",
-            patterns = ['LLDB-' + (version_str if match else '[0-9]+')])
+            patterns = search_regexp)
 
     def test_help_should_not_crash_lldb(self):
         """Command 'help disasm' should not crash lldb."""

Modified: lldb/branches/windows/test/lang/c/anonymous/TestAnonymous.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/test/lang/c/anonymous/TestAnonymous.py?rev=179679&r1=179678&r2=179679&view=diff
==============================================================================
--- lldb/branches/windows/test/lang/c/anonymous/TestAnonymous.py (original)
+++ lldb/branches/windows/test/lang/c/anonymous/TestAnonymous.py Wed Apr 17 03:38:48 2013
@@ -15,6 +15,8 @@ class AnonymousTestCase(TestBase):
         self.buildDsym()
         self.expr()
 
+    @skipIfGcc # llvm.org/pr15036: LLDB is unable to parse DWARF generated by GCC
+    @skipIfIcc # llvm.org/pr15036: LLDB generates an incorrect AST layout for an anonymous struct when DWARF is generated by ICC
     @dwarf_test
     def test_expr_with_dwarf(self):
         self.buildDwarf()

Modified: lldb/branches/windows/test/lang/c/array_types/TestArrayTypes.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/test/lang/c/array_types/TestArrayTypes.py?rev=179679&r1=179678&r2=179679&view=diff
==============================================================================
--- lldb/branches/windows/test/lang/c/array_types/TestArrayTypes.py (original)
+++ lldb/branches/windows/test/lang/c/array_types/TestArrayTypes.py Wed Apr 17 03:38:48 2013
@@ -82,7 +82,7 @@ class ArrayTypesTestCase(TestBase):
                        'Bonjour',
                        'Guten Tag'])
 
-        self.expect("frame variable --show-types char_16", VARIABLES_DISPLAYED_CORRECTLY,
+        self.expect("frame variable --show-types --raw -- char_16", VARIABLES_DISPLAYED_CORRECTLY,
             substrs = ['(char) [0]',
                        '(char) [15]'])
 

Modified: lldb/branches/windows/test/lang/c/bitfields/TestBitfields.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/test/lang/c/bitfields/TestBitfields.py?rev=179679&r1=179678&r2=179679&view=diff
==============================================================================
--- lldb/branches/windows/test/lang/c/bitfields/TestBitfields.py (original)
+++ lldb/branches/windows/test/lang/c/bitfields/TestBitfields.py Wed Apr 17 03:38:48 2013
@@ -33,6 +33,7 @@ class BitfieldsTestCase(TestBase):
 
     @python_api_test
     @dwarf_test
+    @expectedFailureGcc # GCC (4.6/4.7) generates incorrect code with unnamed bitfields.
     def test_with_dwarf_and_python_api(self):
         """Use Python APIs to inspect a bitfields variable."""
         self.buildDwarf()
@@ -105,7 +106,6 @@ class BitfieldsTestCase(TestBase):
 
         self.expect("frame variable --show-types more_bits", VARIABLES_DISPLAYED_CORRECTLY,
             substrs = ['(uint32_t:3) a = 3',
-                       '(int:1)  = 0',
                        '(uint8_t:1) b = \'\\0\'',
                        '(uint8_t:1) c = \'\\x01\'',
                        '(uint8_t:1) d = \'\\0\''])

Modified: lldb/branches/windows/test/lang/c/enum_types/TestEnumTypes.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/test/lang/c/enum_types/TestEnumTypes.py?rev=179679&r1=179678&r2=179679&view=diff
==============================================================================
--- lldb/branches/windows/test/lang/c/enum_types/TestEnumTypes.py (original)
+++ lldb/branches/windows/test/lang/c/enum_types/TestEnumTypes.py Wed Apr 17 03:38:48 2013
@@ -13,7 +13,7 @@ class EnumTypesTestCase(TestBase):
     @unittest2.skipUnless(sys.platform.startswith("darwin"), "requires Darwin")
     @dsym_test
     def test_with_dsym(self):
-        """Test 'image lookup -t days' and check for correct display."""
+        """Test 'image lookup -t days' and check for correct display and enum value printing."""
         self.buildDsym()
         self.image_lookup_for_enum_type()
 
@@ -21,7 +21,7 @@ class EnumTypesTestCase(TestBase):
     # 'image lookup -t days' returns nothing with dwarf debug format.
     @dwarf_test
     def test_with_dwarf(self):
-        """Test 'image lookup -t days' and check for correct display."""
+        """Test 'image lookup -t days' and check for correct display and enum value printing."""
         self.buildDwarf()
         self.image_lookup_for_enum_type()
 
@@ -37,7 +37,7 @@ class EnumTypesTestCase(TestBase):
         self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
 
         # Break inside the main.
-        lldbutil.run_break_set_by_file_and_line (self, "main.c", self.line, num_expected_locations=1, loc_exact=True)
+        bkpt_id = lldbutil.run_break_set_by_file_and_line (self, "main.c", self.line, num_expected_locations=1, loc_exact=True)
 
         self.runCmd("run", RUN_SUCCEEDED)
 
@@ -54,17 +54,32 @@ class EnumTypesTestCase(TestBase):
         # Check for correct display.
         self.expect("image lookup -t days", DATA_TYPES_DISPLAYED_CORRECTLY,
             substrs = ['enum days {',
-                       'Monday,',
+                       'Monday',
                        'Tuesday',
                        'Wednesday',
                        'Thursday',
                        'Friday',
                        'Saturday',
-                       'Sunday,',
+                       'Sunday',
                        'kNumDays',
                        '}'])
 
-
+        enum_values = [ '-4', 
+                        'Monday', 
+                        'Tuesday', 
+                        'Wednesday', 
+                        'Thursday',
+                        'Friday',
+                        'Saturday',
+                        'Sunday',
+                        'kNumDays',
+                        '5'];
+
+        bkpt = self.target().FindBreakpointByID(bkpt_id)
+        for enum_value in enum_values:
+            self.expect("frame variable day", 'check for valid enumeration value',
+                substrs = [enum_value])
+            lldbutil.continue_to_breakpoint (self.process(), bkpt)
 if __name__ == '__main__':
     import atexit
     lldb.SBDebugger.Initialize()

Modified: lldb/branches/windows/test/lang/c/enum_types/main.c
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/test/lang/c/enum_types/main.c?rev=179679&r1=179678&r2=179679&view=diff
==============================================================================
--- lldb/branches/windows/test/lang/c/enum_types/main.c (original)
+++ lldb/branches/windows/test/lang/c/enum_types/main.c Wed Apr 17 03:38:48 2013
@@ -11,7 +11,7 @@
 int main (int argc, char const *argv[])
 {
     enum days {
-        Monday = 10,
+        Monday = -3,
         Tuesday,
         Wednesday,
         Thursday,

Modified: lldb/branches/windows/test/lang/c/forward/TestForwardDeclaration.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/test/lang/c/forward/TestForwardDeclaration.py?rev=179679&r1=179678&r2=179679&view=diff
==============================================================================
--- lldb/branches/windows/test/lang/c/forward/TestForwardDeclaration.py (original)
+++ lldb/branches/windows/test/lang/c/forward/TestForwardDeclaration.py Wed Apr 17 03:38:48 2013
@@ -54,7 +54,7 @@ class ForwardDeclarationTestCase(TestBas
                        '(int) b = 2'])
 
         # And so should this.
-        self.expect("expression *bar_ptr", VARIABLES_DISPLAYED_CORRECTLY,
+        self.expect("expression --show-types -- *bar_ptr", VARIABLES_DISPLAYED_CORRECTLY,
             substrs = ['(bar)',
                        '(int) a = 1',
                        '(int) b = 2'])

Modified: lldb/branches/windows/test/lang/c/shared_lib/TestSharedLib.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/test/lang/c/shared_lib/TestSharedLib.py?rev=179679&r1=179678&r2=179679&view=diff
==============================================================================
--- lldb/branches/windows/test/lang/c/shared_lib/TestSharedLib.py (original)
+++ lldb/branches/windows/test/lang/c/shared_lib/TestSharedLib.py Wed Apr 17 03:38:48 2013
@@ -66,7 +66,7 @@ class SharedLibTestCase(TestBase):
 	self.common_setup()
 
         # This should display correctly.
-        self.expect("expression *my_foo_ptr", VARIABLES_DISPLAYED_CORRECTLY,
+        self.expect("expression --show-types -- *my_foo_ptr", VARIABLES_DISPLAYED_CORRECTLY,
             substrs = ["(foo)", "(sub_foo)", "other_element = 3"])
 
     @unittest2.expectedFailure
@@ -76,7 +76,7 @@ class SharedLibTestCase(TestBase):
 	self.common_setup()
 
         # This should display correctly.
-        self.expect("frame variable *my_foo_ptr", VARIABLES_DISPLAYED_CORRECTLY,
+        self.expect("frame variable --show-types -- *my_foo_ptr", VARIABLES_DISPLAYED_CORRECTLY,
             substrs = ["(foo)", "(sub_foo)", "other_element = 3"])
                        
 if __name__ == '__main__':

Modified: lldb/branches/windows/test/lang/c/stepping/TestStepAndBreakpoints.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/test/lang/c/stepping/TestStepAndBreakpoints.py?rev=179679&r1=179678&r2=179679&view=diff
==============================================================================
--- lldb/branches/windows/test/lang/c/stepping/TestStepAndBreakpoints.py (original)
+++ lldb/branches/windows/test/lang/c/stepping/TestStepAndBreakpoints.py Wed Apr 17 03:38:48 2013
@@ -10,6 +10,9 @@ class TestObjCStepping(TestBase):
 
     mydir = os.path.join("lang", "c", "stepping")
 
+    def getCategories(self):
+        return ['basic_process']
+
     @unittest2.skipUnless(sys.platform.startswith("darwin"), "requires Darwin")
     @python_api_test
     @dsym_test
@@ -72,6 +75,9 @@ class TestObjCStepping(TestBase):
 
         thread = threads[0]
 
+        # Get the stop id and for fun make sure it increases:
+        old_stop_id = process.GetStopID()
+
         # Now step over, which should cause us to hit the breakpoint in "a"
         thread.StepOver()
 
@@ -80,6 +86,10 @@ class TestObjCStepping(TestBase):
         if len(threads) != 1:
             self.fail ("Failed to stop at breakpoint in a.")
 
+        # Check that the stop ID increases:
+        new_stop_id = process.GetStopID()
+        self.assertTrue(new_stop_id > old_stop_id, "Stop ID increases monotonically.")
+
         thread = threads[0]
 
         # Step over, and we should hit the breakpoint in b:
@@ -99,13 +109,25 @@ class TestObjCStepping(TestBase):
         current_bp.append(thread.GetStopReasonDataAtIndex(0))
         current_bp.append(thread.GetStopReasonDataAtIndex(1))
 
-        frame.EvaluateExpression ('(int) printf ("aaaaaaaaaa\n")')
+        stop_id_before_expression = process.GetStopID()
+        stop_id_before_including_expressions = process.GetStopID(True)
+
+        frame.EvaluateExpression ("(int) printf (print_string)")
 
         frame = thread.GetFrameAtIndex(0)
         self.assertTrue (current_line == frame.GetLineEntry().GetLine(), "The line stayed the same after expression.")
         self.assertTrue (current_file == frame.GetLineEntry().GetFileSpec(), "The file stayed the same after expression.")
         self.assertTrue (thread.GetStopReason() == lldb.eStopReasonBreakpoint, "We still say we stopped for a breakpoint.")
         self.assertTrue (thread.GetStopReasonDataAtIndex(0) == current_bp[0] and thread.GetStopReasonDataAtIndex(1) == current_bp[1], "And it is the same breakpoint.")
+        
+        # Also make sure running the expression didn't change the public stop id
+        # but did change if we are asking for expression stops as well.
+        stop_id_after_expression = process.GetStopID()
+        stop_id_after_including_expressions = process.GetStopID(True)
+
+        self.assertTrue (stop_id_before_expression == stop_id_after_expression, "Expression calling doesn't change stop ID")
+
+        self.assertTrue (stop_id_after_including_expressions > stop_id_before_including_expressions, "Stop ID including expressions increments over expression call.")
 
         # Do the same thing with an expression that's going to crash, and make sure we are still unchanged.
 

Modified: lldb/branches/windows/test/lang/c/stepping/main.c
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/test/lang/c/stepping/main.c?rev=179679&r1=179678&r2=179679&view=diff
==============================================================================
--- lldb/branches/windows/test/lang/c/stepping/main.c (original)
+++ lldb/branches/windows/test/lang/c/stepping/main.c Wed Apr 17 03:38:48 2013
@@ -11,6 +11,7 @@
 int a(int);
 int b(int);
 int c(int);
+const char *print_string = "aaaaaaaaaa\n";
 
 int a(int val)
 {
@@ -63,5 +64,6 @@ int main (int argc, char const *argv[])
 
     int A7 = complex (a(5), b(6), c(7)); // Stop here to make sure bogus target steps over.
 
+    printf ("I am using print_string: %s.\n", print_string);
     return 0;
 }

Modified: lldb/branches/windows/test/lang/c/strings/TestCStrings.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/test/lang/c/strings/TestCStrings.py?rev=179679&r1=179678&r2=179679&view=diff
==============================================================================
--- lldb/branches/windows/test/lang/c/strings/TestCStrings.py (original)
+++ lldb/branches/windows/test/lang/c/strings/TestCStrings.py Wed Apr 17 03:38:48 2013
@@ -16,7 +16,6 @@ class CStringsTestCase(TestBase):
         self.buildDsym()
         self.static_method_commands()
 
-    @expectedFailureLinux # bugzilla 14437
     @dwarf_test
     def test_with_dwarf_and_run_command(self):
         """Tests that C strings work as expected in expressions"""
@@ -43,6 +42,7 @@ class CStringsTestCase(TestBase):
         self.expect("expression -- z[2]",
                     startstr = "(const char) $1 = 'x'")
 
+        # On Linux, the expression below will test GNU indirect function calls.
         self.expect("expression -- (int)strlen(\"hello\")",
                     startstr = "(int) $2 = 5")
 
@@ -52,10 +52,12 @@ class CStringsTestCase(TestBase):
         self.expect("expression -- \"\"[0]",
                     startstr = "(const char) $4 = '\\0'")
 
+        self.expect("expr --raw -- \"hello\"",
+            substrs = ['[0] = \'h\'',
+                       '[5] = \'\\0\''])
+
         self.expect("p \"hello\"",
-            substrs = ['(const char [6]) $', 'hello',
-                       '(const char) [0] = \'h\'',
-                       '(const char) [5] = \'\\0\''])
+            substrs = ['[6]) $', 'hello'])
 
         self.expect("p (char*)\"hello\"",
                     substrs = ['(char *) $', ' = 0x',

Modified: lldb/branches/windows/test/lang/c/struct_types/TestStructTypes.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/test/lang/c/struct_types/TestStructTypes.py?rev=179679&r1=179678&r2=179679&view=diff
==============================================================================
--- lldb/branches/windows/test/lang/c/struct_types/TestStructTypes.py (original)
+++ lldb/branches/windows/test/lang/c/struct_types/TestStructTypes.py Wed Apr 17 03:38:48 2013
@@ -15,7 +15,6 @@ class StructTypesTestCase(TestBase):
     mydir = os.path.join("lang", "c", "struct_types")
 
     # rdar://problem/12566646
-    @unittest2.expectedFailure
     @unittest2.skipUnless(sys.platform.startswith("darwin"), "requires Darwin")
     @dsym_test
     def test_with_dsym(self):
@@ -24,7 +23,6 @@ class StructTypesTestCase(TestBase):
         self.struct_types()
 
     # rdar://problem/12566646
-    @unittest2.expectedFailure
     @dwarf_test
     def test_with_dwarf(self):
         """Test that break on a struct declaration has no effect."""

Modified: lldb/branches/windows/test/lang/cpp/bool/TestCPPBool.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/test/lang/cpp/bool/TestCPPBool.py?rev=179679&r1=179678&r2=179679&view=diff
==============================================================================
--- lldb/branches/windows/test/lang/cpp/bool/TestCPPBool.py (original)
+++ lldb/branches/windows/test/lang/cpp/bool/TestCPPBool.py Wed Apr 17 03:38:48 2013
@@ -26,7 +26,9 @@ class CPPBoolTestCase(TestBase):
         TestBase.setUp(self)
     
     def set_breakpoint(self, line):
-        lldbutil.run_break_set_by_file_and_line (self, "main.cpp", line, num_expected_locations=1, loc_exact=False)
+        # Some compilers (for example GCC 4.4.7 and 4.6.1) emit multiple locations for the statement with the ternary
+        # operator in the test program, while others emit only 1.
+        lldbutil.run_break_set_by_file_and_line (self, "main.cpp", line, num_expected_locations=-1, loc_exact=False)
 
     def static_method_commands(self):
         """Test that bool types work in the expression parser"""

Modified: lldb/branches/windows/test/lang/cpp/class_static/TestStaticVariables.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/test/lang/cpp/class_static/TestStaticVariables.py?rev=179679&r1=179678&r2=179679&view=diff
==============================================================================
--- lldb/branches/windows/test/lang/cpp/class_static/TestStaticVariables.py (original)
+++ lldb/branches/windows/test/lang/cpp/class_static/TestStaticVariables.py Wed Apr 17 03:38:48 2013
@@ -19,6 +19,7 @@ class StaticVariableTestCase(TestBase):
         self.buildDsym()
         self.static_variable_commands()
 
+    @expectedFailureLinux # PR-15261: lldb on Linux does not display the size of (class or file)static arrays
     @dwarf_test
     def test_with_dwarf_and_run_command(self):
         """Test that file and class static variables display correctly."""
@@ -26,8 +27,8 @@ class StaticVariableTestCase(TestBase):
         self.static_variable_commands()
 
     @unittest2.skipUnless(sys.platform.startswith("darwin"), "requires Darwin")
-    #rdar://problem/9980907
-    @expectedFailureClang
+    @expectedFailureClang(9980907)
+    @expectedFailureGcc(9980907)
     @python_api_test
     @dsym_test
     def test_with_dsym_and_python_api(self):
@@ -35,8 +36,8 @@ class StaticVariableTestCase(TestBase):
         self.buildDsym()
         self.static_variable_python()
 
-    #rdar://problem/9980907
-    @expectedFailureClang
+    @expectedFailureClang(9980907)
+    @expectedFailureGcc(9980907)
     @python_api_test
     @dwarf_test
     def test_with_dwarf_and_python_api(self):

Modified: lldb/branches/windows/test/lang/cpp/dynamic-value/TestDynamicValue.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/test/lang/cpp/dynamic-value/TestDynamicValue.py?rev=179679&r1=179678&r2=179679&view=diff
==============================================================================
--- lldb/branches/windows/test/lang/cpp/dynamic-value/TestDynamicValue.py (original)
+++ lldb/branches/windows/test/lang/cpp/dynamic-value/TestDynamicValue.py Wed Apr 17 03:38:48 2013
@@ -82,9 +82,13 @@ class DynamicValueTestCase(TestBase):
         contained_auto_ptr = this_dynamic.GetChildMemberWithName ('m_client_A', use_dynamic)
         self.assertTrue (contained_auto_ptr)
         contained_b = contained_auto_ptr.GetChildMemberWithName ('_M_ptr', use_dynamic)
+        if not contained_b:
+                contained_b = contained_auto_ptr.GetChildMemberWithName ('__ptr_', use_dynamic)
         self.assertTrue (contained_b)
         
         contained_b_static = contained_auto_ptr.GetChildMemberWithName ('_M_ptr', no_dynamic)
+        if not contained_b_static:
+                contained_b_static = contained_auto_ptr.GetChildMemberWithName ('__ptr_', no_dynamic)
         self.assertTrue (contained_b_static)
         
         contained_b_addr = int (contained_b.GetValue(), 16)
@@ -177,7 +181,7 @@ class DynamicValueTestCase(TestBase):
         # The "frame var" code uses another path to get into children, so let's
         # make sure that works as well:
 
-        self.expect('frame var -d run-target anotherA.m_client_A._M_ptr', 'frame var finds its way into a child member',
+        self.expect('frame var -d run-target --ptr-depth=2 --show-types anotherA.m_client_A', 'frame var finds its way into a child member',
             patterns = ['\(B \*\)'])
 
         # Now make sure we also get it right for a reference as well:

Modified: lldb/branches/windows/test/lang/cpp/namespace/TestNamespace.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/test/lang/cpp/namespace/TestNamespace.py?rev=179679&r1=179678&r2=179679&view=diff
==============================================================================
--- lldb/branches/windows/test/lang/cpp/namespace/TestNamespace.py (original)
+++ lldb/branches/windows/test/lang/cpp/namespace/TestNamespace.py Wed Apr 17 03:38:48 2013
@@ -21,6 +21,7 @@ class NamespaceTestCase(TestBase):
         self.namespace_variable_commands()
 
     # rdar://problem/8668674
+    @expectedFailureGcc # PR-15302: lldb does not print 'anonymous namespace' when the inferior is built with GCC (4.7)
     @dwarf_test
     def test_with_dwarf_and_run_command(self):
         """Test that anonymous and named namespace variables display correctly."""

Modified: lldb/branches/windows/test/lang/cpp/rvalue-references/Makefile
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/test/lang/cpp/rvalue-references/Makefile?rev=179679&r1=179678&r2=179679&view=diff
==============================================================================
--- lldb/branches/windows/test/lang/cpp/rvalue-references/Makefile (original)
+++ lldb/branches/windows/test/lang/cpp/rvalue-references/Makefile Wed Apr 17 03:38:48 2013
@@ -2,6 +2,6 @@ LEVEL = ../../../make
 
 CXX_SOURCES := main.cpp
 
-CXXFLAGS = -std=c++11
-
 include $(LEVEL)/Makefile.rules
+
+CXXFLAGS += -std=c++11

Modified: lldb/branches/windows/test/lang/cpp/rvalue-references/TestRvalueReferences.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/test/lang/cpp/rvalue-references/TestRvalueReferences.py?rev=179679&r1=179678&r2=179679&view=diff
==============================================================================
--- lldb/branches/windows/test/lang/cpp/rvalue-references/TestRvalueReferences.py (original)
+++ lldb/branches/windows/test/lang/cpp/rvalue-references/TestRvalueReferences.py Wed Apr 17 03:38:48 2013
@@ -21,6 +21,7 @@ class CPPThisTestCase(TestBase):
 
     #rdar://problem/11479676
     @expectedFailureClang
+    @expectedFailureGcc # GCC (4.7) does not emit correct DWARF tags for rvalue-references
     @dwarf_test
     def test_with_dwarf_and_run_command(self):
         """Test that rvalues are supported in the C++ expression parser"""

Modified: lldb/branches/windows/test/lang/cpp/stl/Makefile
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/test/lang/cpp/stl/Makefile?rev=179679&r1=179678&r2=179679&view=diff
==============================================================================
--- lldb/branches/windows/test/lang/cpp/stl/Makefile (original)
+++ lldb/branches/windows/test/lang/cpp/stl/Makefile Wed Apr 17 03:38:48 2013
@@ -1,7 +1,7 @@
 LEVEL = ../../../make
 
 CXX_SOURCES := main.cpp
-CFLAGS :=-arch x86_64 -gdwarf-2 -O0
+CFLAGS := -g -O0
 
 clean: OBJECTS+=$(wildcard main.d.*)
 

Modified: lldb/branches/windows/test/lang/cpp/stl/TestSTL.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/test/lang/cpp/stl/TestSTL.py?rev=179679&r1=179678&r2=179679&view=diff
==============================================================================
--- lldb/branches/windows/test/lang/cpp/stl/TestSTL.py (original)
+++ lldb/branches/windows/test/lang/cpp/stl/TestSTL.py Wed Apr 17 03:38:48 2013
@@ -36,6 +36,7 @@ class STLTestCase(TestBase):
         self.buildDsym()
         self.sbtype_template_apis()
 
+    @skipIfGcc # llvm.org/pr15036: crashes during DWARF parsing when built with GCC
     @python_api_test
     @dwarf_test
     def test_SBType_template_aspects_with_dwarf(self):
@@ -110,7 +111,7 @@ class STLTestCase(TestBase):
         # Get Frame #0.
         self.assertTrue(process.GetState() == lldb.eStateStopped)
         thread = lldbutil.get_stopped_thread(process, lldb.eStopReasonBreakpoint)
-        self.assertTrue(thread != None, "There should be a thread stopped due to breakpoint condition")
+        self.assertTrue(thread.IsValid(), "There should be a thread stopped due to breakpoint condition")
         frame0 = thread.GetFrameAtIndex(0)
 
         # Get the type for variable 'associative_array'.

Modified: lldb/branches/windows/test/lang/cpp/this/TestCPPThis.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/test/lang/cpp/this/TestCPPThis.py?rev=179679&r1=179678&r2=179679&view=diff
==============================================================================
--- lldb/branches/windows/test/lang/cpp/this/TestCPPThis.py (original)
+++ lldb/branches/windows/test/lang/cpp/this/TestCPPThis.py Wed Apr 17 03:38:48 2013
@@ -19,7 +19,7 @@ class CPPThisTestCase(TestBase):
         self.static_method_commands()
 
     #rdar://problem/9962849
-    #@expectedFailureClang
+    @expectedFailureGcc # llvm.org/pr15439 The 'this' pointer isn't available during expression evaluation when stopped in an inlined member function.
     @dwarf_test
     def test_with_dwarf_and_run_command(self):
         """Test that the appropriate member variables are available when stopped in C++ static, inline, and const methods"""

Modified: lldb/branches/windows/test/lang/cpp/this/main.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/test/lang/cpp/this/main.cpp?rev=179679&r1=179678&r2=179679&view=diff
==============================================================================
--- lldb/branches/windows/test/lang/cpp/this/main.cpp (original)
+++ lldb/branches/windows/test/lang/cpp/this/main.cpp Wed Apr 17 03:38:48 2013
@@ -9,45 +9,45 @@
 
 #include <stdio.h>
 
-class A
+template <class T> class A
 {
 public:
-  void accessMember(int a);
-  int accessMemberConst() const;
+  void accessMember(T a);
+  T accessMemberConst() const;
   static int accessStaticMember();
 
-  void accessMemberInline(int a) __attribute__ ((always_inline))
+  void accessMemberInline(T a) __attribute__ ((always_inline))
   {
     m_a = a; // breakpoint 4
   }
 
-  int m_a;
+  T m_a;
   static int s_a;
 };
 
-int A::s_a = 5;
+template <class T> int A<T>::s_a = 5;
 
-void A::accessMember(int a)
+template <class T> void A<T>::accessMember(T a)
 {
   m_a = a; // breakpoint 1
 }
 
-int A::accessMemberConst() const
+template <class T> T A<T>::accessMemberConst() const
 {
   return m_a; // breakpoint 2
 }
 
-int A::accessStaticMember()
+template <class T> int A<T>::accessStaticMember()
 {
   return s_a; // breakpoint 3
 } 
 
 int main()
 {
-  A my_a;
+  A<int> my_a;
 
   my_a.accessMember(3);
   my_a.accessMemberConst();
-  A::accessStaticMember();
+  A<int>::accessStaticMember();
   my_a.accessMemberInline(5);
 }

Modified: lldb/branches/windows/test/lang/cpp/unique-types/TestUniqueTypes.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/test/lang/cpp/unique-types/TestUniqueTypes.py?rev=179679&r1=179678&r2=179679&view=diff
==============================================================================
--- lldb/branches/windows/test/lang/cpp/unique-types/TestUniqueTypes.py (original)
+++ lldb/branches/windows/test/lang/cpp/unique-types/TestUniqueTypes.py Wed Apr 17 03:38:48 2013
@@ -33,10 +33,18 @@ class UniqueTypesTestCase(TestBase):
 
     def unique_types(self):
         """Test for unique types of std::vector<long> and std::vector<short>."""
+
+        compiler = self.getCompiler()
+        compiler_basename = os.path.basename(compiler)
+        if "clang" in compiler_basename and int(self.getCompilerVersion().split('.')[0]) < 3:
+            self.skipTest("rdar://problem/9173060 lldb hangs while running unique-types for clang version < 3")
+
         exe = os.path.join(os.getcwd(), "a.out")
         self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
 
-        lldbutil.run_break_set_by_file_and_line (self, "main.cpp", self.line, num_expected_locations=1, loc_exact=True)
+        # GCC 4.6.3 (but not 4.4, 4.6.5 or 4.7) encodes two locations for the 'return 0' statement in main.cpp
+        locs = 2 if "gcc" in compiler_basename and "4.6.3" in self.getCompilerVersion() else 1
+        lldbutil.run_break_set_by_file_and_line (self, "main.cpp", self.line, num_expected_locations=locs, loc_exact=True)
 
         self.runCmd("run", RUN_SUCCEEDED)
 
@@ -45,25 +53,12 @@ class UniqueTypesTestCase(TestBase):
             substrs = ['stopped',
                        'stop reason = breakpoint'])
 
-        if self.getCompiler().endswith('clang'):
-            import re
-            clang_version_output = system([lldbutil.which(self.getCompiler()), "-v"])[1]
-            #print "my output:", clang_version_output
-            for line in clang_version_output.split(os.linesep):
-                m = re.search('clang version ([0-9]+)\.', line)
-                #print "line:", line
-                if m:
-                    clang_version = int(m.group(1))
-                    #print "clang version:", clang_version
-                    if clang_version < 3:
-                        self.skipTest("rdar://problem/9173060 lldb hangs while running unique-types for clang version < 3")
-
         # Do a "frame variable --show-types longs" and verify "long" is in each line of output.
         self.runCmd("frame variable --show-types longs")
         output = self.res.GetOutput()
         for x in [line.strip() for line in output.split(os.linesep)]:
-            # Skip empty line or closing brace.
-            if not x or x == '}':
+            # Skip empty line, closing brace, and messages about more variables than can be displayed.
+            if not x or x == '}' or x == '...' or "Some of your variables have more members than the debugger will show by default" in x:
                 continue
             self.expect(x, "Expect type 'long'", exe=False,
                 substrs = ['long'])
@@ -72,8 +67,8 @@ class UniqueTypesTestCase(TestBase):
         self.runCmd("frame variable --show-types shorts")
         output = self.res.GetOutput()
         for x in [line.strip() for line in output.split(os.linesep)]:
-            # Skip empty line or closing brace.
-            if not x or x == '}':
+            # Skip empty line, closing brace, and messages about more variables than can be displayed.
+            if not x or x == '}' or x == '...' or "Some of your variables have more members than the debugger will show by default" in x:
                 continue
             self.expect(x, "Expect type 'short'", exe=False,
                 substrs = ['short'])

Modified: lldb/branches/windows/test/lang/cpp/unsigned_types/TestUnsignedTypes.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/test/lang/cpp/unsigned_types/TestUnsignedTypes.py?rev=179679&r1=179678&r2=179679&view=diff
==============================================================================
--- lldb/branches/windows/test/lang/cpp/unsigned_types/TestUnsignedTypes.py (original)
+++ lldb/branches/windows/test/lang/cpp/unsigned_types/TestUnsignedTypes.py Wed Apr 17 03:38:48 2013
@@ -37,8 +37,11 @@ class UnsignedTypesTestCase(TestBase):
         exe = os.path.join(os.getcwd(), "a.out")
         self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
 
+        # GCC puts a breakpoint on the last line of a multi-line expression, so
+        # if GCC is the target compiler, we cannot rely on an exact line match.
+        need_exact = "gcc" not in self.getCompiler()
         # Break on line 19 in main() aftre the variables are assigned values.
-        lldbutil.run_break_set_by_file_and_line (self, "main.cpp", self.line, num_expected_locations=1, loc_exact=True)
+        lldbutil.run_break_set_by_file_and_line (self, "main.cpp", self.line, num_expected_locations=1, loc_exact=need_exact)
 
         self.runCmd("run", RUN_SUCCEEDED)
 

Modified: lldb/branches/windows/test/lang/objc/blocks/TestObjCIvarsInBlocks.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/test/lang/objc/blocks/TestObjCIvarsInBlocks.py?rev=179679&r1=179678&r2=179679&view=diff
==============================================================================
--- lldb/branches/windows/test/lang/objc/blocks/TestObjCIvarsInBlocks.py (original)
+++ lldb/branches/windows/test/lang/objc/blocks/TestObjCIvarsInBlocks.py Wed Apr 17 03:38:48 2013
@@ -48,6 +48,9 @@ class TestObjCIvarsInBlocks(TestBase):
         breakpoint = target.BreakpointCreateBySourceRegex ('// Break here inside the block.', self.class_source_file_spec)
         self.assertTrue(breakpoint, VALID_BREAKPOINT)
 
+        breakpoint_two = target.BreakpointCreateBySourceRegex ('// Break here inside the class method block.', self.class_source_file_spec)
+        self.assertTrue(breakpoint, VALID_BREAKPOINT)
+
         process = target.LaunchSimple (None, None, os.getcwd())
         self.assertTrue (process, "Created a process.")
         self.assertTrue (process.GetState() == lldb.eStateStopped, "Stopped it too.")
@@ -94,6 +97,21 @@ class TestObjCIvarsInBlocks(TestBase):
         self.assertTrue (error.Success(), "Got value from indirect access using the expression parser")
 
         self.assertTrue (direct_value == indirect_value, "Direct ivar access and indirect through expression parser produce same value.")
+
+        process.Continue()
+        self.assertTrue (process.GetState() == lldb.eStateStopped, "Stopped at the second breakpoint.")
+
+        thread_list = lldbutil.get_threads_stopped_at_breakpoint (process, breakpoint_two)
+        self.assertTrue (len(thread_list) == 1)
+        thread = thread_list[0]
+        
+        frame = thread.GetFrameAtIndex(0)
+        self.assertTrue (frame, "frame 0 is valid")
+        
+        expr = frame.EvaluateExpression("(ret)")
+        self.assertTrue (expr, "Successfully got a local variable in a block in a class method.")
+
+        self.assertTrue (expr.GetValueAsSigned (error) == 5, "The local variable in the block was what we expected.")
         
 if __name__ == '__main__':
     import atexit

Modified: lldb/branches/windows/test/lang/objc/blocks/ivars-in-blocks.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/test/lang/objc/blocks/ivars-in-blocks.h?rev=179679&r1=179678&r2=179679&view=diff
==============================================================================
--- lldb/branches/windows/test/lang/objc/blocks/ivars-in-blocks.h (original)
+++ lldb/branches/windows/test/lang/objc/blocks/ivars-in-blocks.h Wed Apr 17 03:38:48 2013
@@ -5,6 +5,7 @@
   @public
   int blocky_ivar;
 }
++ (void) classMethod;
 - (IAmBlocky *) init;
 - (int) callABlock: (int) block_value;
 @end

Modified: lldb/branches/windows/test/lang/objc/blocks/ivars-in-blocks.m
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/test/lang/objc/blocks/ivars-in-blocks.m?rev=179679&r1=179678&r2=179679&view=diff
==============================================================================
--- lldb/branches/windows/test/lang/objc/blocks/ivars-in-blocks.m (original)
+++ lldb/branches/windows/test/lang/objc/blocks/ivars-in-blocks.m Wed Apr 17 03:38:48 2013
@@ -11,7 +11,22 @@ typedef int (^my_block_ptr_type) (int);
 @end
 
 @implementation IAmBlocky
+
++ (int) addend
+{
+  return 3;
+}
  
++ (void) classMethod
+{
+  int (^my_block)(int) = ^(int foo)
+  {
+    int ret = foo + [self addend];
+    return ret; // Break here inside the class method block.
+  };
+  printf("%d\n", my_block(2));
+}
+
 - (void) makeBlockPtr;
 {
   _block_ptr = ^(int inval)
@@ -34,7 +49,9 @@ typedef int (^my_block_ptr_type) (int);
 {
   if (_block_ptr == NULL)
     [self makeBlockPtr];
-  return _block_ptr (block_value);
+  int ret = _block_ptr (block_value);
+  [IAmBlocky classMethod];
+  return ret;
 }
 @end
 

Modified: lldb/branches/windows/test/lang/objc/forward-decl/Makefile
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/test/lang/objc/forward-decl/Makefile?rev=179679&r1=179678&r2=179679&view=diff
==============================================================================
--- lldb/branches/windows/test/lang/objc/forward-decl/Makefile (original)
+++ lldb/branches/windows/test/lang/objc/forward-decl/Makefile Wed Apr 17 03:38:48 2013
@@ -4,6 +4,6 @@ DYLIB_NAME := libContainer
 DYLIB_OBJC_SOURCES := Container.m
 OBJC_SOURCES := main.m
 
-LDFLAGS = -framework Foundation
-
 include $(LEVEL)/Makefile.rules
+
+LDFLAGS += -framework Foundation

Modified: lldb/branches/windows/test/lang/objc/foundation/TestObjCMethods2.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/test/lang/objc/foundation/TestObjCMethods2.py?rev=179679&r1=179678&r2=179679&view=diff
==============================================================================
--- lldb/branches/windows/test/lang/objc/foundation/TestObjCMethods2.py (original)
+++ lldb/branches/windows/test/lang/objc/foundation/TestObjCMethods2.py Wed Apr 17 03:38:48 2013
@@ -133,8 +133,7 @@ class FoundationTestCase2(TestBase):
 
         self.runCmd("process continue")
 
-    @unittest2.expectedFailure
-    # <rdar://problem/8741897> Expressions should support properties
+    @unittest2.expectedFailure(8741897)
     def NSArray_expr(self):
         """Test expression commands for NSArray."""
         exe = os.path.join(os.getcwd(), "a.out")
@@ -160,8 +159,7 @@ class FoundationTestCase2(TestBase):
             patterns = ["\(int\) \$.* = 3"])
         self.runCmd("process continue")
 
-    @unittest2.expectedFailure
-    # <rdar://problem/8741897> Expressions should support properties
+    @unittest2.expectedFailure(8741897)
     def NSString_expr(self):
         """Test expression commands for NSString."""
         exe = os.path.join(os.getcwd(), "a.out")
@@ -200,7 +198,7 @@ class FoundationTestCase2(TestBase):
 
         self.runCmd("run", RUN_SUCCEEDED)
         
-        self.expect("expression *my",
+        self.expect("expression --show-types -- *my",
             patterns = ["\(MyString\) \$.* = ", "\(MyBase\)", "\(NSObject\)", "\(Class\)"])
         self.runCmd("process continue")
 
@@ -216,7 +214,7 @@ class FoundationTestCase2(TestBase):
         self.runCmd("run", RUN_SUCCEEDED)
 
         self.expect("po [NSError errorWithDomain:@\"Hello\" code:35 userInfo:nil]",
-            substrs = ["$", "= 0x", "Error Domain=Hello", "Code=35", "be completed."])
+            substrs = ["Error Domain=Hello", "Code=35", "be completed."])
         self.runCmd("process continue")
 
     def NSError_p(self):

Modified: lldb/branches/windows/test/lang/objc/objc-dynamic-value/TestObjCDynamicValue.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/test/lang/objc/objc-dynamic-value/TestObjCDynamicValue.py?rev=179679&r1=179678&r2=179679&view=diff
==============================================================================
--- lldb/branches/windows/test/lang/objc/objc-dynamic-value/TestObjCDynamicValue.py (original)
+++ lldb/branches/windows/test/lang/objc/objc-dynamic-value/TestObjCDynamicValue.py Wed Apr 17 03:38:48 2013
@@ -116,10 +116,10 @@ class ObjCDynamicValueTestCase(TestBase)
         # check that our ObjC GetISA() does a good job at hiding KVO swizzled classes
         
         self.expect('frame var -d run-target myObserver->_source -T', 'the KVO-ed class is hidden',
-                    substrs = ['dynamic type: SourceDerived'])
+                    substrs = ['SourceDerived'])
 
         self.expect('frame var -d run-target myObserver->_source -T', 'the KVO-ed class is hidden', matching = False,
-                    substrs = ['dynamic type: NSKVONotify'])
+                    substrs = ['NSKVONotify'])
 
         # This test is not entirely related to the main thrust of this test case, but since we're here,
         # try stepping into setProperty, and make sure we get into the version in Source:

Modified: lldb/branches/windows/test/lang/objc/objc-optimized/Makefile
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/test/lang/objc/objc-optimized/Makefile?rev=179679&r1=179678&r2=179679&view=diff
==============================================================================
--- lldb/branches/windows/test/lang/objc/objc-optimized/Makefile (original)
+++ lldb/branches/windows/test/lang/objc/objc-optimized/Makefile Wed Apr 17 03:38:48 2013
@@ -2,7 +2,7 @@ LEVEL = ../../../make
 
 OBJC_SOURCES := main.m
 
-CFLAGS ?= -arch $(ARCH) -gdwarf-2 -O2
+CFLAGS ?= -arch $(ARCH) -g -O2
 LDFLAGS = $(CFLAGS) -lobjc -framework Foundation
 
 include $(LEVEL)/Makefile.rules

Modified: lldb/branches/windows/test/lang/objc/objc-stepping/TestObjCStepping.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/test/lang/objc/objc-stepping/TestObjCStepping.py?rev=179679&r1=179678&r2=179679&view=diff
==============================================================================
--- lldb/branches/windows/test/lang/objc/objc-stepping/TestObjCStepping.py (original)
+++ lldb/branches/windows/test/lang/objc/objc-stepping/TestObjCStepping.py Wed Apr 17 03:38:48 2013
@@ -8,6 +8,9 @@ from lldbtest import *
 
 class TestObjCStepping(TestBase):
 
+    def getCategories (self):
+        return ['basic_process']
+
     mydir = os.path.join("lang", "objc", "objc-stepping")
 
     @unittest2.skipUnless(sys.platform.startswith("darwin"), "requires Darwin")

Modified: lldb/branches/windows/test/lang/objc/rdar-11355592/TestRdar11355592.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/test/lang/objc/rdar-11355592/TestRdar11355592.py?rev=179679&r1=179678&r2=179679&view=diff
==============================================================================
--- lldb/branches/windows/test/lang/objc/rdar-11355592/TestRdar11355592.py (original)
+++ lldb/branches/windows/test/lang/objc/rdar-11355592/TestRdar11355592.py Wed Apr 17 03:38:48 2013
@@ -51,13 +51,13 @@ class Rdar10967107TestCase(TestBase):
         self.expect("frame variable my_string --dynamic-type run-target", substrs = ['const char *'])
         # check that expr also gets it right
         self.expect("expr my_string", substrs = ['const char *'])
-        self.expect("expr -d true -- my_string", substrs = ['const char *'])
+        self.expect("expr -d run -- my_string", substrs = ['const char *'])
         # but check that we get the real Foolie as such
         self.expect("frame variable my_foolie", substrs = ['FoolMeOnce *'])
         self.expect("frame variable my_foolie --dynamic-type run-target", substrs = ['FoolMeOnce *'])
         # check that expr also gets it right
         self.expect("expr my_foolie", substrs = ['FoolMeOnce *'])
-        self.expect("expr -d true -- my_foolie", substrs = ['FoolMeOnce *'])
+        self.expect("expr -d run -- my_foolie", substrs = ['FoolMeOnce *'])
         # now check that assigning a true string does not break anything
         self.runCmd("next")
         # check that we correctly see the const char*, even with dynamic types on
@@ -65,13 +65,13 @@ class Rdar10967107TestCase(TestBase):
         self.expect("frame variable my_string --dynamic-type run-target", substrs = ['const char *'])
         # check that expr also gets it right
         self.expect("expr my_string", substrs = ['const char *'])
-        self.expect("expr -d true -- my_string", substrs = ['const char *'])
+        self.expect("expr -d run -- my_string", substrs = ['const char *'])
         # but check that we get the real Foolie as such
         self.expect("frame variable my_foolie", substrs = ['FoolMeOnce *'])
         self.expect("frame variable my_foolie --dynamic-type run-target", substrs = ['FoolMeOnce *'])
         # check that expr also gets it right
         self.expect("expr my_foolie", substrs = ['FoolMeOnce *'])
-        self.expect("expr -d true -- my_foolie", substrs = ['FoolMeOnce *'])
+        self.expect("expr -d run -- my_foolie", substrs = ['FoolMeOnce *'])
 
 if __name__ == '__main__':
     import atexit

Modified: lldb/branches/windows/test/lang/objc/rdar-12408181/main.m
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/test/lang/objc/rdar-12408181/main.m?rev=179679&r1=179678&r2=179679&view=diff
==============================================================================
--- lldb/branches/windows/test/lang/objc/rdar-12408181/main.m (original)
+++ lldb/branches/windows/test/lang/objc/rdar-12408181/main.m Wed Apr 17 03:38:48 2013
@@ -5,6 +5,7 @@ int main (int argc, char const *argv[])
 {
     NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
 
+	[NSApplication sharedApplication];
 	NSWindow* window = [[NSWindow alloc] initWithContentRect:NSMakeRect(0,0,100,100) styleMask:NSBorderlessWindowMask backing:NSBackingStoreRetained defer:NO];
 	[window setCanHide:YES];
     [pool release]; // Set breakpoint here.

Modified: lldb/branches/windows/test/lldbtest.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/test/lldbtest.py?rev=179679&r1=179678&r2=179679&view=diff
==============================================================================
--- lldb/branches/windows/test/lldbtest.py (original)
+++ lldb/branches/windows/test/lldbtest.py Wed Apr 17 03:38:48 2013
@@ -368,80 +368,228 @@ def dwarf_test(func):
     wrapper.__dwarf_test__ = True
     return wrapper
 
-def expectedFailureClang(func):
-    """Decorate the item as a Clang only expectedFailure."""
-    if isinstance(func, type) and issubclass(func, unittest2.TestCase):
-        raise Exception("@expectedFailureClang can only be used to decorate a test method")
-    @wraps(func)
-    def wrapper(*args, **kwargs):
-        from unittest2 import case
-        self = args[0]
-        compiler = self.getCompiler()
-        try:
-            func(*args, **kwargs)
-        except Exception:
-            if "clang" in compiler:
-                raise case._ExpectedFailure(sys.exc_info())
-            else:
-                raise
-
-        if "clang" in compiler:
-            raise case._UnexpectedSuccess
-    return wrapper
+def expectedFailureGcc(bugnumber=None):
+     if callable(bugnumber):
+        @wraps(bugnumber)
+        def expectedFailureGcc_easy_wrapper(*args, **kwargs):
+            from unittest2 import case
+            self = args[0]
+            test_compiler = self.getCompiler()
+            try:
+                bugnumber(*args, **kwargs)
+            except Exception:
+                if "gcc" in test_compiler:
+                    raise case._ExpectedFailure(sys.exc_info(),None)
+                else:
+                    raise
+            if "gcc" in test_compiler:
+                raise case._UnexpectedSuccess(sys.exc_info(),None)
+        return expectedFailureGcc_easy_wrapper
+     else:
+        def expectedFailureGcc_impl(func):
+              @wraps(func)
+              def wrapper(*args, **kwargs):
+                from unittest2 import case
+                self = args[0]
+                test_compiler = self.getCompiler()
+                try:
+                    func(*args, **kwargs)
+                except Exception:
+                    if "gcc" in test_compiler:
+                        raise case._ExpectedFailure(sys.exc_info(),bugnumber)
+                    else:
+                        raise
+                if "gcc" in test_compiler:
+                    raise case._UnexpectedSuccess(sys.exc_info(),bugnumber)
+              return wrapper
+        return expectedFailureGcc_impl
+
+def expectedFailureClang(bugnumber=None):
+     if callable(bugnumber):
+        @wraps(bugnumber)
+        def expectedFailureClang_easy_wrapper(*args, **kwargs):
+            from unittest2 import case
+            self = args[0]
+            test_compiler = self.getCompiler()
+            try:
+                bugnumber(*args, **kwargs)
+            except Exception:
+                if "clang" in test_compiler:
+                    raise case._ExpectedFailure(sys.exc_info(),None)
+                else:
+                    raise
+            if "clang" in test_compiler:
+                raise case._UnexpectedSuccess(sys.exc_info(),None)
+        return expectedFailureClang_easy_wrapper
+     else:
+        def expectedFailureClang_impl(func):
+              @wraps(func)
+              def wrapper(*args, **kwargs):
+                from unittest2 import case
+                self = args[0]
+                test_compiler = self.getCompiler()
+                try:
+                    func(*args, **kwargs)
+                except Exception:
+                    if "clang" in test_compiler:
+                        raise case._ExpectedFailure(sys.exc_info(),bugnumber)
+                    else:
+                        raise
+                if "clang" in test_compiler:
+                    raise case._UnexpectedSuccess(sys.exc_info(),bugnumber)
+              return wrapper
+        return expectedFailureClang_impl
+
+def expectedFailureIcc(bugnumber=None):
+     if callable(bugnumber):
+        @wraps(bugnumber)
+        def expectedFailureIcc_easy_wrapper(*args, **kwargs):
+            from unittest2 import case
+            self = args[0]
+            test_compiler = self.getCompiler()
+            try:
+                bugnumber(*args, **kwargs)
+            except Exception:
+                if "icc" in test_compiler:
+                    raise case._ExpectedFailure(sys.exc_info(),None)
+                else:
+                    raise
+            if "icc" in test_compiler:
+                raise case._UnexpectedSuccess(sys.exc_info(),None)
+        return expectedFailureIcc_easy_wrapper
+     else:
+        def expectedFailureIcc_impl(func):
+              @wraps(func)
+              def wrapper(*args, **kwargs):
+                from unittest2 import case
+                self = args[0]
+                test_compiler = self.getCompiler()
+                try:
+                    func(*args, **kwargs)
+                except Exception:
+                    if "icc" in test_compiler:
+                        raise case._ExpectedFailure(sys.exc_info(),bugnumber)
+                    else:
+                        raise
+                if "icc" in test_compiler:
+                    raise case._UnexpectedSuccess(sys.exc_info(),bugnumber)
+              return wrapper
+        return expectedFailureIcc_impl
+
+
+def expectedFailurei386(bugnumber=None):
+     if callable(bugnumber):
+        @wraps(bugnumber)
+        def expectedFailurei386_easy_wrapper(*args, **kwargs):
+            from unittest2 import case
+            self = args[0]
+            arch = self.getArchitecture()
+            try:
+                bugnumber(*args, **kwargs)
+            except Exception:
+                if "i386" in arch:
+                    raise case._ExpectedFailure(sys.exc_info(),None)
+                else:
+                    raise
+            if "i386" in arch:
+                raise case._UnexpectedSuccess(sys.exc_info(),None)
+        return expectedFailurei386_easy_wrapper
+     else:
+        def expectedFailurei386_impl(func):
+              @wraps(func)
+              def wrapper(*args, **kwargs):
+                from unittest2 import case
+                self = args[0]
+                arch = self.getArchitecture()
+                try:
+                    func(*args, **kwargs)
+                except Exception:
+                    if "i386" in arch:
+                        raise case._ExpectedFailure(sys.exc_info(),bugnumber)
+                    else:
+                        raise
+                if "i386" in arch:
+                    raise case._UnexpectedSuccess(sys.exc_info(),bugnumber)
+              return wrapper
+        return expectedFailurei386_impl
+
+def expectedFailureLinux(bugnumber=None):
+     if callable(bugnumber):
+        @wraps(bugnumber)
+        def expectedFailureLinux_easy_wrapper(*args, **kwargs):
+            from unittest2 import case
+            self = args[0]
+            platform = sys.platform
+            try:
+                bugnumber(*args, **kwargs)
+            except Exception:
+                if "linux" in platform:
+                    raise case._ExpectedFailure(sys.exc_info(),None)
+                else:
+                    raise
+            if "linux" in platform:
+                raise case._UnexpectedSuccess(sys.exc_info(),None)
+        return expectedFailureLinux_easy_wrapper
+     else:
+        def expectedFailureLinux_impl(func):
+              @wraps(func)
+              def wrapper(*args, **kwargs):
+                from unittest2 import case
+                self = args[0]
+                platform = sys.platform
+                try:
+                    func(*args, **kwargs)
+                except Exception:
+                    if "linux" in platform:
+                        raise case._ExpectedFailure(sys.exc_info(),bugnumber)
+                    else:
+                        raise
+                if "linux" in platform:
+                    raise case._UnexpectedSuccess(sys.exc_info(),bugnumber)
+              return wrapper
+        return expectedFailureLinux_impl
 
-def expectedFailurei386(func):
-    """Decorate the item as an i386 only expectedFailure."""
+def skipOnLinux(func):
+    """Decorate the item to skip tests that should be skipped on Linux."""
     if isinstance(func, type) and issubclass(func, unittest2.TestCase):
-        raise Exception("@expectedFailurei386 can only be used to decorate a test method")
+        raise Exception("@skipOnLinux can only be used to decorate a test method")
     @wraps(func)
     def wrapper(*args, **kwargs):
         from unittest2 import case
         self = args[0]
-        arch = self.getArchitecture()
-        try:
+        platform = sys.platform
+        if "linux" in platform:
+            self.skipTest("skip on linux")
+        else:
             func(*args, **kwargs)
-        except Exception:
-            if "i386" in arch:
-                raise case._ExpectedFailure(sys.exc_info())
-            else:
-                raise
-
-        if "i386" in arch:
-            raise case._UnexpectedSuccess
     return wrapper
 
-def expectedFailureLinux(func):
-    """Decorate the item as a Linux only expectedFailure."""
+def skipIfGcc(func):
+    """Decorate the item to skip tests that should be skipped if building with gcc ."""
     if isinstance(func, type) and issubclass(func, unittest2.TestCase):
-        raise Exception("@expectedFailureLinux can only be used to decorate a test method")
+        raise Exception("@skipIfGcc can only be used to decorate a test method")
     @wraps(func)
     def wrapper(*args, **kwargs):
         from unittest2 import case
         self = args[0]
-        platform = sys.platform
-        try:
+        compiler = self.getCompiler()
+        if "gcc" in compiler:
+            self.skipTest("skipping because gcc is the test compiler")
+        else:
             func(*args, **kwargs)
-        except Exception:
-            if "linux" in platform:
-                raise case._ExpectedFailure(sys.exc_info())
-            else:
-                raise
-
-        if "linux" in platform:
-            raise case._UnexpectedSuccess
     return wrapper
 
-def skipOnLinux(func):
-    """Decorate the item to skip tests that should be skipped on Linux."""
+def skipIfIcc(func):
+    """Decorate the item to skip tests that should be skipped if building with icc ."""
     if isinstance(func, type) and issubclass(func, unittest2.TestCase):
-        raise Exception("@skipOnLinux can only be used to decorate a test method")
+        raise Exception("@skipIfIcc can only be used to decorate a test method")
     @wraps(func)
     def wrapper(*args, **kwargs):
         from unittest2 import case
         self = args[0]
-        platform = sys.platform
-        if "linux" in platform:
-            self.skipTest("skip on linux")
+        compiler = self.getCompiler()
+        if "icc" in compiler:
+            self.skipTest("skipping because icc is the test compiler")
         else:
             func(*args, **kwargs)
     return wrapper
@@ -598,6 +746,9 @@ class Base(unittest2.TestCase):
         self.dicts = []
         self.doTearDownCleanups = False
 
+        # List of spawned subproces.Popen objects
+        self.subprocesses = []
+
         # Create a string buffer to record the session info, to be dumped into a
         # test case specific file if test failure is encountered.
         self.session = StringIO.StringIO()
@@ -651,6 +802,37 @@ class Base(unittest2.TestCase):
                 child.sendline(hook)
                 child.expect_exact(child_prompt)
 
+    def setAsync(self, value):
+        """ Sets async mode to True/False and ensures it is reset after the testcase completes."""
+        old_async = self.dbg.GetAsync()
+        self.dbg.SetAsync(value)
+        self.addTearDownHook(lambda: self.dbg.SetAsync(old_async))
+
+    def cleanupSubprocesses(self):
+        # Ensure any subprocesses are cleaned up
+        for p in self.subprocesses:
+            if p.poll() == None:
+                p.terminate()
+            del p
+        del self.subprocesses[:]
+
+    def spawnSubprocess(self, executable, args=[]):
+        """ Creates a subprocess.Popen object with the specified executable and arguments,
+            saves it in self.subprocesses, and returns the object.
+            NOTE: if using this function, ensure you also call:
+
+              self.addTearDownHook(self.cleanupSubprocesses)
+
+            otherwise the test suite will leak processes.
+        """
+
+        # Don't display the stdout if not in TraceOn() mode.
+        proc = Popen([executable] + args,
+                     stdout = open(os.devnull) if not self.TraceOn() else None,
+                     stdin = PIPE)
+        self.subprocesses.append(proc)
+        return proc
+
     def HideStdout(self):
         """Hide output to stdout from the user.
 
@@ -714,14 +896,17 @@ class Base(unittest2.TestCase):
         if self.child and self.child.isalive():
             with recording(self, traceAlways) as sbuf:
                 print >> sbuf, "tearing down the child process...."
-            if self.child_in_script_interpreter:
-                self.child.sendline('quit()')
-                self.child.expect_exact(self.child_prompt)
-            self.child.sendline('quit')
             try:
+                if self.child_in_script_interpreter:
+                    self.child.sendline('quit()')
+                    self.child.expect_exact(self.child_prompt)
+                self.child.sendline('settings set interpreter.prompt-on-quit false')
+                self.child.sendline('quit')
                 self.child.expect(pexpect.EOF)
-            except:
+            except ValueError, ExceptionPexpect:
+                # child is already terminated
                 pass
+
             # Give it one final blow to make sure the child is terminated.
             self.child.close()
 
@@ -766,14 +951,17 @@ class Base(unittest2.TestCase):
             # Once by the Python unittest framework, and a second time by us.
             print >> sbuf, "FAIL"
 
-    def markExpectedFailure(self):
+    def markExpectedFailure(self,err,bugnumber):
         """Callback invoked when an expected failure/error occurred."""
         self.__expected__ = True
         with recording(self, False) as sbuf:
             # False because there's no need to write "expected failure" to the
             # stderr twice.
             # Once by the Python unittest framework, and a second time by us.
-            print >> sbuf, "expected failure"
+            if bugnumber == None:
+                print >> sbuf, "expected failure"
+            else:
+                print >> sbuf, "expected failure (problem id:" + str(bugnumber) + ")"	
 
     def markSkippedTest(self):
         """Callback invoked when a test is skipped."""
@@ -784,14 +972,17 @@ class Base(unittest2.TestCase):
             # Once by the Python unittest framework, and a second time by us.
             print >> sbuf, "skipped test"
 
-    def markUnexpectedSuccess(self):
+    def markUnexpectedSuccess(self, bugnumber):
         """Callback invoked when an unexpected success occurred."""
         self.__unexpected__ = True
         with recording(self, False) as sbuf:
             # False because there's no need to write "unexpected success" to the
             # stderr twice.
             # Once by the Python unittest framework, and a second time by us.
-            print >> sbuf, "unexpected success"
+            if bugnumber == None:
+                print >> sbuf, "unexpected success"
+            else:
+                print >> sbuf, "unexpected success (problem id:" + str(bugnumber) + ")"	
 
     def dumpSessionInfo(self):
         """
@@ -874,6 +1065,21 @@ class Base(unittest2.TestCase):
         module = builder_module()
         return module.getCompiler()
 
+    def getCompilerVersion(self):
+        """ Returns a string that represents the compiler version.
+            Supports: llvm, clang.
+        """
+        from lldbutil import which
+        version = 'unknown'
+
+        compiler = self.getCompiler()
+        version_output = system([which(compiler), "-v"])[1]
+        for line in version_output.split(os.linesep):
+            m = re.search('version ([0-9\.]+)', line)
+            if m:
+                version = m.group(1)
+        return version
+
     def getRunOptions(self):
         """Command line option for -A and -C to run this test again, called from
         self.dumpSessionInfo()."""

Modified: lldb/branches/windows/test/lldbutil.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/test/lldbutil.py?rev=179679&r1=179678&r2=179679&view=diff
==============================================================================
--- lldb/branches/windows/test/lldbutil.py (original)
+++ lldb/branches/windows/test/lldbutil.py Wed Apr 17 03:38:48 2013
@@ -479,7 +479,7 @@ def get_stopped_thread(process, reason):
     ...
         from lldbutil import get_stopped_thread
         thread = get_stopped_thread(process, lldb.eStopReasonPlanComplete)
-        self.assertTrue(thread != None, "There should be a thread stopped due to breakpoint condition")
+        self.assertTrue(thread.IsValid(), "There should be a thread stopped due to breakpoint condition")
     ...
 
     2. Get the thread stopped due to a breakpoint
@@ -487,7 +487,7 @@ def get_stopped_thread(process, reason):
     ...
         from lldbutil import get_stopped_thread
         thread = get_stopped_thread(process, lldb.eStopReasonBreakpoint)
-        self.assertTrue(thread != None, "There should be a thread stopped due to breakpoint")
+        self.assertTrue(thread.IsValid(), "There should be a thread stopped due to breakpoint")
     ...
 
     """

Modified: lldb/branches/windows/test/logging/TestLogging.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/test/logging/TestLogging.py?rev=179679&r1=179678&r2=179679&view=diff
==============================================================================
--- lldb/branches/windows/test/logging/TestLogging.py (original)
+++ lldb/branches/windows/test/logging/TestLogging.py Wed Apr 17 03:38:48 2013
@@ -63,10 +63,6 @@ class LogTestCase(TestBase):
             "HandleCommand, command succeeded\n",
             ]
 
-        # com.apple.main-thread identifier appears on darwin only
-        if sys.platform.startswith("darwin"):
-            expected_log_lines = ['com.apple.main-thread ' + x for x in expected_log_lines]
-
         self.assertTrue (os.path.isfile (log_file))
 
         idx = 0

Modified: lldb/branches/windows/test/make/Makefile.rules
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/test/make/Makefile.rules?rev=179679&r1=179678&r2=179679&view=diff
==============================================================================
--- lldb/branches/windows/test/make/Makefile.rules (original)
+++ lldb/branches/windows/test/make/Makefile.rules Wed Apr 17 03:38:48 2013
@@ -54,26 +54,49 @@ ifeq "$(CC)" "cc"
 endif
 
 #----------------------------------------------------------------------
+# ARCHFLAG is the flag used to tell the compiler which architecture
+# to compile for. The default is the flag that clang accepts.
+#----------------------------------------------------------------------
+ARCHFLAG ?= -arch 
+
+#----------------------------------------------------------------------
 # Change any build/tool options needed
 #----------------------------------------------------------------------
-CFLAGS ?= -gdwarf-2 -O0
-CFLAGS += $(FRAMEWORK_INCLUDES) $(CFLAGS_EXTRAS)
 ifeq "$(OS)" "Darwin"
-	CFLAGS += -arch $(ARCH)
 	DS := dsymutil
 	DSFLAGS =
 	DSYM = $(EXE).dSYM
 	AR := libtool
 	ARFLAGS := -static -o
+else
+	# On non-Apple platforms, -arch becomes -m
+	ARCHFLAG := -m
+
+	# i386 becomes 32, and x86_64 becomes 64
+	ifeq "$(ARCH)" "x86_64"
+	    override ARCH := $(subst x86_64,64,$(ARCH))
+	endif
+	ifeq "$(ARCH)" "i386"
+	    override ARCH := $(subst i386,32,$(ARCH))
+	endif
 endif
 
+CFLAGS ?= -g -O0
+CFLAGS += $(ARCHFLAG)$(ARCH) $(FRAMEWORK_INCLUDES) $(CFLAGS_EXTRAS)
+
 CXXFLAGS +=$(CFLAGS)
 LD = $(CC)
 LDFLAGS ?= $(CFLAGS)
-LDFLAGS += $(LD_EXTRAS) -arch $(ARCH)
+LDFLAGS += $(LD_EXTRAS)
 OBJECTS =
 EXE ?= a.out
 
+ifneq (,$(findstring g++,$(CXX)))
+	# GCC 4.6 cannot handle -std=c++11, so replace it with -std=c++0x
+	# instead. FIXME: remove once GCC version is upgraded.
+	override CXXFLAGS := $(subst -std=c++11,-std=c++0x,$(CXXFLAGS))
+endif
+
 ifneq "$(DYLIB_NAME)" ""
 	ifeq "$(OS)" "Darwin"
 		DYLIB_FILENAME = lib$(DYLIB_NAME).dylib
@@ -83,10 +106,10 @@ ifneq "$(DYLIB_NAME)" ""
 endif
 
 # Function that returns the counterpart C++ compiler, given $(CC) as arg.
-cxx_compiler = $(if $(findstring clang,$(1)), $(subst clang,clang++,$(1)), $(if $(findstring llvm-gcc,$(1)), $(subst llvm-gcc,llvm-g++,$(1)), $(subst gcc,g++,$(1))))
+cxx_compiler = $(if $(findstring clang,$(1)), $(subst clang,clang++,$(1)), $(if $(findstring icc,$(1)), $(subst icc,icpc,$(1)), $(if $(findstring llvm-gcc,$(1)), $(subst llvm-gcc,llvm-g++,$(1)), $(subst gcc,g++,$(1)))))
 
 # Function that returns the C++ linker, given $(CC) as arg.
-cxx_linker = $(if $(findstring clang,$(1)), $(subst clang,clang++,$(1)), $(if $(findstring llvm-gcc,$(1)), $(subst llvm-gcc,llvm-g++,$(1)), $(subst gcc,g++,$(1))))
+cxx_linker = $(if $(findstring clang,$(1)), $(subst clang,clang++,$(1)), $(if $(findstring icc,$(1)), $(subst icc,icpc,$(1)), $(if $(findstring llvm-gcc,$(1)), $(subst llvm-gcc,llvm-g++,$(1)), $(subst gcc,g++,$(1)))))
 
 #----------------------------------------------------------------------
 # dylib settings
@@ -208,7 +231,7 @@ EXE = $(DYLIB_FILENAME)
 endif
 else
 $(EXE) : $(OBJECTS) $(ARCHIVE_NAME)
-	$(LD) $(LDFLAGS) $(OBJECTS) $(ARCHIVE_NAME) -o "$(EXE)"
+	$(LD) $(OBJECTS) $(LDFLAGS) $(ARCHIVE_NAME) -o "$(EXE)"
 endif
 
 #----------------------------------------------------------------------

Modified: lldb/branches/windows/test/plugins/builder_base.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/test/plugins/builder_base.py?rev=179679&r1=179678&r2=179679&view=diff
==============================================================================
--- lldb/branches/windows/test/plugins/builder_base.py (original)
+++ lldb/branches/windows/test/plugins/builder_base.py Wed Apr 17 03:38:48 2013
@@ -23,6 +23,20 @@ def getCompiler():
     """Returns the compiler in effect the test suite is running with."""
     return os.environ["CC"] if "CC" in os.environ else "clang"
 
+def getArchFlag():
+    """Returns the flag required to specify the arch"""
+    compiler = getCompiler()
+    if compiler is None:
+      return ""
+    elif "gcc" in compiler:
+      archflag = "-m"
+    elif "clang" in compiler:
+      archflag = "-arch "
+    else:
+      archflag = None
+
+    return (" ARCHFLAG=" + archflag) if archflag else ""
+
 def getArchSpec(architecture):
     """
     Helper function to return the key-value string to specify the architecture

Modified: lldb/branches/windows/test/python_api/function_symbol/TestDisasmAPI.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/test/python_api/function_symbol/TestDisasmAPI.py?rev=179679&r1=179678&r2=179679&view=diff
==============================================================================
--- lldb/branches/windows/test/python_api/function_symbol/TestDisasmAPI.py (original)
+++ lldb/branches/windows/test/python_api/function_symbol/TestDisasmAPI.py Wed Apr 17 03:38:48 2013
@@ -61,7 +61,7 @@ class DisasmAPITestCase(TestBase):
         # Frame #0 should be on self.line1.
         self.assertTrue(process.GetState() == lldb.eStateStopped)
         thread = lldbutil.get_stopped_thread(process, lldb.eStopReasonBreakpoint)
-        self.assertTrue(thread != None, "There should be a thread stopped due to breakpoint condition")
+        self.assertTrue(thread.IsValid(), "There should be a thread stopped due to breakpoint condition")
         frame0 = thread.GetFrameAtIndex(0)
         lineEntry = frame0.GetLineEntry()
         self.assertTrue(lineEntry.GetLine() == self.line1)
@@ -80,7 +80,7 @@ class DisasmAPITestCase(TestBase):
         process.Continue()
         self.assertTrue(process.GetState() == lldb.eStateStopped)
         thread = lldbutil.get_stopped_thread(process, lldb.eStopReasonBreakpoint)
-        self.assertTrue(thread != None, "There should be a thread stopped due to breakpoint condition")
+        self.assertTrue(thread.IsValid(), "There should be a thread stopped due to breakpoint condition")
         frame0 = thread.GetFrameAtIndex(0)
         lineEntry = frame0.GetLineEntry()
         self.assertTrue(lineEntry.GetLine() == self.line2)

Modified: lldb/branches/windows/test/python_api/function_symbol/TestSymbolAPI.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/test/python_api/function_symbol/TestSymbolAPI.py?rev=179679&r1=179678&r2=179679&view=diff
==============================================================================
--- lldb/branches/windows/test/python_api/function_symbol/TestSymbolAPI.py (original)
+++ lldb/branches/windows/test/python_api/function_symbol/TestSymbolAPI.py Wed Apr 17 03:38:48 2013
@@ -61,7 +61,7 @@ class SymbolAPITestCase(TestBase):
         # Frame #0 should be on self.line1.
         self.assertTrue(process.GetState() == lldb.eStateStopped)
         thread = lldbutil.get_stopped_thread(process, lldb.eStopReasonBreakpoint)
-        self.assertTrue(thread != None, "There should be a thread stopped due to breakpoint condition")
+        self.assertTrue(thread.IsValid(), "There should be a thread stopped due to breakpoint condition")
         frame0 = thread.GetFrameAtIndex(0)
         symbol_line1 = frame0.GetSymbol()
         # We should have a symbol type of code.
@@ -74,7 +74,7 @@ class SymbolAPITestCase(TestBase):
         process.Continue()
         self.assertTrue(process.GetState() == lldb.eStateStopped)
         thread = lldbutil.get_stopped_thread(process, lldb.eStopReasonBreakpoint)
-        self.assertTrue(thread != None, "There should be a thread stopped due to breakpoint condition")
+        self.assertTrue(thread.IsValid(), "There should be a thread stopped due to breakpoint condition")
         frame0 = thread.GetFrameAtIndex(0)
         symbol_line2 = frame0.GetSymbol()
         # We should have a symbol type of code.

Modified: lldb/branches/windows/test/python_api/hello_world/TestHelloWorld.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/test/python_api/hello_world/TestHelloWorld.py?rev=179679&r1=179678&r2=179679&view=diff
==============================================================================
--- lldb/branches/windows/test/python_api/hello_world/TestHelloWorld.py (original)
+++ lldb/branches/windows/test/python_api/hello_world/TestHelloWorld.py Wed Apr 17 03:38:48 2013
@@ -67,7 +67,7 @@ class HelloWorldTestCase(TestBase):
         self.setTearDownCleanup(dictionary=self.d)
         self.hello_world_attach_with_name_api()
 
-    @expectedFailureLinux # due to bugzilla 14541
+    @expectedFailureLinux # due to bugzilla 14541 -- lldb is unable to attach to process by name
     @python_api_test
     @dwarf_test
     def test_with_dwarf_and_attach_to_process_with_name_api(self):
@@ -135,11 +135,9 @@ class HelloWorldTestCase(TestBase):
 
         target = self.dbg.CreateTarget(self.exe)
 
-        # Spawn a new process and don't display the stdout if not in TraceOn() mode.
-        import subprocess
-        popen = subprocess.Popen([self.exe, "abc", "xyz"],
-                                 stdout = open(os.devnull, 'w') if not self.TraceOn() else None)
-        #print "pid of spawned process: %d" % popen.pid
+        # Spawn a new process
+        popen = self.spawnSubprocess(self.exe, ["abc", "xyz"])
+        self.addTearDownHook(self.cleanupSubprocesses)
 
         listener = lldb.SBListener("my.attach.listener")
         error = lldb.SBError()
@@ -159,11 +157,9 @@ class HelloWorldTestCase(TestBase):
 
         target = self.dbg.CreateTarget(self.exe)
 
-        # Spawn a new process and don't display the stdout if not in TraceOn() mode.
-        import subprocess
-        popen = subprocess.Popen([self.exe, "abc", "xyz"],
-                                 stdout = open(os.devnull, 'w') if not self.TraceOn() else None)
-        #print "pid of spawned process: %d" % popen.pid
+        # Spawn a new process
+        popen = self.spawnSubprocess(self.exe, ["abc", "xyz"])
+        self.addTearDownHook(self.cleanupSubprocesses)
 
         listener = lldb.SBListener("my.attach.listener")
         error = lldb.SBError()

Modified: lldb/branches/windows/test/python_api/lldbutil/iter/Makefile
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/test/python_api/lldbutil/iter/Makefile?rev=179679&r1=179678&r2=179679&view=diff
==============================================================================
--- lldb/branches/windows/test/python_api/lldbutil/iter/Makefile (original)
+++ lldb/branches/windows/test/python_api/lldbutil/iter/Makefile Wed Apr 17 03:38:48 2013
@@ -1,7 +1,7 @@
 LEVEL = ../../../make
 
 CFLAGS_EXTRAS := -D__STDC_LIMIT_MACROS
-LDFLAGS := -lpthread
+LD_EXTRAS := -lpthread
 CXX_SOURCES := main.cpp
 MAKE_DSYM :=NO
 

Modified: lldb/branches/windows/test/python_api/lldbutil/iter/TestLLDBIterator.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/test/python_api/lldbutil/iter/TestLLDBIterator.py?rev=179679&r1=179678&r2=179679&view=diff
==============================================================================
--- lldb/branches/windows/test/python_api/lldbutil/iter/TestLLDBIterator.py (original)
+++ lldb/branches/windows/test/python_api/lldbutil/iter/TestLLDBIterator.py Wed Apr 17 03:38:48 2013
@@ -31,7 +31,6 @@ class LLDBIteratorTestCase(TestBase):
         self.buildDefault()
         self.lldb_iter_breakpoint()
 
-    @expectedFailureLinux # bugzilla 14323
     @python_api_test
     def test_lldb_iter_frame(self):
         """Test iterator works correctly for SBProcess->SBThread->SBFrame."""

Modified: lldb/branches/windows/test/python_api/lldbutil/iter/TestRegistersIterator.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/test/python_api/lldbutil/iter/TestRegistersIterator.py?rev=179679&r1=179678&r2=179679&view=diff
==============================================================================
--- lldb/branches/windows/test/python_api/lldbutil/iter/TestRegistersIterator.py (original)
+++ lldb/branches/windows/test/python_api/lldbutil/iter/TestRegistersIterator.py Wed Apr 17 03:38:48 2013
@@ -18,6 +18,7 @@ class RegistersIteratorTestCase(TestBase
         # Find the line number to break inside main().
         self.line1 = line_number('main.cpp', '// Set break point at this line.')
 
+    @expectedFailureLinux # bugzilla 14600 - Exception state registers not supported on Linux
     @python_api_test
     def test_iter_registers(self):
         """Test iterator works correctly for lldbutil.iter_registers()."""

Modified: lldb/branches/windows/test/python_api/lldbutil/process/Makefile
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/test/python_api/lldbutil/process/Makefile?rev=179679&r1=179678&r2=179679&view=diff
==============================================================================
--- lldb/branches/windows/test/python_api/lldbutil/process/Makefile (original)
+++ lldb/branches/windows/test/python_api/lldbutil/process/Makefile Wed Apr 17 03:38:48 2013
@@ -1,7 +1,7 @@
 LEVEL = ../../../make
 
 CFLAGS_EXTRAS := -D__STDC_LIMIT_MACROS
-LDFLAGS := -lpthread
+LD_EXTRAS := -lpthread
 CXX_SOURCES := main.cpp
 MAKE_DSYM :=NO
 

Modified: lldb/branches/windows/test/python_api/module_section/Makefile
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/test/python_api/module_section/Makefile?rev=179679&r1=179678&r2=179679&view=diff
==============================================================================
--- lldb/branches/windows/test/python_api/module_section/Makefile (original)
+++ lldb/branches/windows/test/python_api/module_section/Makefile Wed Apr 17 03:38:48 2013
@@ -1,7 +1,7 @@
 LEVEL = ../../make
 
 CFLAGS_EXTRAS := -D__STDC_LIMIT_MACROS
-LDFLAGS := -lpthread
+LD_EXTRAS := -lpthread
 CXX_SOURCES := main.cpp b.cpp c.cpp
 MAKE_DSYM :=NO
 

Modified: lldb/branches/windows/test/python_api/process/TestProcessAPI.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/test/python_api/process/TestProcessAPI.py?rev=179679&r1=179678&r2=179679&view=diff
==============================================================================
--- lldb/branches/windows/test/python_api/process/TestProcessAPI.py (original)
+++ lldb/branches/windows/test/python_api/process/TestProcessAPI.py Wed Apr 17 03:38:48 2013
@@ -90,7 +90,7 @@ class ProcessAPITestCase(TestBase):
         process = target.LaunchSimple(None, None, os.getcwd())
 
         thread = get_stopped_thread(process, lldb.eStopReasonBreakpoint)
-        self.assertTrue(thread != None, "There should be a thread stopped due to breakpoint")
+        self.assertTrue(thread.IsValid(), "There should be a thread stopped due to breakpoint")
         frame = thread.GetFrameAtIndex(0)
 
         # Get the SBValue for the global variable 'my_char'.
@@ -172,7 +172,7 @@ class ProcessAPITestCase(TestBase):
         process = target.LaunchSimple(None, None, os.getcwd())
 
         thread = get_stopped_thread(process, lldb.eStopReasonBreakpoint)
-        self.assertTrue(thread != None, "There should be a thread stopped due to breakpoint")
+        self.assertTrue(thread.IsValid(), "There should be a thread stopped due to breakpoint")
         frame = thread.GetFrameAtIndex(0)
 
         # Get the SBValue for the global variable 'my_char'.
@@ -223,7 +223,7 @@ class ProcessAPITestCase(TestBase):
         process = target.LaunchSimple(None, None, os.getcwd())
 
         thread = get_stopped_thread(process, lldb.eStopReasonBreakpoint)
-        self.assertTrue(thread != None, "There should be a thread stopped due to breakpoint")
+        self.assertTrue(thread.IsValid(), "There should be a thread stopped due to breakpoint")
         frame = thread.GetFrameAtIndex(0)
 
         # Get the SBValue for the global variable 'my_int'.

Modified: lldb/branches/windows/test/python_api/process/io/TestProcessIO.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/test/python_api/process/io/TestProcessIO.py?rev=179679&r1=179678&r2=179679&view=diff
==============================================================================
--- lldb/branches/windows/test/python_api/process/io/TestProcessIO.py (original)
+++ lldb/branches/windows/test/python_api/process/io/TestProcessIO.py Wed Apr 17 03:38:48 2013
@@ -35,7 +35,9 @@ class ProcessIOTestCase(TestBase):
 
         target = self.dbg.CreateTarget(self.exe)
 
-        self.dbg.SetAsync(True)
+        # Perform synchronous interaction with the debugger.
+        self.setAsync(True)
+
         process = target.LaunchSimple(None, None, os.getcwd())
         if self.TraceOn():
             print "process launched."

Modified: lldb/branches/windows/test/python_api/sbdata/TestSBData.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/test/python_api/sbdata/TestSBData.py?rev=179679&r1=179678&r2=179679&view=diff
==============================================================================
--- lldb/branches/windows/test/python_api/sbdata/TestSBData.py (original)
+++ lldb/branches/windows/test/python_api/sbdata/TestSBData.py Wed Apr 17 03:38:48 2013
@@ -33,6 +33,19 @@ class SBDataAPICase(TestBase):
         # Find the line number to break on inside main.cpp.
         self.line = line_number('main.cpp', '// set breakpoint here')
 
+    def assert_data(self, func, arg, expected):
+        """ Asserts func(SBError error, arg) == expected. """
+        error = lldb.SBError()
+        result = func(error, arg)
+        if not error.Success():
+            stream = lldb.SBStream()
+            error.GetDescription(stream)
+            self.assertTrue(error.Success(),
+                            "%s(error, %s) did not succeed: %s" % (func.__name__,
+                                                                   arg,
+                                                                   stream.GetData()))
+        self.assertTrue(expected == result, "%s(error, %s) == %s != %s" % (func.__name__, arg, result, expected))
+          
     def data_api(self):
         """Test the SBData APIs."""
         self.runCmd("file a.out", CURRENT_EXECUTABLE_SET)
@@ -68,35 +81,40 @@ class SBDataAPICase(TestBase):
         offset = 0
         error = lldb.SBError()
 
-        self.assertTrue(data.GetUnsignedInt32(error, offset) == 1, 'foo[0].a == 1')
+        self.assert_data(data.GetUnsignedInt32, offset, 1)
         offset += 4
         low = data.GetSignedInt16(error, offset)
+        self.assertTrue(error.Success())
         offset += 2
         high = data.GetSignedInt16(error, offset)
+        self.assertTrue(error.Success())
         offset += 2
         self.assertTrue ((low == 9 and high == 0) or (low == 0 and high == 9), 'foo[0].b == 9')
         self.assertTrue( fabs(data.GetFloat(error, offset) - 3.14) < 1, 'foo[0].c == 3.14')
+        self.assertTrue(error.Success())
         offset += 4
-        self.assertTrue(data.GetUnsignedInt32(error, offset) == 8, 'foo[1].a == 8')
+        self.assert_data(data.GetUnsignedInt32, offset, 8)
         offset += 4
-        self.assertTrue(data.GetUnsignedInt32(error, offset) == 5, 'foo[1].b == 5')
+        self.assert_data(data.GetUnsignedInt32, offset, 5)
         offset += 4
 
         self.runCmd("n")
 
         offset = 16
 
-        self.assertTrue(data.GetUnsignedInt32(error, offset) == 5, 'saved foo[1].b == 5')
+        self.assert_data(data.GetUnsignedInt32, offset, 5)
 
         data = foobar.GetPointeeData(1, 1)
 
         offset = 0
 
-        self.assertTrue(data.GetSignedInt32(error, offset) == 8, 'new foo[1].a == 8')
+        self.assert_data(data.GetSignedInt32, offset, 8)
         offset += 4
-        self.assertTrue(data.GetSignedInt32(error, offset) == 7, 'new foo[1].a == 7')
+        self.assert_data(data.GetSignedInt32, offset, 7)
         offset += 8
         self.assertTrue(data.GetUnsignedInt32(error, offset) == 0, 'do not read beyond end')
+        self.assertTrue(not error.Success())
+        error.Clear() # clear the error for the next test
 
         star_foobar = foobar.Dereference()
         self.assertTrue(star_foobar.IsValid())
@@ -107,9 +125,9 @@ class SBDataAPICase(TestBase):
             print data
         
         offset = 0
-        self.assertTrue(data.GetUnsignedInt32(error, offset) == 1, 'foo[0].a == 1')
+        self.assert_data(data.GetUnsignedInt32, offset, 1)
         offset += 4
-        self.assertTrue(data.GetUnsignedInt32(error, offset) == 9, 'foo[0].b == 9')
+        self.assert_data(data.GetUnsignedInt32, offset, 9)
 
         foobar_addr = star_foobar.GetLoadAddress()
         foobar_addr += 12
@@ -136,11 +154,12 @@ class SBDataAPICase(TestBase):
         self.runCmd("n")
 
         offset = 0
-        self.assertTrue(data.GetUnsignedInt32(error, offset) == 8, 'then foo[1].a == 8')
+        self.assert_data(data.GetUnsignedInt32, offset, 8)
         offset += 4
-        self.assertTrue(data.GetUnsignedInt32(error, offset) == 7, 'then foo[1].b == 7')
+        self.assert_data(data.GetUnsignedInt32, offset, 7)
         offset += 4
         self.assertTrue(fabs(data.GetFloat(error, offset) - 3.14) < 1, 'foo[1].c == 3.14')
+        self.assertTrue(error.Success())
 
         data = new_foobar.GetData()
 
@@ -148,11 +167,12 @@ class SBDataAPICase(TestBase):
             print data
 
         offset = 0
-        self.assertTrue(data.GetUnsignedInt32(error, offset) == 8, 'finally foo[1].a == 8')
+        self.assert_data(data.GetUnsignedInt32, offset, 8)
         offset += 4
-        self.assertTrue(data.GetUnsignedInt32(error, offset) == 7, 'finally foo[1].b == 7')
+        self.assert_data(data.GetUnsignedInt32, offset, 7)
         offset += 4
         self.assertTrue(fabs(data.GetFloat(error, offset) - 6.28) < 1, 'foo[1].c == 6.28')
+        self.assertTrue(error.Success())
 
         self.runCmd("n")
 
@@ -167,17 +187,19 @@ class SBDataAPICase(TestBase):
             print data
 
         offset = 0
-        self.assertTrue(data.GetUnsignedInt32(error, offset) == 1, 'barfoo[0].a = 1')
+        self.assert_data(data.GetUnsignedInt32, offset, 1)
         offset += 4
-        self.assertTrue(data.GetUnsignedInt32(error, offset) == 2, 'barfoo[0].b == 2')
+        self.assert_data(data.GetUnsignedInt32, offset, 2)
         offset += 4
         self.assertTrue(fabs(data.GetFloat(error, offset) - 3) < 1, 'barfoo[0].c == 3')
+        self.assertTrue(error.Success())
         offset += 4
-        self.assertTrue(data.GetUnsignedInt32(error, offset) == 4, 'barfoo[1].a = 4')
+        self.assert_data(data.GetUnsignedInt32, offset, 4)
         offset += 4
-        self.assertTrue(data.GetUnsignedInt32(error, offset) == 5, 'barfoo[1].b == 5')
+        self.assert_data(data.GetUnsignedInt32, offset, 5)
         offset += 4
         self.assertTrue(fabs(data.GetFloat(error, offset) - 6) < 1, 'barfoo[1].c == 6')
+        self.assertTrue(error.Success())
 
         new_object = barfoo.CreateValueFromData("new_object",data,barfoo.GetType().GetBasicType(lldb.eBasicTypeInt))
 
@@ -191,9 +213,11 @@ class SBDataAPICase(TestBase):
         self.assertTrue(new_object.GetValue() == "1", 'new_object == 1')
 
         data.SetData(error, 'A\0\0\0', data.GetByteOrder(), data.GetAddressByteSize())
+        self.assertTrue(error.Success())
         
         data2 = lldb.SBData()
         data2.SetData(error, 'BCD', data.GetByteOrder(), data.GetAddressByteSize())
+        self.assertTrue(error.Success())
 
         data.Append(data2)
         
@@ -202,33 +226,34 @@ class SBDataAPICase(TestBase):
 
         # this breaks on EBCDIC
         offset = 0
-        self.assertTrue(data.GetUnsignedInt32(error, offset) == 65, 'made-up data == 65')
+        self.assert_data(data.GetUnsignedInt32, offset, 65)
         offset += 4
-        self.assertTrue(data.GetUnsignedInt8(error, offset) == 66, 'made-up data == 66')
+        self.assert_data(data.GetUnsignedInt8, offset, 66)
         offset += 1
-        self.assertTrue(data.GetUnsignedInt8(error, offset) == 67, 'made-up data == 67')
+        self.assert_data(data.GetUnsignedInt8, offset, 67)
         offset += 1
-        self.assertTrue(data.GetUnsignedInt8(error, offset) == 68, 'made-up data == 68')
+        self.assert_data(data.GetUnsignedInt8, offset, 68)
         offset += 1
 
         # check the new API calls introduced per LLVM bugzilla enhancement request
         # 11619 (Allow creating SBData values from arrays or primitives in Python)
 
-        data2 = lldb.SBData.CreateDataFromCString(process.GetByteOrder(),process.GetAddressByteSize(),'hello!')
+        hello_str = "hello!"
+        data2 = lldb.SBData.CreateDataFromCString(process.GetByteOrder(),process.GetAddressByteSize(),hello_str)
+        self.assertTrue(len(data2.uint8) == len(hello_str))
         self.assertTrue(data2.uint8[0] == 104, 'h == 104')
         self.assertTrue(data2.uint8[1] == 101, 'e == 101')
         self.assertTrue(data2.uint8[2] == 108, 'l == 108')
-        self.assertTrue(data2.GetUnsignedInt8(error,3) == 108, 'l == 108')
+        self.assert_data(data2.GetUnsignedInt8, 3, 108) # l
         self.assertTrue(data2.uint8[4] == 111, 'o == 111')
-        self.assertTrue(data2.GetUnsignedInt8(error,5) == 33, '! == 33')
-        self.assertTrue(data2.uint8[6] == 0, 'binary 0 terminator')
+        self.assert_data(data2.GetUnsignedInt8, 5, 33) # !
         
         data2 = lldb.SBData.CreateDataFromUInt64Array(process.GetByteOrder(),process.GetAddressByteSize(),[1,2,3,4,5])
-        self.assertTrue(data2.GetUnsignedInt64(error,0) == 1, 'data2[0] = 1')
-        self.assertTrue(data2.GetUnsignedInt64(error,8) == 2, 'data2[1] = 2')
-        self.assertTrue(data2.GetUnsignedInt64(error,16) == 3, 'data2[2] = 3')
-        self.assertTrue(data2.GetUnsignedInt64(error,24) == 4, 'data2[3] = 4')
-        self.assertTrue(data2.GetUnsignedInt64(error,32) == 5, 'data2[4] = 5')
+        self.assert_data(data2.GetUnsignedInt64, 0, 1)
+        self.assert_data(data2.GetUnsignedInt64, 8, 2)
+        self.assert_data(data2.GetUnsignedInt64, 16, 3)
+        self.assert_data(data2.GetUnsignedInt64, 24, 4)
+        self.assert_data(data2.GetUnsignedInt64, 32, 5)
         
         self.assertTrue(data2.uint64s == [1,2,3,4,5], 'read_data_helper failure: data2 == [1,2,3,4,5]')
 
@@ -236,39 +261,42 @@ class SBDataAPICase(TestBase):
         self.assertTrue(data2.sint32[0:2] == [2,-2], 'signed32 data2 = [2,-2]')
         
         data2.Append(lldb.SBData.CreateDataFromSInt64Array(process.GetByteOrder(),process.GetAddressByteSize(),[2, -2]))
-        self.assertTrue(data2.GetSignedInt32(error,0) == 2, 'signed32 data2[0] = 2')
-        self.assertTrue(data2.GetSignedInt32(error,4) == -2, 'signed32 data2[1] = -2')
+        self.assert_data(data2.GetSignedInt32, 0, 2)
+        self.assert_data(data2.GetSignedInt32, 4, -2)
         self.assertTrue(data2.sint64[1:3] == [2,-2], 'signed64 data2 = [2,-2]')
         
         data2 = lldb.SBData.CreateDataFromUInt32Array(process.GetByteOrder(),process.GetAddressByteSize(),[1,2,3,4,5])
-        self.assertTrue(data2.GetUnsignedInt32(error,0) == 1, '32-bit data2[0] = 1')
-        self.assertTrue(data2.GetUnsignedInt32(error,4) == 2, '32-bit data2[1] = 2')
-        self.assertTrue(data2.GetUnsignedInt32(error,8) == 3, '32-bit data2[2] = 3')
-        self.assertTrue(data2.GetUnsignedInt32(error,12) == 4, '32-bit data2[3] = 4')
-        self.assertTrue(data2.GetUnsignedInt32(error,16) == 5, '32-bit data2[4] = 5')
+        self.assert_data(data2.GetUnsignedInt32,0, 1)
+        self.assert_data(data2.GetUnsignedInt32,4, 2)
+        self.assert_data(data2.GetUnsignedInt32,8, 3)
+        self.assert_data(data2.GetUnsignedInt32,12, 4)
+        self.assert_data(data2.GetUnsignedInt32,16, 5)
         
         data2 = lldb.SBData.CreateDataFromDoubleArray(process.GetByteOrder(),process.GetAddressByteSize(),[3.14,6.28,2.71])
         self.assertTrue( fabs(data2.GetDouble(error,0) - 3.14) < 0.5, 'double data2[0] = 3.14')
+        self.assertTrue(error.Success())
         self.assertTrue( fabs(data2.GetDouble(error,8) - 6.28) < 0.5, 'double data2[1] = 6.28')
+        self.assertTrue(error.Success())
         self.assertTrue( fabs(data2.GetDouble(error,16) - 2.71) < 0.5, 'double data2[2] = 2.71')
+        self.assertTrue(error.Success())
 
         data2 = lldb.SBData()
 
-        data2.SetDataFromCString('hello!')
-        self.assertTrue(data2.GetUnsignedInt8(error,0) == 104, 'set h == 104')
-        self.assertTrue(data2.GetUnsignedInt8(error,1) == 101, 'set e == 101')
-        self.assertTrue(data2.GetUnsignedInt8(error,2) == 108, 'set l == 108')
-        self.assertTrue(data2.GetUnsignedInt8(error,3) == 108, 'set l == 108')
-        self.assertTrue(data2.GetUnsignedInt8(error,4) == 111, 'set o == 111')
-        self.assertTrue(data2.GetUnsignedInt8(error,5) == 33, 'set ! == 33')
-        self.assertTrue(data2.GetUnsignedInt8(error,6) == 0, 'set binary 0 terminator')
+        data2.SetDataFromCString(hello_str)
+        self.assertTrue(len(data2.uint8) == len(hello_str))
+        self.assert_data(data2.GetUnsignedInt8, 0, 104)
+        self.assert_data(data2.GetUnsignedInt8, 1, 101)
+        self.assert_data(data2.GetUnsignedInt8, 2, 108)
+        self.assert_data(data2.GetUnsignedInt8, 3, 108)
+        self.assert_data(data2.GetUnsignedInt8, 4, 111)
+        self.assert_data(data2.GetUnsignedInt8, 5, 33)
 
         data2.SetDataFromUInt64Array([1,2,3,4,5])
-        self.assertTrue(data2.GetUnsignedInt64(error,0) == 1, 'set data2[0] = 1')
-        self.assertTrue(data2.GetUnsignedInt64(error,8) == 2, 'set data2[1] = 2')
-        self.assertTrue(data2.GetUnsignedInt64(error,16) == 3, 'set data2[2] = 3')
-        self.assertTrue(data2.GetUnsignedInt64(error,24) == 4, 'set data2[3] = 4')
-        self.assertTrue(data2.GetUnsignedInt64(error,32) == 5, 'set data2[4] = 5')
+        self.assert_data(data2.GetUnsignedInt64, 0, 1)
+        self.assert_data(data2.GetUnsignedInt64, 8,  2)
+        self.assert_data(data2.GetUnsignedInt64, 16, 3)
+        self.assert_data(data2.GetUnsignedInt64, 24, 4)
+        self.assert_data(data2.GetUnsignedInt64, 32, 5)
 
         self.assertTrue(data2.uint64[0] == 1, 'read_data_helper failure: set data2[0] = 1')
         self.assertTrue(data2.uint64[1] == 2, 'read_data_helper failure: set data2[1] = 2')
@@ -279,19 +307,19 @@ class SBDataAPICase(TestBase):
         self.assertTrue(data2.uint64[0:2] == [1,2], 'read_data_helper failure: set data2[0:2] = [1,2]')
 
         data2.SetDataFromSInt32Array([2, -2])
-        self.assertTrue(data2.GetSignedInt32(error,0) == 2, 'set signed32 data2[0] = 2')
-        self.assertTrue(data2.GetSignedInt32(error,4) == -2, 'set signed32 data2[1] = -2')
+        self.assert_data(data2.GetSignedInt32, 0, 2)
+        self.assert_data(data2.GetSignedInt32, 4, -2)
         
         data2.SetDataFromSInt64Array([2, -2])
-        self.assertTrue(data2.GetSignedInt32(error,0) == 2, 'set signed64 data2[0] = 2')
-        self.assertTrue(data2.GetSignedInt32(error,8) == -2, 'set signed64 data2[1] = -2')
+        self.assert_data(data2.GetSignedInt32, 0, 2)
+        self.assert_data(data2.GetSignedInt32, 8, -2)
         
         data2.SetDataFromUInt32Array([1,2,3,4,5])
-        self.assertTrue(data2.GetUnsignedInt32(error,0) == 1, 'set 32-bit data2[0] = 1')
-        self.assertTrue(data2.GetUnsignedInt32(error,4) == 2, 'set 32-bit data2[1] = 2')
-        self.assertTrue(data2.GetUnsignedInt32(error,8) == 3, 'set 32-bit data2[2] = 3')
-        self.assertTrue(data2.GetUnsignedInt32(error,12) == 4, 'set 32-bit data2[3] = 4')
-        self.assertTrue(data2.GetUnsignedInt32(error,16) == 5, 'set 32-bit data2[4] = 5')
+        self.assert_data(data2.GetUnsignedInt32, 0, 1)
+        self.assert_data(data2.GetUnsignedInt32, 4, 2)
+        self.assert_data(data2.GetUnsignedInt32, 8, 3)
+        self.assert_data(data2.GetUnsignedInt32, 12, 4)
+        self.assert_data(data2.GetUnsignedInt32, 16, 5)
         
         self.assertTrue(data2.uint32[0] == 1, 'read_data_helper failure: set 32-bit data2[0] = 1')
         self.assertTrue(data2.uint32[1] == 2, 'read_data_helper failure: set 32-bit data2[1] = 2')

Modified: lldb/branches/windows/test/python_api/symbol-context/TestSymbolContext.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/test/python_api/symbol-context/TestSymbolContext.py?rev=179679&r1=179678&r2=179679&view=diff
==============================================================================
--- lldb/branches/windows/test/python_api/symbol-context/TestSymbolContext.py (original)
+++ lldb/branches/windows/test/python_api/symbol-context/TestSymbolContext.py Wed Apr 17 03:38:48 2013
@@ -55,7 +55,7 @@ class SymbolContextAPITestCase(TestBase)
         # Frame #0 should be on self.line.
         from lldbutil import get_stopped_thread
         thread = get_stopped_thread(process, lldb.eStopReasonBreakpoint)
-        self.assertTrue(thread != None, "There should be a thread stopped due to breakpoint")
+        self.assertTrue(thread.IsValid(), "There should be a thread stopped due to breakpoint")
         frame0 = thread.GetFrameAtIndex(0)
         self.assertTrue(frame0.GetLineEntry().GetLine() == self.line)
 

Modified: lldb/branches/windows/test/python_api/target/TestTargetAPI.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/test/python_api/target/TestTargetAPI.py?rev=179679&r1=179678&r2=179679&view=diff
==============================================================================
--- lldb/branches/windows/test/python_api/target/TestTargetAPI.py (original)
+++ lldb/branches/windows/test/python_api/target/TestTargetAPI.py Wed Apr 17 03:38:48 2013
@@ -262,7 +262,7 @@ class TargetAPITestCase(TestBase):
         # Frame #0 should be on self.line1.
         self.assertTrue(process.GetState() == lldb.eStateStopped)
         thread = lldbutil.get_stopped_thread(process, lldb.eStopReasonBreakpoint)
-        self.assertTrue(thread != None, "There should be a thread stopped due to breakpoint condition")
+        self.assertTrue(thread.IsValid(), "There should be a thread stopped due to breakpoint condition")
         #self.runCmd("process status")
         frame0 = thread.GetFrameAtIndex(0)
         lineEntry = frame0.GetLineEntry()
@@ -274,7 +274,7 @@ class TargetAPITestCase(TestBase):
         process.Continue()
         self.assertTrue(process.GetState() == lldb.eStateStopped)
         thread = lldbutil.get_stopped_thread(process, lldb.eStopReasonBreakpoint)
-        self.assertTrue(thread != None, "There should be a thread stopped due to breakpoint condition")
+        self.assertTrue(thread.IsValid(), "There should be a thread stopped due to breakpoint condition")
         #self.runCmd("process status")
         frame0 = thread.GetFrameAtIndex(0)
         lineEntry = frame0.GetLineEntry()

Modified: lldb/branches/windows/test/python_api/thread/TestThreadAPI.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/test/python_api/thread/TestThreadAPI.py?rev=179679&r1=179678&r2=179679&view=diff
==============================================================================
--- lldb/branches/windows/test/python_api/thread/TestThreadAPI.py (original)
+++ lldb/branches/windows/test/python_api/thread/TestThreadAPI.py Wed Apr 17 03:38:48 2013
@@ -133,7 +133,7 @@ class ThreadAPITestCase(TestBase):
         process = target.LaunchSimple(None, None, os.getcwd())
 
         thread = get_stopped_thread(process, lldb.eStopReasonBreakpoint)
-        self.assertTrue(thread != None, "There should be a thread stopped due to breakpoint")
+        self.assertTrue(thread.IsValid(), "There should be a thread stopped due to breakpoint")
         self.runCmd("process status")
 
         proc_of_thread = thread.GetProcess()
@@ -155,7 +155,7 @@ class ThreadAPITestCase(TestBase):
         process = target.LaunchSimple(None, None, os.getcwd())
 
         thread = get_stopped_thread(process, lldb.eStopReasonBreakpoint)
-        self.assertTrue(thread != None, "There should be a thread stopped due to breakpoint")
+        self.assertTrue(thread.IsValid(), "There should be a thread stopped due to breakpoint")
         #self.runCmd("process status")
 
         # Due to the typemap magic (see lldb.swig), we pass in an (int)length to GetStopDescription
@@ -181,7 +181,7 @@ class ThreadAPITestCase(TestBase):
 
         while True:
             thread = get_stopped_thread(process, lldb.eStopReasonBreakpoint)
-            self.assertTrue(thread != None, "There should be a thread stopped due to breakpoint")
+            self.assertTrue(thread.IsValid(), "There should be a thread stopped due to breakpoint")
             caller_symbol = get_caller_symbol(thread)
             #print "caller symbol of malloc:", caller_symbol
             if not caller_symbol:
@@ -217,7 +217,7 @@ class ThreadAPITestCase(TestBase):
         # Frame #0 should be on self.step_out_of_malloc.
         self.assertTrue(process.GetState() == lldb.eStateStopped)
         thread = get_stopped_thread(process, lldb.eStopReasonBreakpoint)
-        self.assertTrue(thread != None, "There should be a thread stopped due to breakpoint condition")
+        self.assertTrue(thread.IsValid(), "There should be a thread stopped due to breakpoint condition")
         self.runCmd("thread backtrace")
         frame0 = thread.GetFrameAtIndex(0)
         lineEntry = frame0.GetLineEntry()
@@ -258,7 +258,7 @@ class ThreadAPITestCase(TestBase):
         # Frame #0 should be on self.step_out_of_malloc.
         self.assertTrue(process.GetState() == lldb.eStateStopped)
         thread = get_stopped_thread(process, lldb.eStopReasonBreakpoint)
-        self.assertTrue(thread != None, "There should be a thread stopped due to breakpoint condition")
+        self.assertTrue(thread.IsValid(), "There should be a thread stopped due to breakpoint condition")
         self.runCmd("thread backtrace")
         frame0 = thread.GetFrameAtIndex(0)
         lineEntry = frame0.GetLineEntry()

Modified: lldb/branches/windows/test/python_api/type/TestTypeList.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/test/python_api/type/TestTypeList.py?rev=179679&r1=179678&r2=179679&view=diff
==============================================================================
--- lldb/branches/windows/test/python_api/type/TestTypeList.py (original)
+++ lldb/branches/windows/test/python_api/type/TestTypeList.py Wed Apr 17 03:38:48 2013
@@ -59,7 +59,7 @@ class TypeAndTypeListTestCase(TestBase):
         # Get Frame #0.
         self.assertTrue(process.GetState() == lldb.eStateStopped)
         thread = lldbutil.get_stopped_thread(process, lldb.eStopReasonBreakpoint)
-        self.assertTrue(thread != None, "There should be a thread stopped due to breakpoint condition")
+        self.assertTrue(thread.IsValid(), "There should be a thread stopped due to breakpoint condition")
         frame0 = thread.GetFrameAtIndex(0)
 
         # Get the type 'Task'.

Modified: lldb/branches/windows/test/python_api/value/TestValueAPI.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/test/python_api/value/TestValueAPI.py?rev=179679&r1=179678&r2=179679&view=diff
==============================================================================
--- lldb/branches/windows/test/python_api/value/TestValueAPI.py (original)
+++ lldb/branches/windows/test/python_api/value/TestValueAPI.py Wed Apr 17 03:38:48 2013
@@ -58,7 +58,7 @@ class ValueAPITestCase(TestBase):
         # Get Frame #0.
         self.assertTrue(process.GetState() == lldb.eStateStopped)
         thread = lldbutil.get_stopped_thread(process, lldb.eStopReasonBreakpoint)
-        self.assertTrue(thread != None, "There should be a thread stopped due to breakpoint condition")
+        self.assertTrue(thread.IsValid(), "There should be a thread stopped due to breakpoint condition")
         frame0 = thread.GetFrameAtIndex(0)
 
         # Get global variable 'days_of_week'.

Modified: lldb/branches/windows/test/python_api/value/change_values/TestChangeValueAPI.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/test/python_api/value/change_values/TestChangeValueAPI.py?rev=179679&r1=179678&r2=179679&view=diff
==============================================================================
--- lldb/branches/windows/test/python_api/value/change_values/TestChangeValueAPI.py (original)
+++ lldb/branches/windows/test/python_api/value/change_values/TestChangeValueAPI.py Wed Apr 17 03:38:48 2013
@@ -38,8 +38,10 @@ class ChangeValueAPITestCase(TestBase):
         self.exe_name = self.testMethodName
         # Find the line number to of function 'c'.
         self.line = line_number('main.c', '// Stop here and set values')
+        self.check_line = line_number('main.c', '// Stop here and check values')
         self.end_line = line_number ('main.c', '// Set a breakpoint here at the end')
 
+    @expectedFailureGcc # PR-15039: If GCC is the test compiler, stdout is not available via lldb.SBProcess.GetSTDOUT()
     def change_value_api(self, exe_name):
         """Exercise some SBValue APIs."""
         exe = os.path.join(os.getcwd(), exe_name)
@@ -52,6 +54,10 @@ class ChangeValueAPITestCase(TestBase):
         breakpoint = target.BreakpointCreateByLocation('main.c', self.line)
         self.assertTrue(breakpoint, VALID_BREAKPOINT)
 
+        # Create the breakpoint inside the function 'main'
+        check_breakpoint = target.BreakpointCreateByLocation('main.c', self.check_line)
+        self.assertTrue(check_breakpoint, VALID_BREAKPOINT)
+
         # Create the breakpoint inside function 'main'.
         end_breakpoint = target.BreakpointCreateByLocation('main.c', self.end_line)
         self.assertTrue(end_breakpoint, VALID_BREAKPOINT)
@@ -63,7 +69,7 @@ class ChangeValueAPITestCase(TestBase):
         # Get Frame #0.
         self.assertTrue(process.GetState() == lldb.eStateStopped)
         thread = lldbutil.get_stopped_thread(process, lldb.eStopReasonBreakpoint)
-        self.assertTrue(thread != None, "There should be a thread stopped due to breakpoint condition")
+        self.assertTrue(thread.IsValid(), "There should be a thread stopped due to breakpoint condition")
         frame0 = thread.GetFrameAtIndex(0)
         self.assertTrue (frame0.IsValid(), "Got a valid frame.")
 
@@ -115,8 +121,16 @@ class ChangeValueAPITestCase(TestBase):
         self.assertTrue (error.Success(), "Got a changed value from ptr->second_val")
         self.assertTrue (actual_value == 98765, "Got the right changed value from ptr->second_val")
         
-        # Now step, grab the stdout and make sure we changed the real values as well...
-        thread.StepOver()
+        # gcc may set multiple locations for breakpoint
+        breakpoint.SetEnabled(False)
+
+        # Now continue, grab the stdout and make sure we changed the real values as well...
+        process.Continue();
+
+        self.assertTrue(process.GetState() == lldb.eStateStopped)
+        thread = lldbutil.get_stopped_thread(process, lldb.eStopReasonBreakpoint)
+        self.assertTrue(thread.IsValid(), "There should be a thread stopped due to breakpoint condition")
+
         expected_value = "Val - 12345 Mine - 55, 98765, 55555555. Ptr - 66, 98765, 66666666"
         stdout = process.GetSTDOUT(1000)
         self.assertTrue (expected_value in stdout, "STDOUT showed changed values.")

Modified: lldb/branches/windows/test/python_api/value/change_values/main.c
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/test/python_api/value/change_values/main.c?rev=179679&r1=179678&r2=179679&view=diff
==============================================================================
--- lldb/branches/windows/test/python_api/value/change_values/main.c (original)
+++ lldb/branches/windows/test/python_api/value/change_values/main.c Wed Apr 17 03:38:48 2013
@@ -24,6 +24,7 @@ int main ()
           mine.first_val, mine.second_val, mine.third_val,
           ptr->first_val, ptr->second_val, ptr->third_val); 
 
+  // Stop here and check values
   printf ("This is just another call which we won't make it over %d.", val);
   return 0; // Set a breakpoint here at the end
 }

Modified: lldb/branches/windows/test/python_api/value/linked_list/TestValueAPILinkedList.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/test/python_api/value/linked_list/TestValueAPILinkedList.py?rev=179679&r1=179678&r2=179679&view=diff
==============================================================================
--- lldb/branches/windows/test/python_api/value/linked_list/TestValueAPILinkedList.py (original)
+++ lldb/branches/windows/test/python_api/value/linked_list/TestValueAPILinkedList.py Wed Apr 17 03:38:48 2013
@@ -59,7 +59,7 @@ class ValueAsLinkedListTestCase(TestBase
         # Get Frame #0.
         self.assertTrue(process.GetState() == lldb.eStateStopped)
         thread = lldbutil.get_stopped_thread(process, lldb.eStopReasonBreakpoint)
-        self.assertTrue(thread != None, "There should be a thread stopped due to breakpoint condition")
+        self.assertTrue(thread.IsValid(), "There should be a thread stopped due to breakpoint condition")
         frame0 = thread.GetFrameAtIndex(0)
 
         # Get variable 'task_head'.

Modified: lldb/branches/windows/test/python_api/watchpoint/watchlocation/Makefile
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/test/python_api/watchpoint/watchlocation/Makefile?rev=179679&r1=179678&r2=179679&view=diff
==============================================================================
--- lldb/branches/windows/test/python_api/watchpoint/watchlocation/Makefile (original)
+++ lldb/branches/windows/test/python_api/watchpoint/watchlocation/Makefile Wed Apr 17 03:38:48 2013
@@ -1,6 +1,6 @@
 LEVEL = ../../../make
 
-LDFLAGS := -lpthread
+LD_EXTRAS := -lpthread
 CXX_SOURCES := main.cpp
 
 include $(LEVEL)/Makefile.rules

Modified: lldb/branches/windows/test/settings/TestSettings.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/test/settings/TestSettings.py?rev=179679&r1=179678&r2=179679&view=diff
==============================================================================
--- lldb/branches/windows/test/settings/TestSettings.py (original)
+++ lldb/branches/windows/test/settings/TestSettings.py Wed Apr 17 03:38:48 2013
@@ -81,15 +81,15 @@ class SettingsCommandTestCase(TestBase):
         """Test that 'set prompt' actually changes the prompt."""
 
         # Set prompt to 'lldb2'.
-        self.runCmd("settings set prompt lldb2")
+        self.runCmd("settings set prompt 'lldb2 '")
 
         # Immediately test the setting.
         self.expect("settings show prompt", SETTING_MSG("prompt"),
-            startstr = 'prompt (string) = "lldb2"')
+            startstr = 'prompt (string) = "lldb2 "')
 
         # The overall display should also reflect the new setting.
         self.expect("settings show", SETTING_MSG("prompt"),
-            substrs = ['prompt (string) = "lldb2"'])
+            substrs = ['prompt (string) = "lldb2 "'])
 
         # Use '-r' option to reset to the original default prompt.
         self.runCmd("settings clear prompt")
@@ -307,7 +307,57 @@ class SettingsCommandTestCase(TestBase):
                      substrs = [ 'MY_FILE=this is a file name with spaces.txt' ])
         self.runCmd ("settings clear target.env-vars")
 
-
+    def test_settings_with_trailing_whitespace (self):
+        
+        # boolean
+        self.runCmd ("settings set target.skip-prologue true")      # Set to known value
+        self.runCmd ("settings set target.skip-prologue false ")    # Set to new value with trailing whitespace
+        # Make sure the setting was correctly set to "false"
+        self.expect ("settings show target.skip-prologue", SETTING_MSG("target.skip-prologue"),
+            startstr = "target.skip-prologue (boolean) = false")
+        self.runCmd("settings clear target.skip-prologue", check=False)
+        # integer
+        self.runCmd ("settings set term-width 70")      # Set to known value
+        self.runCmd ("settings set term-width 60 \t")   # Set to new value with trailing whitespaces
+        self.expect ("settings show term-width", SETTING_MSG("term-width"),
+            startstr = "term-width (int) = 60")
+        self.runCmd("settings clear term-width", check=False)
+        # string
+        self.runCmd ("settings set target.arg0 abc")    # Set to known value
+        self.runCmd ("settings set target.arg0 cde\t ") # Set to new value with trailing whitespaces
+        self.expect ("settings show target.arg0", SETTING_MSG("target.arg0"),
+            startstr = 'target.arg0 (string) = "cde"')
+        self.runCmd("settings clear target.arg0", check=False)
+        # file
+        self.runCmd ("settings set target.output-path /bin/ls")   # Set to known value
+        self.runCmd ("settings set target.output-path /bin/cat ") # Set to new value with trailing whitespaces
+        self.expect ("settings show target.output-path", SETTING_MSG("target.output-path"),
+            startstr = 'target.output-path (file) = "/bin/cat"')
+        self.runCmd("settings clear target.output-path", check=False)
+        # enum
+        self.runCmd ("settings set stop-disassembly-display never")   # Set to known value
+        self.runCmd ("settings set stop-disassembly-display always ") # Set to new value with trailing whitespaces
+        self.expect ("settings show stop-disassembly-display", SETTING_MSG("stop-disassembly-display"),
+            startstr = 'stop-disassembly-display (enum) = always')
+        self.runCmd("settings clear stop-disassembly-display", check=False)        
+        # arguments
+        self.runCmd ("settings set target.run-args 1 2 3")  # Set to known value
+        self.runCmd ("settings set target.run-args 3 4 5 ") # Set to new value with trailing whitespaces
+        self.expect ("settings show target.run-args", SETTING_MSG("target.run-args"),
+            substrs = [ 'target.run-args (arguments) =', 
+                        '[0]: "3"', 
+                        '[1]: "4"',
+                        '[2]: "5"' ])
+        self.runCmd("settings clear target.run-args", check=False)        
+        # dictionaries
+        self.runCmd ("settings clear target.env-vars")  # Set to known value
+        self.runCmd ("settings set target.env-vars A=B C=D\t ") # Set to new value with trailing whitespaces
+        self.expect ("settings show target.env-vars", SETTING_MSG("target.env-vars"),
+            substrs = [ 'target.env-vars (dictionary of strings) =', 
+                        'A=B', 
+                        'C=D'])
+        self.runCmd("settings clear target.env-vars", check=False)        
+        
     def test_all_settings_exist (self):
         self.expect ("settings show",
                      substrs = [ "auto-confirm",

Modified: lldb/branches/windows/test/source-manager/TestSourceManager.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/test/source-manager/TestSourceManager.py?rev=179679&r1=179678&r2=179679&view=diff
==============================================================================
--- lldb/branches/windows/test/source-manager/TestSourceManager.py (original)
+++ lldb/branches/windows/test/source-manager/TestSourceManager.py Wed Apr 17 03:38:48 2013
@@ -105,7 +105,7 @@ class SourceManagerTestCase(TestBase):
             substrs = [os.getcwd(), os.path.join(os.getcwd(), "hidden")])
 
         # Display main() and verify that the source mapping has been kicked in.
-        self.expect("list -n main", SOURCE_DISPLAYED_CORRECTLY,
+        self.expect("source list -n main", SOURCE_DISPLAYED_CORRECTLY,
             substrs = ['Hello world'])
 
     def modify_source_file_while_debugging(self):
@@ -124,14 +124,14 @@ class SourceManagerTestCase(TestBase):
                        'stop reason = breakpoint'])
 
         # Display some source code.
-        self.expect("list -f main.c -l %d" % self.line, SOURCE_DISPLAYED_CORRECTLY,
+        self.expect("source list -f main.c -l %d" % self.line, SOURCE_DISPLAYED_CORRECTLY,
             substrs = ['Hello world'])
 
         # The '-b' option shows the line table locations from the debug information
         # that indicates valid places to set source level breakpoints.
 
         # The file to display is implicit in this case.
-        self.runCmd("list -l %d -c 3 -b" % self.line)
+        self.runCmd("source list -l %d -c 3 -b" % self.line)
         output = self.res.GetOutput().splitlines()[0]
 
         # If the breakpoint set command succeeded, we should expect a positive number
@@ -178,7 +178,7 @@ class SourceManagerTestCase(TestBase):
             self.addTearDownHook(restore_file)
 
         # Display the source code again.  We should see the updated line.
-        self.expect("list -f main.c -l %d" % self.line, SOURCE_DISPLAYED_CORRECTLY,
+        self.expect("source list -f main.c -l %d" % self.line, SOURCE_DISPLAYED_CORRECTLY,
             substrs = ['Hello lldb'])
 
 

Modified: lldb/branches/windows/test/unittest2/case.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/test/unittest2/case.py?rev=179679&r1=179678&r2=179679&view=diff
==============================================================================
--- lldb/branches/windows/test/unittest2/case.py (original)
+++ lldb/branches/windows/test/unittest2/case.py Wed Apr 17 03:38:48 2013
@@ -36,16 +36,23 @@ class _ExpectedFailure(Exception):
     This is an implementation detail.
     """
 
-    def __init__(self, exc_info):
+    def __init__(self, exc_info, bugnumber=None):
         # can't use super because Python 2.4 exceptions are old style
         Exception.__init__(self)
         self.exc_info = exc_info
+        self.bugnumber = bugnumber
 
 class _UnexpectedSuccess(Exception):
     """
     The test was supposed to fail, but it didn't!
     """
 
+    def __init__(self, exc_info, bugnumber=None):
+        # can't use super because Python 2.4 exceptions are old style
+        Exception.__init__(self)
+        self.exc_info = exc_info
+        self.bugnumber = bugnumber
+
 def _id(obj):
     return obj
 
@@ -81,17 +88,27 @@ def skipUnless(condition, reason):
         return skip(reason)
     return _id
 
-
-def expectedFailure(func):
-    @wraps(func)
-    def wrapper(*args, **kwargs):
-        try:
-            func(*args, **kwargs)
-        except Exception:
-            raise _ExpectedFailure(sys.exc_info())
-        raise _UnexpectedSuccess
-    return wrapper
-
+def expectedFailure(bugnumber=None):
+     if callable(bugnumber):
+        @wraps(bugnumber)
+        def expectedFailure_easy_wrapper(*args, **kwargs):
+             try:
+                bugnumber(*args, **kwargs)
+             except Exception:
+                raise _ExpectedFailure(sys.exc_info(),None)
+             raise _UnexpectedSuccess(sys.exc_info(),None)
+        return expectedFailure_easy_wrapper
+     else:
+        def expectedFailure_impl(func):
+              @wraps(func)
+              def wrapper(*args, **kwargs):
+                   try:
+                      func(*args, **kwargs)
+                   except Exception:
+                      raise _ExpectedFailure(sys.exc_info(),bugnumber)
+                   raise _UnexpectedSuccess(sys.exc_info(),bugnumber)
+              return wrapper
+        return expectedFailure_impl
 
 class _AssertRaisesContext(object):
     """A context manager used to implement TestCase.assertRaises* methods."""
@@ -343,15 +360,15 @@ class TestCase(unittest.TestCase):
                 except _ExpectedFailure, e:
                     addExpectedFailure = getattr(result, 'addExpectedFailure', None)
                     if addExpectedFailure is not None:
-                        addExpectedFailure(self, e.exc_info)
+                        addExpectedFailure(self, e.exc_info, e.bugnumber)
                     else: 
                         warnings.warn("Use of a TestResult without an addExpectedFailure method is deprecated", 
                                       DeprecationWarning)
                         result.addSuccess(self)
-                except _UnexpectedSuccess:
+                except _UnexpectedSuccess, x:
                     addUnexpectedSuccess = getattr(result, 'addUnexpectedSuccess', None)
                     if addUnexpectedSuccess is not None:
-                        addUnexpectedSuccess(self)
+                        addUnexpectedSuccess(self, x.bugnumber)
                     else:
                         warnings.warn("Use of a TestResult without an addUnexpectedSuccess method is deprecated", 
                                       DeprecationWarning)

Modified: lldb/branches/windows/test/unittest2/result.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/test/unittest2/result.py?rev=179679&r1=179678&r2=179679&view=diff
==============================================================================
--- lldb/branches/windows/test/unittest2/result.py (original)
+++ lldb/branches/windows/test/unittest2/result.py Wed Apr 17 03:38:48 2013
@@ -123,13 +123,13 @@ class TestResult(unittest.TestResult):
         """Called when a test is skipped."""
         self.skipped.append((test, reason))
 
-    def addExpectedFailure(self, test, err):
+    def addExpectedFailure(self, test, err, bugnumber):
         """Called when an expected failure/error occured."""
         self.expectedFailures.append(
             (test, self._exc_info_to_string(err, test)))
 
     @failfast
-    def addUnexpectedSuccess(self, test):
+    def addUnexpectedSuccess(self, test, bugnumber):
         """Called when a test was expected to fail, but succeed."""
         self.unexpectedSuccesses.append(test)
 

Modified: lldb/branches/windows/test/unittest2/runner.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/test/unittest2/runner.py?rev=179679&r1=179678&r2=179679&view=diff
==============================================================================
--- lldb/branches/windows/test/unittest2/runner.py (original)
+++ lldb/branches/windows/test/unittest2/runner.py Wed Apr 17 03:38:48 2013
@@ -3,6 +3,7 @@
 import sys
 import time
 import unittest
+import progress
 
 from unittest2 import result
 
@@ -45,6 +46,7 @@ class TextTestResult(result.TestResult):
         self.showAll = verbosity > 1
         self.dots = verbosity == 1
         self.descriptions = descriptions
+        self.progressbar = None
 
     def getDescription(self, test):
         doc_first_line = test.shortDescription()
@@ -60,55 +62,48 @@ class TextTestResult(result.TestResult):
             self.stream.write(" ... ")
             self.stream.flush()
 
-    def addSuccess(self, test):
-        super(TextTestResult, self).addSuccess(test)
+    def newTestResult(self,test,result_short,result_long):
         if self.showAll:
-            self.stream.writeln("ok")
+            self.stream.writeln(result_long)
+        elif self.progressbar:
+            self.progressbar.__add__(1)
+            self.progressbar.add_event(result_short)
+            self.progressbar.show_progress()
         elif self.dots:
-            self.stream.write('.')
+            self.stream.write(result_short)
             self.stream.flush()
 
+    def addSuccess(self, test):
+        super(TextTestResult, self).addSuccess(test)
+        if self.progressbar:
+            self.newTestResult(test,"ok","ok")
+        else:
+            self.newTestResult(test,".","ok")
+
     def addError(self, test, err):
         super(TextTestResult, self).addError(test, err)
-        if self.showAll:
-            self.stream.writeln("ERROR")
-        elif self.dots:
-            self.stream.write('E')
-            self.stream.flush()
+        self.newTestResult(test,"E","ERROR")
 
     def addFailure(self, test, err):
         super(TextTestResult, self).addFailure(test, err)
-        if self.showAll:
-            self.stream.writeln("FAIL")
-        elif self.dots:
-            self.stream.write('F')
-            self.stream.flush()
+        self.newTestResult(test,"F","FAILURE")
 
     def addSkip(self, test, reason):
         super(TextTestResult, self).addSkip(test, reason)
-        if self.showAll:
-            self.stream.writeln("skipped %r" % (reason,))
-        elif self.dots:
-            self.stream.write("s")
-            self.stream.flush()
+        self.newTestResult(test,"s","skipped %r" % (reason,))
 
-    def addExpectedFailure(self, test, err):
-        super(TextTestResult, self).addExpectedFailure(test, err)
-        if self.showAll:
-            self.stream.writeln("expected failure")
-        elif self.dots:
-            self.stream.write("x")
-            self.stream.flush()
-
-    def addUnexpectedSuccess(self, test):
-        super(TextTestResult, self).addUnexpectedSuccess(test)
-        if self.showAll:
-            self.stream.writeln("unexpected success")
-        elif self.dots:
-            self.stream.write("u")
-            self.stream.flush()
+    def addExpectedFailure(self, test, err, bugnumber):
+        super(TextTestResult, self).addExpectedFailure(test, err, bugnumber)
+        self.newTestResult(test,"x","expected failure")
+
+    def addUnexpectedSuccess(self, test, bugnumber):
+        super(TextTestResult, self).addUnexpectedSuccess(test, bugnumber)
+        self.newTestResult(test,"u","unexpected success")
 
     def printErrors(self):
+        if self.progressbar:
+            self.progressbar.complete()
+            self.progressbar.show_progress()
         if self.dots or self.showAll:
             self.stream.writeln()
         self.printErrorList('ERROR', self.errors)

Removed: lldb/branches/windows/test/warnings/uuid/TestUUIDMismatchWanring.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/test/warnings/uuid/TestUUIDMismatchWanring.py?rev=179678&view=auto
==============================================================================
--- lldb/branches/windows/test/warnings/uuid/TestUUIDMismatchWanring.py (original)
+++ lldb/branches/windows/test/warnings/uuid/TestUUIDMismatchWanring.py (removed)
@@ -1,113 +0,0 @@
-"""Test that the 'warning: UUID mismatch detected ...' message is emitted if a
-dsym in vicinity of the executable does not match its UUID."""
-
-import os, time
-import unittest2
-import lldb
-import pexpect
-from lldbtest import *
-
- at unittest2.skipUnless(sys.platform.startswith("darwin"), "requires Darwin")
-class UUIDMismatchWarningCase(TestBase):
-
-    mydir = os.path.join("warnings", "uuid")
-
-    @classmethod
-    def classCleanup(cls):
-        """Cleanup the test byproducts."""
-        cls.RemoveTempFile("child_send.txt")
-        cls.RemoveTempFile("child_read.txt")
-
-    def setUp(self):
-        TestBase.setUp(self)
-        self.template = 'main.cpp.template'
-        self.source = 'main.cpp'
-        self.teardown_hook_added = False
-
-    def test_uuid_mismatch_warning(self):
-        """Test that the 'warning: UUID mismatch detected ...' message is emitted."""
-
-        # Call the program generator to produce main.cpp, version 1.
-        self.generate_main_cpp(version=1)
-        self.line_to_break = line_number(self.source, '// Set breakpoint here.')
-        self.buildDsym(clean=True)
-
-        # Insert some delay and then call the program generator to produce main.cpp, version 2.
-        time.sleep(5)
-        self.generate_main_cpp(version=101)
-        # Now call make again, but this time don't generate the dSYM.
-        self.buildDwarf(clean=False)
-
-        self.exe_name = 'a.out'
-        self.check_executable_and_dsym(self.exe_name)
-
-    def generate_main_cpp(self, version=0):
-        """Generate main.cpp from main.cpp.template."""
-        temp = os.path.join(os.getcwd(), self.template)
-        with open(temp, 'r') as f:
-            content = f.read()
-
-        new_content = content.replace('%ADD_EXTRA_CODE%',
-                                      'printf("This is version %d\\n");' % version)
-        src = os.path.join(os.getcwd(), self.source)
-        with open(src, 'w') as f:
-            f.write(new_content)
-
-        # The main.cpp has been generated, add a teardown hook to remove it.
-        if not self.teardown_hook_added:
-            self.addTearDownHook(lambda: os.remove(src))
-            self.teardown_hook_added = True
-
-    def check_executable_and_dsym(self, exe_name):
-        """Sanity check executable compiled from the auto-generated program."""
-
-        # The default lldb prompt.
-        prompt = "(lldb) "
-
-        # So that the child gets torn down after the test.
-        self.child = pexpect.spawn('%s %s' % (self.lldbHere, self.lldbOption))
-        child = self.child
-        # Turn on logging for input/output to/from the child.
-        with open('child_send.txt', 'w') as f_send:
-            with open('child_read.txt', 'w') as f_read:
-                child.logfile_send = f_send
-                child.logfile_read = f_read
-
-                child.expect_exact(prompt)
-                child.setecho(True)
-
-                # Execute the file command, followed by a breakpoint set, the
-                # UUID mismatch warning should be generated by then.
-
-                child.sendline("file %s" % exe_name)
-                child.expect_exact(prompt)
-                child.sendline("breakpoint set -f %s -l %d" % (self.source, self.line_to_break))
-                child.expect_exact(prompt)
-                child.sendline("run")
-                child.expect_exact(prompt)
-
-        # Now that the necessary logging is done, restore logfile to None to
-        # stop further logging.
-        child.logfile_send = None
-        child.logfile_read = None
-        
-        with open('child_send.txt', 'r') as fs:
-            if self.TraceOn():
-                print "\n\nContents of child_send.txt:"
-                print fs.read()
-        with open('child_read.txt', 'r') as fr:
-            from_child = fr.read()
-            if self.TraceOn():
-                print "\n\nContents of child_read.txt:"
-                print from_child
-
-            # Test that lldb emits the "UUID mismatch detected" message.
-            self.expect(from_child, msg="UUID mismatch expected!", exe=False,
-                substrs = ['warning: UUID mismatch detected'])
-
-
-if __name__ == '__main__':
-    import atexit
-    lldb.SBDebugger.Initialize()
-    atexit.register(lambda: lldb.SBDebugger.Terminate())
-    unittest2.main()

Modified: lldb/branches/windows/tools/darwin-debug/darwin-debug.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/tools/darwin-debug/darwin-debug.cpp?rev=179679&r1=179678&r2=179679&view=diff
==============================================================================
--- lldb/branches/windows/tools/darwin-debug/darwin-debug.cpp (original)
+++ lldb/branches/windows/tools/darwin-debug/darwin-debug.cpp Wed Apr 17 03:38:48 2013
@@ -184,7 +184,7 @@ int main (int argc, char *const *argv, c
     int pass_env = 1;
     std::string unix_socket_name;
     std::string working_dir;
-	while ((ch = getopt_long(argc, argv, "a:dehsu:?", g_long_options, NULL)) != -1)
+	while ((ch = getopt_long_only(argc, argv, "a:dehsu:?", g_long_options, NULL)) != -1)
 	{
 		switch (ch) 
 		{

Modified: lldb/branches/windows/tools/darwin-threads/examine-threads.c
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/tools/darwin-threads/examine-threads.c?rev=179679&r1=179678&r2=179679&view=diff
==============================================================================
--- lldb/branches/windows/tools/darwin-threads/examine-threads.c (original)
+++ lldb/branches/windows/tools/darwin-threads/examine-threads.c Wed Apr 17 03:38:48 2013
@@ -152,6 +152,53 @@ get_thread_identifier_info (thread_t thr
   return tident;
 }
 
+
+/* Given a mach port # (in the examine-threads mach port namespace) for a thread,
+   find the mach port # in the inferior program's port namespace.  
+   Sets inferior_port if successful.
+   Returns true if successful, false if unable to find the port number.  */
+
+bool
+inferior_namespace_mach_port_num (task_t task, thread_t examine_threads_port, thread_t *inferior_port)
+{
+    kern_return_t retval;
+    mach_port_name_array_t names;
+    mach_msg_type_number_t nameslen;
+    mach_port_type_array_t types;
+    mach_msg_type_number_t typeslen;
+
+    if (inferior_port == NULL)
+        return false;
+
+    retval = mach_port_names (task, &names, &nameslen, &types, &typeslen);
+    if (retval != KERN_SUCCESS)
+    {
+        printf ("Error - unable to get mach port names for inferior.\n");
+        return false;
+    }
+    int i = 0;
+    for (i = 0; i < nameslen; i++)
+    {
+        mach_port_t local_name;
+        mach_msg_type_name_t local_type;
+        retval = mach_port_extract_right (task, names[i], MACH_MSG_TYPE_COPY_SEND, &local_name, &local_type);
+        if (retval == KERN_SUCCESS)
+        {
+            mach_port_deallocate (mach_task_self(), local_name);
+            if (local_name == examine_threads_port)
+            {
+                *inferior_port = names[i];
+                vm_deallocate (mach_task_self (), (vm_address_t) names, nameslen * sizeof (mach_port_t));
+                vm_deallocate (mach_task_self (), (vm_address_t) types, typeslen * sizeof (mach_port_t));
+                return true;
+            }
+        }
+    }
+    vm_deallocate (mach_task_self (), (vm_address_t) names, nameslen * sizeof (mach_port_t));
+    vm_deallocate (mach_task_self (), (vm_address_t) types, typeslen * sizeof (mach_port_t));
+    return false;
+}
+
 /* Get the current pc value for a given thread.  */
 
 uint64_t
@@ -353,7 +400,7 @@ main (int argc, char **argv)
           int wordsize;
           uint64_t pc = get_current_pc (thread_list[i], &wordsize);
 
-          printf ("thread #%d, unique tid %lld, suspend count is %d, ", i,
+          printf ("thread #%d, system-wide-unique-tid %lld, suspend count is %d, ", i,
                   identifier_info.thread_id,
                   basic_info->suspend_count);
           if (wordsize == 8)
@@ -371,18 +418,19 @@ main (int argc, char **argv)
           }
           if (verbose)
             {
-              printf ("           ");
-              printf ("mach thread #0x%4.4x ", (int) thread_list[i]);
-              printf ("pthread handle id 0x%llx ", (uint64_t) identifier_info.thread_handle);
+              printf ("           (examine-threads port namespace) mach port # 0x%4.4x\n", (int) thread_list[i]);
+              thread_t mach_port_inferior_namespace;
+              if (inferior_namespace_mach_port_num (task, thread_list[i], &mach_port_inferior_namespace))
+                  printf ("           (inferior port namepsace) mach port # 0x%4.4x\n", (int) mach_port_inferior_namespace);
+              printf ("           pthread handle id 0x%llx\n", (uint64_t) identifier_info.thread_handle);
 
               struct proc_threadinfo pth;
               int proc_threadinfo_succeeded = get_proc_threadinfo (pid, identifier_info.thread_handle, &pth);
 
               if (proc_threadinfo_succeeded && pth.pth_name[0] != '\0')
-                printf ("thread name '%s' ", pth.pth_name);
+                printf ("           thread name '%s' ", pth.pth_name);
 
-              printf ("\n           ");
-              printf ("user %d.%06ds, system %d.%06ds", 
+              printf ("           user %d.%06ds, system %d.%06ds", 
                               basic_info->user_time.seconds, basic_info->user_time.microseconds, 
                               basic_info->system_time.seconds, basic_info->system_time.microseconds);
               if (basic_info->cpu_usage > 0)

Modified: lldb/branches/windows/tools/debugserver/debugserver.xcodeproj/project.pbxproj
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/tools/debugserver/debugserver.xcodeproj/project.pbxproj?rev=179679&r1=179678&r2=179679&view=diff
==============================================================================
--- lldb/branches/windows/tools/debugserver/debugserver.xcodeproj/project.pbxproj (original)
+++ lldb/branches/windows/tools/debugserver/debugserver.xcodeproj/project.pbxproj Wed Apr 17 03:38:48 2013
@@ -65,8 +65,6 @@
 		2695DD9B0D3EC160007E4CA2 /* CFString.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CFString.cpp; sourceTree = "<group>"; };
 		2695DE2D0D3EE55B007E4CA2 /* CFData.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CFData.h; sourceTree = "<group>"; };
 		2695DE2E0D3EE55B007E4CA2 /* CFData.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CFData.cpp; sourceTree = "<group>"; };
-		269DE5C50CB5B723008989F0 /* ProfileObjectiveC.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ProfileObjectiveC.h; sourceTree = "<group>"; };
-		269DE5C60CB5B723008989F0 /* ProfileObjectiveC.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ProfileObjectiveC.cpp; sourceTree = "<group>"; };
 		269E8DF8164B2ED200AD65F6 /* com.apple.debugserver.posix.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = com.apple.debugserver.posix.plist; sourceTree = "<group>"; };
 		26A02918114AB9240029C479 /* debugserver.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = debugserver.cpp; sourceTree = "<group>"; };
 		26A4BAED0D498B7D00A9BEAB /* com.apple.debugserver.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = com.apple.debugserver.plist; sourceTree = "<group>"; };
@@ -77,8 +75,6 @@
 		26A68FD50D10574500665A9E /* RNBRemote.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RNBRemote.h; sourceTree = "<group>"; };
 		26A68FD60D10574500665A9E /* RNBRemote.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RNBRemote.cpp; sourceTree = "<group>"; };
 		26A8FE1E0D11A77B00203048 /* DNBTimer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DNBTimer.h; sourceTree = "<group>"; };
-		26A901EA0EA3F46B00F7C71E /* FunctionProfiler.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = FunctionProfiler.cpp; sourceTree = "<group>"; };
-		26A901EB0EA3F46B00F7C71E /* FunctionProfiler.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FunctionProfiler.h; sourceTree = "<group>"; };
 		26ACA3340D3E956300A2120B /* CoreFoundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreFoundation.framework; path = System/Library/Frameworks/CoreFoundation.framework; sourceTree = SDKROOT; };
 		26B67DE00EE9BC30006C8BC0 /* MachTask.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MachTask.h; sourceTree = "<group>"; };
 		26B67DE10EE9BC30006C8BC0 /* MachTask.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MachTask.cpp; sourceTree = "<group>"; };
@@ -235,17 +231,6 @@
 			name = libdebugnub;
 			sourceTree = "<group>";
 		};
-		26A02900114AB6DB0029C479 /* Utility */ = {
-			isa = PBXGroup;
-			children = (
-				26A901EB0EA3F46B00F7C71E /* FunctionProfiler.h */,
-				26A901EA0EA3F46B00F7C71E /* FunctionProfiler.cpp */,
-				269DE5C50CB5B723008989F0 /* ProfileObjectiveC.h */,
-				269DE5C60CB5B723008989F0 /* ProfileObjectiveC.cpp */,
-			);
-			name = Utility;
-			sourceTree = "<group>";
-		};
 		26ACA3330D3E94F200A2120B /* Framework */ = {
 			isa = PBXGroup;
 			children = (
@@ -268,7 +253,6 @@
 				26593A060D4931CC001C9FE3 /* ChangeLog */,
 				26DEFD6C0D104C23008A5A07 /* debugserver */,
 				26A028FF114AB6BB0029C479 /* libdebugnub */,
-				26A02900114AB6DB0029C479 /* Utility */,
 			);
 			indentWidth = 4;
 			path = source;
@@ -390,7 +374,7 @@
 		08FB7793FE84155DC02AAC07 /* Project object */ = {
 			isa = PBXProject;
 			attributes = {
-				LastUpgradeCheck = 0430;
+				LastUpgradeCheck = 0500;
 			};
 			buildConfigurationList = 1DEB914E08733D8E0010E9CD /* Build configuration list for PBXProject "debugserver" */;
 			compatibilityVersion = "Xcode 3.2";
@@ -485,15 +469,22 @@
 					x86_64,
 					i386,
 				);
+				CLANG_WARN_BOOL_CONVERSION = YES;
+				CLANG_WARN_CONSTANT_CONVERSION = YES;
+				CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES;
+				CLANG_WARN_EMPTY_BODY = YES;
+				CLANG_WARN_ENUM_CONVERSION = YES;
+				CLANG_WARN_INT_CONVERSION = YES;
+				CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
 				COPY_PHASE_STRIP = NO;
-				CURRENT_PROJECT_VERSION = 198;
+				CURRENT_PROJECT_VERSION = 300.99.0;
 				GCC_VERSION = com.apple.compilers.llvm.clang.1_0;
 				GCC_WARN_ABOUT_RETURN_TYPE = YES;
+				GCC_WARN_UNDECLARED_SELECTOR = YES;
+				GCC_WARN_UNINITIALIZED_AUTOS = YES;
 				GCC_WARN_UNUSED_VARIABLE = YES;
 				ONLY_ACTIVE_ARCH = YES;
-				SDKROOT = "";
 				STRIP_INSTALLED_PRODUCT = NO;
-				VALID_ARCHS = "armv4t armv5 armv6 armv7 armv7s i386 ppc ppc64 ppc7400 ppc970 x86_64";
 				VERSIONING_SYSTEM = "apple-generic";
 				VERSION_INFO_BUILDER = "$(USER)";
 			};
@@ -507,16 +498,23 @@
 					armv7s,
 				);
 				"ARCHS[sdk=macosx*]" = "$(ARCHS_STANDARD_64_BIT)";
-				CURRENT_PROJECT_VERSION = 198;
+				CLANG_WARN_BOOL_CONVERSION = YES;
+				CLANG_WARN_CONSTANT_CONVERSION = YES;
+				CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES;
+				CLANG_WARN_EMPTY_BODY = YES;
+				CLANG_WARN_ENUM_CONVERSION = YES;
+				CLANG_WARN_INT_CONVERSION = YES;
+				CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
+				CURRENT_PROJECT_VERSION = 300.99.0;
 				DEAD_CODE_STRIPPING = YES;
 				GCC_VERSION = com.apple.compilers.llvm.clang.1_0;
 				GCC_WARN_ABOUT_RETURN_TYPE = YES;
+				GCC_WARN_UNDECLARED_SELECTOR = YES;
+				GCC_WARN_UNINITIALIZED_AUTOS = YES;
 				GCC_WARN_UNUSED_VARIABLE = YES;
 				ONLY_ACTIVE_ARCH = YES;
-				SDKROOT = "";
 				STRIPFLAGS = "-x";
 				STRIP_STYLE = debugging;
-				VALID_ARCHS = "armv4t armv5 armv6 armv7 armv7s i386 ppc ppc64 ppc7400 ppc970 x86_64";
 				VERSIONING_SYSTEM = "apple-generic";
 				VERSION_INFO_BUILDER = "$(USER)";
 			};
@@ -533,15 +531,22 @@
 					x86_64,
 					i386,
 				);
-				CURRENT_PROJECT_VERSION = 198;
+				CLANG_WARN_BOOL_CONVERSION = YES;
+				CLANG_WARN_CONSTANT_CONVERSION = YES;
+				CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES;
+				CLANG_WARN_EMPTY_BODY = YES;
+				CLANG_WARN_ENUM_CONVERSION = YES;
+				CLANG_WARN_INT_CONVERSION = YES;
+				CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
+				CURRENT_PROJECT_VERSION = 300.99.0;
 				DEAD_CODE_STRIPPING = YES;
 				GCC_VERSION = com.apple.compilers.llvm.clang.1_0;
 				GCC_WARN_ABOUT_RETURN_TYPE = YES;
+				GCC_WARN_UNDECLARED_SELECTOR = YES;
+				GCC_WARN_UNINITIALIZED_AUTOS = YES;
 				GCC_WARN_UNUSED_VARIABLE = YES;
-				SDKROOT = "";
 				STRIPFLAGS = "-x";
 				STRIP_STYLE = debugging;
-				VALID_ARCHS = "armv4t armv5 armv6 armv7 armv7s i386 ppc ppc64 ppc7400 ppc970 x86_64";
 				VERSIONING_SYSTEM = "apple-generic";
 				VERSION_INFO_BUILDER = "$(USER)";
 			};
@@ -554,7 +559,7 @@
 				CLANG_CXX_LIBRARY = "libc++";
 				"CODE_SIGN_ENTITLEMENTS[sdk=iphoneos*]" = "source/debugserver-entitlements.plist";
 				COPY_PHASE_STRIP = YES;
-				CURRENT_PROJECT_VERSION = 198;
+				CURRENT_PROJECT_VERSION = 300.99.0;
 				DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
 				FRAMEWORK_SEARCH_PATHS = $SDKROOT/System/Library/PrivateFrameworks;
 				"FRAMEWORK_SEARCH_PATHS[sdk=iphoneos*][arch=*]" = (
@@ -574,7 +579,6 @@
 					"-Wparentheses",
 					"-DWITH_LOCKDOWN",
 					"-DWITH_SPRINGBOARD",
-					"-DUSE_ARM_DISASSEMBLER_FRAMEWORK",
 					"-DOS_OBJECT_USE_OBJC=0",
 				);
 				"OTHER_CPLUSPLUSFLAGS[sdk=iphoneos*][arch=*]" = "$(OTHER_CFLAGS)";
@@ -587,8 +591,6 @@
 				"OTHER_LDFLAGS[sdk=iphoneos*][arch=*]" = (
 					"-framework",
 					SpringBoardServices,
-					"-framework",
-					ARMDisassembler,
 					"-llockdown",
 				);
 				OTHER_MIGFLAGS = "-I$(DERIVED_FILE_DIR)";
@@ -610,7 +612,7 @@
 				"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "-";
 				"CODE_SIGN_IDENTITY[sdk=macosx*]" = lldb_codesign;
 				COPY_PHASE_STRIP = YES;
-				CURRENT_PROJECT_VERSION = 198;
+				CURRENT_PROJECT_VERSION = 300.99.0;
 				FRAMEWORK_SEARCH_PATHS = $SDKROOT/System/Library/PrivateFrameworks;
 				"FRAMEWORK_SEARCH_PATHS[sdk=iphoneos*][arch=*]" = (
 					"$(SDKROOT)/System/Library/PrivateFrameworks",
@@ -629,7 +631,6 @@
 					"-Wparentheses",
 					"-DWITH_LOCKDOWN",
 					"-DWITH_SPRINGBOARD",
-					"-DUSE_ARM_DISASSEMBLER_FRAMEWORK",
 					"-DOS_OBJECT_USE_OBJC=0",
 				);
 				"OTHER_CPLUSPLUSFLAGS[sdk=iphoneos*][arch=*]" = "$(OTHER_CFLAGS)";
@@ -642,8 +643,6 @@
 				"OTHER_LDFLAGS[sdk=iphoneos*][arch=*]" = (
 					"-framework",
 					SpringBoardServices,
-					"-framework",
-					ARMDisassembler,
 					"-llockdown",
 				);
 				OTHER_MIGFLAGS = "-I$(DERIVED_FILE_DIR)";
@@ -665,7 +664,7 @@
 				"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "-";
 				"CODE_SIGN_IDENTITY[sdk=macosx*]" = lldb_codesign;
 				COPY_PHASE_STRIP = YES;
-				CURRENT_PROJECT_VERSION = 198;
+				CURRENT_PROJECT_VERSION = 300.99.0;
 				DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
 				FRAMEWORK_SEARCH_PATHS = $SDKROOT/System/Library/PrivateFrameworks;
 				"FRAMEWORK_SEARCH_PATHS[sdk=iphoneos*][arch=*]" = (
@@ -684,7 +683,6 @@
 					"-Wparentheses",
 					"-DWITH_LOCKDOWN",
 					"-DWITH_SPRINGBOARD",
-					"-DUSE_ARM_DISASSEMBLER_FRAMEWORK",
 					"-DOS_OBJECT_USE_OBJC=0",
 				);
 				"OTHER_CPLUSPLUSFLAGS[sdk=iphoneos*][arch=*]" = "$(OTHER_CFLAGS)";
@@ -697,8 +695,6 @@
 				"OTHER_LDFLAGS[sdk=iphoneos*][arch=*]" = (
 					"-framework",
 					SpringBoardServices,
-					"-framework",
-					ARMDisassembler,
 					"-llockdown",
 				);
 				OTHER_MIGFLAGS = "-I$(DERIVED_FILE_DIR)";
@@ -722,15 +718,22 @@
 					x86_64,
 					i386,
 				);
+				CLANG_WARN_BOOL_CONVERSION = YES;
+				CLANG_WARN_CONSTANT_CONVERSION = YES;
+				CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES;
+				CLANG_WARN_EMPTY_BODY = YES;
+				CLANG_WARN_ENUM_CONVERSION = YES;
+				CLANG_WARN_INT_CONVERSION = YES;
+				CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
 				COPY_PHASE_STRIP = NO;
-				CURRENT_PROJECT_VERSION = 198;
+				CURRENT_PROJECT_VERSION = 300.99.0;
 				GCC_VERSION = com.apple.compilers.llvm.clang.1_0;
 				GCC_WARN_ABOUT_RETURN_TYPE = YES;
+				GCC_WARN_UNDECLARED_SELECTOR = YES;
+				GCC_WARN_UNINITIALIZED_AUTOS = YES;
 				GCC_WARN_UNUSED_VARIABLE = YES;
 				ONLY_ACTIVE_ARCH = YES;
-				SDKROOT = "";
 				STRIP_INSTALLED_PRODUCT = NO;
-				VALID_ARCHS = "armv4t armv5 armv6 armv7 armv7s i386 ppc ppc64 ppc7400 ppc970 x86_64";
 				VERSIONING_SYSTEM = "apple-generic";
 				VERSION_INFO_BUILDER = "$(USER)";
 			};
@@ -745,7 +748,7 @@
 				"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "-";
 				"CODE_SIGN_IDENTITY[sdk=macosx*]" = lldb_codesign;
 				COPY_PHASE_STRIP = YES;
-				CURRENT_PROJECT_VERSION = 198;
+				CURRENT_PROJECT_VERSION = 300.99.0;
 				FRAMEWORK_SEARCH_PATHS = $SDKROOT/System/Library/PrivateFrameworks;
 				"FRAMEWORK_SEARCH_PATHS[sdk=iphoneos*][arch=*]" = (
 					"$(SDKROOT)/System/Library/PrivateFrameworks",
@@ -764,7 +767,6 @@
 					"-Wparentheses",
 					"-DWITH_LOCKDOWN",
 					"-DWITH_SPRINGBOARD",
-					"-DUSE_ARM_DISASSEMBLER_FRAMEWORK",
 					"-DOS_OBJECT_USE_OBJC=0",
 				);
 				"OTHER_CPLUSPLUSFLAGS[sdk=iphoneos*][arch=*]" = "$(OTHER_CFLAGS)";
@@ -777,8 +779,6 @@
 				"OTHER_LDFLAGS[sdk=iphoneos*][arch=*]" = (
 					"-framework",
 					SpringBoardServices,
-					"-framework",
-					ARMDisassembler,
 					"-llockdown",
 				);
 				OTHER_MIGFLAGS = "-I$(DERIVED_FILE_DIR)";

Modified: lldb/branches/windows/tools/debugserver/debugserver.xcodeproj/xcshareddata/xcschemes/debugserver.xcscheme
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/windows/tools/debugserver/debugserver.xcodeproj/xcshareddata/xcschemes/debugserver.xcscheme?rev=179679&r1=179678&r2=179679&view=diff
==============================================================================
--- lldb/branches/windows/tools/debugserver/debugserver.xcodeproj/xcshareddata/xcschemes/debugserver.xcscheme (original)
+++ lldb/branches/windows/tools/debugserver/debugserver.xcodeproj/xcshareddata/xcschemes/debugserver.xcscheme Wed Apr 17 03:38:48 2013
@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <Scheme
-   LastUpgradeVersion = "0450"
+   LastUpgradeVersion = "0500"
    version = "1.8">
    <BuildAction
       parallelizeBuildables = "NO"
@@ -56,7 +56,6 @@
       buildConfiguration = "Debug"
       ignoresPersistentStateOnLaunch = "NO"
       debugDocumentVersioning = "YES"
-      enableOpenGLFrameCaptureMode = "0"
       allowLocationSimulation = "YES">
       <BuildableProductRunnable>
          <BuildableReference





More information about the llvm-branch-commits mailing list