[Lldb-commits] [lldb] r118654 - in /lldb/trunk: include/lldb/Core/ include/lldb/Expression/ source/Expression/ source/Plugins/SymbolFile/DWARF/

Greg Clayton gclayton at apple.com
Tue Nov 9 15:46:38 PST 2010


Author: gclayton
Date: Tue Nov  9 17:46:37 2010
New Revision: 118654

URL: http://llvm.org/viewvc/llvm-project?rev=118654&view=rev
Log:
Did a lot of code cleanup.

Fixed the DWARF plug-in such that when it gets all attributes for a DIE, that
it omits the DW_AT_sibling and DW_AT_declaration when getting attributes
from a DW_AT_abstract_origin or DW_AT_specification DIE.


Modified:
    lldb/trunk/include/lldb/Core/ClangForward.h
    lldb/trunk/include/lldb/Expression/ClangASTSource.h
    lldb/trunk/source/Expression/ClangExpressionDeclMap.cpp
    lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.cpp
    lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.h
    lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp
    lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.h
    lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDefines.cpp
    lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDefines.h
    lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFLocationDescription.cpp
    lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
    lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h

Modified: lldb/trunk/include/lldb/Core/ClangForward.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/ClangForward.h?rev=118654&r1=118653&r2=118654&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Core/ClangForward.h (original)
+++ lldb/trunk/include/lldb/Core/ClangForward.h Tue Nov  9 17:46:37 2010
@@ -104,6 +104,7 @@
     class TemplateTemplateParmDecl;
     class TemplateTypeParmDecl;
     class TextDiagnosticBuffer;
+    class TranslationUnitDecl;
     class Type;
     class TypedefDecl;
     class TypesCompatibleExpr;

Modified: lldb/trunk/include/lldb/Expression/ClangASTSource.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Expression/ClangASTSource.h?rev=118654&r1=118653&r2=118654&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Expression/ClangASTSource.h (original)
+++ lldb/trunk/include/lldb/Expression/ClangASTSource.h Tue Nov  9 17:46:37 2010
@@ -28,12 +28,9 @@
 /// to Clang for these names, consulting the ClangExpressionDeclMap to do
 /// the actual lookups.
 //----------------------------------------------------------------------
-class ClangASTSource : public clang::ExternalSemaSource {
-	clang::ASTContext &m_ast_context;   ///< The parser's AST context, for copying types into
-	ClangExpressionDeclMap &m_decl_map; ///< The object that looks up named entities in LLDB
+class ClangASTSource : public clang::ExternalSemaSource 
+{
 public:
-    friend struct NameSearchContext;
-    
     //------------------------------------------------------------------
     /// Constructor
     ///
@@ -91,20 +88,21 @@
     /// @return
     ///     Whatever SetExternalVisibleDeclsForName returns.
     //------------------------------------------------------------------
-    clang::DeclContextLookupResult FindExternalVisibleDeclsByName(const clang::DeclContext *DC,
-                                                                  clang::DeclarationName Name);
+    clang::DeclContextLookupResult 
+    FindExternalVisibleDeclsByName (const clang::DeclContext *DC,
+                                    clang::DeclarationName Name);
     
     //------------------------------------------------------------------
     /// Interface stub.
     //------------------------------------------------------------------
-    void MaterializeVisibleDecls(const clang::DeclContext *DC);
+    void MaterializeVisibleDecls (const clang::DeclContext *DC);
 	
     //------------------------------------------------------------------
     /// Interface stub that returns true.
     //------------------------------------------------------------------
-	bool FindExternalLexicalDecls(const clang::DeclContext *DC,
-                                  bool (*isKindWeWant)(clang::Decl::Kind),
-                                  llvm::SmallVectorImpl<clang::Decl*> &Decls);
+	bool FindExternalLexicalDecls (const clang::DeclContext *DC,
+                                   bool (*isKindWeWant)(clang::Decl::Kind),
+                                   llvm::SmallVectorImpl<clang::Decl*> &Decls);
     
     //------------------------------------------------------------------
     /// Called on entering a translation unit.  Tells Clang by calling
@@ -114,7 +112,13 @@
     /// @param[in] ASTConsumer
     ///     Unused.
     //------------------------------------------------------------------
-    void StartTranslationUnit(clang::ASTConsumer *Consumer);
+    void StartTranslationUnit (clang::ASTConsumer *Consumer);
+
+protected:
+    friend struct NameSearchContext;
+
+	clang::ASTContext &m_ast_context;   ///< The parser's AST context, for copying types into
+	ClangExpressionDeclMap &m_decl_map; ///< The object that looks up named entities in LLDB
 };
 
 //----------------------------------------------------------------------

Modified: lldb/trunk/source/Expression/ClangExpressionDeclMap.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Expression/ClangExpressionDeclMap.cpp?rev=118654&r1=118653&r2=118654&view=diff
==============================================================================
--- lldb/trunk/source/Expression/ClangExpressionDeclMap.cpp (original)
+++ lldb/trunk/source/Expression/ClangExpressionDeclMap.cpp Tue Nov  9 17:46:37 2010
@@ -301,15 +301,15 @@
     if (m_exe_ctx.frame == NULL)
         return false;
 
-    SymbolContextList sym_ctxs;
+    SymbolContextList sc_list;
     
-    m_sym_ctx.FindFunctionsByName(name, false, sym_ctxs);
+    m_sym_ctx.FindFunctionsByName(name, false, sc_list);
     
-    if (!sym_ctxs.GetSize())
+    if (!sc_list.GetSize())
         return false;
     
     SymbolContext sym_ctx;
-    sym_ctxs.GetContextAtIndex(0, sym_ctx);
+    sc_list.GetContextAtIndex(0, sym_ctx);
     
     const Address *fun_address;
     
@@ -955,11 +955,7 @@
 
 // Interface for ClangASTSource
 void 
-ClangExpressionDeclMap::GetDecls 
-(
-    NameSearchContext &context,
-    const ConstString &name
-)
+ClangExpressionDeclMap::GetDecls (NameSearchContext &context, const ConstString &name)
 {
     lldb::LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EXPRESSIONS));
         
@@ -970,7 +966,7 @@
     if (m_exe_ctx.frame == NULL)
         return;
         
-    SymbolContextList sym_ctxs;
+    SymbolContextList sc_list;
     
     // Only look for functions by name out in our symbols if the function 
     // doesn't start with our phony prefix of '$'
@@ -986,18 +982,18 @@
         }
         else
         {
-            m_sym_ctx.FindFunctionsByName (name, false, sym_ctxs);
+            m_sym_ctx.FindFunctionsByName (name, false, sc_list);
         
             bool found_specific = false;
             Symbol *generic_symbol = NULL;
             Symbol *non_extern_symbol = NULL;
             
-            for (uint32_t index = 0, num_indices = sym_ctxs.GetSize();
+            for (uint32_t index = 0, num_indices = sc_list.GetSize();
                  index < num_indices;
                  ++index)
             {
                 SymbolContext sym_ctx;
-                sym_ctxs.GetContextAtIndex(index, sym_ctx);
+                sc_list.GetContextAtIndex(index, sym_ctx);
 
                 if (sym_ctx.function)
                 {

Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.cpp?rev=118654&r1=118653&r2=118654&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.cpp (original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.cpp Tue Nov  9 17:46:37 2010
@@ -644,15 +644,8 @@
                     break;
 
                 case DW_AT_declaration:
-                    // Make sure the declaration is from this DIE, and not from 
-                    // a DW_AT_specification or DW_AT_abstract_origin by checking
-                    // this die and seeing if its abbreviations have the
-                    // DW_AT_declaration attribute
-                    if (die.GetAbbreviationDeclarationPtr()->FindAttributeIndex (DW_AT_declaration) != DW_INVALID_INDEX)
-                    {
-                        if (attributes.ExtractFormValueAtIndex(m_dwarf2Data, i, form_value))
-                            is_declaration = form_value.Unsigned() != 0;
-                    }
+                    if (attributes.ExtractFormValueAtIndex(m_dwarf2Data, i, form_value))
+                        is_declaration = form_value.Unsigned() != 0;
                     break;
 
                 case DW_AT_artificial:

Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.h?rev=118654&r1=118653&r2=118654&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.h (original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.h Tue Nov  9 17:46:37 2010
@@ -65,8 +65,7 @@
     {
         eDumpFlag_Verbose               = (1<<0),   // Verbose dumping
         eDumpFlag_ShowForm              = (1<<1),   // Show the DW_form type
-        eDumpFlag_EnglishyNames         = (1<<2),   // Show the DW_TAG, DW_AT and DW_FORM types in more englishy names instead of as DWARF definitions values
-        eDumpFlag_ShowAncestors         = (1<<3)    // Show all parent DIEs when dumping single DIEs
+        eDumpFlag_ShowAncestors         = (1<<2)    // Show all parent DIEs when dumping single DIEs
     };
 
 

Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp?rev=118654&r1=118653&r2=118654&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp (original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp Tue Nov  9 17:46:37 2010
@@ -1098,7 +1098,6 @@
 {
     const DataExtractor& debug_info_data = dwarf2Data->get_debug_info_data();
     uint32_t offset = m_offset;
-    bool english    = s->GetFlags().Test (DWARFDebugInfo::eDumpFlag_EnglishyNames);
 
     if (debug_info_data.ValidOffset(offset))
     {
@@ -1110,10 +1109,7 @@
         {
             if (m_abbrevDecl)
             {
-                if (english)
-                    s->PutCString(DW_TAG_value_to_englishy_name(m_abbrevDecl->Tag()));
-                else
-                    s->PutCString(DW_TAG_value_to_name(m_abbrevDecl->Tag()));
+                s->PutCString(DW_TAG_value_to_name(m_abbrevDecl->Tag()));
                 s->Printf( " [%u] %c\n", abbrCode, m_abbrevDecl->HasChildren() ? '*':' ');
 
                 // Dump all data in the .debug_info for the attributes
@@ -1172,22 +1168,16 @@
 {
     bool verbose    = s->GetVerbose();
     bool show_form  = s->GetFlags().Test(DWARFDebugInfo::eDumpFlag_ShowForm);
-    bool english    = s->GetFlags().Test(DWARFDebugInfo::eDumpFlag_EnglishyNames);
     const DataExtractor* debug_str_data = dwarf2Data ? &dwarf2Data->get_debug_str_data() : NULL;
     if (verbose)
-        s->Offset(*offset_ptr);
-    else
-        s->Printf( "            ");
-    s->Indent();
-
-    if (english)
-        s->PutCString(DW_AT_value_to_englishy_name(attr));
+        s->Offset (*offset_ptr);
     else
-        s->PutCString(DW_AT_value_to_name(attr));
+        s->Printf ("            ");
+    s->Indent(DW_AT_value_to_name(attr));
 
     if (show_form)
     {
-        s->Printf( "[%s", english ? DW_FORM_value_to_englishy_name(form) : DW_FORM_value_to_name(form));
+        s->Printf( "[%s", DW_FORM_value_to_name(form));
     }
 
     DWARFFormValue form_value(form);
@@ -1199,7 +1189,7 @@
     {
         if (form == DW_FORM_indirect)
         {
-            s->Printf( " [%s]", english ? DW_FORM_value_to_englishy_name(form_value.Form()) : DW_FORM_value_to_name(form_value.Form()));
+            s->Printf( " [%s]", DW_FORM_value_to_name(form_value.Form()));
         }
 
         s->PutCString("] ");
@@ -1326,7 +1316,8 @@
     SymbolFileDWARF* dwarf2Data,
     const DWARFCompileUnit* cu,
     const uint8_t *fixed_form_sizes,
-    DWARFDebugInfoEntry::Attributes& attributes
+    DWARFDebugInfoEntry::Attributes& attributes,
+    uint32_t curr_depth
 ) const
 {
     if (m_abbrevDecl)
@@ -1347,7 +1338,27 @@
         for (i=0; i<num_attributes; ++i)
         {
             m_abbrevDecl->GetAttrAndFormByIndexUnchecked (i, attr, form);
-            attributes.Append(cu, offset, attr, form);
+            
+            // If we are tracking down DW_AT_specification or DW_AT_abstract_origin
+            // attributes, the depth will be non-zero. We need to omit certain
+            // attributes that don't make sense.
+            switch (attr)
+            {
+            case DW_AT_sibling:
+            case DW_AT_declaration:
+                if (curr_depth > 0)
+                {
+                    // This attribute doesn't make sense when combined with
+                    // the DIE that references this DIE. We know a DIE is 
+                    // referencing this DIE because curr_depth is not zero
+                    break;  
+                }
+                // Fall through...
+            default:
+                attributes.Append(cu, offset, attr, form);
+                break;
+            }
+
             if ((attr == DW_AT_specification) || (attr == DW_AT_abstract_origin))
             {
                 form_value.SetForm(form);
@@ -1359,14 +1370,14 @@
                     {
                         die = const_cast<DWARFCompileUnit*>(cu)->GetDIEPtr(die_offset);
                         if (die)
-                            die->GetAttributes(dwarf2Data, cu, fixed_form_sizes, attributes);
+                            die->GetAttributes(dwarf2Data, cu, fixed_form_sizes, attributes, curr_depth + 1);
                     }
                     else
                     {
                         DWARFCompileUnitSP cu_sp_ptr;
                         die = const_cast<SymbolFileDWARF*>(dwarf2Data)->DebugInfo()->GetDIEPtr(die_offset, &cu_sp_ptr);
                         if (die)
-                            die->GetAttributes(dwarf2Data, cu_sp_ptr.get(), fixed_form_sizes, attributes);
+                            die->GetAttributes(dwarf2Data, cu_sp_ptr.get(), fixed_form_sizes, attributes, curr_depth + 1);
                     }
                 }
             }

Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.h?rev=118654&r1=118653&r2=118654&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.h (original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.h Tue Nov  9 17:46:37 2010
@@ -142,7 +142,8 @@
                     SymbolFileDWARF* dwarf2Data,
                     const DWARFCompileUnit* cu,
                     const uint8_t *fixed_form_sizes,
-                    DWARFDebugInfoEntry::Attributes& attrs) const;
+                    DWARFDebugInfoEntry::Attributes& attrs,
+                    uint32_t curr_depth = 0) const; // "curr_depth" for internal use only, don't set this yourself!!!
 
     dw_offset_t GetAttributeValue(
                     SymbolFileDWARF* dwarf2Data,

Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDefines.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDefines.cpp?rev=118654&r1=118653&r2=118654&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDefines.cpp (original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDefines.cpp Tue Nov  9 17:46:37 2010
@@ -23,7 +23,7 @@
   if (val == 0)
       return "NULL";
 
-  const char *llvmstr = TagString (val);
+  const char *llvmstr = llvm::dwarf::TagString (val);
   if (llvmstr == NULL)
   {
       snprintf (invalid, sizeof (invalid), "Unknown DW_TAG constant: 0x%x", val);
@@ -33,37 +33,10 @@
 }   
 
 const char *
-DW_TAG_value_to_englishy_name (uint32_t val)
-{
-  static char invalid[100];
-
-  if (val == 0)
-      return "NULL";
-
-  const char *llvmstr = TagString (val);
-  if (llvmstr == NULL)
-  {
-      snprintf (invalid, sizeof (invalid), "Unknown DW_TAG constant: 0x%x", val);
-      return invalid;
-  }
-
-  std::string str;
-  if (strncmp (llvmstr, "DW_TAG_", 7) == 0)
-    llvmstr += 7;
-  
-  for (const char *i = llvmstr; *i != '\0'; i++)
-    str += *i == '_' ? ' ' : *i;
-
-  ConstString const_str (str.c_str());
-
-  return const_str.GetCString();
-}
-
-const char *
 DW_CHILDREN_value_to_name (uint8_t val)
 {
   static char invalid[100];
-  const char *llvmstr = ChildrenString (val);
+  const char *llvmstr = llvm::dwarf::ChildrenString (val);
   if (llvmstr == NULL)
   {
        snprintf (invalid, sizeof (invalid), "Unknown DW_CHILDREN constant: 0x%x", val);
@@ -76,7 +49,7 @@
 DW_AT_value_to_name (uint32_t val)
 {
   static char invalid[100];
-  const char *llvmstr = AttributeString (val);
+  const char *llvmstr = llvm::dwarf::AttributeString (val);
   if (llvmstr == NULL)
   {
       snprintf (invalid, sizeof (invalid), "Unknown DW_AT constant: 0x%x", val);
@@ -86,32 +59,10 @@
 }
 
 const char *
-DW_AT_value_to_englishy_name (uint32_t val)
-{
-  static char invalid[100];
-  const char *llvmstr = AttributeString (val);
-  if (llvmstr == NULL)
-  {
-      snprintf (invalid, sizeof (invalid), "Unknown DW_AT constant: 0x%x", val);
-      return invalid;
-  }
-
-  std::string str;
-  if (strncmp (llvmstr, "DW_AT_", 6) == 0)
-    llvmstr += 6;
-
-  for (const char *i = llvmstr; *i != '\0'; i++)
-    str += *i == '_' ? ' ' : *i;
-
-  ConstString const_str (str.c_str());
-  return const_str.GetCString();
-}
-
-const char *
 DW_FORM_value_to_name (uint32_t val)
 {
   static char invalid[100];
-  const char *llvmstr = FormEncodingString (val);
+  const char *llvmstr = llvm::dwarf::FormEncodingString (val);
   if (llvmstr == NULL)
   {
       snprintf (invalid, sizeof (invalid), "Unknown DW_FORM constant: 0x%x", val);
@@ -121,32 +72,10 @@
 }
 
 const char *
-DW_FORM_value_to_englishy_name (uint32_t val)
-{
-  static char invalid[100];
-  const char *llvmstr = FormEncodingString (val);
-  if (llvmstr == NULL)
-  {
-      snprintf (invalid, sizeof (invalid), "Unknown DW_FORM constant: 0x%x", val);
-      return invalid;
-  }
-
-  std::string str;
-  if (strncmp (llvmstr, "DW_FORM_", 8) == 0)
-    llvmstr += 8;
-
-  for (const char *i = llvmstr; *i != '\0'; i++)
-    str += *i == '_' ? ' ' : *i;
-
-  ConstString const_str (str.c_str());
-  return const_str.GetCString();
-}
-
-const char *
 DW_OP_value_to_name (uint32_t val)
 {
   static char invalid[100];
-  const char *llvmstr = OperationEncodingString (val);
+  const char *llvmstr = llvm::dwarf::OperationEncodingString (val);
   if (llvmstr == NULL)
   {
       snprintf (invalid, sizeof (invalid), "Unknown DW_OP constant: 0x%x", val);
@@ -155,28 +84,6 @@
   return llvmstr;
 }
 
-const char *
-DW_OP_value_to_englishy_name (uint32_t val)
-{
-  static char invalid[100];
-  const char *llvmstr = OperationEncodingString (val);
-  if (llvmstr == NULL)
-  {
-      snprintf (invalid, sizeof (invalid), "Unknown DW_OP constant: 0x%x", val);
-      return invalid;
-  }
-
-  std::string str;
-  if (strncmp (llvmstr, "DW_OP_", 6) == 0)
-    llvmstr += 6;
-
-  for (const char *i = llvmstr; *i != '\0'; i++)
-    str += *i == '_' ? ' ' : *i;
-
-  ConstString const_str (str.c_str());
-  return const_str.GetCString();
-}
-
 DRC_class
 DW_OP_value_to_class (uint32_t val)
 {
@@ -341,7 +248,7 @@
 DW_ATE_value_to_name (uint32_t val)
 {
   static char invalid[100];
-  const char *llvmstr = AttributeEncodingString (val);
+  const char *llvmstr = llvm::dwarf::AttributeEncodingString (val);
   if (llvmstr == NULL)
   {
       snprintf (invalid, sizeof (invalid), "Unknown DW_ATE constant: 0x%x", val);
@@ -355,7 +262,7 @@
 {
   static char invalid[100];
 
-  const char *llvmstr = AccessibilityString (val);
+  const char *llvmstr = llvm::dwarf::AccessibilityString (val);
   if (llvmstr == NULL)
   {
       snprintf (invalid, sizeof (invalid), "Unknown DW_ACCESS constant: 0x%x", val);
@@ -368,7 +275,7 @@
 DW_VIS_value_to_name (uint32_t val)
 {
   static char invalid[100];
-  const char *llvmstr = VisibilityString (val);
+  const char *llvmstr = llvm::dwarf::VisibilityString (val);
   if (llvmstr == NULL)
   {
       snprintf (invalid, sizeof (invalid), "Unknown DW_VIS constant: 0x%x", val);
@@ -381,7 +288,7 @@
 DW_VIRTUALITY_value_to_name (uint32_t val)
 {
   static char invalid[100];
-  const char *llvmstr = VirtualityString (val);
+  const char *llvmstr = llvm::dwarf::VirtualityString (val);
   if (llvmstr == NULL)
   {
       snprintf (invalid, sizeof (invalid), "Unknown DW_VIRTUALITY constant: 0x%x", val);
@@ -394,7 +301,7 @@
 DW_LANG_value_to_name (uint32_t val)
 {
   static char invalid[100];
-  const char *llvmstr = LanguageString (val);
+  const char *llvmstr = llvm::dwarf::LanguageString (val);
   if (llvmstr == NULL)
   {
       snprintf (invalid, sizeof (invalid), "Unknown DW_LANG constant: 0x%x", val);
@@ -407,7 +314,7 @@
 DW_ID_value_to_name (uint32_t val)
 {
   static char invalid[100];
-  const char *llvmstr = CaseString (val);
+  const char *llvmstr = llvm::dwarf::CaseString (val);
   if (llvmstr == NULL)
   {
       snprintf (invalid, sizeof (invalid), "Unknown DW_ID constant: 0x%x", val);
@@ -420,7 +327,7 @@
 DW_CC_value_to_name (uint32_t val)
 {
   static char invalid[100];
-  const char *llvmstr = ConventionString (val);
+  const char *llvmstr = llvm::dwarf::ConventionString (val);
   if (llvmstr == NULL)
   {
       snprintf (invalid, sizeof (invalid), "Unknown DW_CC constant: 0x%x", val);
@@ -433,7 +340,7 @@
 DW_INL_value_to_name (uint32_t val)
 {
   static char invalid[100];
-  const char *llvmstr = InlineCodeString (val);
+  const char *llvmstr = llvm::dwarf::InlineCodeString (val);
   if (llvmstr == NULL)
   {
       snprintf (invalid, sizeof (invalid), "Unknown DW_INL constant: 0x%x", val);
@@ -446,7 +353,7 @@
 DW_ORD_value_to_name (uint32_t val)
 {
   static char invalid[100];
-  const char *llvmstr = ArrayOrderString (val);
+  const char *llvmstr = llvm::dwarf::ArrayOrderString (val);
   if (llvmstr == NULL)
   {
       snprintf (invalid, sizeof (invalid), "Unknown DW_ORD constant: 0x%x", val);
@@ -459,7 +366,7 @@
 DW_DSC_value_to_name (uint32_t val)
 {
   static char invalid[100];
-  const char *llvmstr = DiscriminantString (val);
+  const char *llvmstr = llvm::dwarf::DiscriminantString (val);
   if (llvmstr == NULL)
   {
       snprintf (invalid, sizeof (invalid), "Unknown DW_DSC constant: 0x%x", val);
@@ -472,7 +379,7 @@
 DW_LNS_value_to_name (uint32_t val)
 {
   static char invalid[100];
-  const char *llvmstr = LNStandardString (val);
+  const char *llvmstr = llvm::dwarf::LNStandardString (val);
   if (llvmstr == NULL)
   {
       snprintf (invalid, sizeof (invalid), "Unknown DW_LNS constant: 0x%x", val);
@@ -485,7 +392,7 @@
 DW_LNE_value_to_name (uint32_t val)
 {
   static char invalid[100];
-  const char *llvmstr = LNExtendedString (val);
+  const char *llvmstr = llvm::dwarf::LNExtendedString (val);
   if (llvmstr == NULL)
   {
       snprintf (invalid, sizeof (invalid), "Unknown DW_LNE constant: 0x%x", val);
@@ -498,7 +405,7 @@
 DW_MACINFO_value_to_name (uint32_t val)
 {
   static char invalid[100];
-  const char *llvmstr = MacinfoString (val);
+  const char *llvmstr = llvm::dwarf::MacinfoString (val);
   if (llvmstr == NULL)
   {
       snprintf (invalid, sizeof (invalid), "Unknown DW_MACINFO constant: 0x%x", val);
@@ -511,7 +418,7 @@
 DW_CFA_value_to_name (uint32_t val)
 {
   static char invalid[100];
-  const char *llvmstr = CallFrameString (val);
+  const char *llvmstr = llvm::dwarf::CallFrameString (val);
   if (llvmstr == NULL)
   {
       snprintf (invalid, sizeof (invalid), "Unknown DW_CFA constant: 0x%x", val);

Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDefines.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDefines.h?rev=118654&r1=118653&r2=118654&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDefines.h (original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDefines.h Tue Nov  9 17:46:37 2010
@@ -27,20 +27,19 @@
 };
 
 typedef enum DW_TAG_Category DW_TAG_CategoryEnum;
+
 const char *DW_TAG_value_to_name (uint32_t val);
-const char *DW_TAG_value_to_englishy_name (uint32_t val);
+
 DW_TAG_CategoryEnum get_tag_category (uint16_t tag);
 
 const char *DW_CHILDREN_value_to_name (uint8_t val);
 
 const char *DW_AT_value_to_name (uint32_t val);
-const char *DW_AT_value_to_englishy_name (uint32_t val);
 
 const char *DW_FORM_value_to_name (uint32_t val);
-const char *DW_FORM_value_to_englishy_name (uint32_t val);
 
 const char *DW_OP_value_to_name (uint32_t val);
-const char *DW_OP_value_to_englishy_name (uint32_t val);
+
 DRC_class DW_OP_value_to_class (uint32_t val);
 
 const char *DW_ATE_value_to_name (uint32_t val);

Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFLocationDescription.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFLocationDescription.cpp?rev=118654&r1=118653&r2=118654&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFLocationDescription.cpp (original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFLocationDescription.cpp Tue Nov  9 17:46:37 2010
@@ -61,7 +61,7 @@
 
     opcode_class = DW_OP_value_to_class (opcode) & (~DRC_DWARFv3);
 
-    s->Printf("%s ", DW_OP_value_to_englishy_name (opcode));
+    s->Printf("%s ", DW_OP_value_to_name (opcode));
 
     /* Does this take zero parameters?  If so we can shortcut this function.  */
     if (opcode_class == DRC_ZEROOPERANDS)

Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp?rev=118654&r1=118653&r2=118654&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp (original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp Tue Nov  9 17:46:37 2010
@@ -145,6 +145,7 @@
 SymbolFileDWARF::SymbolFileDWARF(ObjectFile* objfile) :
     SymbolFile (objfile),
     m_debug_map_symfile (NULL),
+    m_clang_tu_decl (NULL),
     m_flags(),
     m_data_debug_abbrev(),
     m_data_debug_frame(),
@@ -2531,7 +2532,10 @@
 
         die = die->GetParent();
     }
-    return NULL;
+    // Right now we have only one translation unit per module...
+    if (m_clang_tu_decl == NULL)
+        m_clang_tu_decl = m_obj_file->GetModule()->GetTypeList()->GetClangASTContext().getASTContext()->getTranslationUnitDecl();
+    return m_clang_tu_decl;
 }
 
 // This function can be used when a DIE is found that is a forward declaration
@@ -2810,12 +2814,7 @@
                                     break;
 
                                 case DW_AT_declaration: 
-                                    // Make sure the declaration is from this DIE, and not from 
-                                    // a DW_AT_specification or DW_AT_abstract_origin by checking
-                                    // this die and seeing if its abbreviations have the
-                                    // DW_AT_declaration attribute
-                                    if (die->GetAbbreviationDeclarationPtr()->FindAttributeIndex (DW_AT_declaration) != DW_INVALID_INDEX)
-                                        is_forward_declaration = form_value.Unsigned() != 0; 
+                                    is_forward_declaration = form_value.Unsigned() != 0; 
                                     break;
 
                                 case DW_AT_APPLE_runtime_class: 
@@ -2938,24 +2937,17 @@
                             {
                                 switch (attr)
                                 {
-                                case DW_AT_decl_file:   decl.SetFile(sc.comp_unit->GetSupportFiles().GetFileSpecAtIndex(form_value.Unsigned())); break;
-                                case DW_AT_decl_line:   decl.SetLine(form_value.Unsigned()); break;
-                                case DW_AT_decl_column: decl.SetColumn(form_value.Unsigned()); break;
+                                case DW_AT_decl_file:       decl.SetFile(sc.comp_unit->GetSupportFiles().GetFileSpecAtIndex(form_value.Unsigned())); break;
+                                case DW_AT_decl_line:       decl.SetLine(form_value.Unsigned()); break;
+                                case DW_AT_decl_column:     decl.SetColumn(form_value.Unsigned()); break;
                                 case DW_AT_name:
                                     type_name_cstr = form_value.AsCString(&get_debug_str_data());
                                     type_name_const_str.SetCString(type_name_cstr);
                                     break;
-                                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: accessibility = DW_ACCESS_to_AccessType(form_value.Unsigned()); break;
-                                case DW_AT_declaration: 
-                                    // Make sure the declaration is from this DIE, and not from 
-                                    // a DW_AT_specification or DW_AT_abstract_origin by checking
-                                    // this die and seeing if its abbreviations have the
-                                    // DW_AT_declaration attribute
-                                    if (die->GetAbbreviationDeclarationPtr()->FindAttributeIndex (DW_AT_declaration) != DW_INVALID_INDEX)
-                                        is_forward_declaration = form_value.Unsigned() != 0; 
-                                    break;
+                                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:   accessibility = DW_ACCESS_to_AccessType(form_value.Unsigned()); break;
+                                case DW_AT_declaration:     is_forward_declaration = form_value.Unsigned() != 0; break;
                                 case DW_AT_allocated:
                                 case DW_AT_associated:
                                 case DW_AT_bit_stride:
@@ -3047,14 +3039,7 @@
                                 case DW_AT_MIPS_linkage_name:   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: 
-                                    // Make sure the declaration is from this DIE, and not from 
-                                    // a DW_AT_specification or DW_AT_abstract_origin by checking
-                                    // this die and seeing if its abbreviations have the
-                                    // DW_AT_declaration attribute
-                                    if (die->GetAbbreviationDeclarationPtr()->FindAttributeIndex (DW_AT_declaration) != DW_INVALID_INDEX)
-                                        is_forward_declaration = form_value.Unsigned() != 0; 
-                                    break;
+                                case DW_AT_declaration:         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; 
@@ -3267,14 +3252,7 @@
                                 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_accessibility:   accessibility = DW_ACCESS_to_AccessType(form_value.Unsigned()); break;
-                                case DW_AT_declaration: 
-                                    // Make sure the declaration is from this DIE, and not from 
-                                    // a DW_AT_specification or DW_AT_abstract_origin by checking
-                                    // this die and seeing if its abbreviations have the
-                                    // DW_AT_declaration attribute
-                                    if (die->GetAbbreviationDeclarationPtr()->FindAttributeIndex (DW_AT_declaration) != DW_INVALID_INDEX)
-                                        is_forward_declaration = form_value.Unsigned() != 0; 
-                                    break;
+                                case DW_AT_declaration:     is_forward_declaration = form_value.Unsigned() != 0; break;
                                 case DW_AT_allocated:
                                 case DW_AT_associated:
                                 case DW_AT_data_location:

Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h?rev=118654&r1=118653&r2=118654&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h (original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h Tue Nov  9 17:46:37 2010
@@ -20,6 +20,7 @@
 // Other libraries and framework includes
 #include "llvm/ADT/DenseMap.h"
 
+#include "lldb/Core/ClangForward.h"
 #include "lldb/Core/ConstString.h"
 #include "lldb/Core/dwarf.h"
 #include "lldb/Core/DataExtractor.h"
@@ -296,7 +297,8 @@
                                 m_debug_map_symfile = debug_map_symfile;
                             }
 
-    SymbolFileDWARFDebugMap*        m_debug_map_symfile;
+    SymbolFileDWARFDebugMap *       m_debug_map_symfile;
+    clang::TranslationUnitDecl *    m_clang_tu_decl;
     lldb_private::Flags             m_flags;
     lldb_private::DataExtractor     m_dwarf_data; 
     lldb_private::DataExtractor     m_data_debug_abbrev;





More information about the lldb-commits mailing list