[Lldb-commits] [lldb] r181613 - Add temporary fix for calling c++ global/anonymous functions on Linux.

Matt Kopec Matt.Kopec at intel.com
Fri May 10 10:53:48 PDT 2013


Author: mkopec
Date: Fri May 10 12:53:48 2013
New Revision: 181613

URL: http://llvm.org/viewvc/llvm-project?rev=181613&view=rev
Log:
Add temporary fix for calling c++ global/anonymous functions on Linux.

Modified:
    lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
    lldb/trunk/test/expression_command/test/TestExprs.py
    lldb/trunk/test/lang/cpp/call-function/TestCallCPPFunction.py
    lldb/trunk/test/lang/cpp/overloaded-functions/TestOverloadedFunctions.py

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=181613&r1=181612&r2=181613&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp (original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp Fri May 10 12:53:48 2013
@@ -3542,8 +3542,38 @@ SymbolFileDWARF::FindFunctions (const Co
             Index ();
 
         if (name_type_mask & eFunctionNameTypeFull)
+        {
             FindFunctions (name, m_function_fullname_index, sc_list);
 
+            // Temporary workaround for global/anonymous namespace functions on linux
+#if defined (__linux__)
+            // If we didn't find any functions in the global namespace try
+            // looking in the basename index but ignore any returned
+            // functions that have a namespace (ie. mangled names starting with 
+            // '_ZN') but keep functions which have an anonymous namespace
+            if (sc_list.GetSize() == 0)
+            {
+                SymbolContextList temp_sc_list;
+                FindFunctions (name, m_function_basename_index, temp_sc_list);
+                if (!namespace_decl)
+                {
+                    SymbolContext sc;
+                    for (uint32_t i = 0; i < temp_sc_list.GetSize(); i++)
+                    {
+                        if (temp_sc_list.GetContextAtIndex(i, sc))
+                        {
+                            ConstString func_name = sc.GetFunctionName(Mangled::ePreferDemangled);
+                            if (!strncmp(name.GetCString(), "_ZN", 3) ||
+                                strncmp(name.GetCString(), "(anonymous namespace)", 21))
+                            {
+                                sc_list.Append(sc);
+                            }
+                        }
+                    }
+                }
+            }
+#endif
+        }
         DIEArray die_offsets;
         DWARFCompileUnit *dwarf_cu = NULL;
         

Modified: lldb/trunk/test/expression_command/test/TestExprs.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/expression_command/test/TestExprs.py?rev=181613&r1=181612&r2=181613&view=diff
==============================================================================
--- lldb/trunk/test/expression_command/test/TestExprs.py (original)
+++ lldb/trunk/test/expression_command/test/TestExprs.py Fri May 10 12:53:48 2013
@@ -80,7 +80,6 @@ class BasicExprCommandsTestCase(TestBase
                        "a.out"])
         # (const char *) $8 = 0x... "/Volumes/data/lldb/svn/trunk/test/expression_command/test/a.out"
 
-    @expectedFailureLinux # bugzilla 15854
     @python_api_test
     def test_evaluate_expression_python(self):
         """Test SBFrame.EvaluateExpression() API for evaluating an expression."""

Modified: lldb/trunk/test/lang/cpp/call-function/TestCallCPPFunction.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/lang/cpp/call-function/TestCallCPPFunction.py?rev=181613&r1=181612&r2=181613&view=diff
==============================================================================
--- lldb/trunk/test/lang/cpp/call-function/TestCallCPPFunction.py (original)
+++ lldb/trunk/test/lang/cpp/call-function/TestCallCPPFunction.py Fri May 10 12:53:48 2013
@@ -17,7 +17,6 @@ class CallCPPFunctionTestCase(TestBase):
         self.buildDsym()
         self.call_cpp_function()
 
-    @expectedFailureLinux # bugzilla 15854
     @dwarf_test
     def test_with_dwarf_and_run_command(self):
         """Test calling a function by basename"""

Modified: lldb/trunk/test/lang/cpp/overloaded-functions/TestOverloadedFunctions.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/lang/cpp/overloaded-functions/TestOverloadedFunctions.py?rev=181613&r1=181612&r2=181613&view=diff
==============================================================================
--- lldb/trunk/test/lang/cpp/overloaded-functions/TestOverloadedFunctions.py (original)
+++ lldb/trunk/test/lang/cpp/overloaded-functions/TestOverloadedFunctions.py Fri May 10 12:53:48 2013
@@ -17,7 +17,6 @@ class CPPStaticMethodsTestCase(TestBase)
         self.buildDsym()
         self.static_method_commands()
 
-    @expectedFailureLinux # bugzilla 15854
     @dwarf_test
     def test_with_dwarf_and_run_command(self):
         """Test that functions with the same name are resolved correctly"""





More information about the lldb-commits mailing list