Remove the test override of `target.prefer-dynamic-value`.
Previously, the lldb default was `no-dynamic-values`. In rG9aa7e8e9ffbe (in
2015), the default was changed to `no-run-target`, but at that time the tests
were changed to be run with `no-dynamic-value`. I don't know the reasons for
not changing the tests, perhaps to avoid determining which tests to change, and
what about them to change.
Because `no-run-target` is the lldb default, I think it makes sense to make it
the test default too. It puts the test config closer to what's used in
practice.
This change removes the `target.prefer-dynamic-value` override, and for those
tests that failed, they have been updated to explicitly use
`no-dynamic-values`. Future changes could update these tests to use dynamic
values too, or they can be left as is to exercise non-dynamic typing.
Differential Revision: https://reviews.llvm.org/D132382
dwarf_version = 0
# Any overridden settings.
-# Always disable default dynamic types for testing purposes.
-settings = [('target.prefer-dynamic-value', 'no-dynamic-values')]
+settings = []
# Path to the FileCheck testing tool. Not optional.
filecheck = None
self.runCmd("run", RUN_SUCCEEDED)
+ self.runCmd("settings set target.prefer-dynamic-value no-dynamic-values")
+
self.expect("expr -O -v -- foo",
substrs=['(id) $', ' = 0x', '1 = 2', '2 = 3;'])
self.expect("expr -O -vfull -- foo",
self.runCmd("run", RUN_SUCCEEDED)
+ self.runCmd("settings set target.prefer-dynamic-value no-dynamic-values")
+
# Now do a NSArry type query from the 'main.m' compile uint.
self.expect("expression (NSArray*)array_token",
substrs=['(NSArray *) $0 = 0x'])
STOPPED_DUE_TO_BREAKPOINT,
substrs=['stopped', 'stop reason = breakpoint'])
+ self.runCmd('settings set target.prefer-dynamic-value no-dynamic-values')
+
# check formatters for common Objective-C types
expect_strings = [
'(CFGregorianUnits) cf_greg_units = 1 years, 3 months, 5 days, 12 hours, 5 minutes 7 seconds',
STOPPED_DUE_TO_BREAKPOINT,
substrs=['stopped', 'stop reason = breakpoint'])
+ self.runCmd('settings set target.prefer-dynamic-value no-dynamic-values')
+
# This is the function to remove the custom formats in order to have a
# clean slate for the next test case.
def cleanup():
self, '// Set break point at this line.',
lldb.SBFileSpec('main.m', False))
+ self.runCmd('settings set target.prefer-dynamic-value no-dynamic-values')
+
# The stop reason of the thread should be breakpoint.
self.expect(
"thread list",
self.appkit_tester_impl(self.nscontainers_data_formatter_commands, False)
def nscontainers_data_formatter_commands(self):
+ self.runCmd('settings set target.prefer-dynamic-value no-dynamic-values')
+
self.expect(
'frame variable newArray nsDictionary newDictionary nscfDictionary cfDictionaryRef newMutableDictionary copyDictionary newMutableDictionaryRef cfarray_ref mutable_array_ref',
substrs=[
self.appkit_tester_impl(self.nsdata_data_formatter_commands, False)
def nsdata_data_formatter_commands(self):
+ self.runCmd('settings set target.prefer-dynamic-value no-dynamic-values')
+
self.expect(
'frame variable immutableData mutableData data_ref mutable_data_ref mutable_string_ref concreteData concreteMutableData',
substrs=[
self.appkit_tester_impl(self.nscontainers_data_formatter_commands, False)
def nscontainers_data_formatter_commands(self):
+ self.runCmd('settings set target.prefer-dynamic-value no-dynamic-values')
+
self.expect(
'frame variable newArray nsDictionary newDictionary nscfDictionary cfDictionaryRef newMutableDictionary cfarray_ref mutable_array_ref',
substrs=[
self.runCmd("run", RUN_SUCCEEDED)
+ self.runCmd("settings set target.prefer-dynamic-value no-dynamic-values")
+
# The stop reason of the thread should be breakpoint.
self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT,
substrs=['stopped',
substrs=[
'@"0 elements"'])
self.expect(
- 'frame variable arr --ptr-depth 1 -d no-run-target',
+ 'frame variable arr --ptr-depth 1',
substrs=[
'@"6 elements"',
'@"hello"',
'@"me"',
'@"http://www.apple.com'])
self.expect(
- 'frame variable other_arr --ptr-depth 1 -d no-run-target',
+ 'frame variable other_arr --ptr-depth 1',
substrs=[
'@"4 elements"',
'(int)5',
'@"a string"',
'@"6 elements"'])
self.expect(
- 'frame variable other_arr --ptr-depth 2 -d no-run-target',
+ 'frame variable other_arr --ptr-depth 2',
substrs=[
'@"4 elements"',
'@"6 elements" {',
'[2] = ',
'[3] = '])
self.expect(
- 'frame variable dictionary --ptr-depth 1 --dynamic-type no-run-target',
+ 'frame variable dictionary --ptr-depth 1',
substrs=[
'3 key/value pairs',
'@"bar"',
'@"baz"',
'2 key/value pairs'])
self.expect(
- 'frame variable mutabledict --ptr-depth 1 --dynamic-type no-run-target',
+ 'frame variable mutabledict --ptr-depth 1',
substrs=[
'4 key/value pairs',
'(int)23',
'@"sourceofstuff"',
'3 key/value pairs'])
self.expect(
- 'frame variable mutabledict --ptr-depth 2 --dynamic-type no-run-target',
+ 'frame variable mutabledict --ptr-depth 2',
substrs=[
'4 key/value pairs',
'(int)23',
'@"bar"',
'@"2 elements"'])
self.expect(
- 'frame variable mutabledict --ptr-depth 3 --dynamic-type no-run-target',
+ 'frame variable mutabledict --ptr-depth 3',
substrs=[
'4 key/value pairs',
'(int)23',
self.build()
lldbutil.run_to_source_breakpoint(self, "// breakpoint 1", lldb.SBFileSpec("main.cpp"))
+ self.runCmd("settings set target.prefer-dynamic-value no-dynamic-values")
+
j1 = self.frame().FindVariable("j1")
j1_Derived1 = j1.GetChildAtIndex(0)
j1_Derived2 = j1.GetChildAtIndex(1)
process.GetState(), lldb.eStateStopped,
"Stopped it too.")
+ self.runCmd('settings set target.prefer-dynamic-value no-dynamic-values')
+
thread_list = lldbutil.get_threads_stopped_at_breakpoint(
process, breakpoint)
self.assertEqual(len(thread_list), 1)
])
self.expect(
- 'frame variable --dynamic-type no-run-target *e1',
+ 'frame variable *e1',
substrs=[
'(NSException) *e1 = ',
'name = ', '"ExceptionName"',
])
self.expect(
- 'frame variable --dynamic-type no-run-target *e2',
+ 'frame variable *e2',
substrs=[
'(NSException) *e2 = ',
'name = ', '"ThrownException"',
self.runCmd("run", RUN_SUCCEEDED)
+ self.runCmd("settings set target.prefer-dynamic-value no-dynamic-values")
+
# The backtrace should show we stop at -[MyString description].
self.expect("thread backtrace", "Stop at -[MyString description]",
substrs=["a.out`-[MyString description]"])
self, '// Break here for NSString tests',
lldb.SBFileSpec('main.m', False))
+ self.runCmd("settings set target.prefer-dynamic-value no-dynamic-values")
+
# Test_NSString:
self.runCmd("thread backtrace")
self.expect("expression (int)[str length]",
self.runCmd("run", RUN_SUCCEEDED)
+ self.runCmd("settings set target.prefer-dynamic-value no-dynamic-values")
+
# The backtrace should show we stop at -[MyString description].
self.expect("thread backtrace", "Stop at -[MyString description]",
substrs=["a.out`-[MyString description]"])
def test_float_literal(self):
self.runToBreakpoint()
+ self.runCmd("settings set target.prefer-dynamic-value no-dynamic-values")
+
self.expect("expr -- @123.45", VARIABLES_DISPLAYED_CORRECTLY,
substrs=["NSNumber", "123.45"])
def test_expressions_in_literals(self):
self.runToBreakpoint()
+ self.runCmd("settings set target.prefer-dynamic-value no-dynamic-values")
+
self.expect(
"expr --object-description -- @( 1 + 3 )",
VARIABLES_DISPLAYED_CORRECTLY,
# Run at stop at main
lldbutil.check_breakpoint(self, bpno = 1, expected_hit_count = 1)
+ self.runCmd("settings set target.prefer-dynamic-value no-dynamic-values")
+
# This should display correctly.
self.expect(
"frame variable foo->_bar->_hidden_ivar",
# Run at stop at main
lldbutil.check_breakpoint(self, bpno = 1, expected_hit_count = 1)
+ self.runCmd("settings set target.prefer-dynamic-value no-dynamic-values")
+
# This should display correctly.
self.expect(
"frame variable foo->_bar->_hidden_ivar",
NO_DEBUG_INFO_TESTCASE = True
- @skipIf(setting=('target.prefer-dynamic-value', 'no-dynamic-values'))
+ @skipIf(py_version=('>=', (3, 0)))
def testSkip(self):
"""This setting is on by default"""
self.assertTrue(False, "This test should not run!")
- @skipIf(setting=('target.prefer-dynamic-value', 'run-target'))
+ @skipIf(py_version=('<', (3, 0)))
def testNoMatch(self):
self.assertTrue(True, "This test should run!")
def testNotExisting(self):
self.assertTrue(True, "This test should run!")
- @expectedFailureAll(setting=('target.prefer-dynamic-value', 'no-dynamic-values'))
+ @expectedFailureAll(py_version=('>=', (3, 0)))
def testXFAIL(self):
self.assertTrue(False, "This test should run and fail!")
- @expectedFailureAll(setting=('target.prefer-dynamic-value', 'run-target'))
+ @expectedFailureAll(py_version=('<', (3, 0)))
def testNotXFAIL(self):
self.assertTrue(True, "This test should run and succeed!")