[Lldb-commits] [lldb] r246820 - Lookup function using full name if one with mangled name is not found.

Siva Chandra via lldb-commits lldb-commits at lists.llvm.org
Thu Sep 3 16:27:11 PDT 2015


Author: sivachandra
Date: Thu Sep  3 18:27:10 2015
New Revision: 246820

URL: http://llvm.org/viewvc/llvm-project?rev=246820&view=rev
Log:
Lookup function using full name if one with mangled name is not found.

Summary:
Remove expected failure decorators from tests which now should start
passing.

Reviewers: clayborg, spyffe

Subscribers: lldb-commits

Differential Revision: http://reviews.llvm.org/D12613

Modified:
    lldb/trunk/source/Expression/ClangExpressionDeclMap.cpp
    lldb/trunk/test/expression_command/formatters/TestFormatters.py
    lldb/trunk/test/functionalities/data-formatter/data-formatter-synthval/TestDataFormatterSynthVal.py

Modified: lldb/trunk/source/Expression/ClangExpressionDeclMap.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Expression/ClangExpressionDeclMap.cpp?rev=246820&r1=246819&r2=246820&view=diff
==============================================================================
--- lldb/trunk/source/Expression/ClangExpressionDeclMap.cpp (original)
+++ lldb/trunk/source/Expression/ClangExpressionDeclMap.cpp Thu Sep  3 18:27:10 2015
@@ -47,6 +47,8 @@
 #include "lldb/Target/Target.h"
 #include "lldb/Target/Thread.h"
 
+#include "Plugins/Language/CPlusPlus/CPlusPlusLanguage.h"
+
 using namespace lldb;
 using namespace lldb_private;
 using namespace clang;
@@ -498,6 +500,7 @@ FindCodeSymbolInContext
 (
     const ConstString &name,
     SymbolContext &sym_ctx,
+    uint32_t name_type_mask,
     SymbolContextList &sc_list
 )
 {
@@ -506,7 +509,7 @@ FindCodeSymbolInContext
     if (sym_ctx.module_sp)
         sym_ctx.module_sp->FindFunctions(name,
                                          NULL,
-                                         eFunctionNameTypeAuto,
+                                         name_type_mask,
                                          true,  // include_symbols
                                          false, // include_inlines
                                          true,  // append
@@ -515,7 +518,7 @@ FindCodeSymbolInContext
     {
         if (sym_ctx.target_sp)
             sym_ctx.target_sp->GetImages().FindFunctions(name,
-                                                         eFunctionNameTypeAuto,
+                                                         name_type_mask,
                                                          true,  // include_symbols
                                                          false, // include_inlines
                                                          true,  // append
@@ -573,10 +576,33 @@ ClangExpressionDeclMap::GetFunctionAddre
 
     SymbolContextList sc_list;
 
-    FindCodeSymbolInContext(name, m_parser_vars->m_sym_ctx, sc_list);
+    FindCodeSymbolInContext(name, m_parser_vars->m_sym_ctx, eFunctionNameTypeAuto, sc_list);
 
     uint32_t sc_list_size = sc_list.GetSize();
-    
+
+    if (sc_list_size == 0)
+    {
+        SymbolContext &sc = m_parser_vars->m_sym_ctx;
+        if (sc.comp_unit)
+        {
+            LanguageType lang_type = sc.comp_unit->GetLanguage();
+            if (Language::LanguageIsCPlusPlus(lang_type) &&
+                CPlusPlusLanguage::IsCPPMangledName(name.AsCString()))
+            {
+                // 1. Demangle the name
+                Mangled mangled(name, true);
+                ConstString demangled = mangled.GetDemangledName(lang_type);
+
+                if (demangled)
+                {
+                    FindCodeSymbolInContext(
+                        demangled, m_parser_vars->m_sym_ctx, eFunctionNameTypeFull, sc_list);
+                    sc_list_size = sc_list.GetSize();
+                }
+            }
+        }
+    }
+
     if (sc_list_size == 0)
     {
         // We occasionally get debug information in which a const function is reported
@@ -592,7 +618,8 @@ ClangExpressionDeclMap::GetFunctionAddre
             if (log)
                 log->Printf("Failed to find symbols given non-const name %s; trying %s", name.GetCString(), fixed_name.GetCString());
 
-            FindCodeSymbolInContext(fixed_name, m_parser_vars->m_sym_ctx, sc_list);
+            FindCodeSymbolInContext(
+                fixed_name, m_parser_vars->m_sym_ctx, eFunctionNameTypeAuto, sc_list);
             sc_list_size = sc_list.GetSize();
         }
     }

Modified: lldb/trunk/test/expression_command/formatters/TestFormatters.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/expression_command/formatters/TestFormatters.py?rev=246820&r1=246819&r2=246820&view=diff
==============================================================================
--- lldb/trunk/test/expression_command/formatters/TestFormatters.py (original)
+++ lldb/trunk/test/expression_command/formatters/TestFormatters.py Thu Sep  3 18:27:10 2015
@@ -26,7 +26,6 @@ class ExprFormattersTestCase(TestBase):
         self.do_my_test()
 
     @expectedFailureFreeBSD('llvm.org/pr19011') # Newer Clang omits C1 complete object constructor
-    @expectedFailureLinux('llvm.org/pr19011', ['clang'])
     @expectedFailureWindows("llvm.org/pr21765")
     @skipIfTargetAndroid() # skipping to avoid crashing the test runner
     @expectedFailureAndroid('llvm.org/pr24691') # we hit an assertion in clang

Modified: lldb/trunk/test/functionalities/data-formatter/data-formatter-synthval/TestDataFormatterSynthVal.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/functionalities/data-formatter/data-formatter-synthval/TestDataFormatterSynthVal.py?rev=246820&r1=246819&r2=246820&view=diff
==============================================================================
--- lldb/trunk/test/functionalities/data-formatter/data-formatter-synthval/TestDataFormatterSynthVal.py (original)
+++ lldb/trunk/test/functionalities/data-formatter/data-formatter-synthval/TestDataFormatterSynthVal.py Thu Sep  3 18:27:10 2015
@@ -22,7 +22,6 @@ class DataFormatterSynthValueTestCase(Te
     @skipIfFreeBSD # llvm.org/pr20545 bogus output confuses buildbot parser
     @expectedFailureWindows("llvm.org/pr24462") # Data formatters have problems on Windows
     @dwarf_test
-    @expectedFailureLinux('llvm.org/pr19011', ['clang'])
     def test_with_dwarf_and_run_command(self):
         """Test using Python synthetic children provider to provide a value."""
         self.buildDwarf()




More information about the lldb-commits mailing list