summaryrefslogtreecommitdiffstats
path: root/lldb/test
diff options
context:
space:
mode:
authorGreg Clayton <gclayton@apple.com>2014-01-11 00:29:50 +0000
committerGreg Clayton <gclayton@apple.com>2014-01-11 00:29:50 +0000
commitc26e63e9868cb66339f244f199328ae2848803ef (patch)
treea93d0afb8d0df59ff8bbae6544d86d44f1c05947 /lldb/test
parent942f22c4396701968b7a759e022b6f3ff2449167 (diff)
downloadbcm5719-llvm-c26e63e9868cb66339f244f199328ae2848803ef.tar.gz
bcm5719-llvm-c26e63e9868cb66339f244f199328ae2848803ef.zip
We are doing spurious name lookups when running expressions in objective C methods.
<rdar://problem/15797390> This new test case will detect this and make sure we don't regress on global name lookups that search all DWARF for everything when we don't need to. llvm-svn: 198982
Diffstat (limited to 'lldb/test')
-rw-r--r--lldb/test/lang/objc/foundation/TestObjCMethods.py42
1 files changed, 42 insertions, 0 deletions
diff --git a/lldb/test/lang/objc/foundation/TestObjCMethods.py b/lldb/test/lang/objc/foundation/TestObjCMethods.py
index ed458f8864c..c201f756a3e 100644
--- a/lldb/test/lang/objc/foundation/TestObjCMethods.py
+++ b/lldb/test/lang/objc/foundation/TestObjCMethods.py
@@ -6,6 +6,7 @@ Also lookup objective-c data types and evaluate expressions.
import os, time
import unittest2
import lldb
+import string
from lldbtest import *
import lldbutil
@@ -111,6 +112,47 @@ class FoundationTestCase(TestBase):
self.expect("thread backtrace", "Stop at -[NSAutoreleasePool release]",
substrs = ["Foundation`-[NSAutoreleasePool release]"])
+ @dsym_test
+ @expectedFailureDarwin(15797390)
+ def test_expression_lookups_objc_dsym(self):
+ """Test running an expression detect spurious debug info lookups (dSYM)."""
+ self.buildDsym()
+ self.expression_lookups_objc()
+
+ @dwarf_test
+ @expectedFailureDarwin(15797390)
+ def test_expression_lookups_objc_dwarf(self):
+ """Test running an expression detect spurious debug info lookups (DWARF)."""
+ self.buildDwarf()
+ self.expression_lookups_objc()
+
+ def expression_lookups_objc (self):
+ """Test running an expression and make sure we don't search all dwarf files for any internal names (anything that contains '__lldb')."""
+ exe = os.path.join(os.getcwd(), "a.out")
+ self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
+
+ # Stop at -[MyString initWithNSString:].
+ lldbutil.run_break_set_by_symbol (self, '-[MyString initWithNSString:]', num_expected_locations=1, sym_exact=True)
+
+ self.runCmd("run", RUN_SUCCEEDED)
+
+ # Log any DWARF lookups
+ logfile = "dwarf-lookups.txt"
+ self.runCmd("log enable -f %s dwarf lookups" % (logfile))
+ self.runCmd("expr self")
+ self.runCmd("log disable dwarf lookups")
+ f = open(logfile)
+ lines = f.readlines()
+ num_errors = 0
+ for line in lines:
+ if string.find(line, "$__lldb") != -1:
+ if num_errors == 0:
+ print "error: found spurious name lookups when evaluating an expression:"
+ num_errors += 1
+ print line,
+ self.assertTrue(num_errors == 0, "Spurious lookups detected")
+ f.close()
+
def setUp(self):
# Call super's setUp().
TestBase.setUp(self)
OpenPOWER on IntegriCloud