[Lldb-commits] [PATCH] D29932: Fix TestNameLookup for GCC

Pavel Labath via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Tue Feb 14 04:32:46 PST 2017

labath created this revision.

GCC emits also symbols for the __PRETTY_FUNCTION__ virtual variable,
which we accidentaly pick up when looking for functions for with
"unique_function_name" in the name. This makes the target.FindFunctions
call fail, as that symbol is not a function.

I also strenghten the test a bit to make sure we actually find all the
functions we are interested in. I've put a check that we find at least 6
functions, but maybe this should be *exactly* 6 ?



Index: packages/Python/lldbsuite/test/python_api/name_lookup/TestNameLookup.py
--- packages/Python/lldbsuite/test/python_api/name_lookup/TestNameLookup.py
+++ packages/Python/lldbsuite/test/python_api/name_lookup/TestNameLookup.py
@@ -20,7 +20,6 @@
     mydir = TestBase.compute_mydir(__file__)
-    @expectedFailureAll(compiler="gcc")
     def test_target(self):
         """Exercise SBTarget.FindFunctions() with various name masks.
@@ -44,7 +43,7 @@
         for i in range(num_symbols):
             symbol = exe_module.GetSymbolAtIndex(i);
             name = symbol.GetName()
-            if name and 'unique_function_name' in name:
+            if name and 'unique_function_name' in name and '__PRETTY_FUNCTION__' not in name:
                 mangled = symbol.GetMangledName()
                 if mangled:
                     mangled_to_symbol[mangled] = symbol
@@ -56,6 +55,7 @@
         # Make sure each mangled name turns up exactly one match when looking up
         # functions by full name and using the mangled name as the name in the 
         # lookup
+        self.assertGreaterEqual(len(mangled_to_symbol), 6)
         for mangled in mangled_to_symbol.keys():
             symbol_contexts = target.FindFunctions(mangled, lldb.eFunctionNameTypeFull)
             self.assertTrue(symbol_contexts.GetSize() == 1)

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D29932.88347.patch
Type: text/x-patch
Size: 1447 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20170214/bf2c8f09/attachment-0001.bin>

More information about the lldb-commits mailing list