Add temporary fix for calling c++ global/anonymous functions on Linux.

llvm-svn: 181613
This commit is contained in:
Matt Kopec 2013-05-10 17:53:48 +00:00
parent 9449989601
commit d608996610
4 changed files with 30 additions and 3 deletions

View File

@ -3542,8 +3542,38 @@ SymbolFileDWARF::FindFunctions (const ConstString &name,
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;

View File

@ -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."""

View File

@ -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"""

View File

@ -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"""